From 328da041da3bfa5ac4d05e2484b77c7475f070ce Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Mon, 12 Dec 2022 14:00:43 +0800 Subject: [PATCH] gtk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化最大化最小化 等消息 --- designer/tediterform.tsf | 2 +- designer/tslvcldesigner.tsf | 12 ++++++-- funcext/tvclib/ugtkinterface.tsf | 51 ++++++++++++++++++++++++-------- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/designer/tediterform.tsf b/designer/tediterform.tsf index 9ba1171..f0cd7ed 100644 --- a/designer/tediterform.tsf +++ b/designer/tediterform.tsf @@ -554,7 +554,7 @@ type TEditerForm = class(TVCform) // end d := FEdter.GetHistoryFiles(); if ifarray(d) and d then - begin + begin Exportfile(ftstream(),"",FHistoryPath,d); end d := FEdter.GetFindHistory(); diff --git a/designer/tslvcldesigner.tsf b/designer/tslvcldesigner.tsf index a2790f6..7308a58 100644 --- a/designer/tslvcldesigner.tsf +++ b/designer/tslvcldesigner.tsf @@ -387,7 +387,7 @@ type TVclDesigner = class(tvcform) end function WMSYSCOMMAND(o,e);override; - begin + begin case e.wparam of SC_MAXIMIZE: begin @@ -795,6 +795,13 @@ type TVclDesigner = class(tvcform) if e then e.skip := true; end private //ڵ + function windowactive(o,e); + begin + if e.wparam then + begin + ClickComponent(o,e); + end + end function ClickComponent(o,e); //ѡ begin {** @@ -903,7 +910,8 @@ type TVclDesigner = class(tvcform) e.skip := true; CloseShowForm(); //洰Ϣ end ; - wnd.bindmessage(wnd.WM_NCLBUTTONDOWN,thisfunction(ClickComponent)); + //wnd.bindmessage(wnd.WM_NCLBUTTONDOWN,thisfunction(ClickComponent)); + wnd.bindmessage(wnd.WM_ACTIVATE,thisfunction(windowactive)); //WM_NCLBUTTONUP wnd. if (wnd is class(TVCForm)) then begin diff --git a/funcext/tvclib/ugtkinterface.tsf b/funcext/tvclib/ugtkinterface.tsf index f102948..e86f285 100644 --- a/funcext/tvclib/ugtkinterface.tsf +++ b/funcext/tvclib/ugtkinterface.tsf @@ -4926,15 +4926,42 @@ type tgtk_ctl_object = class(_gtkeventtype) case e.ttype of GDK_WINDOW_STATE: begin - {st := gdk_window_get_state(e.window);//.& 0xffff; - if (st .& 32) = 32 then + obj := new _GdkEventWindowState(c); + msk := obj.new_window_state; + //st := obj.changed_mask; + if msk .& 4 then begin - echo "\r\n above"; - end else - if (st .& 64) = 64 then + return CallTslVclProc(_const.WM_SYSCOMMAND ,_const.SC_MAXIMIZE,0); + end + if msk .& 2 then begin - echo "\r\n blowe"; - end } + return CallTslVclProc(_const.WM_SYSCOMMAND ,_const.SC_MINIMIZE,0); + end + if msk .& (2^4) then + begin + //echo "\r\n full screen"; + end + if msk .& (2^5) then + begin + //echo "\r\n above"; + end + if msk .& (2^6) then + begin + //echo "\r\n below"; + end + if msk .& (2^7) then + begin + CallTslVclProc(_const.WM_SETFOCUS ,0,0); + CallTslVclProc(_const.WM_ACTIVATE ,2,0,0); + + end + {GDK_WINDOW_STATE_WITHDRAWN = 1 << 0, + GDK_WINDOW_STATE_ICONIFIED = 1 << 1, + GDK_WINDOW_STATE_MAXIMIZED = 1 << 2, + GDK_WINDOW_STATE_STICKY = 1 << 3, + GDK_WINDOW_STATE_FULLSCREEN = 1 << 4, + GDK_WINDOW_STATE_ABOVE = 1 << 5, + GDK_WINDOW_STATE_BELOW = 1 << 6} end GDK_BUTTON_PRESS: begin @@ -5046,10 +5073,6 @@ type tgtk_ctl_object = class(_gtkeventtype) end ; return CanignoreBtnpress(); end - 32: - begin - //echo tostn(new _GdkEventWindowState(c)._getdata_()); - end 8,9: //key begin kud := e.ttype; @@ -6841,7 +6864,8 @@ begin "clicked":13, "value-changed":14, "delete-event":15, - "event":16 ); + "event":16 , + "window-sate-event":17); for i,v in G_E_ID_Name_1 do begin G_E_ID_Name_2[v] := i; @@ -7222,7 +7246,7 @@ begin "dodeleteevents": return mgnr.get(thisfunction(dodeleteevents)); "tsl_gtk_normal_event_cb": return mgnr.get(thisfunction(tsl_gtk_normal_event_cb)); "tsl_gtk_normal_event_bc": return mgnr.get(thisfunction(tsl_gtk_normal_event_bc)); - "tsl_gtk_idle":return mgnr.get(thisfunction(tsl_gtk_idle)); + "tsl_gtk_idle": return mgnr.get(thisfunction(tsl_gtk_idle)); end ; end function tsl_gtk_idle(dlg:pointer):integer; @@ -7266,6 +7290,7 @@ function tsl_gtk_activate_event(a:pointer;b:pointer):integer; begin return dodeleteevents(a, "activate"); end + function tsl_gtk_destroy_event(a:pointer; b:pointer;c:pointer):integer; begin return _gtkeventcall_(a,b,c);