mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:50:06 +02:00
gtk2: smarter window z-order reposition below (system-wide) active window, where available
git-svn-id: trunk@51082 -
This commit is contained in:
parent
feeb522991
commit
b32ffa065f
@ -1124,6 +1124,10 @@ const
|
|||||||
TGtk2TopForms: Array[Boolean] of TGtk2TempFormStyleSet = (fsAllNonSystemStayOnTop,
|
TGtk2TopForms: Array[Boolean] of TGtk2TempFormStyleSet = (fsAllNonSystemStayOnTop,
|
||||||
fsAllStayOnTop);
|
fsAllStayOnTop);
|
||||||
|
|
||||||
|
|
||||||
|
procedure gdk_window_restack(w, s: PGdkWindow; above: gboolean); cdecl; external gdklib;
|
||||||
|
function gdk_screen_get_active_window(screen: PGdkScreen):PGdkWindow; cdecl; external gdklib;
|
||||||
|
|
||||||
function TGtk2WidgetSet.AppRemoveStayOnTopFlags(const ASystemTopAlso: Boolean
|
function TGtk2WidgetSet.AppRemoveStayOnTopFlags(const ASystemTopAlso: Boolean
|
||||||
): Boolean;
|
): Boolean;
|
||||||
var
|
var
|
||||||
@ -1132,10 +1136,20 @@ var
|
|||||||
W: PGtkWidget;
|
W: PGtkWidget;
|
||||||
Flags: TGdkWindowState;
|
Flags: TGdkWindowState;
|
||||||
B: Boolean;
|
B: Boolean;
|
||||||
|
act: PGdkWindow;
|
||||||
|
nact: PGdkWindow;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if StayOnTopList = nil then
|
if StayOnTopList = nil then
|
||||||
StayOnTopList := TMap.Create(TMapIdType(ituPtrSize), SizeOf(TGtkWidget));
|
StayOnTopList := TMap.Create(TMapIdType(ituPtrSize), SizeOf(TGtkWidget));
|
||||||
|
|
||||||
|
// todo: all screens should be evaluated
|
||||||
|
// depending on the screen of a window
|
||||||
|
act:=gdk_screen_get_active_window(gdk_screen_get_default);
|
||||||
|
// act is typically returned for X11. other systems might
|
||||||
|
// not implement it.
|
||||||
|
nact:=act;
|
||||||
|
|
||||||
for i := 0 to Screen.CustomFormZOrderCount - 1 do
|
for i := 0 to Screen.CustomFormZOrderCount - 1 do
|
||||||
begin
|
begin
|
||||||
AForm := Screen.CustomFormsZOrdered[i];
|
AForm := Screen.CustomFormsZOrdered[i];
|
||||||
@ -1154,14 +1168,21 @@ begin
|
|||||||
(Flags and GDK_WINDOW_STATE_ICONIFIED = 0) then
|
(Flags and GDK_WINDOW_STATE_ICONIFIED = 0) then
|
||||||
begin
|
begin
|
||||||
gdk_window_set_keep_above(W^.Window, False);
|
gdk_window_set_keep_above(W^.Window, False);
|
||||||
gdk_window_lower(W^.Window); // flush it to the bottom, some WMs keep it above
|
if Assigned(nact) then
|
||||||
gdk_window_raise(W^.Window); // bring it back immediatly. But it should keep below the top app
|
begin
|
||||||
|
gdk_window_restack(W^.Window, act, False);
|
||||||
|
nact:=W^.Window;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
gdk_window_lower(W^.Window); // send to the bottom
|
||||||
|
gdk_window_raise(W^.Window); // restore back
|
||||||
|
end;
|
||||||
if not StayOnTopList.HasId(W) then
|
if not StayOnTopList.HasId(W) then
|
||||||
StayOnTopList.Add(W, W);
|
StayOnTopList.Add(W, W);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
if Assigned(act) then g_object_unref(act);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtk2WidgetSet.AppRestoreStayOnTopFlags(const ASystemTopAlso: Boolean
|
function TGtk2WidgetSet.AppRestoreStayOnTopFlags(const ASystemTopAlso: Boolean
|
||||||
|
Loading…
Reference in New Issue
Block a user