aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winprefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winprefs.c')
-rw-r--r--xorg-server/hw/xwin/winprefs.c76
1 files changed, 37 insertions, 39 deletions
diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c
index 86a788287..c66e11396 100644
--- a/xorg-server/hw/xwin/winprefs.c
+++ b/xorg-server/hw/xwin/winprefs.c
@@ -51,6 +51,8 @@
extern const char *winGetBaseDir(void);
+extern const char *g_pszLogFile;
+
/* From winprefslex.l, the real parser */
extern int parse_file(FILE * fp);
@@ -148,7 +150,6 @@ static wBOOL CALLBACK
ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
{
HICON hicon;
- Window wid;
if (!hwnd) {
ErrorF("ReloadEnumWindowsProc: hwnd==NULL!\n");
@@ -173,10 +174,23 @@ ReloadEnumWindowsProc(HWND hwnd, LPARAM lParam)
/* This window is now clean of our taint (but with undefined icons) */
}
else {
- /* winUpdateIcon() will set the icon default, dynamic, or from xwinrc */
- wid = (Window) GetProp(hwnd, WIN_WID_PROP);
- if (wid)
- winUpdateIcon(wid);
+ /* Send a message to WM thread telling it re-evaluate the icon for this window */
+ {
+ winWMMessageRec wmMsg;
+
+ WindowPtr pWin = GetProp(hwnd, WIN_WINDOW_PROP);
+
+ if (pWin) {
+ winPrivWinPtr pWinPriv = winGetWindowPriv(pWin);
+ winPrivScreenPtr s_pScreenPriv = pWinPriv->pScreenPriv;
+
+ wmMsg.msg = WM_WM_ICON_EVENT;
+ wmMsg.hwndWindow = hwnd;
+ wmMsg.iWindow = (Window) GetProp(hwnd, WIN_WID_PROP);
+
+ winSendMessageToWM(s_pScreenPriv->pWMInfo, &wmMsg);
+ }
+ }
/* Update the system menu for this window */
SetupSysMenu((unsigned long) hwnd);
@@ -344,8 +358,8 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
memset(&start, 0, sizeof(start));
start.cb = sizeof(start);
- start.dwFlags = STARTF_USESHOWWINDOW;
- start.wShowWindow = SW_HIDE;
+ //start.dwFlags = STARTF_USESHOWWINDOW;
+ //start.wShowWindow = SW_HIDE;
memset(&child, 0, sizeof(child));
@@ -357,7 +371,7 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command)
}
else
MessageBox(NULL, m->menuItem[j].param,
- "Mingrc Exec Command Error!",
+ "VcXsrv Exec Command Error!",
MB_OK | MB_ICONEXCLAMATION);
}
return TRUE;
@@ -577,31 +591,15 @@ LoadImageComma(char *fname, int sx, int sy, int flags)
* ICONS{} section in the prefs file, and load the icon from a file
*/
HICON
-winOverrideIcon(unsigned long longWin)
+winOverrideIcon(char *res_name, char *res_class, char *wmName)
{
- WindowPtr pWin = (WindowPtr) longWin;
- char *res_name, *res_class;
int i;
HICON hicon;
- char *wmName;
-
- if (pWin == NULL)
- return 0;
-
- /* If we can't find the class, we can't override from default! */
- if (!winMultiWindowGetClassHint(pWin, &res_name, &res_class))
- return 0;
-
- winMultiWindowGetWMName(pWin, &wmName);
for (i = 0; i < pref.iconItems; i++) {
- if (!strcmp(pref.icon[i].match, res_name) ||
- !strcmp(pref.icon[i].match, res_class) ||
+ if ((res_name && !strcmp(pref.icon[i].match, res_name)) ||
+ (res_class && !strcmp(pref.icon[i].match, res_class)) ||
(wmName && strstr(wmName, pref.icon[i].match))) {
- free(res_name);
- free(res_class);
- free(wmName);
-
if (pref.icon[i].hicon)
return pref.icon[i].hicon;
@@ -616,10 +614,6 @@ winOverrideIcon(unsigned long longWin)
}
/* Didn't find the icon, fail gracefully */
- free(res_name);
- free(res_class);
- free(wmName);
-
return 0;
}
@@ -656,6 +650,7 @@ winPrefsLoadPreferences(char *path)
if (path)
prefFile = fopen(path, "r");
+#ifndef _MSC_VER
else {
char defaultPrefs[] =
"MENU rmenu {\n"
@@ -667,6 +662,7 @@ winPrefsLoadPreferences(char *path)
path = "built-in default";
prefFile = fmemopen(defaultPrefs, strlen(defaultPrefs), "r");
}
+#endif
if (!prefFile) {
ErrorF("LoadPreferences: %s not found\n", path);
@@ -735,16 +731,13 @@ LoadPreferences(void)
}
/* Setup a DISPLAY environment variable, need to allocate on heap */
- /* because putenv doesn't copy the argument... */
- snprintf(szDisplay, 512, "DISPLAY=127.0.0.1:%s.0", display);
- szEnvDisplay = (char *) (malloc(strlen(szDisplay) + 1));
- if (szEnvDisplay) {
- strcpy(szEnvDisplay, szDisplay);
- putenv(szEnvDisplay);
- }
+ /* because putenv doesn't copy the argument... Always use screen 0 */
+ winGetDisplayName(szDisplay, 0);
+ szEnvDisplay = (char *)(malloc(strlen(szDisplay)+9/*strlen("DISPLAY=")+1*/));
+ snprintf(szEnvDisplay, 512, "DISPLAY=%s", szDisplay);
+ putenv (szEnvDisplay);
/* Replace any "%display%" in menu commands with display string */
- snprintf(szDisplay, 512, "127.0.0.1:%s.0", display);
for (i = 0; i < pref.menuItems; i++) {
for (j = 0; j < pref.menu[i].menuItems; j++) {
if (pref.menu[i].menuItem[j].cmd == CMD_EXEC) {
@@ -756,6 +749,11 @@ LoadPreferences(void)
dstParam += strlen(szDisplay);
srcParam += 9;
}
+ else if (!strncmp(srcParam, "%logfile%", 9)) {
+ memcpy (dstParam, g_pszLogFile, strlen(g_pszLogFile));
+ dstParam += strlen(g_pszLogFile);
+ srcParam += 9;
+ }
else {
*dstParam = *srcParam;
dstParam++;