mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 16:59:21 +02:00
Gtk2: improved gtk2 performance in case of pointer motions by using GDK_POINTER_MOTION_HINT_MASK.Patch by Henry Vermaak. Fixes issue #14936
git-svn-id: trunk@28107 -
This commit is contained in:
parent
f0374c12fd
commit
cdeb7f8f68
@ -1217,6 +1217,25 @@ begin
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
procedure GTKGetDevicePointer(win: PGdkWindow; dev: PGdkDevice;
|
||||
x, y: pgdouble; mask: PGdkModifierType);
|
||||
var
|
||||
axes: pgdouble;
|
||||
i: Integer;
|
||||
begin
|
||||
axes := g_new(SizeOf(gdouble), dev^.num_axes);
|
||||
gdk_device_get_state(dev, win, axes, mask);
|
||||
|
||||
for i := 0 to dev^.num_axes - 1 do
|
||||
if (x^ <> 0) and (dev^.axes[i].use = GDK_AXIS_X) then
|
||||
x^ := axes[i]
|
||||
else if (y^ <> 0) and (dev^.axes[i].use = GDK_AXIS_Y) then
|
||||
y^ := axes[i];
|
||||
|
||||
g_free(axes);
|
||||
end;
|
||||
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
GTKMotionNotify
|
||||
Params: widget: PGTKWidget; event: PGDKEventMotion; data: gPointer
|
||||
@ -1234,6 +1253,10 @@ var
|
||||
begin
|
||||
Result := CallBackDefaultReturn;
|
||||
|
||||
if (Event^.is_hint <> 0) and (Event^._type = GDK_MOTION_NOTIFY) then
|
||||
GTKGetDevicePointer(Event^.window, Event^.device,
|
||||
@Event^.x, @Event^.y, @Event^.state);
|
||||
|
||||
{$IFDEF VerboseMouseBugfix}
|
||||
DesignOnlySignal:=GetDesignOnlySignalFlag(Widget,dstMouseMotion);
|
||||
DebugLn('[GTKMotionNotify] ',
|
||||
@ -1285,6 +1308,10 @@ function GTKMotionNotifyAfter(widget:PGTKWidget; event: PGDKEventMotion;
|
||||
begin
|
||||
Result := true; // stop event propagation
|
||||
|
||||
if (Event^.is_hint <> 0) and (Event^._type = GDK_MOTION_NOTIFY) then
|
||||
GTKGetDevicePointer(Event^.window, Event^.device,
|
||||
@Event^.x, @Event^.y, @Event^.state);
|
||||
|
||||
{$IFDEF VerboseMouseBugfix}
|
||||
DebugLn('[GTKMotionNotifyAfter] ',
|
||||
DbgSName(TControl(Data)));
|
||||
|
@ -607,9 +607,10 @@ begin
|
||||
LM_MOUSEMOVE:
|
||||
begin
|
||||
ConnectSenderSignal(gMouse, 'motion-notify-event', @GTKMotionNotify,
|
||||
GDK_POINTER_MOTION_MASK);
|
||||
GDK_POINTER_MOTION_HINT_MASK or GDK_POINTER_MOTION_MASK);
|
||||
ConnectSenderSignalAfter(gMouse, 'motion-notify-event',
|
||||
@GTKMotionNotifyAfter, GDK_POINTER_MOTION_MASK);
|
||||
@GTKMotionNotifyAfter,
|
||||
GDK_POINTER_MOTION_HINT_MASK or GDK_POINTER_MOTION_MASK);
|
||||
end;
|
||||
|
||||
LM_LBUTTONDOWN,
|
||||
|
Loading…
Reference in New Issue
Block a user