Re: [AD] Old problems that still persist on Allegro 4.2 beta 3 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Tuesday 31 May 2005 16:45, Evert Glebbeek wrote:
> > else too much code is duplicated (like window creation,
> > AllegroGL programs have no alex icon because of it :().
>
> Hmm... that should not be too hard to fix, I suppose. I'll have a look at
> it.
Patch attached (I guess I should send it to the AGL mailinglist rather than
send it here, but I'm in a bit of a hurry right now). It seems to work
fine, judging from the two seconds I took to run the test programme in
Windowed mode. More duplicate code I'm afraid though. :-/
Evert
Index: src/x.c
===================================================================
RCS file: /cvsroot/allegrogl/alleggl/src/x.c,v
retrieving revision 1.68
diff -u -r1.68 x.c
--- src/x.c 19 Mar 2005 19:28:25 -0000 1.68
+++ src/x.c 31 May 2005 21:54:04 -0000
@@ -10,6 +10,10 @@
#include <allegro/platform/aintunix.h>
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
+#include <X11/xpm.h>
+#endif
+
#include "alleggl.h"
#include "allglint.h"
#include "glvtable.h"
@@ -23,6 +27,11 @@
#endif
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
+extern void *allegro_icon;
+#endif
+
+
static BITMAP *allegro_gl_x_windowed_init(int w, int h, int vw, int vh,
int color_depth);
static void allegro_gl_x_exit(BITMAP *bmp);
@@ -545,6 +554,9 @@
#ifdef ALLEGROGL_HAVE_XF86VIDMODE
int bestmode=0;
#endif
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
+ XpmAttributes attributes;
+#endif
if (_xwin.display == 0) {
return -1;
@@ -780,6 +792,15 @@
wm_hints.flags = InputHint | StateHint;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
+
+#ifdef ALLEGRO_XWINDOWS_WITH_XPM
+ if (allegro_icon) {
+ wm_hints.flags |= IconPixmapHint | IconMaskHint | WindowGroupHint;
+ attributes.valuemask = XpmReturnAllocPixels | XpmReturnExtensions;
+ XpmCreatePixmapFromData(_xwin.display,_xwin.window,allegro_icon,&wm_hints.icon_pixmap,&wm_hints.icon_mask, &attributes);
+ }
+#endif
+
XSetWMHints(_xwin.display, _xwin.window, &wm_hints);
}