diff options
Diffstat (limited to 'hw/xwin')
-rw-r--r-- | hw/xwin/winmultiwindowwm.c | 22 | ||||
-rw-r--r-- | hw/xwin/winprefs.c | 26 | ||||
-rw-r--r-- | hw/xwin/winprefs.h | 2 |
3 files changed, 24 insertions, 26 deletions
diff --git a/hw/xwin/winmultiwindowwm.c b/hw/xwin/winmultiwindowwm.c index ef0c7cf0b..67a58a076 100644 --- a/hw/xwin/winmultiwindowwm.c +++ b/hw/xwin/winmultiwindowwm.c @@ -1576,7 +1576,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); MwmHints *mwm_hint = NULL; if (!hWnd) return; @@ -1669,7 +1668,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 4ccb4ffc2..d941c5169 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -813,40 +813,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); - 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); - free(wmName); - return STYLE_NONE; } diff --git a/hw/xwin/winprefs.h b/hw/xwin/winprefs.h index 33b496df8..ecd0a3fbd 100644 --- a/hw/xwin/winprefs.h +++ b/hw/xwin/winprefs.h @@ -180,7 +180,7 @@ HICON winOverrideIcon (unsigned long longpWin); unsigned long -winOverrideStyle (unsigned long longpWin); +winOverrideStyle (char *res_name, char *res_class, char *wmName); HICON winTaskbarIcon(void); |