View Issue Details

IDProjectCategoryView StatusLast Update
0037867LazarusLCLpublic2020-10-05 13:40
ReporterCudaText man_ Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSubuntu 20 
Product Version2.1 (SVN) 
Summary0037867: gtk3: ApplicationProperties.OnActivate/OnDeactivate don't work
DescriptionDemo shows that events are not fired
https://github.com/Alexey-T/FreePascal-tests/tree/master/Application%20OnActivate
TagsNo tags attached.
Fixed in Revisionr63957
LazTarget-
WidgetsetGTK 3
Attached Files

Relationships

related to 0037868 assignedZeljan Rikalo gtk2, qt5: ApplicationProperties.OnActivate/OnDeactivate fired 3 times 

Activities

Anton Kavalenka

2020-10-04 20:20

reporter   ~0126089

Looks like it works. I oppose complex solutions like it is done in GTK2.
gtk3app_act.diff (969 bytes)   
Index: lcl/interfaces/gtk3/gtk3widgets.pas
===================================================================
--- lcl/interfaces/gtk3/gtk3widgets.pas	(revision 63949)
+++ lcl/interfaces/gtk3/gtk3widgets.pas	(working copy)
@@ -1055,6 +1055,8 @@
   end;
 end;
 
+const act_count:integer=0;
+
 function Gtk3WidgetEvent(widget: PGtkWidget; event: PGdkEvent; data: GPointer): gboolean; cdecl;
 begin
   {$IFDEF GTK3DEBUGCOMBOBOX}
@@ -1230,6 +1232,19 @@
     end;
   GDK_FOCUS_CHANGE:
     begin
+      if event^.focus_change.in_=1 then
+      begin
+        if act_count=0 then
+          Application.IntfAppActivate();
+        inc(act_count);
+      end
+      else
+      begin
+        if act_count>0 then
+          Application.IntfAppDeactivate();
+        dec(act_count);
+      end;
+
       if wtComboBox in TGtk3Widget(Data).WidgetType then
       begin
         TGtk3ComboBox(Data).DumpPrivateStructValues('GDK_FOCUS_CHANGE='+IntToStr(Event^.focus_change.in_));
gtk3app_act.diff (969 bytes)   

Juha Manninen

2020-10-04 21:14

developer   ~0126090

Works! Applied, thanks.

Issue History

Date Modified Username Field Change
2020-10-04 13:19 CudaText man_ New Issue
2020-10-04 15:11 Juha Manninen Relationship added related to 0037868
2020-10-04 20:20 Anton Kavalenka Note Added: 0126089
2020-10-04 20:20 Anton Kavalenka File Added: gtk3app_act.diff
2020-10-04 21:11 Juha Manninen Assigned To => Juha Manninen
2020-10-04 21:11 Juha Manninen Status new => assigned
2020-10-04 21:14 Juha Manninen Status assigned => resolved
2020-10-04 21:14 Juha Manninen Resolution open => fixed
2020-10-04 21:14 Juha Manninen Fixed in Revision => r63957
2020-10-04 21:14 Juha Manninen LazTarget => -
2020-10-04 21:14 Juha Manninen Widgetset GTK 3 => GTK 3
2020-10-04 21:14 Juha Manninen Note Added: 0126090
2020-10-05 13:40 CudaText man_ Status resolved => closed