summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-12 07:15:02 +0000
committersekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-12 07:15:02 +0000
commit69e6c6fc970d14602875f290f9fcb3cfff2911bb (patch)
tree8bb3fd33ad0dbeab2791eccbf48772dc04c13e56
parent0b1c5f7ce659f63f00f3b7c408871bd35e6f7456 (diff)
downloadfpGUI-69e6c6fc970d14602875f290f9fcb3cfff2911bb.tar.xz
Implemented a better Invalidate for X11 and fixed mouse release on X11
-rw-r--r--gfx/x11/gfx_x11.pas24
-rw-r--r--prototypes/newmultihandle/gui_button.inc4
2 files changed, 18 insertions, 10 deletions
diff --git a/gfx/x11/gfx_x11.pas b/gfx/x11/gfx_x11.pas
index 7f677ffb..2d5d6c41 100644
--- a/gfx/x11/gfx_x11.pas
+++ b/gfx/x11/gfx_x11.pas
@@ -1049,12 +1049,10 @@ begin
// According to a comment in X.h, the valid event types start with 2!
if XEvent._type >= 2 then
begin
-// WriteLn('=== Received X event "', GetXEventName(XEvent._type), '"');
WindowEntry := FindWindowByXID(XEvent.XAny.Window);
if not Assigned(WindowEntry) then
begin
-// writeln(Format('==unknown== Window ID = %d', [XEvent.XAny.Window]));
WriteLn('fpGFX/X11: Received X event "', GetXEventName(XEvent._type), '" for unknown window');
continue;
end;
@@ -1103,11 +1101,15 @@ begin
end;
X.ButtonRelease:
begin
- XButtonToMouseButton(XEvent.xbutton.button, MouseButton);
+ { Release events are only for mouse buttons, and not mouse wheel moviments }
+ if (XEvent.xbutton.button >= 1) and (XEvent.xbutton.button <= 3) then
+ begin
+ XButtonToMouseButton(XEvent.xbutton.button, MouseButton);
- WindowEntry.EvMouseReleased(
- MouseButton,
- Point(XEvent.xbutton.x, XEvent.xbutton.y));
+ WindowEntry.EvMouseReleased(
+ MouseButton,
+ Point(XEvent.xbutton.x, XEvent.xbutton.y));
+ end;
end;
X.EnterNotify:
begin
@@ -1522,15 +1524,17 @@ begin
end;
procedure TX11Window.Invalidate;
-var
- ARect: TRect;
+{var
+ ARect: TRect;}
begin
- ARect.Left := Left;
+{ ARect.Left := Left;
ARect.Top := Top;
ARect.Right := Left + Width;
ARect.Bottom := Top + Height;
- GFApplication.DirtyList.AddRect(Self, ARect);
+ GFApplication.DirtyList.AddRect(Self, ARect); }
+
+ EvPaint();
end;
procedure TX11Window.PaintInvalidRegion;
diff --git a/prototypes/newmultihandle/gui_button.inc b/prototypes/newmultihandle/gui_button.inc
index e79b8748..b12bbf8a 100644
--- a/prototypes/newmultihandle/gui_button.inc
+++ b/prototypes/newmultihandle/gui_button.inc
@@ -80,6 +80,8 @@ end;
procedure TFButton.EvMousePressed(AButton: TMouseButton; const AMousePos: TPoint
);
begin
+ WriteLn('Mouse Pressed');
+
FIsPressed := True;
Invalidate;
@@ -90,6 +92,8 @@ end;
procedure TFButton.EvMouseReleased(AButton: TMouseButton;
const AMousePos: TPoint);
begin
+ WriteLn('Mouse Released');
+
FIsPressed := False;
Invalidate;