diff options
author | marha <marha@users.sourceforge.net> | 2011-03-07 07:56:07 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-03-07 07:56:07 +0000 |
commit | 43ac73d271f697d91670fd6cb120489acc03aaeb (patch) | |
tree | 2109e1e6eac063c74cc146842aeeeb27a86cec02 /xorg-server/hw/xwin | |
parent | 4f70194d203322cf1ec38767098976797c116f0c (diff) | |
download | vcxsrv-43ac73d271f697d91670fd6cb120489acc03aaeb.tar.gz vcxsrv-43ac73d271f697d91670fd6cb120489acc03aaeb.tar.bz2 vcxsrv-43ac73d271f697d91670fd6cb120489acc03aaeb.zip |
Made winOverrideStyle thread safe
Diffstat (limited to 'xorg-server/hw/xwin')
-rw-r--r-- | xorg-server/hw/xwin/winmultiwindowwm.c | 21 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winprefs.c | 26 | ||||
-rw-r--r-- | xorg-server/hw/xwin/winprefs.h | 5 |
3 files changed, 23 insertions, 29 deletions
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<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/xorg-server/hw/xwin/winprefs.h b/xorg-server/hw/xwin/winprefs.h index 66fab626a..00f01348d 100644 --- a/xorg-server/hw/xwin/winprefs.h +++ b/xorg-server/hw/xwin/winprefs.h @@ -180,10 +180,7 @@ HICON winOverrideIcon (unsigned long longpWin);
unsigned long
-winOverrideStyle (unsigned long longpWin);
-
-unsigned long
-winOverrideStyle (unsigned long longpWin);
+winOverrideStyle (char *res_name, char *res_class, char *wmName);
HICON
winTaskbarIcon(void);
|