summaryrefslogtreecommitdiff
path: root/gfx/x11
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@users.sourceforge.net>2006-11-23 14:53:37 +0000
committerGraeme Geldenhuys <graemeg@users.sourceforge.net>2006-11-23 14:53:37 +0000
commit88f2537400dfcc2dae03e79bba084dbde23fb948 (patch)
tree28f6d67cd1322df786d5e39b46ac7d7bfca8bf40 /gfx/x11
parent9dd17d1808bf8e8d945d7d0bc332bd5ba4ef4880 (diff)
downloadfpGUI-88f2537400dfcc2dae03e79bba084dbde23fb948.tar.xz
* Toying with the idea of a TPopupWindow class in the multi-handle prototype.
* Think I fixed the problem with the dropdown window of the TComboBox not always appearing in the correct position.
Diffstat (limited to 'gfx/x11')
-rw-r--r--gfx/x11/gfx_x11.pas32
1 files changed, 29 insertions, 3 deletions
diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas
index 07083c8d..7b96da5e 100644
--- a/gfx/x11/gfx_x11.pas
+++ b/gfx/x11/gfx_x11.pas
@@ -1234,15 +1234,41 @@ procedure TX11Window.SetPosition(const APosition: TPoint);
var
Supplied: PtrInt;
SizeHints: PXSizeHints;
+
+ dx, dy: integer;
+ lx, ly: integer;
+ cw : PWindow;
begin
+ if FParent = nil then
+ begin
+ {$Note This doesn't work yet. I want to position a new window relative to
+ another window. Used for popup windows, like the TComboBox dropdown. }
+ {$IFDEF DEBUG} writeln('SetPosition with no Parent'); {$ENDIF}
+ lx := APosition.x;
+ ly := APosition.y;
+
+ XTranslateCoordinates(GFApplication.Handle, Handle,
+ XDefaultRootWindow(GFApplication.Handle),
+ lx, ly, @dx, @dy, @cw);
+ lx := dx;
+ ly := dy;
+ end
+ else
+ begin
+ {$IFDEF DEBUG} writeln('SetPosition inside parent'); {$ENDIF}
+ lx := APosition.x;
+ ly := APosition.y;
+ end;
+ {$IFDEF DEBUG} Writeln(Format('was (%d,%d) and is now (%d,%d)', [APosition.x, APosition.y, lx, ly])); {$ENDIF}
+
SizeHints := XAllocSizeHints;
XGetWMNormalHints(GFApplication.Handle, Handle, SizeHints, @Supplied);
SizeHints^.flags := SizeHints^.flags or PPosition;
- SizeHints^.x := APosition.x;
- SizeHints^.y := APosition.y;
+ SizeHints^.x := lx;
+ SizeHints^.y := ly;
XSetWMNormalHints(GFApplication.Handle, Handle, SizeHints);
XFree(SizeHints);
- XMoveWindow(GFApplication.Handle, Handle, APosition.x, APosition.y);
+ XMoveWindow(GFApplication.Handle, Handle, lx, ly);
end;