Re: [AD] set_window_name

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> look at the attached patch... it works for me ¹!

now attached

-- 
"Just because you're paranoid, it doesn't mean they are not after you"
                                . /\ °
Real Name: Lorenzo Petrone       <* >
Web: digilander.iol.it/lano666    \/ ·
diff -ubBr -x *.[ao] _allegro/src/x/xwin.c allegro/src/x/xwin.c
--- _allegro/src/x/xwin.c	Sun Apr 21 18:01:13 2002
+++ allegro/src/x/xwin.c	Sun Apr 21 18:22:02 2002
@@ -196,6 +196,7 @@
 static int _xwin_private_scroll_screen(int x, int y);
 static void _xwin_private_update_screen(int x, int y, int w, int h);
 static void _xwin_private_set_window_title(AL_CONST char *name);
+static void _xwin_private_set_window_name(AL_CONST char *name,AL_CONST char *group);
 static void _xwin_private_change_keyboard_control(int led, int on);
 static int _xwin_private_get_pointer_mapping(unsigned char map[], int nmap);
 static void _xwin_private_init_keyboard_tables(void);
@@ -2406,6 +2407,56 @@
 {
    XLOCK();
    _xwin_private_set_window_title(name);
+   XUNLOCK();
+}
+
+
+
+/* _xwin_sysdrv_set_window_name:
+ *  Sets window name and group.
+ */
+static void _xwin_private_set_window_name(AL_CONST char *name,AL_CONST char *group)
+{
+   if (!name)
+      _xwin_safe_copy(_xwin.application_name, XWIN_DEFAULT_APPLICATION_NAME, sizeof(_xwin.application_name));
+   else
+      _xwin_safe_copy(_xwin.application_name, name, sizeof(_xwin.application_name));
+
+   if (!group)
+      _xwin_safe_copy(_xwin.application_class, XWIN_DEFAULT_APPLICATION_CLASS, sizeof(_xwin.application_class));
+   else
+      _xwin_safe_copy(_xwin.application_class, group, sizeof(_xwin.application_class));
+
+   if (_xwin.window != None)
+//		_xwin_private_set_window_defaults();
+	{
+		XClassHint hint;
+		XWMHints wm_hints;
+	
+		if (_xwin.window == None)
+			return;
+	
+		/* Set hints.  */
+		hint.res_name = _xwin.application_name;
+		hint.res_class = _xwin.application_class;
+		XSetClassHint(_xwin.display, _xwin.window, &hint);
+	
+/*		wm_hints.flags = InputHint | StateHint;
+		wm_hints.input = True;
+		wm_hints.initial_state = NormalState;
+		XSetWMHints(_xwin.display, _xwin.window, &wm_hints);
+*/	}
+}
+
+void _xwin_set_window_name(AL_CONST char *name, AL_CONST char *group)
+{
+   char _name[128],_group[128];
+
+   do_uconvert(name, U_CURRENT, _name, U_ASCII, sizeof(_name));
+   do_uconvert(group, U_CURRENT, _group, U_ASCII, sizeof(_group));
+
+   XLOCK();
+   _xwin_private_set_window_name(_name,_group);
    XUNLOCK();
 }
 
diff -ubBr -x *.[ao] _allegro/src/x/xwin.h allegro/src/x/xwin.h
--- _allegro/src/x/xwin.h	Sun Apr 21 18:01:13 2002
+++ allegro/src/x/xwin.h	Sun Apr 21 18:02:45 2002
@@ -44,6 +44,7 @@
    AL_FUNC(int, _xwin_scroll_screen, (int x, int y));
    AL_FUNC(void, _xwin_update_screen, (int x, int y, int w, int h));
    AL_FUNC(void, _xwin_set_window_title, (AL_CONST char *name));
+	AL_FUNC(void, _xwin_set_window_name, (AL_CONST char *name, AL_CONST char *group));
    AL_FUNC(void, _xwin_change_keyboard_control, (int led, int on));
    AL_FUNC(int, _xwin_get_pointer_mapping, (unsigned char map[], int nmap));
    AL_FUNC(void, _xwin_init_keyboard_tables, (void));


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/