From 43ac73d271f697d91670fd6cb120489acc03aaeb Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 7 Mar 2011 07:56:07 +0000 Subject: Made winOverrideStyle thread safe --- xorg-server/hw/xwin/winmultiwindowwm.c | 21 +++++++++++++++++++-- xorg-server/hw/xwin/winprefs.c | 26 +++----------------------- xorg-server/hw/xwin/winprefs.h | 5 +---- 3 files changed, 23 insertions(+), 29 deletions(-) (limited to 'xorg-server/hw/xwin') diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index b59a2e9b0..f05fe79ae 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -1535,7 +1535,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; WinXSizeHints SizeHints; @@ -1629,7 +1628,25 @@ 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}; + + if (XGetClassHint(pDisplay, iWindow, &class_hint)) + { + char *window_name = 0; + 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/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c index f24074636..e92e95f2b 100644 --- a/xorg-server/hw/xwin/winprefs.c +++ b/xorg-server/hw/xwin/winprefs.c @@ -821,40 +821,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