mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-28 12:09:21 +02:00
Gtk2: introduced GetWindowManager:String function for later tuning of differences between metacity and other wm's under X11.
git-svn-id: trunk@31596 -
This commit is contained in:
parent
d744f675e6
commit
da3f158361
@ -841,6 +841,71 @@ begin
|
||||
if Widget^.window = nil then exit;
|
||||
Result := gdk_window_xwindow(Widget^.window);
|
||||
end;
|
||||
|
||||
function GetWindowManager: String;
|
||||
{used to get window manager name, so we can handle different wm's behaviour
|
||||
eg. kde vs. gnome}
|
||||
var
|
||||
Display: PDisplay;
|
||||
ScreenNum: Integer;
|
||||
RootWin: TWindow;
|
||||
WMAtom: TAtom;
|
||||
WMWindow: TWindow;
|
||||
|
||||
typeReturned: TAtom;
|
||||
formatReturned: Integer;
|
||||
nitemsReturned: PtrInt;
|
||||
unused: PtrInt;
|
||||
data: Pointer;
|
||||
begin
|
||||
Result := '';
|
||||
|
||||
Display := gdk_display;
|
||||
if Display = nil then
|
||||
exit;
|
||||
ScreenNum := XDefaultScreen(Display);
|
||||
RootWin := XRootWindow(Display , ScreenNum);
|
||||
|
||||
WMAtom := XInternAtom(Display,'_NET_WM_DESKTOP', True);
|
||||
|
||||
if WMAtom > 0 then
|
||||
begin
|
||||
WMAtom := XInternAtom(Display,'_NET_SUPPORTING_WM_CHECK', False);
|
||||
if WMAtom > 0 then
|
||||
begin
|
||||
data := nil;
|
||||
WMWindow := 0;
|
||||
if XGetWindowProperty(Display, RootWin, WMAtom, 0, 1024, False, XA_WINDOW,
|
||||
@typeReturned, @formatReturned, @nitemsReturned,
|
||||
@unused, @data) = Success then
|
||||
begin
|
||||
if (typeReturned = XA_WINDOW) and (formatReturned = 32) and
|
||||
(Data <> nil) then
|
||||
begin
|
||||
// this is our window manager window
|
||||
WMWindow := TWindow(Data^);
|
||||
XFree(Data);
|
||||
Data := nil;
|
||||
end;
|
||||
if WMWindow = 0 then
|
||||
exit;
|
||||
WMAtom := XInternAtom(Display,'UTF8_STRING', False);
|
||||
if XGetWindowProperty(Display, WMWindow,
|
||||
XInternAtom(Display,'_NET_WM_NAME', False), 0, 1024, False,
|
||||
WMAtom, @typeReturned, @formatReturned, @nitemsReturned,
|
||||
@unused, @data) = Success then
|
||||
begin
|
||||
if (typeReturned = WMAtom) and (formatReturned = 8) then
|
||||
Result := LowerCase(StrPas(Data));
|
||||
if Data <> nil then
|
||||
XFree(Data);
|
||||
Data := nil;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
procedure SetLabelAlignment(LabelWidget: PGtkLabel;
|
||||
@ -9180,11 +9245,11 @@ begin
|
||||
bsDialog : Result := GDK_FUNC_CLOSE or GDK_FUNC_MINIMIZE
|
||||
or GDK_FUNC_MOVE;
|
||||
|
||||
bsToolWindow : Result := GDK_FUNC_MOVE or GDK_FUNC_CLOSE
|
||||
or GDK_FUNC_MINIMIZE or GDK_FUNC_MAXIMIZE;
|
||||
bsToolWindow : Result := GDK_FUNC_MOVE or GDK_FUNC_CLOSE or
|
||||
GDK_FUNC_MINIMIZE;
|
||||
|
||||
bsSizeToolWin : Result := GDK_FUNC_RESIZE or GDK_FUNC_MOVE or GDK_FUNC_CLOSE
|
||||
or GDK_FUNC_MINIMIZE or GDK_FUNC_MAXIMIZE;
|
||||
bsSizeToolWin : Result := GDK_FUNC_RESIZE or GDK_FUNC_MOVE or
|
||||
GDK_FUNC_CLOSE or GDK_FUNC_MINIMIZE or GDK_FUNC_MAXIMIZE;
|
||||
end;
|
||||
|
||||
// X warns if marking a fixed size window resizeable:
|
||||
|
@ -779,6 +779,7 @@ function GetGtkContainerBorderWidth(Widget: PGtkContainer): gint;
|
||||
{$ifdef HasX}
|
||||
// X functions
|
||||
function FormToX11Window(const AForm: TCustomForm): X.TWindow;
|
||||
function GetWindowManager: String;
|
||||
{$endif}
|
||||
function FindFocusWidget(AWidget: PGtkWidget): PGtkWidget;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user