summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-15 15:14:26 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-03-15 15:14:26 +0000
commit4999dddb24a8a6c24e1f630a3337cb5c604e2286 (patch)
tree2aa71ddd98f4c1f1b5cabdf9e76c9c7594d23d5e /src/corelib
parentac9f0769fc3e837c82ad07c16a1d16d2dc180f1d (diff)
downloadfpGUI-4999dddb24a8a6c24e1f630a3337cb5c604e2286.tar.xz
* fpGUI-X11 applications now have a unique program icon. I was simply playing around.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/x11/gfx_x11.pas31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index d737eaf2..84b25d01 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -16,6 +16,15 @@ uses
_netlayer,
gfxbase,
gfx_impl;
+
+const
+ IconBitmapWidth = 16;
+ IconBitmapHeight = 16;
+
+ IconBitmapBits: packed array[1..32] of Byte = (
+ $00, $00, $78, $07, $08, $09, $38, $09, $08, $07, $08, $01,
+ $08, $01, $00, $00, $00, $00, $98, $74, $a4, $24, $84, $24,
+ $b4, $24, $a4, $24, $18, $73, $00, $00);
type
TfpgGContext = Xlib.TGc;
@@ -128,7 +137,7 @@ type
TfpgWindowImpl = class(TfpgWindowBase)
protected
- FWinFlags : TXWindowStateFlags;
+ FWinFlags: TXWindowStateFlags;
FWinHandle: TfpgWinHandle;
FBackupWinHandle: TfpgWinHandle; // Used by DestroyNotify & UnmapNotify events
FModalForWin: TfpgWindowImpl;
@@ -630,10 +639,7 @@ begin
FDisplay := XOpenDisplay(PChar(aparams));
if FDisplay = nil then
-// begin
raise Exception.Create('fpGUI-X11: Could not open the display. Is your X11 server running?');
-// halt(1);
-// end;
Terminated := False;
DefaultScreen := XDefaultScreen(Display);
@@ -1216,6 +1222,9 @@ var
attr: TXSetWindowAttributes;
mask: longword;
hints: TXSizeHints;
+
+ IconPixmap: TPixmap;
+ WMHints: PXWMHints;
begin
if HandleIsValid then
Exit; //==>
@@ -1244,13 +1253,23 @@ begin
FWinHandle := wh;
FBackupWinHandle := wh;
-
+
// so newish window manager can close unresponsive programs
if AParent = nil then // is a toplevel window
begin
- XSetWMProperties(fpgApplication.Display, FWinHandle, nil, nil, nil, 0, nil, nil, nil);
+ IconPixMap := XCreateBitmapFromData(fpgApplication.Display, FWinHandle,
+ @IconBitmapBits, IconBitmapWidth, IconBitmapHeight);
+
+ WMHints := XAllocWMHints;
+ WMHints^.icon_pixmap := IconPixmap;
+ WMHints^.flags := IconPixmapHint;
+
+// XSetWMProperties(fpgApplication.Display, FWinHandle, nil, nil, nil, 0, nil, nil, nil);
+ XSetWMProperties(fpgApplication.Display, FWinHandle, nil, nil, nil, 0, nil, WMHints, nil);
fpgApplication.netlayer.WindowSetPID(FWinHandle, GetProcessID);
fpgApplication.netlayer.WindowSetSupportPING(FWinHandle);
+
+ XFree(WMHints);
end;
hints.flags := 0;