Modal form : difference between Ms_Windows and Linux (Ubuntu)? lazarus / 21-General ---------------------------------------------------------------------- Tdecnj · 2023-11-18 10:40 Hello, I am using Lazarus Lazarus 2.2.6 and FPC 3.2.2 on MS Windows (10) and Linux Ubuntu (22.04.03 LTS , Gnome 42.9 and GTK2). I've noticed a difference in execution behaviour between the 2 systems, MS Windows  and Ubuntu, concerning modal windows. I have 2 windows created automatically: the 1st calls the 2nd via ShowModal. The 2nd window displayed does not completely cover the 1st and let show the border of the first window. In MS Windows, it's impossible to move the first window via its border, whereas in Ubuntu it's possible. It seems to me that the behaviour under MS Windows corresponds to expected: only the modal window should be active. Incidentally, I've made the same observation in Lazarus, which I use in its initial version (flying windows in every corner). Under MS Windows, open "Options for the project" and try to move the various open windows, you can't, under Ubuntu you can. My question is this: is there a modality made in MS_Windows or made in Linux (or Ubuntu) or is it a bug or there is something i did not understand? Thanks. ---------------------------------------------------------------------- Handoko · 2023-11-18 11:00 I just tested on Ubuntu Mate 23.10 Lazarus 2.2.6. And yes, when showing a modal form, I was allowed to move the previous form (the caller). I believe that is OS depended behavior. Do you have problem with it? ---------------------------------------------------------------------- Tdecnj · 2023-11-18 11:23 Hello, If that you say it's true, it's a problem because the implementation does not meet the definition. And for a user, it's disturbing because he may think that he can act on the two forms when he can't. Thank for the answer. ---------------------------------------------------------------------- zeljko · 2023-11-18 12:03 Do not use gtk based window managers (metacity, marco, gnome shell), use KDE Plasma and it will work as under windows. ---------------------------------------------------------------------- Zoran · 2023-11-18 13:07 What Zeljko said seems a bit problematic at first, as you should avoid imposing demands to your users, like what os, window manager or web browser they should or should not use. But you ought not worry about that. Just think of it this way - if they choose window managers which behave differently from what you expect, then it is their choice and that is the expected behaviour for them. So, by following Zeljko's advice yourself, you'll be fine and don't worry about users who will have the behaviour they are used to. ---------------------------------------------------------------------- balazsszekely · 2023-11-18 16:43 If you insist on the same behaviour, you can do something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   Form1.Enabled := False;  Form2 := TForm2.Create(nil);  try    Form2.ShowModal;  finally    Form2.Free;    Form1.Enabled := True;  end; ---------------------------------------------------------------------- Tdecnj · 2023-11-18 18:48 Hello,  To GetMem : this is the first idea that came to me and this solution does not work (at least on my system).  To zoran and zeljko : i will try Kde to see... but I think it's a serious problem that these differences in behavior aren't documented and highlighted. Thanks. ---------------------------------------------------------------------- balazsszekely · 2023-11-18 19:08 @Tdecnj Quotethis is the first idea that came to me and this solution does not work (at least on my system).Can you be more specific? Why does not work? ---------------------------------------------------------------------- tetrastes · 2023-11-18 19:28 Quote from: Tdecnj on November 18, 2023, 07:48:17 pmbut I think it's a serious problem that these differences in behavior aren't documented and highlighted. Do you really think that differences in behaviour of different OSes, DEs, WMs should be in Lazarus documentation? ---------------------------------------------------------------------- dsiders · 2023-11-18 23:28 Quote from: tetrastes on November 18, 2023, 08:28:59 pmQuote from: Tdecnj on November 18, 2023, 07:48:17 pmbut I think it's a serious problem that these differences in behavior aren't documented and highlighted. Do you really think that differences in behaviour of different OSes, DEs, WMs should be in Lazarus documentation? Sure, why not. But we're waiting on the OP to write the content. ---------------------------------------------------------------------- AmatCoder · 2023-11-19 01:46 Quote from: Tdecnj on November 18, 2023, 11:40:58 amIn MS Windows, it's impossible to move the first window via its border, whereas in Ubuntu it's possible. It seems to me that the behaviour under MS Windows corresponds to expected: only the modal window should be active. No, a modal window only prevent interaction with widgets from others windows in the same application. On Linux, the windows themselves belongs to the Windows Manager (WM). You only can to send hints to the WM (hints as 'indications or suggestions') but WM's may choose to ignore them. Think about it like this: The developer decides on the application, but the WM (and ultimately the user) decides on interactions between windows. ---------------------------------------------------------------------- Handoko · 2023-11-19 03:36 I have been using GTK based Linux for quite a long time, I have no problem with this kind of modal behavior. Because, users can only resize and move the caller form, no any other interaction is allowed. If anyone have problem with this behavior, maybe one can post a bug report or question on GTK community. Maybe they have their reasons for doing it. ---------------------------------------------------------------------- AmatCoder · 2023-11-19 07:22 GTk just lets the Window Manager do his job. But Qt does a trick. This persistently steals the focus from parent window and it prevents to the user any type of interaction. ---------------------------------------------------------------------- Tdecnj · 2023-11-19 13:09 Hello, To GetMem : I tried Enabled/Not Enabled even though I knew it would not work because I could see that the controls of the first windows was not enabled except the border, in case I'd missed something... To AmatCoder : I've learned something and have a better understanding of what I'm dealing with : it's a long way from MS_Windows to Babel Linux. Thanks for the very interesting link and the explication on how Gnome and Gtk are acting differently on this point. Thanks to all. ---------------------------------------------------------------------- PascalDragon · 2023-11-19 16:41 Quote from: Handoko on November 19, 2023, 04:36:14 amIf anyone have problem with this behavior, maybe one can post a bug report or question on GTK community. Maybe they have their reasons for doing it. It's not a problem of GTK itself, it's a “problem” of the used window manager, cause it's the task of the window manager to handle the corresponding modal hints the window provides. And some might simply not do so either due to bugs or due design (e.g. a tiling window manager might want to update it's layout (thus moving the parent window) when displaying the modal window).