diff --git a/hw/xwin/XWinrc.man b/hw/xwin/XWinrc.man index eba3fb603..8e2498cdb 100755 --- a/hw/xwin/XWinrc.man +++ b/hw/xwin/XWinrc.man @@ -30,6 +30,10 @@ that \fIXWin -multiwindow\fP produces for each top-level X-window. Again, that can be done both for the generic case and for particular programs. The new icons associated should be \fIWindows\fP format icons \fI.ico\fP. +.PP +4- To change the style that is associated to the \fIWindows\fP window +that \fI-multiwindow\fP produces for each top-level X window. Again, +that can be done both for the generic case and for particular programs. .SH FILE FORMAT @@ -41,9 +45,10 @@ completely capitalized. are legal pretty much anywhere you can have an end-of-line; they begin with "#" or "//" and go to the end-of-line. .PP -Quote marks in strings are optional unless the string has included spaces. +Quote marks in strings are optional unless the string has included spaces, +or could be parsed, ambiguously, as a misplaced keyword. .PP -There are three kinds of instructions: miscellaneous, menu, and icon. +There are four kinds of instructions: miscellaneous, menu, icon and style. .SH Miscellaneous instruction @@ -117,7 +122,9 @@ included at the start or at the end of the menu. .br \fB}\fP .br -Associates a specific menu to a specific WM_CLASS or WM_NAME. +Associates a specific menu to a specified window class or name +in \fI-multiwindow\fP mode. The keywords ATSTART or ATEND indicate if +such items should be included at the start or at the end of the menu. .SH Icon Instructions @@ -131,7 +138,7 @@ When specifying an \fIicon-file\fP in the following commands several different f .br \t \t ("c:\\windows\\system32\\shell32.dll,4" is the default folder icon) .br -\fB",nn"\fP\fI index into XWin.EXE internal ICON resources\fP +\fB",nnn"\fP\fI index into XWin.EXE internal ICON resources\fP .br \t \t (",101" is the 1st icon inside \fIXWin.EXE\fP) .TP 8 @@ -155,6 +162,57 @@ Defines icon replacements windows matching the specified window class or names. If multiple name or class matches occur for a window, only the first one will be used. +.SH Style Instructions +.TP 8 +.B STYLES { +\fIclass-or-name-of-window\fP \fIstyle-keyword-1\fP \fIstyle-keyword-2\fP +.br + \fI...\fP +.br +\fB}\fP + +Associates specific styles to a specified window class or name +in \fI-multiwindow\fP mode. If multiple class or name matches occur, +for a window, only the first one will be used. + +The style keywords indicate the following: + +\fIstyle-keyword-1\fP + +\fBTOPMOST\fP +.br +Open the class or name above all NOTOPMOST Microsoft Windows +.br +\fBMAXIMIZE\fP +.br +Start the class or name fullscreen. +.br +\fBMINIMIZE\fP +.br +Start the class or name iconic. +.br +\fBBOTTOM\fP +.br +Open the class or name below all Windows windows. +.br + +\fIstyle-keyword-2\fP + +\fBNOTITLE\fP +.br +No Windows title bar, for the class or name. +.br +\fBOUTLINE\fP +.br +No Windows title bar and just a thin-line border, for the class or name. +.br +\fBNOFRAME\fP +.br +No Windows title bar or border, for the class or name. + +One keyword in \fIstyle-keyword-1\fP can be used with one keyword in \fIstyle-keyword-2\fP, +or any keyword can be used singly. + .SH EXAMPLE .TP 8 @@ -170,6 +228,15 @@ This example adds an Xterm menu item to the system tray icon ROOTMENU systray \fP +.TP 8 +This example makes an oclock window frameless in \fI-multiwindow\fP mode +\fBSTYLES { +.br +\t oclock NOFRAME +.br +} + + .SH "SEE ALSO" XWin(1) @@ -177,4 +244,4 @@ ROOTMENU systray .SH AUTHOR The XWinrc feature of XWin was written primarily by Earle F. Philhower -III. +III. Extended for style configuration by Colin Harrison. diff --git a/hw/xwin/winprefs.c b/hw/xwin/winprefs.c index 30e587d4a..73d543af9 100644 --- a/hw/xwin/winprefs.c +++ b/hw/xwin/winprefs.c @@ -1,5 +1,6 @@ /* * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -26,6 +27,7 @@ * from the XFree86 Project. * * Authors: Earle F. Philhower, III + * Colin Harrison */ #ifdef HAVE_XWIN_CONFIG_H @@ -820,3 +822,49 @@ LoadPreferences () } /* for all menus */ } + + +/* + * Check for a match of the window class to one specified in the + * STYLES{} section in the prefs file, and return the style type + */ +unsigned long +winOverrideStyle (unsigned long longpWin) +{ + 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 STRING +%type group1 +%type group2 +%type stylecombo %type atspot %% @@ -107,6 +122,7 @@ command: defaulticon | icondirectory | menu | icons + | styles | sysmenu | rootmenu | defaultsysmenu @@ -154,6 +170,33 @@ iconlist: iconline icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();} ; +group1: TOPMOST { $$=STYLE_TOPMOST; } + | MAXIMIZE { $$=STYLE_MAXIMIZE; } + | MINIMIZE { $$=STYLE_MINIMIZE; } + | BOTTOM { $$=STYLE_BOTTOM; } + ; + +group2: NOTITLE { $$=STYLE_NOTITLE; } + | OUTLINE { $$=STYLE_OUTLINE; } + | NOFRAME { $$=STYLE_NOFRAME; } + ; + +stylecombo: group1 { $$=$1; } + | group2 { $$=$1; } + | group1 group2 { $$=$1|$2; } + | group2 group1 { $$=$1|$2; } + ; + +styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); } + ; + +stylelist: styleline + | styleline stylelist + ; + +styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();} + ; + atspot: { $$=AT_END; } | ATSTART { $$=AT_START; } | ATEND { $$=AT_END; } @@ -315,6 +358,39 @@ CloseIcons (void) { } +static void +OpenStyles (void) +{ + if (pref.style != NULL) { + ErrorF("LoadPreferences: Redefining window style\n"); + free(pref.style); + pref.style = NULL; + } + pref.styleItems = 0; +} + +static void +AddStyleLine (char *matchstr, unsigned long style) +{ + if (pref.style==NULL) + pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + else + pref.style = (STYLEITEM*) + realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + + strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); + pref.style[pref.styleItems].match[MENU_MAX] = 0; + + pref.style[pref.styleItems].type = style; + + pref.styleItems++; +} + +static void +CloseStyles (void) +{ +} + static void OpenSysMenu (void) {