summaryrefslogtreecommitdiff
path: root/src/corelib/x11/gfx_x11.pas
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-23 21:53:15 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-23 21:53:15 +0000
commit85ffdc73b32e747ba0517bfc0e8403299f539b03 (patch)
treec864f2d7449f220fd89321fecc8a443110fbb8eb /src/corelib/x11/gfx_x11.pas
parent1284f0cc6d37a3b1e72d7dba7ad80de0ee24057f (diff)
downloadfpGUI-85ffdc73b32e747ba0517bfc0e8403299f539b03.tar.xz
X11: Modal forms are now working correctly. You cannot kill the parent of a modal form by clicking the top right X button anymore.
Diffstat (limited to 'src/corelib/x11/gfx_x11.pas')
-rw-r--r--src/corelib/x11/gfx_x11.pas25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index 99411c18..66722790 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -689,7 +689,6 @@ begin
msgp.mouse.shiftstate := ConvertShiftState(ev.xbutton.state);
w := FindWindowByHandle(ev.xbutton.window);
-
if fpgTopModalForm <> nil then
begin
// This is ugly!!!!!!!!!!!!!!!
@@ -756,6 +755,15 @@ begin
//
until not XCheckTypedWindowEvent(display, ev.xbutton.window, X.MotionNotify, @ev);
+ w := FindWindowByHandle(ev.xany.window);
+ if fpgTopModalForm <> nil then
+ begin
+ // This is ugly!!!!!!!!!!!!!!!
+ ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w)));
+ if (ew <> nil) and (fpgTopModalForm <> ew) then
+ blockmsg := true;
+ end;
+
if not blockmsg then
begin
msgp.mouse.x := ev.xmotion.x;
@@ -768,8 +776,19 @@ begin
// message blockings for modal windows
X.ClientMessage:
- if not blockmsg then
- fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_CLOSE);
+ begin
+ w := FindWindowByHandle(ev.xany.window);
+ if fpgTopModalForm <> nil then
+ begin
+ // This is ugly!!!!!!!!!!!!!!!
+ ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w)));
+ if (ew <> nil) and (fpgTopModalForm <> ew) then
+ blockmsg := true;
+ end;
+
+ if not blockmsg then
+ fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_CLOSE);
+ end;
X.ConfigureNotify: