mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 19:52:26 +02:00
gtk2 intf: fixed slow down when mouse outside bug #11740, fixed crash when WindowFromPoint widget destroyed
git-svn-id: trunk@21213 -
This commit is contained in:
parent
d18426903d
commit
7dbec45e6d
@ -1,23 +1,23 @@
|
||||
object CalendarPopupForm: TCalendarPopupForm
|
||||
Left = 635
|
||||
Height = 155
|
||||
Height = 192
|
||||
Top = 259
|
||||
Width = 164
|
||||
Width = 233
|
||||
ActiveControl = Calendar
|
||||
AutoSize = True
|
||||
BorderIcons = [biMinimize, biMaximize]
|
||||
BorderStyle = bsNone
|
||||
Caption = 'CalendarPopupForm'
|
||||
ClientHeight = 155
|
||||
ClientWidth = 164
|
||||
ClientHeight = 192
|
||||
ClientWidth = 233
|
||||
OnClose = FormClose
|
||||
OnDeactivate = FormDeactivate
|
||||
LCLVersion = '0.9.27'
|
||||
object Calendar: TCalendar
|
||||
Left = 1
|
||||
Height = 153
|
||||
Height = 190
|
||||
Top = 1
|
||||
Width = 162
|
||||
Width = 231
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 1
|
||||
DateTime = 38823
|
||||
|
@ -1,13 +1,13 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
{ Das ist eine automatisch erzeugte Lazarus-Ressourcendatei }
|
||||
|
||||
LazarusResources.Add('TCalendarPopupForm','FORMDATA',[
|
||||
'TPF0'#18'TCalendarPopupForm'#17'CalendarPopupForm'#4'Left'#3'{'#2#6'Height'#3
|
||||
+#155#0#3'Top'#3#3#1#5'Width'#3#164#0#13'ActiveControl'#7#8'Calendar'#8'AutoS'
|
||||
+#192#0#3'Top'#3#3#1#5'Width'#3#233#0#13'ActiveControl'#7#8'Calendar'#8'AutoS'
|
||||
+'ize'#9#11'BorderIcons'#11#10'biMinimize'#10'biMaximize'#0#11'BorderStyle'#7
|
||||
+#6'bsNone'#7'Caption'#6#17'CalendarPopupForm'#12'ClientHeight'#3#155#0#11'Cl'
|
||||
+'ientWidth'#3#164#0#7'OnClose'#7#9'FormClose'#12'OnDeactivate'#7#14'FormDeac'
|
||||
+#6'bsNone'#7'Caption'#6#17'CalendarPopupForm'#12'ClientHeight'#3#192#0#11'Cl'
|
||||
+'ientWidth'#3#233#0#7'OnClose'#7#9'FormClose'#12'OnDeactivate'#7#14'FormDeac'
|
||||
+'tivate'#10'LCLVersion'#6#6'0.9.27'#0#9'TCalendar'#8'Calendar'#4'Left'#2#1#6
|
||||
+'Height'#3#153#0#3'Top'#2#1#5'Width'#3#162#0#8'AutoSize'#9#20'BorderSpacing.'
|
||||
+'Height'#3#190#0#3'Top'#2#1#5'Width'#3#231#0#8'AutoSize'#9#20'BorderSpacing.'
|
||||
+'Around'#2#1#8'DateTime'#5#0#0#0#0#0#0#167#151#14'@'#10'OnDblClick'#7#16'Cal'
|
||||
+'endarDblClick'#9'OnKeyDown'#7#15'CalendarKeyDown'#7'TabStop'#9#0#0#0
|
||||
]);
|
||||
|
@ -1057,6 +1057,15 @@ begin
|
||||
FreeWidgetInfo(Widget);
|
||||
end;
|
||||
|
||||
function DestroyWindowFromPointCB(Widget: PGtkWidget; data: gPointer
|
||||
): GBoolean; cdecl;
|
||||
begin
|
||||
Result:=CallBackDefaultReturn;
|
||||
if PGtkWidget(LastWFPResult)<>Widget then exit;
|
||||
LastWFPResult:=0;
|
||||
LastWFPMousePos:=Point(High(Integer),High(Integer));
|
||||
end;
|
||||
|
||||
function gtkdeleteCB( widget : PGtkWidget; event : PGdkEvent;
|
||||
data : gPointer) : GBoolean; cdecl;
|
||||
var Mess : TLMessage;
|
||||
@ -1542,7 +1551,7 @@ begin
|
||||
DebugLn('');
|
||||
DesignOnlySignal:=GetDesignOnlySignalFlag(Widget,dstMousePress);
|
||||
DebugLn('[gtkMouseBtnPress] ',
|
||||
DbgSName(AWinControl,
|
||||
DbgSName(AWinControl),
|
||||
' Widget=',DbgS(Widget),
|
||||
' ControlWidget=',DbgS(AWinControl.Handle),
|
||||
' DSO='+dbgs(DesignOnlySignal),
|
||||
|
@ -69,6 +69,10 @@ var
|
||||
MousePosition: TPoint;
|
||||
MousePositionTime: TDateTime;
|
||||
|
||||
// cache for WindowFromPoint
|
||||
LastWFPMousePos: TPoint;
|
||||
LastWFPResult: HWND;
|
||||
|
||||
const
|
||||
DblClickTime = 250;// 250 miliseconds or less between clicks is a double click
|
||||
DblClickThreshold = 3;// max Movement between two clicks of a DblClick
|
||||
|
@ -131,10 +131,6 @@ type
|
||||
FDragImageListIcon: PGtkWidget;
|
||||
FDragHotStop: TPoint;
|
||||
|
||||
// cache for WindowFromPoint
|
||||
FLastWFPMousePos: TPoint;
|
||||
FLastWFPResult: HWND;
|
||||
|
||||
function CreateThemeServices: TThemeServices; override;
|
||||
function GetDeviceContextClass: TGtkDeviceContextClass; virtual; abstract;
|
||||
public
|
||||
|
@ -140,6 +140,7 @@ function GTKKillFocusCB(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
function GTKKillFocusCBAfter(widget: PGtkWidget; event:PGdkEventFocus;
|
||||
data: gPointer): GBoolean; cdecl;
|
||||
function gtkdestroyCB(widget: PGtkWidget; data: gPointer): GBoolean; cdecl;
|
||||
function DestroyWindowFromPointCB(Widget: PGtkWidget; data: gPointer): GBoolean; cdecl;
|
||||
function gtkdeleteCB(widget: PGtkWidget; event: PGdkEvent;
|
||||
data: gPointer): GBoolean; cdecl;
|
||||
function gtkresizeCB(widget: PGtkWidget; data: gPointer): GBoolean; cdecl;
|
||||
|
@ -181,7 +181,7 @@ begin
|
||||
|
||||
inherited Create;
|
||||
|
||||
FLastWFPMousePos := Point(MaxInt, MaxInt);
|
||||
LastWFPMousePos := Point(MaxInt, MaxInt);
|
||||
|
||||
{$IFDEF EnabledGtkThreading}
|
||||
{$IFNDEF Win32}
|
||||
|
@ -9695,10 +9695,8 @@ var
|
||||
p: TPoint;
|
||||
begin
|
||||
// return cached value to prevent heavy gdk_window_at_pointer call
|
||||
if (APoint = FLastWFPMousePos) and GTK_IS_WIDGET(Pointer(FLastWFPResult)) then
|
||||
Exit(FLastWFPResult);
|
||||
//DebugLn('WindowFromPoint: ', dbgs(APoint));
|
||||
//DumpStack;
|
||||
if (APoint = LastWFPMousePos) then
|
||||
Exit(LastWFPResult);
|
||||
Result := 0;
|
||||
|
||||
// !!!gdk_window_at_pointer changes the coordinates!!!
|
||||
@ -9712,8 +9710,16 @@ begin
|
||||
Widget := gtk_get_event_widget(@ev);
|
||||
Result := PtrUInt(Widget);
|
||||
end;
|
||||
FLastWFPMousePos := APoint;
|
||||
FLastWFPResult := Result;
|
||||
// disconnect old handler
|
||||
if LastWFPResult<>0 then
|
||||
g_signal_handlers_disconnect_by_func(GPointer(LastWFPResult),
|
||||
TGTKSignalFunc(@DestroyWindowFromPointCB), nil);
|
||||
LastWFPMousePos := APoint;
|
||||
LastWFPResult := Result;
|
||||
// connect handler
|
||||
if LastWFPResult<>0 then
|
||||
g_signal_connect(GPointer(LastWFPResult), 'destroy',
|
||||
TGTKSignalFunc(@DestroyWindowFromPointCB), nil);
|
||||
end;
|
||||
|
||||
//##apiwiz##eps## // Do not remove
|
||||
|
Loading…
Reference in New Issue
Block a user