summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/xwin/winmultiwindowwm.c22
-rw-r--r--hw/xwin/winprefs.c28
-rw-r--r--hw/xwin/winprefs.h2
3 files changed, 24 insertions, 28 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c
index 2fcad3249..9ab41f7a9 100644
--- a/hw/xwin/winmultiwindowwm.c
+++ b/hw/xwin/winmultiwindowwm.c
@@ -1552,7 +1552,6 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
Atom type, *pAtom = NULL;
int format;
unsigned long hint = 0, maxmin = 0, style, nitems = 0 , left = 0;
- WindowPtr pWin = GetProp (hWnd, WIN_WINDOW_PROP);
if (!hWnd) return;
if (!IsWindow (hWnd)) return;
@@ -1645,7 +1644,26 @@ winApplyHints (Display *pDisplay, Window iWindow, HWND hWnd, HWND *zstyle)
}
/* Override hint settings from above with settings from config file */
- style = winOverrideStyle((unsigned long)pWin);
+ {
+ XClassHint class_hint = {0,0};
+ char *window_name = 0;
+
+ if (XGetClassHint(pDisplay, iWindow, &class_hint))
+ {
+ XFetchName(pDisplay, iWindow, &window_name);
+
+ style = winOverrideStyle(class_hint.res_name, class_hint.res_class, window_name);
+
+ if (class_hint.res_name) XFree(class_hint.res_name);
+ if (class_hint.res_class) XFree(class_hint.res_class);
+ if (window_name) XFree(window_name);
+ }
+ else
+ {
+ style = STYLE_NONE;
+ }
+ }
+
if (style & STYLE_TOPMOST) *zstyle = HWND_TOPMOST;
else if (style & STYLE_MAXIMIZE) maxmin = (hint & ~HINT_MIN) | HINT_MAX;
else if (style & STYLE_MINIMIZE) maxmin = (hint & ~HINT_MAX) | HINT_MIN;
diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c
index 93901cac7..2641c737d 100644
--- a/hw/xwin/winprefs.c
+++ b/hw/xwin/winprefs.c
@@ -826,42 +826,20 @@ LoadPreferences (void)
* STYLES{} section in the prefs file, and return the style type
*/
unsigned long
-winOverrideStyle (unsigned long longpWin)
+winOverrideStyle (char *res_name, char *res_class, char *wmName)
{
- WindowPtr pWin = (WindowPtr) longpWin;
- char *res_name, *res_class;
int i;
- char *wmName;
-
- if (pWin==NULL)
- return STYLE_NONE;
-
- /* If we can't find the class, we can't override from default! */
- if (!winMultiWindowGetClassHint (pWin, &res_name, &res_class))
- return STYLE_NONE;
-
- winMultiWindowGetWMName (pWin, &wmName);
for (i=0; i<pref.styleItems; i++) {
- if (!strcmp(pref.style[i].match, res_name) ||
- !strcmp(pref.style[i].match, res_class) ||
+ if ((res_name && !strcmp(pref.style[i].match, res_name)) ||
+ (res_class && !strcmp(pref.style[i].match, res_class)) ||
(wmName && strstr(wmName, pref.style[i].match)))
{
- free (res_name);
- free (res_class);
- if (wmName)
- free (wmName);
-
if (pref.style[i].type)
return pref.style[i].type;
}
}
/* Didn't find the style, fail gracefully */
- free (res_name);
- free (res_class);
- if (wmName)
- free (wmName);
-
return STYLE_NONE;
}
diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h
index 4daf47401..e672b6ea1 100644
--- a/hw/xwin/winprefs.h
+++ b/hw/xwin/winprefs.h
@@ -179,7 +179,7 @@ HICON
winOverrideIcon (unsigned long longpWin);
unsigned long
-winOverrideStyle (unsigned long longpWin);
+winOverrideStyle (char *res_name, char *res_class, char *wmName);
HICON
winTaskbarIcon(void);