diff options
author | Matthieu Herrb <matthieu@herrb.eu> | 2019-07-17 17:33:35 +0200 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2019-07-17 17:33:35 +0200 |
commit | 879fca731c241d59dcfcfdb4d4d67d2df996a4d7 (patch) | |
tree | 7a45752897099e4fa4382ab3e0a7aada9aef60f3 | |
parent | 6197a5f16dbc71d6199615ceec0caf676e8aa1b2 (diff) | |
parent | 2e0923ba703d040160bac1deb05d5d6d4cbd62aa (diff) |
Merge remote-tracking branch 'origin/master' into obsd
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | man/twm.man | 765 | ||||
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/add_window.c | 86 | ||||
-rw-r--r-- | src/cursor.c | 5 | ||||
-rw-r--r-- | src/deftwmrc.sed | 2 | ||||
-rw-r--r-- | src/events.c | 104 | ||||
-rw-r--r-- | src/events.h | 1 | ||||
-rw-r--r-- | src/gram.y | 37 | ||||
-rw-r--r-- | src/iconmgr.c | 22 | ||||
-rw-r--r-- | src/icons.c | 38 | ||||
-rw-r--r-- | src/lex.l | 2 | ||||
-rw-r--r-- | src/list.c | 6 | ||||
-rw-r--r-- | src/menus.c | 159 | ||||
-rw-r--r-- | src/parse.c | 22 | ||||
-rw-r--r-- | src/resize.c | 50 | ||||
-rw-r--r-- | src/session.c | 96 | ||||
-rw-r--r-- | src/twm.c | 40 | ||||
-rw-r--r-- | src/twm.h | 13 | ||||
-rw-r--r-- | src/util.c | 236 |
21 files changed, 1013 insertions, 690 deletions
@@ -1,6 +1,6 @@ # # X.Org module default exclusion patterns -# The next section if for module specific patterns +# The next section is for module specific patterns # # Do not edit the following section # GNU Build System (Autotools) @@ -76,3 +76,4 @@ core # Edit the following section as needed # For example, !report.pc overrides *.pc. See 'man gitignore' # +LOGS diff --git a/configure.ac b/configure.ac index 76f7103..ef7e482 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([twm], [1.0.10], +AC_INIT([twm], [1.0.10.2], [https://gitlab.freedesktop.org/xorg/app/twm/issues], [twm]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) @@ -49,7 +49,11 @@ AC_PROG_LEX AC_CHECK_FUNCS([mkstemp]) # Checks for pkg-config packages -PKG_CHECK_MODULES(TWM, x11 xext xt xmu ice sm xproto >= 7.0.17) +PKG_CHECK_MODULES([TWM], [x11 xext xt xmu ice sm xproto >= 7.0.17]) +PKG_CHECK_MODULES([XRANDR], [xrandr], [have_xrandr=yes], [have_xrandr=no]) +if test "$have_xrandr" = yes; then + AC_DEFINE([HAVE_XRANDR], [1], [Define to 1 if you have the xrandr headers/libraries]) +fi AC_CONFIG_FILES([Makefile src/Makefile diff --git a/man/twm.man b/man/twm.man index d1dbaa0..ac61a19 100644 --- a/man/twm.man +++ b/man/twm.man @@ -24,19 +24,21 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.de EX \"Begin example -.ne 5 -.if n .sp 1 -.if t .sp .5 +.de Ex +.RS +7 +.PP .nf -.in +.5i +.ft CW .. -.de EE +.de Ee .fi -.in -.5i -.if n .sp 1 -.if t .sp .5 +.ft R +.RE .. +.ie \n(.g .ds `` \(lq +.el .ds `` `` +.ie \n(.g .ds '' \(rq +.el .ds '' '' .TH TWM 1 __xorgversion__ .SH NAME twm \- Tab Window Manager for the X Window System @@ -44,22 +46,28 @@ twm \- Tab Window Manager for the X Window System \fBtwm \fP[ \fB\-display\fP \fIdpy\fP ] [ \fB\-s\fP ] [ \fB\-f\fP \fIinitfile\fP ] [ \fB\-v\fP ] .SH DESCRIPTION -\fITwm\fP is a window manager for the X Window System. It provides +\fITwm\fP is a window manager for the X Window System. +It provides titlebars, shaped windows, several forms of icon management, user-defined macro functions, click-to-type and pointer-driven keyboard focus, and user-specified key and pointer button bindings. .PP This program is usually started by the user's session manager or -startup script. When used from \fIxdm(__appmansuffix__)\fP or \fIxinit(__appmansuffix__)\fP without -a session manager, \fItwm\fP is frequently executed in the foreground -as the last client. When run this way, exiting \fItwm\fP causes the +startup script. +When used +from \fIxdm(__appmansuffix__)\fP +or \fIxinit(__appmansuffix__)\fP without a session manager, +\fItwm\fP is frequently executed in the foreground +as the last client. +When run this way, exiting \fItwm\fP causes the session to be terminated (i.e., logged out). .PP -By default, application windows are surrounded by a ``frame'' with a -titlebar at the top and a special border around the window. The titlebar +By default, application windows are surrounded by a \*(``frame\*('' with a +titlebar at the top and a special border around the window. +The titlebar contains the window's name, a rectangle that is lit when the window is -receiving keyboard input, and function boxes known as ``titlebuttons'' at +receiving keyboard input, and function boxes known as \*(``titlebuttons\*('' at the left and right edges of the titlebar. .PP Pressing pointer Button1 (usually the left-most @@ -67,7 +75,8 @@ button unless it has been changed with \fIxmodmap\fP) on a titlebutton will invoke the function associated with the button. In the default interface, windows are iconified by clicking (pressing and then immediately releasing) the left titlebutton (which looks -like a Dot). Conversely, windows are deiconified by clicking in the +like a Dot). +Conversely, windows are deiconified by clicking in the associated icon or entry in the icon manager (see description of the variable \fBShowIconManager\fP and of the function \fBf.showiconmgr\fP). @@ -75,9 +84,11 @@ associated icon or entry in the icon manager Windows are resized by pressing the right titlebutton (which resembles a group of nested squares), dragging the pointer over edge that is to be moved, and releasing the pointer when the outline of the window is the desired -size. Similarly, windows are moved by pressing in the title or highlight +size. +Similarly, windows are moved by pressing in the title or highlight region, dragging a window outline to the new location, and then releasing -when the outline is in the desired position. Just +when the outline is in the desired position. +Just clicking in the title or highlight region raises the window without moving it. .PP When new windows are created, \fItwm\fP will honor any size and location @@ -88,10 +99,12 @@ dividing the window into a 3x3 grid that track the pointer are displayed. Clicking pointer Button1 will position the window at the current position and give it the default -size. Pressing pointer Button2 (usually the middle pointer button) +size. +Pressing pointer Button2 (usually the middle pointer button) and dragging the outline will give the window its current position but allow the sides to be resized as -described above. Clicking pointer Button3 (usually the right pointer button) +described above. +Clicking pointer Button3 (usually the right pointer button) will give the window its current position but attempt to make it long enough to touch the bottom the screen. .SH OPTIONS @@ -104,17 +117,20 @@ This option specifies the X server to use. .B \-s This option indicates that only the default screen (as specified by \fB\-display\fP or by the \fBDISPLAY\fP environment variable) should be -managed. By default, \fItwm\fP will attempt to manage +managed. +By default, \fItwm\fP will attempt to manage all screens on the display. .TP 8 .B \-f \fIfilename\fP -This option specifies the name of the startup file to use. By default, +This option specifies the name of the startup file to use. +By default, \fItwm\fP will look in the user's home directory for files named \fI.twmrc.num\fP (where \fInum\fP is a screen number) or \fI.twmrc\fP. .TP 8 .B \-v This option indicates that \fItwm\fP should print error messages whenever -an unexpected X Error event is received. This can be useful when debugging +an unexpected X Error event is received. +This can be useful when debugging applications but can be distracting in regular use. .SH CUSTOMIZATION .PP @@ -123,10 +139,12 @@ a startup file in one of the following locations (searched in order for each screen being managed when \fItwm\fP begins): .TP 8 .B "$HOME/.twmrc.\fIscreennumber\fP" -The \fIscreennumber\fP is a small positive number (e.g. 0, 1, etc.) -representing the screen number (e.g. the last number in the DISPLAY environment +The \fIscreennumber\fP is a small positive number (e.g. +0, 1, etc.) +representing the screen number (e.g., the last number in the DISPLAY environment variable \fIhost:displaynum.screennum\fP) that would be used to contact that -screen of the display. This is intended for displays with multiple screens of +screen of the display. +This is intended for displays with multiple screens of differing visual types. .TP 8 .B "$HOME/.twmrc" @@ -135,67 +153,79 @@ This is the usual name for an individual user's startup file. .B __datadir__/X11/twm/system.twmrc If neither of the preceding files are found, \fItwm\fP will look in this file for a -default configuration. This is often tailored by the site administrator to +default configuration. +This is often tailored by the site administrator to provide convenient menus or familiar bindings for novice users. .PP If no startup files are found, \fItwm\fP will use the built-in defaults -described above. The only resource used by \fItwm\fP is +described above. +The only resource used by \fItwm\fP is \fIbitmapFilePath\fP for a colon-separated list of directories to search when looking for bitmap files (for more information, see the \fIAthena Widgets\fP manual and \fIxrdb(__appmansuffix__)\fP). .PP \fITwm\fP startup files are logically broken up into three types of -specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The +specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. +The \fIVariables\fP section must come first and is used to describe the fonts, colors, cursors, border widths, icon and window placement, highlighting, autoraising, layout of titles, warping, use of the icon manager. The \fIBindings\fP section usually comes second and is used to specify the functions that should be to be invoked when keyboard and pointer buttons are pressed in -windows, icons, titles, and frames. The \fIMenus\fP section gives any +windows, icons, titles, and frames. +The \fIMenus\fP section gives any user-defined menus (containing functions to be invoked or commands to be executed). .PP -Variable names and keywords are case-insensitive. Strings must be surrounded -by double quote characters (e.g. "blue") and are case-sensitive. +Variable names and keywords are case-insensitive. +Strings must be surrounded +by double quote characters (e.g., "blue") and are case-sensitive. A pound sign (#) outside of a string causes the remainder of the line in which the character appears to be treated as a comment. .SH VARIABLES .PP Many of the aspects of \fItwm\fP's user interface are controlled by variables -that may be set in the user's startup file. Some of the options are -enabled or disabled simply by the presence of a particular keyword. Other +that may be set in the user's startup file. +Some of the options are +enabled or disabled simply by the presence of a particular keyword. +Other options require keywords, numbers, strings, or lists of all of these. .PP Lists are surrounded by braces and are usually separated by -whitespace or a newline. For example: -.EX 0 +whitespace or a newline. +For example: +.Ex 0 \fBAutoRaise\fP { "emacs" "XTerm" "Xmh" } -.EE +.Ee +.LP or -.EX 0 +.Ex 0 \fBAutoRaise\fP { "emacs" "XTerm" "Xmh" } -.EE +.Ee +.LP When a variable containing a list of strings representing windows is searched -(e.g. to determine whether or not to enable autoraise as shown above), a string +(e.g., to determine whether or not to enable autoraise as shown above), a string must be an exact, case-sensitive match to the window's name (given by the WM_NAME window property), resource name -or class name (both given by the WM_CLASS window property). The preceding -example would enable autoraise on windows named ``emacs'' as well as any -\fIxterm\fP (since they are of class ``XTerm'') or xmh windows -(which are of class ``Xmh''). +or class name (both given by the WM_CLASS window property). +The preceding +example would enable autoraise on windows named \*(``emacs\*('' as well as any +\fIxterm\fP (since they are of class \*(``XTerm\*('') or xmh windows +(which are of class \*(``Xmh\*(''). .PP String arguments that are interpreted as filenames (see the \fBPixmaps\fP, \fBCursors\fP, and \fBIconDirectory\fP below) will prepend the user's directory (specified by the \fBHOME\fP environment variable) if the first character is a -tilde (~). If, instead, the first character is a colon (:), the name is +tilde (~). +If, instead, the first character is a colon (:), the name is assumed to refer to one of the internal bitmaps that are used to create the default titlebars symbols: \fB:xlogo\fP or \fB:delete\fP (both refer to the X logo), @@ -206,11 +236,13 @@ and \fB:question\fP (the question mark used for non-existent bitmap files). .PP The following variables may be specified at the top of a \fItwm\fP startup -file. Lists of Window name prefix strings are indicated by \fIwin-list\fP. +file. +Lists of Window name prefix strings are indicated by \fIwin-list\fP. Optional arguments are shown in square brackets: .IP "\fBAutoRaise\fP { \fIwin-list\fP }" 8 This variable specifies a list of windows that should automatically be -raised whenever the pointer enters the window. This action can be +raised whenever the pointer enters the window. +This action can be interactively enabled or disabled on individual windows using the function \fBf.autoraise\fP. .IP "\fBAutoRelativeResize\fP" 8 @@ -219,12 +251,14 @@ initially sizing the window with pointer Button2 or when resizing it) should not wait until the pointer has crossed the window edges. Instead, moving the pointer automatically causes the nearest edge or edges to move by the -same amount. This allows the resizing of windows that extend off +same amount. +This allows the resizing of windows that extend off the edge of the screen. If the pointer is in the center of the window, or if the resize is begun by pressing a titlebutton, \fItwm\fP will still wait for the pointer to cross a window -edge (to prevent accidents). This option is +edge (to prevent accidents). +This option is particularly useful for people who like the press-drag-release method of sweeping out window sizes. .IP "\fBBorderColor\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 @@ -232,47 +266,62 @@ This variable specifies the default color of the border to be placed around all non-iconified windows, and may only be given within a \fBColor\fP, \fBGrayscale\fP or -\fBMonochrome\fP list. The optional \fIwincolorlist\fP specifies a list +\fBMonochrome\fP list. +The optional \fIwincolorlist\fP specifies a list of window and color name pairs for specifying particular border colors for -different types of windows. For example: -.EX 0 +different types of windows. +For example: +.RS 5 +.Ex 0 \fBBorderColor\fP "gray50" { "XTerm" "red" "xmh" "green" } -.EE +.Ee +.RE +.IP The default is "black". .IP "\fBBorderTileBackground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 This variable specifies the default background color in the gray pattern used in unhighlighted borders (only if \fBNoHighlight\fP hasn't been set), -and may only be given within a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The -optional \fIwincolorlist\fP allows per-window colors to be specified. +and may only be given within a +\fBColor\fP, +\fBGrayscale\fP or +\fBMonochrome\fP list. +The optional \fIwincolorlist\fP allows per-window colors to be specified. The default is "white". .IP "\fBBorderTileForeground\fP \fIstring\fP [{ \fIwincolorlist\fP }]" 8 This variable specifies the default foreground color in the gray pattern used in unhighlighted borders (only if \fBNoHighlight\fP hasn't been set), and may only be given within a -\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows -per-window colors to be specified. The default is "black". +\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +The optional \fIwincolorlist\fP allows +per-window colors to be specified. +The default is "black". .IP "\fBBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding all client window frames if \fBClientBorderWidth\fP has not been specified. This value is also used to set the border size of windows created by \fItwm\fP -(such as the icon manager). The default is 2. +(such as the icon manager). +The default is 2. .IP "\fBButtonIndent\fP \fIpixels\fP" 8 This variable specifies the amount by which titlebuttons should be -indented on all sides. Positive values cause the buttons to be smaller than -the window text and highlight area so that they stand out. Setting this +indented on all sides. +Positive values cause the buttons to be smaller than +the window text and highlight area so that they stand out. +Setting this and the \fBTitleButtonBorderWidth\fP variables to 0 makes titlebuttons be as -tall and wide as possible. The default is 1. +tall and wide as possible. +The default is 1. .IP "\fBClientBorderWidth\fP" 8 This variable indicates that border width of a window's frame should be set to the initial border width of the window, rather than to the value of \fBBorderWidth\fP. .IP "\fBColor\fP { \fIcolors-list\fP }" 8 This variable specifies a list of color assignments to be made if the default -display is capable of displaying more than simple black and white. The +display is capable of displaying more than simple black and white. +The \fIcolors-list\fP is made up of the following color variables and their values: \fBDefaultBackground\fP, \fBDefaultForeground\fP, @@ -299,81 +348,97 @@ allow per-window colors to be specified (see \fBBorderColor\fP for details): \fBIconManagerBackground\fP, and \fBIconManagerForeground\fP. For example: -.EX 0 +.RS 5 +.Ex 0 \fBColor\fP { MenuBackground "gray50" MenuForeground "blue" - BorderColor "red" { "XTerm" "yellow" } + BorderColor "red" { "XTerm" "yellow" } TitleForeground "yellow" TitleBackground "blue" } -.EE +.Ee +.RE +.IP All of these color variables may also be specified for the \fBMonochrome\fP variable, allowing the same initialization file to be used on both color and monochrome displays. .IP "\fBConstrainedMoveTime\fP \fImilliseconds\fP" 8 This variable specifies the length of time between button clicks needed to begin -a constrained move operation. Double clicking within this amount +a constrained move operation. +Double clicking within this amount of time when invoking \fBf.move\fP will cause the window to be moved only -in a horizontal or vertical direction. Setting this value to 0 will disable -constrained moves. The default is 400 milliseconds. +in a horizontal or vertical direction. +Setting this value to 0 will disable +constrained moves. +The default is 400 milliseconds. .IP "\fBCursors\fP { \fIcursor-list\fP }" 8 This variable specifies the glyphs that \fItwm\fP should use for various -pointer cursors. Each cursor +pointer cursors. +Each cursor may be defined either from the \fBcursor\fP font or from two bitmap files. Shapes from the \fBcursor\fP font may be specified directly as: -.EX 0 +.Ex 0 \fIcursorname\fP "\fIstring\fP" -.EE +.Ee +.IP where \fIcursorname\fP is one of the cursor names listed below, and \fIstring\fP is the name of a glyph as found in the file .I __projectroot__/include/X11/cursorfont.h -(without the ``XC_'' prefix). +(without the \*(``XC_\*('' prefix). If the cursor is to be defined from bitmap files, the following syntax is used instead: -.EX 0 +.Ex 0 \fIcursorname\fP "\fIimage\fP" "\fImask\fP" -.EE +.Ee +.IP The \fIimage\fP and \fImask\fP strings specify the names of files containing the glyph image and mask in \fIbitmap(__appmansuffix__)\fP form. The bitmap files are located in the same manner as icon bitmap files. The following example shows the default cursor definitions: -.EX 0 +.RS 5 +.Ex 0 \fBCursors\fP { Frame "top_left_arrow" Title "top_left_arrow" Icon "top_left_arrow" - IconMgr "top_left_arrow" + IconMgr "top_left_arrow" Move "fleur" Resize "fleur" Menu "sb_left_arrow" Button "hand2" Wait "watch" Select "dot" - Destroy "pirate" + Destroy "pirate" } -.EE +.Ee +.RE .IP "\fBDecorateTransients\fP" 8 This variable indicates that transient windows (those containing a -WM_TRANSIENT_FOR property) should have titlebars. By default, transients +WM_TRANSIENT_FOR property) should have titlebars. +By default, transients are not reparented. .IP "\fBDefaultBackground\fP \fIstring\fP" 8 This variable specifies the background color to be used for sizing and -information windows. The default is "white". +information windows. +The default is "white". .IP "\fBDefaultForeground\fP \fIstring\fP" 8 This variable specifies the foreground color to be used for sizing and -information windows. The default is "black". +information windows. +The default is "black". .IP "\fBDontIconifyByUnmapping\fP { \fIwin-list\fP }" 8 This variable specifies a list of windows that should not be iconified by simply unmapping the window (as would be the case if \fBIconifyByUnmapping\fP -had been set). This is frequently used to force some windows to be treated +had been set). +This is frequently used to force some windows to be treated as icons while other windows are handled by the icon manager. .IP "\fBDontMoveOff\fP" 8 This variable indicates that windows should not be allowed to be moved off the -screen. It can be overridden by the \fBf.forcemove\fP function. +screen. +It can be overridden by the \fBf.forcemove\fP function. .IP "\fBDontSqueezeTitle\fP [{ \fIwin-list\fP }] " 8 This variable indicates that titlebars should not be squeezed to their minimum size as described under \fBSqueezeTitle\fP below. @@ -384,49 +449,64 @@ This variable indicates that icon pixmaps specified in the \fBIcons\fP variable should override any client-supplied pixmaps. .IP "\fBFramePadding\fP \fIpixels\fP" 8 This variable specifies the distance between the titlebar decorations (the -button and text) and the window frame. The default is 2 pixels. +button and text) and the window frame. +The default is 2 pixels. .IP "\fBGrayscale\fP { \fIcolors\fP }" 8 This variable specifies a list of color assignments that should be made if -the screen has a GrayScale default visual. See the description of \fBColors\fP. +the screen has a GrayScale default visual. +See the description of \fBColors\fP. .IP "\fBIconBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the background color of icons, and may -only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +only be specified inside of a +\fBColor\fP, +\fBGrayscale\fP or +\fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that -per-window colors may be specified. See the \fBBorderColor\fP +per-window colors may be specified. +See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "white". .IP "\fBIconBorderColor\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the color of the border used for icon windows, and -may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +may only be specified inside of a +\fBColor\fP, +\fBGrayscale\fP or +\fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that -per-window colors may be specified. See the \fBBorderColor\fP +per-window colors may be specified. +See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "black". .IP "\fBIconBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding -icon windows. The default is 2. +icon windows. +The default is 2. .IP "\fBIconDirectory\fP \fIstring\fP" 8 This variable specifies the directory that should be searched if if a bitmap file cannot be found in any of the directories in the \fBbitmapFilePath\fP resource. .IP "\fBIconFont\fP \fIstring\fP" 8 This variable specifies the font to be used to display icon names within -icons. The default is "variable". +icons. +The default is "variable". .IP "\fBIconForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the foreground color to be used when displaying icons, and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that -per-window colors may be specified. See the \fBBorderColor\fP +per-window colors may be specified. +See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "black". .IP "\fBIconifyByUnmapping [{ \fIwin-list\fP }]\fP" 8 This variable indicates that windows should be iconified by being unmapped -without trying to map any icons. This assumes that the user will +without trying to map any icons. +This assumes that the user will remap the window through the icon manager, the \fBf.warpto\fP function, or the \fITwmWindows\fP menu. If the optional \fIwin-list\fP is provided, only those windows will be -iconified by simply unmapping. Windows that have both this and the +iconified by simply unmapping. +Windows that have both this and the \fBIconManagerDontShow\fP options set may not be accessible if no binding to the \fITwmWindows\fP menu is set in the user's startup file. .IP "\fBIconManagerBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 @@ -434,100 +514,128 @@ This variable specifies the background color to use for icon manager entries, and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that -per-window colors may be specified. See the \fBBorderColor\fP +per-window colors may be specified. +See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "white". .IP "\fBIconManagerDontShow\fP [{ \fIwin-list\fP }]" 8 This variable indicates that the icon manager should not display any -windows. If the optional \fIwin-list\fP is given, only those windows will -not be displayed. This variable is used to prevent windows that are rarely +windows. +If the optional \fIwin-list\fP is given, only those windows will +not be displayed. +This variable is used to prevent windows that are rarely iconified (such as \fIxclock\fP or \fIxload\fP) from taking up space in the icon manager. .IP "\fBIconManagerFont\fP \fIstring\fP" 8 This variable specifies the font to be used when displaying icon manager -entries. The default is "variable". +entries. +The default is "variable". .IP "\fBIconManagerForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the foreground color to be used when displaying icon manager entries, and may only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that -per-window colors may be specified. See the \fBBorderColor\fP +per-window colors may be specified. +See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "black". .IP "\fBIconManagerGeometry\fP \fIstring\fP [ \fIcolumns\fP ]" 8 -This variable specifies the geometry of the icon manager window. The +This variable specifies the geometry of the icon manager window. +The \fIstring\fP argument is standard geometry specification that indicates -the initial full size of the icon manager. The icon manager window is +the initial full size of the icon manager. +The icon manager window is then broken into \fIcolumns\fP pieces and scaled according to the number -of entries in the icon manager. Extra entries are wrapped to form -additional rows. The default number of columns is 1. +of entries in the icon manager. +Extra entries are wrapped to form +additional rows. +The default number of columns is 1. .IP "\fBIconManagerHighlight\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the border color to be used when highlighting the icon manager entry that currently has the focus, and can only be specified inside of a \fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwin-list\fP is a list of window names and colors so that -per-window colors may be specified. See the \fBBorderColor\fP +per-window colors may be specified. +See the \fBBorderColor\fP variable for a complete description of the \fIwin-list\fP. The default is "black". .IP "\fBIconManagers\fP { \fIiconmgr-list\fP }" 8 -This variable specifies a list of icon managers to create. Each item in the +This variable specifies a list of icon managers to create. +Each item in the \fIiconmgr-list\fP has the following format: -.EX 0 +.Ex 0 "\fIwinname\fP" ["\fIiconname\fP"] "\fIgeometry\fP" \fIcolumns\fP -.EE +.Ee +.IP where \fIwinname\fP is the name of the windows that should be put into this icon manager, \fIiconname\fP is the name of that icon manager window's icon, \fIgeometry\fP is a standard geometry specification, and \fIcolumns\fP is the number of columns in this icon manager as described in -\fBIconManagerGeometry\fP. For example: -.EX 0 +\fBIconManagerGeometry\fP. +For example: +.RS 5 +.Ex 0 \fBIconManagers\fP { - "XTerm" "=300x5+800+5" 5 + "XTerm" "=300x5+800+5" 5 "myhost" "=400x5+100+5" 2 } -.EE -Clients whose name or class is ``XTerm'' will have an entry created -in the ``XTerm'' icon manager. Clients whose name was ``myhost'' would -be put into the ``myhost'' icon manager. +.Ee +.RE +.IP +Clients whose name or class is \*(``XTerm\*('' will have an entry created +in the \*(``XTerm\*('' icon manager. +Clients whose name was \*(``myhost\*('' would +be put into the \*(``myhost\*('' icon manager. .IP "\fBIconManagerShow\fP { \fIwin-list\fP }" 8 This variable specifies a list of windows that should appear in the icon -manager. When used in conjunction with the \fBIconManagerDontShow\fP +manager. +When used in conjunction with the \fBIconManagerDontShow\fP variable, only the windows in this list will be shown in the icon manager. .IP "\fBIconRegion\fP \fIgeomstring\fP \fIvgrav hgrav gridwidth gridheight\fP" This variable specifies an area on the root window in which icons are placed -if no specific icon location is provided by the client. The \fIgeomstring\fP +if no specific icon location is provided by the client. +The \fIgeomstring\fP is a quoted string containing a standard geometry specification. If more than one \fBIconRegion\fP lines are given, icons will be put into the succeeding icon regions when the first is full. The \fIvgrav\fP argument should be either \fBNorth\fP or \fBSouth\fP and control and is used to control whether icons are first filled in from the -top or bottom of the icon region. Similarly, the \fIhgrav\fP argument should +top or bottom of the icon region. +Similarly, the \fIhgrav\fP argument should be either \fBEast\fP or \fBWest\fP and is used to control whether icons should -be filled in from left from the right. Icons are laid out within the region +be filled in from left from the right. +Icons are laid out within the region in a grid with cells \fIgridwidth\fP pixels wide and \fIgridheight\fP pixels high. .IP "\fBIcons\fP { \fIwin-list\fP }" 8 This variable specifies a list of window names and the bitmap filenames that -should be used as their icons. For example: -.EX 0 +should be used as their icons. +For example: +.RS 5 +.Ex 0 \fBIcons\fP { - "XTerm" "xterm.icon" + "XTerm" "xterm.icon" "xfd" "xfd_icon" } -.EE -Windows that match ``XTerm'' and would not be iconified by unmapping, and +.Ee +.RE +.IP +Windows that match \*(``XTerm\*('' and would not be iconified by unmapping, and would try to use -the icon bitmap in the file ``xterm.icon''. If \fBForceIcons\fP is +the icon bitmap in the file \*(``xterm.icon\*(''. +If \fBForceIcons\fP is specified, this bitmap will be used even if the client has requested its own icon pixmap. .IP "\fBInterpolateMenuColors\fP" 8 This variable indicates that menu entry colors should be interpolated between -entry specified colors. In the example below: -.EX 0 +entry specified colors. +In the example below: +.RS 5 +.Ex 0 \fBMenu\fP "mymenu" { "Title" ("black":"red") f.title @@ -537,153 +645,198 @@ entry specified colors. In the example below: "entry4" f.nop "entry5" ("red":"white") f.nop } -.EE -the foreground colors for ``entry1'' and ``entry2'' will be interpolated +.Ee +.RE +.IP +the foreground colors for +\*(``entry1\*('' and +\*(``entry2\*('' will be interpolated between black and white, and the background colors between red and green. -Similarly, the foreground for ``entry4'' will be half-way between white and -red, and the background will be half-way between green and white. +Similarly, the foreground for \*(``entry4\*('' +will be half-way between white and red, +and the background will be half-way between green and white. .IP "\fBMakeTitle\fP { \fIwin-list\fP }" 8 This variable specifies a list of windows on which a titlebar should be placed and is used to request titles on specific windows when \fBNoTitle\fP has been set. .IP "\fBMaxWindowSize\fP \fIstring\fP" 8 This variable specifies a geometry in which the width and height -give the maximum size for a given window. This is typically used to -restrict windows to the size of the screen. The default width is 32767 - -screen width. The default height is 32767 - screen height. +give the maximum size for a given window. +This is typically used to +restrict windows to the size of the screen. +The default width is 32767 - +screen width. +The default height is 32767 - screen height. .IP "\fBMenuBackground\fP \fIstring\fP" 8 This variable specifies the background color used for menus, and can only be specified inside of a -\fBColor\fP or \fBMonochrome\fP list. The default is "white". +\fBColor\fP or \fBMonochrome\fP list. +The default is "white". .IP "\fBMenuBorderColor\fP \fIstring\fP" 8 This variable specifies the color of the menu border and can only be specified inside of a -\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black". +\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +The default is "black". .IP "\fBMenuBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding -menu windows. The default is 2. +menu windows. +The default is 2. .IP "\fBMenuFont\fP \fIstring\fP" 8 -This variable specifies the font to use when displaying menus. The default +This variable specifies the font to use when displaying menus. +The default is "variable". .IP "\fBMenuForeground\fP \fIstring\fP" 8 This variable specifies the foreground color used for menus, and can only be specified inside of a -\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black". +\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +The default is "black". .IP "\fBMenuShadowColor\fP \fIstring\fP" 8 This variable specifies the color of the shadow behind pull-down menus and can only be specified inside of a -\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black". +\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +The default is "black". .IP "\fBMenuTitleBackground\fP \fIstring\fP" 8 This variable specifies the background color for \fBf.title\fP entries in menus, and can only be specified inside of a -\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "white". +\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. +The default is "white". .IP "\fBMenuTitleForeground\fP \fIstring\fP" 8 This variable specifies the foreground color for \fBf.title\fP entries in menus and can only be specified inside of a -\fBColor\fP or \fBMonochrome\fP list. The default is "black". +\fBColor\fP or \fBMonochrome\fP list. +The default is "black". .IP "\fBMonochrome\fP { \fIcolors\fP }" 8 This variable specifies a list of color assignments that should be made if -the screen has a depth of 1. See the description of \fBColors\fP. +the screen has a depth of 1. +See the description of \fBColors\fP. .IP "\fBMoveDelta\fP \fIpixels\fP" 8 This variable specifies the number of pixels the pointer -must move before the \fBf.move\fP function starts working. Also -see the \fBf.deltastop\fP function. The default is zero pixels. +must move before the \fBf.move\fP function starts working. +Also +see the \fBf.deltastop\fP function. +The default is zero pixels. .IP "\fBNoBackingStore\fP" 8 This variable indicates that \fItwm\fP's menus should not request backing -store to minimize repainting of menus. This is typically +store to minimize repainting of menus. +This is typically used with servers that can repaint faster than they can handle backing store. .IP "\fBNoCaseSensitive\fP" 8 This variable indicates that case should be ignored when sorting icon names -in an icon manager. This option is typically used with applications that +in an icon manager. +This option is typically used with applications that capitalize the first letter of their icon name. .IP "\fBNoDefaults\fP" 8 This variable indicates that \fItwm\fP should not supply the default -titlebuttons and bindings. This option should only be used if the startup +titlebuttons and bindings. +This option should only be used if the startup file contains a completely new set of bindings and definitions. .IP "\fBNoGrabServer\fP" 8 This variable indicates that \fItwm\fP should not grab the server when popping up menus and moving opaque windows. .IP "\fBNoHighlight\fP [{ \fIwin-list\fP }]" 8 This variable indicates that borders should not be highlighted to track the -location of the pointer. If the optional \fIwin-list\fP is given, highlighting +location of the pointer. +If the optional \fIwin-list\fP is given, highlighting will only be disabled for those windows. When the border is highlighted, it will -be drawn in the current \fBBorderColor\fP. When the border is not +be drawn in the current \fBBorderColor\fP. +When the border is not highlighted, it will be stippled with a gray pattern using the current \fBBorderTileForeground\fP and \fBBorderTileBackground\fP colors. .IP "\fBNoIconManagers\fP" 8 This variable indicates that no icon manager should be created. .IP "\fBNoMenuShadows\fP" 8 This variable indicates that menus should not have drop shadows drawn behind -them. This is typically used with slower servers since it speeds up menu +them. +This is typically used with slower servers since it speeds up menu drawing at the expense of making the menu slightly harder to read. .IP "\fBNoRaiseOnDeiconify\fP" 8 This variable indicates that windows that are deiconified should not be raised. .IP "\fBNoRaiseOnMove\fP" 8 -This variable indicates that windows should not be raised when moved. This +This variable indicates that windows should not be raised when moved. +This is typically used to allow windows to slide underneath each other. .IP "\fBNoRaiseOnResize\fP" 8 -This variable indicates that windows should not be raised when resized. This +This variable indicates that windows should not be raised when resized. +This is typically used to allow windows to be resized underneath each other. .IP "\fBNoRaiseOnWarp\fP" 8 This variable indicates that windows should not be raised when the pointer -is warped into them with the \fBf.warpto\fP function. If this option is set, +is warped into them with the \fBf.warpto\fP function. +If this option is set, warping to an occluded window may result in the pointer ending up in the occluding window instead the desired window (which causes unexpected behavior with \fBf.warpring\fP). .IP "\fBNoSaveUnders\fP" 8 This variable indicates that menus should not request save-unders to minimize -window repainting following menu selection. It is typically used with displays +window repainting following menu selection. +It is typically used with displays that can repaint faster than they can handle save-unders. .IP "\fBNoStackMode\fP [{ \fIwin-list\fP }]" 8 This variable indicates that client window requests to change stacking order -should be ignored. If the optional \fIwin-list\fP is given, only requests on -those windows will be ignored. This is typically used to prevent applications +should be ignored. +If the optional \fIwin-list\fP is given, only requests on +those windows will be ignored. +This is typically used to prevent applications from relentlessly popping themselves to the front of the window stack. .IP "\fBNoTitle\fP [{ \fIwin-list\fP }] " 8 -This variable indicates that windows should not have titlebars. If the +This variable indicates that windows should not have titlebars. +If the optional \fIwin-list\fP is given, only those windows will not have titlebars. \fBMakeTitle\fP may be used with this option to force titlebars to be put on specific windows. .IP "\fBNoTitleFocus\fP" 8 This variable indicates that \fItwm\fP should not set keyboard input focus to -each window as it is entered. Normally, \fItwm\fP sets the focus +each window as it is entered. +Normally, \fItwm\fP sets the focus so that focus and key events from the titlebar and -icon managers are delivered to the application. If the pointer is moved +icon managers are delivered to the application. +If the pointer is moved quickly and \fItwm\fP is slow to respond, input can be directed to the old -window instead of the new. This option is typically -used to prevent this ``input lag'' and to +window instead of the new. +This option is typically +used to prevent this \*(``input lag\*('' and to work around bugs in older applications that have problems with focus events. .IP "\fBNoTitleHighlight\fP [{ \fIwin-list\fP }]" 8 This variable indicates that the highlight area of the titlebar, which is used to indicate the window that currently has the input focus, should not -be displayed. If the optional \fIwin-list\fP is given, only those windows -will not have highlight areas. This and the \fBSqueezeTitle\fP options +be displayed. +If the optional \fIwin-list\fP is given, only those windows +will not have highlight areas. +This and the \fBSqueezeTitle\fP options can be set to substantially reduce the amount of screen space required by titlebars. .IP "\fBOpaqueMove\fP" 8 This variable indicates that the \fBf.move\fP function should actually move the window instead of just an outline so that the user can immediately see -what the window will look like in the new position. This option is typically +what the window will look like in the new position. +This option is typically used on fast displays (particularly if \fBNoGrabServer\fP is set). .IP "\fBPixmaps\fP { \fIpixmaps\fP }" 8 This variable specifies a list of pixmaps that define the appearance of various -images. Each entry is a keyword indicating the pixmap to set, followed by a -string giving the name of the bitmap file. The following pixmaps +images. +Each entry is a keyword indicating the pixmap to set, followed by a +string giving the name of the bitmap file. +The following pixmaps may be specified: -.EX 0 +.RS 5 +.Ex 0 \fBPixmaps\fP { TitleHighlight "gray1" } -.EE +.Ee +.RE +.IP The default for \fITitleHighlight\fP is to use an even stipple pattern. .IP "\fBPriority\fP \fIpriority\fP" 8 -This variable sets \fItwm\fP's priority. \fIpriority\fP should be an -unquoted, signed number (e.g. 999). This variable has an effect only +This variable sets \fItwm\fP's priority. +\fIpriority\fP should be an +unquoted, signed number (e.g., 999). +This variable has an effect only if the server supports the SYNC extension. .IP "\fBRandomPlacement\fP" 8 This variable indicates that windows with no specified geometry should @@ -691,7 +844,8 @@ be placed in a pseudo-random location instead of having the user drag out an outline. .IP "\fBResizeFont\fP \fIstring\fP" 8 This variable specifies the font to be used for in the dimensions window when -resizing windows. The default is "fixed". +resizing windows. +The default is "fixed". .IP "\fBRestartPreviousState\fP" 8 This variable indicates that \fItwm\fP should attempt to use the WM_STATE property on client windows @@ -700,14 +854,17 @@ This is typically used to try to regenerate the state that the screen was in before the previous window manager was shutdown. .IP "\fBSaveColor\fP { \fIcolors-list\fP }" 8 This variable indicates a list of color assignments to be stored as pixel -values in the root window property _MIT_PRIORITY_COLORS. Clients may elect -to preserve these values when installing their own colormap. Note that +values in the root window property _MIT_PRIORITY_COLORS. +Clients may elect +to preserve these values when installing their own colormap. +Note that use of this mechanism is a way an for application to avoid the "technicolor" problem, whereby useful screen objects such as window borders and titlebars disappear when a programs custom colors are installed by the window manager. For example: -.EX 0 +.RS 5 +.Ex 0 \fBSaveColor\fP { BorderColor @@ -717,12 +874,15 @@ For example: "green" "blue" } -.EE +.Ee +.RE +.IP This would place on the root window 3 pixel values for borders and titlebars, as well as the three color strings, all taken from the default colormap. .IP "\fBShowIconManager\fP" 8 This variable indicates that the icon manager window should be displayed when -\fItwm\fP is started. It can always be brought up using the +\fItwm\fP is started. +It can always be brought up using the \fBf.showiconmgr\fP function. .IP "\fBSortIconManager\fP" 8 This variable indicates that entries in the icon manager should be @@ -734,34 +894,45 @@ extension to make titlebars occupy only as much screen space as they need, rather than extending all the way across the top of the window. The optional \fIsqueeze-list\fP may be used to control the location of the squeezed titlebar along the -top of the window. It contains entries of the form: -.EX 0 +top of the window. +It contains entries of the form: +.Ex 0 "\fIname\fP" \fIjustification\fP \fInum\fP \fIdenom\fP -.EE +.Ee +.IP where \fIname\fP is a window name, \fIjustification\fP is either \fBleft\fP, \fBcenter\fP, or \fBright\fP, and \fInum\fP and \fIdenom\fP are numbers specifying a ratio giving the relative position about which -the titlebar is justified. The ratio is measured from left to right if -the numerator is positive, and right to left if negative. A denominator -of 0 indicates that the numerator should be measured in pixels. For +the titlebar is justified. +The ratio is measured from left to right if +the numerator is positive, and right to left if negative. +A denominator +of 0 indicates that the numerator should be measured in pixels. +For convenience, the ratio 0/0 is the same as 1/2 for \fBcenter\fP and -1/1 -for \fBright\fP. For example: -.EX 0 +for \fBright\fP. +For example: +.RS 5 +.Ex 0 \fBSqueezeTitle\fP { - "XTerm" left 0 0 + "XTerm" left 0 0 "xterm1" left 1 3 "xterm2" left 2 3 "oclock" center 0 0 - "emacs" right 0 0 + "emacs" right 0 0 } -.EE +.Ee +.RE +.IP The \fBDontSqueezeTitle\fP list can be used to turn off squeezing on certain titles. .IP "\fBStartIconified\fP [{ \fIwin-list\fP }] " 8 This variable indicates that client windows should initially be left as -icons until explicitly deiconified by the user. If the optional \fIwin-list\fP -is given, only those windows will be started iconic. This is useful for +icons until explicitly deiconified by the user. +If the optional \fIwin-list\fP +is given, only those windows will be started iconic. +This is useful for programs that do not support an \fI-iconic\fP command line option or resource. .IP "\fBTitleBackground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 @@ -773,12 +944,14 @@ per-window colors may be specified. The default is "white". .IP "\fBTitleButtonBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding -titlebuttons. This is typically set to 0 to allow titlebuttons to take up as +titlebuttons. +This is typically set to 0 to allow titlebuttons to take up as much space as possible and to not have a border. The default is 1. .IP "\fBTitleFont\fP \fIstring\fP" 8 This variable specifies the font to be used for displaying window names in -titlebars. The default is "variable". +titlebars. +The default is "variable". .IP "\fBTitleForeground\fP \fIstring\fP [{ \fIwin-list\fP }]" 8 This variable specifies the foreground color used in titlebars, and may only be specified inside of a @@ -788,10 +961,12 @@ per-window colors may be specified. The default is "black". .IP "\fBTitlePadding\fP \fIpixels\fP" 8 This variable specifies the distance between the various buttons, text, and -highlight areas in the titlebar. The default is 8 pixels. +highlight areas in the titlebar. +The default is 8 pixels. .IP "\fBUnknownIcon\fP \fIstring\fP" 8 This variable specifies the filename of a bitmap file to be -used as the default icon. This bitmap will be used as the icon of all +used as the default icon. +This bitmap will be used as the icon of all clients which do not provide an icon bitmap and are not listed in the \fBIcons\fP list. .IP "\fBUsePPosition\fP \fIstring\fP" 8 @@ -805,78 +980,95 @@ should ignore the program-supplied position, \fB"on"\fP indicating that the position should be used, and \fB"non-zero"\fP indicating that the position should used if -it is other than (0,0). The latter option is for working around a bug in +it is other than (0,0). +The latter option is for working around a bug in older toolkits. .IP "\fBWarpCursor\fP [{ \fIwin-list\fP }]" 8 This variable indicates that the pointer should be warped into windows when -they are deiconified. If the optional \fIwin-list\fP is given, the pointer +they are deiconified. +If the optional \fIwin-list\fP is given, the pointer will only be warped when those windows are deiconified. .IP "\fBWindowRing\fP { \fIwin-list\fP }" 8 This variable specifies a list of windows along which the \fBf.warpring\fP function cycles. .IP "\fBWarpUnmapped\fP" 8 This variable indicates that the \fBf.warpto\fP function should deiconify -any iconified windows it encounters. This is typically used to make a key +any iconified windows it encounters. +This is typically used to make a key binding that will pop a particular window (such as \fIxmh\fP), no matter -where it is. The default is for \fBf.warpto\fP to ignore iconified windows. +where it is. +The default is for \fBf.warpto\fP to ignore iconified windows. .IP "\fBXorValue\fP \fInumber\fP" 8 This variable specifies the value to use when drawing window outlines for -moving and resizing. This should be set to a value that will result in a +moving and resizing. +This should be set to a value that will result in a variety of of distinguishable colors when exclusive-or'ed with the contents of the -user's typical screen. Setting this variable to 1 often gives nice results -if adjacent colors in the default colormap are distinct. By default, +user's typical screen. +Setting this variable to 1 often gives nice results +if adjacent colors in the default colormap are distinct. +By default, \fItwm\fP will attempt to cause temporary lines to appear at the opposite end of the colormap from the graphics. .IP "\fBZoom\fP [ \fIcount\fP ]" 8 This variable indicates that outlines suggesting movement of a window to and from its iconified state should be displayed whenever a window is -iconified or deiconified. The optional \fIcount\fP argument specifies the -number of outlines to be drawn. The default count is 8. +iconified or deiconified. +The optional \fIcount\fP argument specifies the +number of outlines to be drawn. +The default count is 8. .PP The following variables must be set after the fonts have been assigned, so it is usually best to put them at the end of the variables or beginning of the bindings sections: .IP "\fBDefaultFunction\fP \fIfunction\fP" 8 This variable specifies the function to be executed when a key or button -event is received for which no binding is provided. This is typically +event is received for which no binding is provided. +This is typically bound to \fBf.nop\fP, \fBf.beep\fP, or a menu containing window operations. .IP "\fBWindowFunction\fP \fIfunction\fP" 8 This variable specifies the function to execute when a window is selected -from the \fBTwmWindows\fP menu. If this variable is not set, the window +from the \fBTwmWindows\fP menu. +If this variable is not set, the window will be deiconified and raised. .SH BINDINGS .PP After the desired variables have been set, functions may be attached -titlebuttons and key and pointer buttons. Titlebuttons may be added +titlebuttons and key and pointer buttons. +Titlebuttons may be added from the left or right side and appear in the titlebar from left-to-right according to the -order in which they are specified. Key and pointer button +order in which they are specified. +Key and pointer button bindings may be given in any order. .PP Titlebuttons specifications must include the name of the pixmap to use in the button box and the function to be invoked when a pointer button is pressed within them: -.EX 0 -\fBLeftTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP -.EE +.Ex 0 +\fBLeftTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP +.Ee +.LP or -.EX 0 -\fBRightTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP -.EE +.Ex 0 +\fBRightTitleButton\fP "\fIbitmapname\fP" = \fIfunction\fP +.Ee +.LP The \fIbitmapname\fP may refer to one of the built-in bitmaps (which are scaled to match \fBTitleFont\fP) by using the appropriate colon-prefixed name described above. .PP Key and pointer button specifications must give the modifiers that must be pressed, over which parts of the screen the pointer must be, and what -function is to be invoked. Keys are given as strings containing the +function is to be invoked. +Keys are given as strings containing the appropriate keysym name; buttons are given as the keywords \fBButton1\fP-\fBButton5\fP: -.EX 0 -"FP1" = \fImodlist\fP : \fIcontext\fP : \fIfunction\fP +.Ex 0 +"FP1" = \fImodlist\fP : \fIcontext\fP : \fIfunction\fP \fBButton1\fP = \fImodlist\fP : \fIcontext\fP : \fIfunction\fP -.EE +.Ee +.LP The \fImodlist\fP is any combination of the modifier names \fBshift\fP, \fBcontrol\fP, \fBlock\fP, \fBmeta\fP, \fBmod1\fP, \fBmod2\fP, \fBmod3\fP, \fBmod4\fP, or \fBmod5\fP (which may be abbreviated as @@ -890,10 +1082,12 @@ Similarly, the \fIcontext\fP is any combination of \fBframe\fP, \fBiconmgr\fP, their first letters (\fBiconmgr\fP abbreviation is \fBm\fP), or \fBall\fP, -separated by a vertical bar. The \fIfunction\fP is any of the \fBf.\fP -keywords described below. For example, the default startup +separated by a vertical bar. +The \fIfunction\fP is any of the \fBf.\fP +keywords described below. +For example, the default startup file contains the following bindings: -.EX 0 +.Ex 0 Button1 = : root : f.menu "TwmWindows" Button1 = m : window | icon : f.function "move-or-lower" Button2 = m : window | icon : f.iconify @@ -904,10 +1098,11 @@ Button1 = : icon : f.function "move-or-iconify" Button2 = : icon : f.iconify Button1 = : iconmgr : f.iconify Button2 = : iconmgr : f.iconify -.EE +.Ee +.LP A user who wanted to be able to manipulate windows from the keyboard could use the following bindings: -.EX 0 +.Ex 0 "F1" = : all : f.iconify "F2" = : all : f.raiselower "F3" = : all : f.warpring "next" @@ -920,25 +1115,30 @@ use the following bindings: "Right" = m | s : all : f.forwiconmgr "Up" = m : all : f.upiconmgr "Down" = m | s : all : f.downiconmgr -.EE +.Ee +.LP \fITwm\fP provides many more window manipulation primitives than can be -conveniently stored in a titlebar, menu, or set of key bindings. Although +conveniently stored in a titlebar, menu, or set of key bindings. +Although a small set of defaults are supplied (unless the \fBNoDefaults\fP is specified), most users will want to have their most common operations -bound to key and button strokes. To do this, \fItwm\fP associates names +bound to key and button strokes. +To do this, \fItwm\fP associates names with each of the primitives and provides \fIuser-defined functions\fP for building higher level primitives and \fImenus\fP for interactively selecting among groups of functions. .PP User-defined functions contain the name by which they are referenced in -calls to \fBf.function\fP and a list of other functions to execute. For +calls to \fBf.function\fP and a list of other functions to execute. +For example: -.EX 0 +.Ex 0 Function "move-or-lower" { f.move f.deltastop f.lower } Function "move-or-raise" { f.move f.deltastop f.raise } Function "move-or-iconify" { f.move f.deltastop f.iconify } Function "restore-colormap" { f.colormap "default" f.lower } -.EE +.Ee +.LP The function name must be used in \fBf.function\fP exactly as it appears in the function specification. .PP @@ -953,7 +1153,8 @@ This is an abbreviation for \fBf.exec\fP \fIstring\fP. .\"This is an abbreviation for \fBf.cut\fP \fIstring\fP. .IP "\fBf.autoraise\fP" 8 This function toggles whether or not the selected window is raised whenever -entered by the pointer. See the description of the variable \fBAutoRaise\fP. +entered by the pointer. +See the description of the variable \fBAutoRaise\fP. .IP "\fBf.backiconmgr\fI" 8 This function warps the pointer to the previous column in the current icon manager, wrapping back to the previous row if necessary. @@ -969,11 +1170,14 @@ This function raises the bottom-most window that is occluded by another window. .IP "\fBf.colormap\fP \fIstring\fP" 8 This function rotates the colormaps (obtained from the WM_COLORMAP_WINDOWS property on the window) that \fItwm\fP will display when the pointer -is in this window. The argument \fIstring\fP may have one of the following -values: \fB"next"\fP, \fB"prev"\fP, and \fB"default"\fP. It should be noted +is in this window. +The argument \fIstring\fP may have one of the following +values: \fB"next"\fP, \fB"prev"\fP, and \fB"default"\fP. +It should be noted here that in general, the installed colormap is determined by keyboard focus. A pointer driven keyboard focus will install a private colormap upon entry -of the window owning the colormap. Using the click to type model, private +of the window owning the colormap. +Using the click to type model, private colormaps will not be installed until the user presses a mouse button on the target window. .\"OBSOLETE - should go away and use a clipboard. @@ -984,25 +1188,33 @@ the target window. .\"This function reads the file indicated by the contents of the CUT_BUFFER0 .\"window property and replaces the cut buffer. .IP "\fBf.deiconify\fP" 8 -This function deiconifies the selected window. If the window is not an icon, +This function deiconifies the selected window. +If the window is not an icon, this function does nothing. .IP "\fBf.delete\fP" 8 This function sends the WM_DELETE_WINDOW message to the selected window if the client application has requested it through the WM_PROTOCOLS window -property. The application is supposed to respond to the message by removing -the indicated window. If the window has not requested +property. +The application is supposed to respond to the message by removing +the indicated window. +If the window has not requested WM_DELETE_WINDOW messages, the keyboard bell will be rung indicating that -the user should choose an alternative method. Note this is very different -from f.destroy. The intent here is to delete a single window, not +the user should choose an alternative method. +Note this is very different +from \fBf.destroy\fP. +The intent here is to delete a single window, not necessarily the entire application. .IP "\fBf.deltastop\fP" 8 This function allows a user-defined function to be aborted if the pointer has -been moved more than \fIMoveDelta\fP pixels. See the example definition +been moved more than \fIMoveDelta\fP pixels. +See the example definition given for \fBFunction "move-or-raise"\fP at the beginning of the section. .IP "\fBf.destroy\fP" 8 This function instructs the X server to close the display connection of the -client that created the selected window. This should only be used as a last -resort for shutting down runaway clients. See also f.delete. +client that created the selected window. +This should only be used as a last +resort for shutting down runaway clients. +See also \fBf.delete\fP. .IP "\fBf.downiconmgr\fI" 8 This function warps the pointer to the next row in the current icon manger, wrapping to the beginning of the next column if necessary. @@ -1047,7 +1259,8 @@ This function iconifies or deiconifies the selected window or icon, respectively. .IP "\fBf.identify\fP" 8 This function displays a summary of the name and geometry of the -selected window. If the server supports the SYNC extension, the priority +selected window. +If the server supports the SYNC extension, the priority of the client owning the window is also displayed. Clicking the pointer or pressing a key in the window will dismiss it. @@ -1065,7 +1278,8 @@ Cascaded menus may be built by nesting calls to \fBf.menu\fP. .IP "\fBf.move\fP" 8 This function drags an outline of the selected window (or the window itself if the \fBOpaqueMove\fP variable is set) until the invoking pointer button -is released. Double clicking within the number of milliseconds given by +is released. +Double clicking within the number of milliseconds given by \fBConstrainedMoveTime\fP warps the pointer to the center of the window and constrains the move to be either horizontal or vertical depending on which @@ -1084,10 +1298,12 @@ windows on the current or preceding screens. .IP "\fBf.priority\fP \fIstring\fP" 8 This function sets the priority of the client owning the selected window to the numeric value of the argument \fIstring\fP, which should be a signed -integer in double quotes (e.g. "999" ). This function has an effect only +integer in double quotes (e.g., "999" ). +This function has an effect only if the server supports the SYNC extension. .IP "\fBf.quit\fP" 8 -This function causes \fItwm\fP to restore the window's borders and exit. If +This function causes \fItwm\fP to restore the window's borders and exit. +If \fItwm\fP is the first client invoked from \fIxdm\fP, this will result in a server reset. .IP "\fBf.raise\fP" 8 @@ -1098,9 +1314,11 @@ it is occluded by any windows, otherwise the window will be lowered. .IP "\fBf.refresh\fP" 8 This function causes all windows to be refreshed. .IP "\fBf.resize\fP" 8 -This function displays an outline of the selected window. Crossing a border +This function displays an outline of the selected window. +Crossing a border (or setting \fBAutoRelativeResize\fP) will cause the outline to begin to -rubber band until the invoking button is released. To abort a resize, +rubber band until the invoking button is released. +To abort a resize, press another button before releasing the first button. .IP "\fBf.restart\fP" 8 This function kills and restarts \fItwm\fP. @@ -1115,9 +1333,11 @@ This variable is similar to the \fBf.bottomzoom\fP function except that the selected window is only resized to the right half of the display. .IP "\fBf.saveyourself\fP" 8 This function sends a WM_SAVEYOURSELF message to the selected window if it -has requested the message in its WM_PROTOCOLS window property. Clients that +has requested the message in its WM_PROTOCOLS window property. +Clients that accept this message are supposed to checkpoint all state associated with the -window and update the WM_COMMAND property as specified in the ICCCM. If +window and update the WM_COMMAND property as specified in the ICCCM. +If the selected window has not selected for this message, the keyboard bell will be rung. .IP "\fBf.showiconmgr\fP" 8 @@ -1132,7 +1352,8 @@ See the variable \fBSortIconManager\fP. .\"function is intended to be used only to re-build pull-down menus. None .\"of the \fItwm\fP variables are changed. .IP "\fBf.title\fP" 8 -This function provides a centered, unselectable item in a menu definition. It +This function provides a centered, unselectable item in a menu definition. +It should not be used in any other context. .IP "\fBf.topzoom\fP" 8 This variable is similar to the \fBf.bottomzoom\fP function except that @@ -1142,7 +1363,8 @@ the selected window is only resized to the top half of the display. .\"function is exactly like the \fBf.source\fP function without having to .\"specify the filename. .IP "\fBf.unfocus\fP" 8 -This function resets the focus back to pointer-driven. This should be used +This function resets the focus back to pointer-driven. +This should be used when a focused window is no longer desired. .IP "\fBf.upiconmgr\fI" 8 This function warps the pointer to the previous row in the current icon @@ -1161,16 +1383,19 @@ by the argument \fIstring\fP, which may be \fB"next"\fP or \fB"prev"\fP) specified in the \fBWindowRing\fP variable. .IP "\fBf.warpto\fP \fIstring\fP" 8 This function warps the pointer to the window which has a name or class -that matches \fIstring\fP. If the window is iconified, it will be deiconified +that matches \fIstring\fP. +If the window is iconified, it will be deiconified if the variable \fBWarpUnmapped\fP is set or else ignored. .IP "\fBf.warptoiconmgr\fP \fIstring\fP" 8 This function warps the pointer to the icon manager entry associated with the window containing the pointer in the icon manager -specified by the argument \fIstring\fP. If \fIstring\fP is empty (i.e. ""), +specified by the argument \fIstring\fP. +If \fIstring\fP is empty (i.e., ""), the current icon manager is chosen. .IP "\fBf.warptoscreen\fP \fIstring\fP" 8 This function warps the pointer to the screen specified by the -argument \fIstring\fP. \fIString\fP may be a number (e.g. \fB"0"\fP or +argument \fIstring\fP. +\fIString\fP may be a number (e.g., \fB"0"\fP or \fB"1"\fP), the word \fB"next"\fP (indicating the current screen plus 1, skipping over any unmanaged screens), the word \fB"back"\fP (indicating the current screen minus 1, skipping over @@ -1186,12 +1411,13 @@ the only the height of the selected window is changed. .PP Functions may be grouped and interactively selected using pop-up (when bound to a pointer button) or pull-down (when associated -with a titlebutton) menus. Each menu specification contains the name of the +with a titlebutton) menus. +Each menu specification contains the name of the menu as it will be referred to by \fBf.menu\fP, optional default foreground and background colors, the list of item names and the functions they should invoke, and optional foreground and background colors for individual items: -.EX 0 +.Ex 0 \fBMenu\fP "\fImenuname\fP" [ ("\fIdeffore\fP":"\fIdefback\fP") ] { \fIstring1\fP [ ("\fIfore1\fP":"\fIbackn\fP")] \fIfunction1\fP @@ -1201,7 +1427,7 @@ individual items: . \fIstringN\fP [ ("\fIforeN\fP":"\fIbackN\fP")] \fIfunctionN\fP } -.EE +.Ee .PP The \fImenuname\fP is case-sensitive. The optional \fIdeffore\fP and \fIdefback\fP arguments specify the foreground @@ -1211,29 +1437,36 @@ The \fIstring\fP portion of each menu entry will be the text which will appear in the menu. The optional \fIfore\fP and \fIback\fP arguments specify the foreground and background colors of the menu entry when the pointer is not in -the entry. These colors will only be used on a color display. The +the entry. +These colors will only be used on a color display. +The default is to use the colors specified by the \fBMenuForeground\fP and \fBMenuBackground\fP variables. The \fIfunction\fP portion of the menu entry is one of the functions, including any user-defined functions, or additional menus. .PP There is a special menu named \fBTwmWindows\fP which contains the names of -all of the client and \fItwm\fP-supplied windows. Selecting an entry will +all of the client and \fItwm\fP-supplied windows. +Selecting an entry will cause the -\fBWindowFunction\fP to be executed on that window. If \fBWindowFunction\fP +\fBWindowFunction\fP to be executed on that window. +If \fBWindowFunction\fP hasn't been set, the window will be deiconified and raised. .SH ICONS \fITwm\fP supports several different ways of manipulating iconified windows. The common pixmap-and-text style may be laid out by hand or automatically -arranged as described by the \fBIconRegion\fP variable. In addition, a +arranged as described by the \fBIconRegion\fP variable. +In addition, a terse grid of icon names, called an icon manager, provides a more efficient use of screen space as well as the ability to navigate among windows from the keyboard. .PP An icon manager is a window that contains names of selected or all -windows currently on the display. In addition to the window name, +windows currently on the display. +In addition to the window name, a small button using the default iconify symbol will be displayed to the -left of the name when the window is iconified. By default, clicking on an +left of the name when the window is iconified. +By default, clicking on an entry in the icon manager performs \fBf.iconify\fP. To change the actions taken in the icon manager, use the the \fBiconmgr\fP context when specifying button and keyboard bindings. @@ -1267,14 +1500,18 @@ they may be lost if they are iconified and no bindings to .fi .SH "ENVIRONMENT VARIABLES" .IP "DISPLAY" 8 -This variable is used to determine which X server to use. It is also set +This variable is used to determine which X server to use. +It is also set during \fBf.exec\fP so that programs come up on the proper screen. .IP "HOME" 8 This variable is used as the prefix for files that begin with a tilde and for locating the \fItwm\fP startup file. .SH "SEE ALSO" .PP -X(__miscmansuffix__), Xserver(__appmansuffix__), xdm(__appmansuffix__), xrdb(__appmansuffix__) +X(__miscmansuffix__), +Xserver(__appmansuffix__), +xdm(__appmansuffix__), +xrdb(__appmansuffix__) .SH AUTHORS Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; diff --git a/src/Makefile.am b/src/Makefile.am index ba9c7b9..4bafe55 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,8 +32,8 @@ AM_CPPFLAGS = \ -DXORG_RELEASE=\"Release\ $(VERSION)\" \ -DSYSTEM_INIT_FILE=\"${rcdir}/system.twmrc\" -AM_CFLAGS = $(TWM_CFLAGS) -twm_LDADD = $(TWM_LIBS) +AM_CFLAGS = $(TWM_CFLAGS) $(XRANDR_CFLAGS) +twm_LDADD = $(TWM_LIBS) $(XRANDR_LIBS) twm_SOURCES = \ add_window.c \ @@ -77,8 +77,8 @@ deftwmrc.c: system.twmrc echo ' * twm bindings file system.twmrc by the twm Makefile.' >>$@ ; \ echo ' */' >>$@ ; \ echo '' >>$@ ; \ - echo 'unsigned char *defTwmrc[] = {' >>$@ ; \ + echo 'const unsigned char *defTwmrc[] = {' >>$@ ; \ $(SED) -f ${srcdir}/deftwmrc.sed < ${srcdir}/system.twmrc >>$@ ; \ - echo ' (unsigned char *) 0 };' >>$@ + echo ' (const unsigned char *) 0 };' >>$@ EXTRA_DIST = deftwmrc.sed siconify.bm diff --git a/src/add_window.c b/src/add_window.c index 99481b0..acd685f 100644 --- a/src/add_window.c +++ b/src/add_window.c @@ -179,7 +179,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } tmp_win->w = w; tmp_win->zoomed = ZOOM_NONE; - tmp_win->iconmgr = iconm; + tmp_win->iconmgr = (short) iconm; tmp_win->iconmgrp = iconp; tmp_win->cmaps.number_cwins = 0; @@ -266,7 +266,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) * fields in the WM_NORMAL_HINTS property. */ - tmp_win->transient = Transient(tmp_win->w, &tmp_win->transientfor); + tmp_win->transient = (short)Transient(tmp_win->w, &tmp_win->transientfor); tmp_win->nameChanged = 0; if (tmp_win->class.res_name == NULL) @@ -275,7 +275,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->class.res_class = NoName; tmp_win->full_name = strdup(tmp_win->name); - namelen = strlen (tmp_win->name); + namelen = (int)strlen (tmp_win->name); tmp_win->highlight = Scr->Highlight && (!(short)(long) LookInList(Scr->NoHighlight, tmp_win->full_name, @@ -479,7 +479,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->name, namelen)); height = Scr->SizeFont.height + SIZE_VINDENT * 2; - XResizeWindow (dpy, Scr->SizeWindow, width + SIZE_HINDENT, height); + XResizeWindow (dpy, Scr->SizeWindow, (unsigned)(width + SIZE_HINDENT), (unsigned)height); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); @@ -585,8 +585,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) Scr->SizeStringOffset = width + MyFont_TextWidth(&Scr->SizeFont, ": ", 2); - XResizeWindow (dpy, Scr->SizeWindow, Scr->SizeStringOffset + - Scr->SizeStringWidth, height); + XResizeWindow (dpy, Scr->SizeWindow, (unsigned)(Scr->SizeStringOffset + + Scr->SizeStringWidth), (unsigned)height); MyFont_DrawImageString (dpy, Scr->SizeWindow, &Scr->SizeFont, Scr->NormalGC, width, SIZE_VINDENT + Scr->SizeFont.ascent, @@ -658,8 +658,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) } else if (event.xbutton.button == Button3) { - int maxw = Scr->MyDisplayWidth - AddingX - bw2; - int maxh = Scr->MyDisplayHeight - AddingY - bw2; + int maxw = Scr->MyDisplayWidth - AddingX; + int maxh = Scr->MyDisplayHeight - AddingY; /* * Make window go to bottom of screen, and clip to right edge. @@ -669,6 +669,8 @@ AddWindow(Window w, int iconm, IconMgr *iconp) if (AddingW > maxw) AddingW = maxw; AddingH = maxh; + AddingW -= bw2; + AddingH -= bw2; ConstrainSize (tmp_win, &AddingW, &AddingH); /* w/o borders */ AddingW += bw2; AddingH += bw2; @@ -843,7 +845,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root, gray_bits, gray_width, gray_height, tmp_win->border_tile.fore, tmp_win->border_tile.back, - Scr->d_depth); + (unsigned)Scr->d_depth); SetBorder (tmp_win, False); } @@ -882,7 +884,7 @@ AddWindow(Window w, int iconm, IconMgr *iconp) XShapeQueryExtents (dpy, tmp_win->w, &boundingShaped, &xws, &yws, &wws, &hws, &clipShaped, &xbs, &ybs, &wbs, &hbs); - tmp_win->wShaped = boundingShaped; + tmp_win->wShaped = (short)boundingShaped; } if (!tmp_win->iconmgr) @@ -913,27 +915,27 @@ AddWindow(Window w, int iconm, IconMgr *iconp) (void) AddIconManager(tmp_win); - XSaveContext(dpy, tmp_win->w, TwmContext, (caddr_t) tmp_win); - XSaveContext(dpy, tmp_win->w, ScreenContext, (caddr_t) Scr); - XSaveContext(dpy, tmp_win->frame, TwmContext, (caddr_t) tmp_win); - XSaveContext(dpy, tmp_win->frame, ScreenContext, (caddr_t) Scr); + XSaveContext(dpy, tmp_win->w, TwmContext, (XPointer) tmp_win); + XSaveContext(dpy, tmp_win->w, ScreenContext, (XPointer) Scr); + XSaveContext(dpy, tmp_win->frame, TwmContext, (XPointer) tmp_win); + XSaveContext(dpy, tmp_win->frame, ScreenContext, (XPointer) Scr); if (tmp_win->title_height) { int i; int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; - XSaveContext(dpy, tmp_win->title_w, TwmContext, (caddr_t) tmp_win); - XSaveContext(dpy, tmp_win->title_w, ScreenContext, (caddr_t) Scr); + XSaveContext(dpy, tmp_win->title_w, TwmContext, (XPointer) tmp_win); + XSaveContext(dpy, tmp_win->title_w, ScreenContext, (XPointer) Scr); for (i = 0; i < nb; i++) { XSaveContext(dpy, tmp_win->titlebuttons[i].window, TwmContext, - (caddr_t) tmp_win); + (XPointer) tmp_win); XSaveContext(dpy, tmp_win->titlebuttons[i].window, ScreenContext, - (caddr_t) Scr); + (XPointer) Scr); } if (tmp_win->hilite_w) { - XSaveContext(dpy, tmp_win->hilite_w, TwmContext, (caddr_t)tmp_win); - XSaveContext(dpy, tmp_win->hilite_w, ScreenContext, (caddr_t)Scr); + XSaveContext(dpy, tmp_win->hilite_w, TwmContext, (XPointer)tmp_win); + XSaveContext(dpy, tmp_win->hilite_w, ScreenContext, (XPointer)Scr); } } @@ -1023,7 +1025,7 @@ GrabButtons(TwmWindow *tmp_win) /* twm used to do this grab on the application main window, * tmp_win->w . This was not ICCCM complient and was changed. */ - XGrabButton(dpy, i, j, tmp_win->frame, + XGrabButton(dpy, (unsigned)i, (unsigned)j, tmp_win->frame, True, ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, Scr->FrameCursor); @@ -1048,29 +1050,29 @@ GrabKeys(TwmWindow *tmp_win) switch (tmp->cont) { case C_WINDOW: - XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True, + XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->w, True, GrabModeAsync, GrabModeAsync); break; case C_ICON: if (tmp_win->icon_w) - XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->icon_w, True, + XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->icon_w, True, GrabModeAsync, GrabModeAsync); case C_TITLE: if (tmp_win->title_w) - XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->title_w, True, + XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->title_w, True, GrabModeAsync, GrabModeAsync); break; case C_NAME: - XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->w, True, + XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->w, True, GrabModeAsync, GrabModeAsync); if (tmp_win->icon_w) - XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->icon_w, True, + XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->icon_w, True, GrabModeAsync, GrabModeAsync); if (tmp_win->title_w) - XGrabKey(dpy, tmp->keycode, tmp->mods, tmp_win->title_w, True, + XGrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, tmp_win->title_w, True, GrabModeAsync, GrabModeAsync); break; /* @@ -1087,7 +1089,7 @@ GrabKeys(TwmWindow *tmp_win) { for (p = &Scr->iconmgr; p != NULL; p = p->next) { - XUngrabKey(dpy, tmp->keycode, tmp->mods, p->twm_win->w); + XUngrabKey(dpy, tmp->keycode, (unsigned)tmp->mods, p->twm_win->w); } } } @@ -1125,8 +1127,8 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) } if (Scr->hilitePm) { pm = XCreatePixmap (dpy, tmp_win->title_w, - Scr->hilite_pm_width, Scr->hilite_pm_height, - Scr->d_depth); + (unsigned)Scr->hilite_pm_width, (unsigned)Scr->hilite_pm_height, + (unsigned)Scr->d_depth); gcv.foreground = tmp_win->title.fore; gcv.background = tmp_win->title.back; gcv.graphics_exposures = False; @@ -1135,7 +1137,7 @@ static Window CreateHighlightWindow (TwmWindow *tmp_win) &gcv); if (gc) { XCopyPlane (dpy, Scr->hilitePm, pm, gc, 0, 0, - Scr->hilite_pm_width, Scr->hilite_pm_height, + (unsigned)Scr->hilite_pm_width, (unsigned)Scr->hilite_pm_height, 0, 0, 1); XFreeGC (dpy, gc); } else { @@ -1287,14 +1289,14 @@ static void CreateWindowTitlebarButtons (TwmWindow *tmp_win) tmp_win->titlebuttons = NULL; nb = Scr->TBInfo.nleft + Scr->TBInfo.nright; if (nb > 0) { - tmp_win->titlebuttons = malloc (nb * sizeof(TBWindow)); + tmp_win->titlebuttons = malloc ((size_t)nb * sizeof(TBWindow)); if (!tmp_win->titlebuttons) { fprintf (stderr, "%s: unable to allocate %d titlebuttons\n", ProgramName, nb); } else { TBWindow *tbw; int boxwidth = (Scr->TBInfo.width + Scr->TBInfo.pad); - unsigned int h = (Scr->TBInfo.width - Scr->TBInfo.border * 2); + unsigned h = (unsigned)(Scr->TBInfo.width - Scr->TBInfo.border * 2); for (tb = Scr->TBInfo.head, tbw = tmp_win->titlebuttons; tb; tb = tb->next, tbw++) { @@ -1338,8 +1340,8 @@ SetHighlightPixmap (char *filename) XFreePixmap (dpy, Scr->hilitePm); } Scr->hilitePm = pm; - Scr->hilite_pm_width = JunkWidth; - Scr->hilite_pm_height = JunkHeight; + Scr->hilite_pm_width = (int)JunkWidth; + Scr->hilite_pm_height = (int)JunkHeight; } } @@ -1371,7 +1373,7 @@ CreateTwmColormap(Colormap c) TwmColormap *cmap; cmap = malloc(sizeof(TwmColormap)); if (!cmap || - XSaveContext(dpy, c, ColormapContext, (caddr_t) cmap)) { + XSaveContext(dpy, c, ColormapContext, (XPointer) cmap)) { if (cmap) free(cmap); return (NULL); } @@ -1393,13 +1395,13 @@ CreateColormapWindow(Window w, Bool creating_parent, Bool property_window) cwin = malloc(sizeof(ColormapWindow)); if (cwin) { if (!XGetWindowAttributes(dpy, w, &attributes) || - XSaveContext(dpy, w, ColormapContext, (caddr_t) cwin)) { + XSaveContext(dpy, w, ColormapContext, (XPointer) cwin)) { free(cwin); return (NULL); } if (XFindContext(dpy, attributes.colormap, ColormapContext, - (caddr_t *)&cwin->colormap) == XCNOENT) { + (XPointer *)&cwin->colormap) == XCNOENT) { cwin->colormap = cmap = CreateTwmColormap(attributes.colormap); if (!cmap) { XDeleteContext(dpy, w, ColormapContext); @@ -1469,7 +1471,7 @@ FetchWmColormapWindows (TwmWindow *tmp) } if (i == number_cmap_windows) { /* not in list */ Window *new_cmap_windows = - malloc (sizeof(Window) * (number_cmap_windows + 1)); + malloc (sizeof(Window) * (size_t)(number_cmap_windows + 1)); if (!new_cmap_windows) { fprintf (stderr, @@ -1487,7 +1489,7 @@ FetchWmColormapWindows (TwmWindow *tmp) number_cmap_windows++; } - cwins = malloc(sizeof(ColormapWindow *) * number_cmap_windows); + cwins = malloc(sizeof(ColormapWindow *) * (size_t)number_cmap_windows); if (cwins) { for (i = 0; i < number_cmap_windows; i++) { @@ -1509,7 +1511,7 @@ FetchWmColormapWindows (TwmWindow *tmp) */ if (j == tmp->cmaps.number_cwins) { if (XFindContext(dpy, cmap_windows[i], ColormapContext, - (caddr_t *)&cwins[i]) == XCNOENT) { + (XPointer *)&cwins[i]) == XCNOENT) { if ((cwins[i] = CreateColormapWindow(cmap_windows[i], (Bool) tmp->cmaps.number_cwins == 0, True)) == NULL) { @@ -1533,7 +1535,7 @@ FetchWmColormapWindows (TwmWindow *tmp) number_cmap_windows = 1; cwins = malloc(sizeof(ColormapWindow *)); - if (XFindContext(dpy, tmp->w, ColormapContext, (caddr_t *)&cwins[0]) == + if (XFindContext(dpy, tmp->w, ColormapContext, (XPointer *)&cwins[0]) == XCNOENT) { cwins[0] = CreateColormapWindow(tmp->w, (Bool) tmp->cmaps.number_cwins == 0, False); diff --git a/src/cursor.c b/src/cursor.c index bbe05f0..9a0cb28 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -127,7 +127,7 @@ NewFontCursor (Cursor *cp, const char *str) { int i; - for (i = 0; i < sizeof(cursor_names)/sizeof(struct _CursorName); i++) + for (i = 0; (size_t)i < sizeof(cursor_names)/sizeof(struct _CursorName); i++) { if (strcmp(str, cursor_names[i].name) == 0) { @@ -167,5 +167,6 @@ NewBitmapCursor(Cursor *cp, char *source, char *mask) return; } *cp = XCreatePixmapCursor(dpy, spm, mpm, &Scr->PointerForeground, - &Scr->PointerBackground, hotx,hoty); + &Scr->PointerBackground, + (unsigned)hotx, (unsigned)hoty); } diff --git a/src/deftwmrc.sed b/src/deftwmrc.sed index d26926a..30f8c27 100644 --- a/src/deftwmrc.sed +++ b/src/deftwmrc.sed @@ -1,4 +1,4 @@ /^#/d s/"/\\"/g -s/^/ (unsigned char *) "/ +s/^/ (const unsigned char *) "/ s/$/",/ diff --git a/src/events.c b/src/events.c index ac26d88..ce66446 100644 --- a/src/events.c +++ b/src/events.c @@ -73,6 +73,9 @@ in this Software without prior written authorization from The Open Group. #include "icons.h" #include "version.h" +#ifdef HAVE_XRANDR +#include <X11/extensions/Xrandr.h> +#endif #define MAX_X_EVENT 256 event_proc EventHandler[MAX_X_EVENT]; /* event handler jump table */ @@ -170,6 +173,18 @@ InitEvents(void) EventHandler[VisibilityNotify] = HandleVisibilityNotify; if (HasShape) EventHandler[ShapeEventBase+ShapeNotify] = HandleShapeNotify; +#ifdef HAVE_XRANDR + if (HasXrandr) + { + int scrnum; + + EventHandler[XrandrEventBase+RRScreenChangeNotify] = HandleScreenChangeNotify; + for (scrnum = 0; scrnum < NumScreens; scrnum++) + { + XRRSelectInput(dpy,ScreenList[scrnum]->Root,RRScreenChangeNotifyMask); + } + } +#endif } @@ -595,7 +610,7 @@ HandleKeyPress(void) for (key = Scr->FuncKeyRoot.next; key != NULL; key = key->next) { if (key->keysym == ks && - key->mods == modifier && + (unsigned)key->mods == modifier && (key->cont == Context || key->cont == C_NAME)) { /* weed out the functions that don't make sense to execute @@ -617,13 +632,13 @@ HandleKeyPress(void) else { int matched = FALSE; - len = strlen(key->win_name); + len = (int)strlen(key->win_name); /* try and match the name first */ for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; Tmp_win = Tmp_win->next) { - if (!strncmp(key->win_name, Tmp_win->name, len)) + if (!strncmp(key->win_name, Tmp_win->name, (size_t)len)) { matched = TRUE; ExecuteFunction(key->func, key->action, Tmp_win->frame, @@ -637,7 +652,7 @@ HandleKeyPress(void) for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; Tmp_win = Tmp_win->next) { - if (!strncmp(key->win_name, Tmp_win->class.res_name, len)) + if (!strncmp(key->win_name, Tmp_win->class.res_name, (size_t)len)) { matched = TRUE; ExecuteFunction(key->func, key->action, Tmp_win->frame, @@ -651,7 +666,7 @@ HandleKeyPress(void) for (Tmp_win = Scr->TwmRoot.next; Tmp_win != NULL; Tmp_win = Tmp_win->next) { - if (!strncmp(key->win_name, Tmp_win->class.res_class, len)) + if (!strncmp(key->win_name, Tmp_win->class.res_class, (size_t)len)) { matched = TRUE; ExecuteFunction(key->func, key->action, Tmp_win->frame, @@ -780,7 +795,7 @@ HandlePropertyNotify(void) Tmp_win->name_width = MyFont_TextWidth (&Scr->TitleBarFont, Tmp_win->name, - strlen (Tmp_win->name)); + (int)strlen (Tmp_win->name)); SetupWindow (Tmp_win, Tmp_win->frame_x, Tmp_win->frame_y, Tmp_win->frame_width, Tmp_win->frame_height, -1); @@ -881,8 +896,8 @@ HandlePropertyNotify(void) Tmp_win->icon_w = Tmp_win->wmhints->icon_window; XSelectInput (dpy, Tmp_win->icon_w, KeyPressMask | ButtonPressMask | ButtonReleaseMask); - XSaveContext(dpy, Tmp_win->icon_w, TwmContext, (caddr_t)Tmp_win); - XSaveContext(dpy, Tmp_win->icon_w, ScreenContext, (caddr_t)Scr); + XSaveContext(dpy, Tmp_win->icon_w, TwmContext, (XPointer)Tmp_win); + XSaveContext(dpy, Tmp_win->icon_w, ScreenContext, (XPointer)Scr); XDefineCursor(dpy, Tmp_win->icon_w, Scr->IconCursor); } } @@ -895,13 +910,13 @@ HandlePropertyNotify(void) return; } - pm = XCreatePixmap (dpy, Scr->Root, Tmp_win->icon_width, - Tmp_win->icon_height, Scr->d_depth); + pm = XCreatePixmap (dpy, Scr->Root, (unsigned)Tmp_win->icon_width, + (unsigned)Tmp_win->icon_height, (unsigned)Scr->d_depth); FB(Tmp_win->iconc.fore, Tmp_win->iconc.back); XCopyPlane(dpy, Tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC, - 0,0, Tmp_win->icon_width, Tmp_win->icon_height, 0, 0, 1 ); + 0,0, (unsigned)Tmp_win->icon_width, (unsigned)Tmp_win->icon_height, 0, 0, 1 ); valuemask = CWBackPixmap; attributes.background_pixmap = pm; @@ -964,7 +979,7 @@ RedoIconName(void) return; Tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, - Tmp_win->icon_name, strlen(Tmp_win->icon_name)); + Tmp_win->icon_name, (int)strlen(Tmp_win->icon_name)); Tmp_win->icon_w_width += 6; if (Tmp_win->icon_w_width < Tmp_win->icon_width) @@ -988,8 +1003,8 @@ RedoIconName(void) Tmp_win->icon_w_height = Tmp_win->icon_height + Scr->IconFont.height + 4; Tmp_win->icon_y = Tmp_win->icon_height + Scr->IconFont.height; - XResizeWindow(dpy, Tmp_win->icon_w, Tmp_win->icon_w_width, - Tmp_win->icon_w_height); + XResizeWindow(dpy, Tmp_win->icon_w, (unsigned)Tmp_win->icon_w_width, + (unsigned)Tmp_win->icon_w_height); if (Tmp_win->icon_bm_w) { XMoveWindow(dpy, Tmp_win->icon_bm_w, x, y); @@ -1063,7 +1078,7 @@ HandleExpose(void) { MyFont_DrawString(dpy, Scr->InfoWindow, &Scr->DefaultFont, Scr->NormalGC, 5, (i*height) + Scr->DefaultFont.y, Info[i], - strlen(Info[i])); + (int)strlen(Info[i])); } flush_expose (Event.xany.window); } @@ -1076,7 +1091,7 @@ HandleExpose(void) MyFont_DrawString (dpy, Tmp_win->title_w, &Scr->TitleBarFont, Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, - Tmp_win->name, strlen(Tmp_win->name)); + Tmp_win->name, (int)strlen(Tmp_win->name)); flush_expose (Event.xany.window); } else if (Event.xany.window == Tmp_win->icon_w) @@ -1086,7 +1101,7 @@ HandleExpose(void) MyFont_DrawString (dpy, Tmp_win->icon_w, &Scr->IconFont, Scr->NormalGC, Tmp_win->icon_x, Tmp_win->icon_y, - Tmp_win->icon_name, strlen(Tmp_win->icon_name)); + Tmp_win->icon_name, (int)strlen(Tmp_win->icon_name)); flush_expose (Event.xany.window); return; } else if (Tmp_win->titlebuttons) { @@ -1116,7 +1131,7 @@ HandleExpose(void) MyFont_DrawString (dpy, Event.xany.window, &Scr->IconManagerFont, Scr->NormalGC, iconmgr_textx, Scr->IconManagerFont.y+4, - Tmp_win->icon_name, strlen(Tmp_win->icon_name)); + Tmp_win->icon_name, (int)strlen(Tmp_win->icon_name)); DrawIconManagerBorder(Tmp_win->list); flush_expose (Event.xany.window); return; @@ -1126,7 +1141,7 @@ HandleExpose(void) FB(Tmp_win->list->fore, Tmp_win->list->back); XCopyPlane(dpy, Scr->siconifyPm, Tmp_win->list->icon, Scr->NormalGC, - 0,0, iconifybox_width, iconifybox_height, 0, 0, 1); + 0,0, (unsigned)iconifybox_width, (unsigned)iconifybox_height, 0, 0, 1); flush_expose (Event.xany.window); return; } @@ -1336,7 +1351,7 @@ HandleMapRequest(void) zoom_save = Scr->DoZoom; Scr->DoZoom = FALSE; Iconify(Tmp_win, 0, 0); - Scr->DoZoom = zoom_save; + Scr->DoZoom = (short)zoom_save; break; } } @@ -1443,7 +1458,7 @@ HandleUnmapNotify(void) if (reparented) { if (Tmp_win->old_bw) XSetWindowBorderWidth (dpy, Event.xunmap.window, - Tmp_win->old_bw); + (unsigned)Tmp_win->old_bw); if (Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconWindowHint)) XUnmapWindow (dpy, Tmp_win->wmhints->icon_window); } else { @@ -1635,11 +1650,11 @@ HandleButtonRelease(void) mask = (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask); switch (Event.xbutton.button) { - case Button1: mask &= ~Button1Mask; break; - case Button2: mask &= ~Button2Mask; break; - case Button3: mask &= ~Button3Mask; break; - case Button4: mask &= ~Button4Mask; break; - case Button5: mask &= ~Button5Mask; break; + case Button1: mask &= (unsigned)(~Button1Mask); break; + case Button2: mask &= (unsigned)(~Button2Mask); break; + case Button3: mask &= (unsigned)(~Button3Mask); break; + case Button4: mask &= (unsigned)(~Button4Mask); break; + case Button5: mask &= (unsigned)(~Button5Mask); break; } if (RootFunction != 0 || @@ -1755,7 +1770,7 @@ HandleButtonPress(void) return; } else - ButtonPressed = Event.xbutton.button; + ButtonPressed = (int)Event.xbutton.button; if (ResizeWindow != None || DragWindow != None || @@ -1958,7 +1973,7 @@ typedef struct HENScanArgs { } HENScanArgs; static Bool -HENQueueScanner(Display *dpy, XEvent *ev, char *args) +HENQueueScanner(Display *dpy2 _X_UNUSED, XEvent *ev, char *args) { if (ev->type == LeaveNotify) { if (ev->xcrossing.window == ((HENScanArgs *) args)->w && @@ -2155,7 +2170,7 @@ typedef struct HLNScanArgs { } HLNScanArgs; static Bool -HLNQueueScanner(Display *dpy, XEvent *ev, char *args) +HLNQueueScanner(Display *dpy2 _X_UNUSED, XEvent *ev, char *args) { if (ev->type == EnterNotify && ev->xcrossing.mode != NotifyGrab) { ((HLNScanArgs *) args)->enters = True; @@ -2297,7 +2312,7 @@ HandleConfigureRequest(void) xwc.width = cre->width; xwc.height = cre->height; xwc.border_width = cre->border_width; - XConfigureWindow(dpy, Event.xany.window, xwcm, &xwc); + XConfigureWindow(dpy, Event.xany.window, (unsigned)xwcm, &xwc); return; } @@ -2393,12 +2408,37 @@ HandleShapeNotify (void) XShapeCombineMask (dpy, Tmp_win->frame, ShapeClip, 0, 0, None, ShapeSet); } - Tmp_win->wShaped = sev->shaped; + Tmp_win->wShaped = (short)sev->shaped; SetFrameShape (Tmp_win); } +#ifdef HAVE_XRANDR +/** + * xrandr screen configuration change-notification handler + */ +void +HandleScreenChangeNotify (void) +{ + XRRScreenChangeNotifyEvent *xev = (XRRScreenChangeNotifyEvent *) &Event; + int scrnum; + + for (scrnum = 0; scrnum < NumScreens; scrnum++) + { + if ( ScreenList[scrnum]->Root == xev->root ) + { + ScreenList[scrnum]->MyDisplayWidth = xev->width; + ScreenList[scrnum]->MyDisplayHeight = xev->height; + } + } + + XRRUpdateConfiguration(&Event); +} +#endif + + + /** * unknown event handler */ @@ -2600,7 +2640,7 @@ InstallRootColormap(void) static Bool -UninstallRootColormapQScanner(Display *dpy, XEvent *ev, char *args) +UninstallRootColormapQScanner(Display *dpy2 _X_UNUSED, XEvent *ev, char *args) { if (!*args) { if (ev->type == EnterNotify) { diff --git a/src/events.h b/src/events.h index e6bcfc9..f554642 100644 --- a/src/events.h +++ b/src/events.h @@ -97,6 +97,7 @@ extern void HandleEnterNotify ( void ); extern void HandleLeaveNotify ( void ); extern void HandleConfigureRequest ( void ); extern void HandleShapeNotify ( void ); +extern void HandleScreenChangeNotify ( void ); extern void HandleUnknown ( void ); extern int Transient ( Window w, Window *propw ); extern ScreenInfo * FindScreenInfo ( Window w ); @@ -78,8 +78,9 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xos.h> #include <X11/Xmu/CharSet.h> -static char *Action = ""; -static char *Name = ""; +static char empty[1]; +static char *Action = empty; +static char *Name = empty; static MenuRoot *root, *pull = NULL; static MenuRoot *GetRoot ( const char *name, const char *fore, const char *back ); @@ -159,7 +160,7 @@ stmt : error | ZOOM number { if (Scr->FirstTime) { Scr->DoZoom = TRUE; - Scr->ZoomCount = $2; + Scr->ZoomCount = (short)$2; } } | ZOOM { if (Scr->FirstTime) @@ -193,7 +194,7 @@ stmt : error AddToMenu(root,"x",Action, NULL,$2,NULLSTR,NULLSTR); } - Action = ""; + Action = empty; pull = NULL; } | string fullkey { GotKey($1, $2); } @@ -259,7 +260,7 @@ stmt : error AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); } - Action = ""; + Action = empty; pull = NULL; } | WINDOW_FUNCTION action { Scr->WindowFunction.func = $2; @@ -267,7 +268,7 @@ stmt : error Scr->WindowFunction.item = AddToMenu(root,"x",Action, NULL,$2, NULLSTR, NULLSTR); - Action = ""; + Action = empty; pull = NULL; } | WARP_CURSOR { list = &Scr->WarpCursorL; } @@ -567,9 +568,9 @@ function_entries: /* Empty */ | function_entries function_entry ; -function_entry : action { AddToMenu(root, "", Action, NULL, $1, +function_entry : action { AddToMenu(root, empty, Action, NULL, $1, NULLSTR, NULLSTR); - Action = ""; + Action = empty; } ; @@ -582,13 +583,13 @@ menu_entries : /* Empty */ menu_entry : string action { AddToMenu(root, $1, Action, pull, $2, NULLSTR, NULLSTR); - Action = ""; + Action = empty; pull = NULL; } | string LP string COLON string RP action { AddToMenu(root, $1, Action, pull, $7, $3, $5); - Action = ""; + Action = empty; pull = NULL; } ; @@ -716,7 +717,7 @@ RemoveDQuote(char *str) n = (n<<3) + (*i++ - '0'); count++; } - *o = n; + *o = (char)n; break; hex: case 'x': @@ -733,7 +734,7 @@ RemoveDQuote(char *str) else break; } - *o = n; + *o = (char)n; break; case '\n': i++; /* punt */ @@ -769,7 +770,7 @@ static MenuRoot *GetRoot(const char *name, const char* fore, const char *back) Scr->FirstTime = TRUE; GetColor(COLOR, &tmp->hi_fore, fore); GetColor(COLOR, &tmp->hi_back, back); - Scr->FirstTime = save; + Scr->FirstTime = (short)save; } return tmp; @@ -797,10 +798,10 @@ static void GotButton(int butt, int func) NULL, func, NULLSTR, NULLSTR); } } - Action = ""; + Action = empty; pull = NULL; cont = 0; - mods_used |= mods; + mods_used |= (unsigned)mods; mods = 0; } @@ -816,10 +817,10 @@ static void GotKey(char *key, int func) break; } - Action = ""; + Action = empty; pull = NULL; cont = 0; - mods_used |= mods; + mods_used |= (unsigned)mods; mods = 0; } @@ -832,7 +833,7 @@ static void GotTitleButton (char *bitmapname, int func, Bool rightside) "unable to create %s titlebutton \"%s\"\n", rightside ? "right" : "left", bitmapname); } - Action = ""; + Action = empty; pull = NULL; } diff --git a/src/iconmgr.c b/src/iconmgr.c index ca7b307..80457a1 100644 --- a/src/iconmgr.c +++ b/src/iconmgr.c @@ -90,7 +90,7 @@ CreateIconManagers(void) &background); p->w = XCreateSimpleWindow(dpy, Scr->Root, - JunkX, JunkY, p->width, p->height, 1, + JunkX, JunkY, (unsigned)p->width, (unsigned)p->height, 1, Scr->Black, background); snprintf(str, sizeof(str), "%s Icon Manager", p->name); @@ -429,11 +429,11 @@ WList *AddIconManager(TwmWindow *tmp_win) PackIconManager(ip); XMapWindow(dpy, tmp->w); - XSaveContext(dpy, tmp->w, IconManagerContext, (caddr_t) tmp); - XSaveContext(dpy, tmp->w, TwmContext, (caddr_t) tmp_win); - XSaveContext(dpy, tmp->w, ScreenContext, (caddr_t) Scr); - XSaveContext(dpy, tmp->icon, TwmContext, (caddr_t) tmp_win); - XSaveContext(dpy, tmp->icon, ScreenContext, (caddr_t) Scr); + XSaveContext(dpy, tmp->w, IconManagerContext, (XPointer) tmp); + XSaveContext(dpy, tmp->w, TwmContext, (XPointer) tmp_win); + XSaveContext(dpy, tmp->w, ScreenContext, (XPointer) Scr); + XSaveContext(dpy, tmp->icon, TwmContext, (XPointer) tmp_win); + XSaveContext(dpy, tmp->icon, ScreenContext, (XPointer) Scr); tmp_win->list = tmp; if (!ip->twm_win->icon) @@ -564,7 +564,7 @@ void DrawIconManagerBorder(WList *tmp) { XSetForeground(dpy, Scr->NormalGC, tmp->fore); XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 2, 2, - tmp->width-5, tmp->height-5); + (unsigned)(tmp->width-5), (unsigned)(tmp->height-5)); if (tmp->active && Scr->Highlight) XSetForeground(dpy, Scr->NormalGC, tmp->highlight); @@ -572,9 +572,9 @@ void DrawIconManagerBorder(WList *tmp) XSetForeground(dpy, Scr->NormalGC, tmp->back); XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 0, 0, - tmp->width-1, tmp->height-1); + (unsigned)(tmp->width-1), (unsigned)(tmp->height-1)); XDrawRectangle(dpy, tmp->w, Scr->NormalGC, 1, 1, - tmp->width-3, tmp->height-3); + (unsigned)(tmp->width-3), (unsigned)(tmp->height-3)); } } @@ -659,7 +659,7 @@ void PackIconManager(IconMgr *ip) if (tmp->x != new_x || tmp->y != new_y || tmp->width != wwidth || tmp->height != wheight) { - XMoveResizeWindow(dpy, tmp->w, new_x, new_y, wwidth, wheight); + XMoveResizeWindow(dpy, tmp->w, new_x, new_y, (unsigned)wwidth, (unsigned)wheight); tmp->row = row-1; tmp->col = col; @@ -680,7 +680,7 @@ void PackIconManager(IconMgr *ip) if (newwidth == 0) newwidth = colinc; - XResizeWindow(dpy, ip->w, newwidth, ip->height); + XResizeWindow(dpy, ip->w, (unsigned)newwidth, (unsigned)ip->height); savewidth = ip->width; if (ip->twm_win) diff --git a/src/icons.c b/src/icons.c index 617a1f7..a3a6588 100644 --- a/src/icons.c +++ b/src/icons.c @@ -378,12 +378,12 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) (unsigned int *) &tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); - pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, - tmp_win->icon_height, Scr->d_depth); + pm = XCreatePixmap(dpy, Scr->Root, (unsigned)tmp_win->icon_width, + (unsigned)tmp_win->icon_height, (unsigned)Scr->d_depth); /* the copy plane works on color ! */ XCopyPlane(dpy, bm, pm, Scr->NormalGC, - 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 ); tmp_win->forced = TRUE; } @@ -402,11 +402,11 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); pm = XCreatePixmap(dpy, Scr->Root, - tmp_win->icon_width, tmp_win->icon_height, - Scr->d_depth); + (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, + (unsigned)Scr->d_depth); XCopyPlane(dpy, tmp_win->wmhints->icon_pixmap, pm, Scr->NormalGC, - 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 ); } /* if we still haven't got an icon, let's look in the Icon list @@ -438,12 +438,12 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) (unsigned int *)&tmp_win->icon_width, (unsigned int *)&tmp_win->icon_height, &JunkBW, &JunkDepth); - pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, - tmp_win->icon_height, Scr->d_depth); + pm = XCreatePixmap(dpy, Scr->Root, (unsigned)tmp_win->icon_width, + (unsigned)tmp_win->icon_height, (unsigned)Scr->d_depth); /* the copy plane works on color ! */ XCopyPlane(dpy, bm, pm, Scr->NormalGC, - 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 ); } } @@ -454,12 +454,12 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) tmp_win->icon_width = Scr->UnknownWidth; tmp_win->icon_height = Scr->UnknownHeight; - pm = XCreatePixmap(dpy, Scr->Root, tmp_win->icon_width, - tmp_win->icon_height, Scr->d_depth); + pm = XCreatePixmap(dpy, Scr->Root, (unsigned)tmp_win->icon_width, + (unsigned)tmp_win->icon_height, (unsigned)Scr->d_depth); /* the copy plane works on color ! */ XCopyPlane(dpy, Scr->UnknownPm, pm, Scr->NormalGC, - 0,0, tmp_win->icon_width, tmp_win->icon_height, 0, 0, 1 ); + 0,0, (unsigned)tmp_win->icon_width, (unsigned)tmp_win->icon_height, 0, 0, 1 ); } if (pm == None) @@ -475,7 +475,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) } tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, - tmp_win->icon_name, strlen(tmp_win->icon_name)); + tmp_win->icon_name, (int)strlen(tmp_win->icon_name)); tmp_win->icon_w_width += 6; if (tmp_win->icon_w_width < tmp_win->icon_width) @@ -518,14 +518,14 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) { tmp_win->icon_w = XCreateSimpleWindow(dpy, Scr->Root, 0,0, - tmp_win->icon_w_width, tmp_win->icon_w_height, - Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back); + (unsigned)tmp_win->icon_w_width, (unsigned)tmp_win->icon_w_height, + (unsigned)Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back); event_mask = ExposureMask; } XSelectInput (dpy, tmp_win->icon_w, - KeyPressMask | ButtonPressMask | ButtonReleaseMask | - event_mask); + (long)(KeyPressMask | ButtonPressMask | ButtonReleaseMask | + event_mask)); tmp_win->icon_bm_w = None; if (pm != None && @@ -574,8 +574,8 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y) tmp_win->iconified = TRUE; XMapSubwindows(dpy, tmp_win->icon_w); - XSaveContext(dpy, tmp_win->icon_w, TwmContext, (caddr_t)tmp_win); - XSaveContext(dpy, tmp_win->icon_w, ScreenContext, (caddr_t)Scr); + XSaveContext(dpy, tmp_win->icon_w, TwmContext, (XPointer)tmp_win); + XSaveContext(dpy, tmp_win->icon_w, ScreenContext, (XPointer)Scr); XDefineCursor(dpy, tmp_win->icon_w, Scr->IconCursor); if (pm) XFreePixmap (dpy, pm); return; @@ -82,7 +82,7 @@ static int doinput (char *buf, int size) if ((c = (*twmInputFunc)()) <= 0) return (0); - buf[0] = c; + buf[0] = (char)c; return (1); } #define YY_NO_UNPUT @@ -170,7 +170,7 @@ int GetColorFromList(name_list *list_head, const char *name, XClassHint *class, save = Scr->FirstTime; Scr->FirstTime = TRUE; GetColor(Scr->Monochrome, ptr, nptr->ptr); - Scr->FirstTime = save; + Scr->FirstTime = (short)save; return (TRUE); } @@ -182,7 +182,7 @@ int GetColorFromList(name_list *list_head, const char *name, XClassHint *class, save = Scr->FirstTime; Scr->FirstTime = TRUE; GetColor(Scr->Monochrome, ptr, nptr->ptr); - Scr->FirstTime = save; + Scr->FirstTime = (short)save; return (TRUE); } @@ -192,7 +192,7 @@ int GetColorFromList(name_list *list_head, const char *name, XClassHint *class, save = Scr->FirstTime; Scr->FirstTime = TRUE; GetColor(Scr->Monochrome, ptr, nptr->ptr); - Scr->FirstTime = save; + Scr->FirstTime = (short)save; return (TRUE); } } diff --git a/src/menus.c b/src/menus.c index 8aa99c7..c446eed 100644 --- a/src/menus.c +++ b/src/menus.c @@ -171,12 +171,12 @@ InitMenus(void) * * \param name the name of the key * \param cont the context to look for the key press in - * \param mods modifier keys that need to be pressed + * \param mods2 modifier keys that need to be pressed * \param func the function to perform * \param win_name the window name (if any) * \param action the action string associated with the function (if any) */ -Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, +Bool AddFuncKey (char *name, int cont, int mods2, int func, char *win_name, char *action) { FuncKey *tmp; @@ -198,7 +198,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, { if (tmp->keysym == keysym && tmp->cont == cont && - tmp->mods == mods) + tmp->mods == mods2) break; } @@ -213,7 +213,7 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name, tmp->keysym = keysym; tmp->keycode = keycode; tmp->cont = cont; - tmp->mods = mods; + tmp->mods = mods2; tmp->func = func; tmp->win_name = win_name; tmp->action = action; @@ -342,18 +342,18 @@ void InitTitlebarButtons (void) } } - tb->dstx = (h - tb->width + 1) / 2; + tb->dstx = (int)(((unsigned)h - tb->width + 1) / 2); if (tb->dstx < 0) { /* clip to minimize copying */ tb->srcx = -(tb->dstx); - tb->width = h; + tb->width = (unsigned)h; tb->dstx = 0; } else { tb->srcx = 0; } - tb->dsty = (h - tb->height + 1) / 2; + tb->dsty = (int)(((unsigned)h - tb->height + 1) / 2); if (tb->dsty < 0) { tb->srcy = -(tb->dsty); - tb->height = h; + tb->height = (unsigned)h; tb->dsty = 0; } else { tb->srcy = 0; @@ -385,7 +385,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) XSetForeground(dpy, Scr->NormalGC, mi->hi_back); XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset, - mr->width, Scr->EntryHeight); + (unsigned)mr->width, (unsigned)Scr->EntryHeight); MyFont_ChangeGC(mi->hi_fore, mi->hi_back, &Scr->MenuFont); @@ -401,7 +401,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) XSetForeground(dpy, Scr->NormalGC, mi->back); XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset, - mr->width, Scr->EntryHeight); + (unsigned)mr->width, (unsigned)Scr->EntryHeight); MyFont_ChangeGC(mi->fore, mi->back, &Scr->MenuFont); gc = Scr->NormalGC; @@ -422,8 +422,8 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) Scr->pullPm = CreateMenuIcon (Scr->MenuFont.height, &Scr->pullW, &Scr->pullH); } - x = mr->width - Scr->pullW - 5; - y = y_offset + ((Scr->MenuFont.height - Scr->pullH) / 2); + x = (int)((unsigned)mr->width - (Scr->pullW + 5)); + y = (int)((unsigned)y_offset + (((unsigned)Scr->MenuFont.height - Scr->pullH) / 2)); XCopyPlane(dpy, Scr->pullPm, mr->w, gc, 0, 0, Scr->pullW, Scr->pullH, x, y, 1); } @@ -436,7 +436,7 @@ PaintEntry(MenuRoot *mr, MenuItem *mi, int exposure) /* fill the rectangle with the title background color */ XFillRectangle(dpy, mr->w, Scr->NormalGC, 0, y_offset, - mr->width, Scr->EntryHeight); + (unsigned)mr->width, (unsigned)Scr->EntryHeight); { XSetForeground(dpy, Scr->NormalGC, mi->fore); @@ -713,19 +713,19 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action, menu->last = tmp; tmp->item = item; - tmp->strlen = strlen(item); + tmp->strlen = (short)strlen(item); tmp->action = action; tmp->next = NULL; tmp->sub = NULL; tmp->state = 0; - tmp->func = func; + tmp->func = (short)func; if (!Scr->HaveFonts) CreateFonts(); width = MyFont_TextWidth(&Scr->MenuFont, item, tmp->strlen); if (width <= 0) width = 1; if (width > menu->width) - menu->width = width; + menu->width = (short)width; tmp->user_colors = FALSE; if (Scr->Monochrome == COLOR && fore != NULL) @@ -736,7 +736,7 @@ AddToMenu(MenuRoot *menu, const char *item, const char *action, Scr->FirstTime = TRUE; GetColor(COLOR, &tmp->fore, fore); GetColor(COLOR, &tmp->back, back); - Scr->FirstTime = save; + Scr->FirstTime = (short)save; tmp->user_colors = TRUE; } if (sub != NULL) @@ -787,7 +787,7 @@ MakeMenu(MenuRoot *mr) { if (mr->pull == TRUE) { - mr->width += 16 + 10; + mr->width = (short)(mr->width + (16 + 10)); } width = mr->width + 10; @@ -798,13 +798,13 @@ MakeMenu(MenuRoot *mr) cur->x = 5; else { - cur->x = width - MyFont_TextWidth(&Scr->MenuFont, cur->item, - cur->strlen); + cur->x = (short)(width - MyFont_TextWidth(&Scr->MenuFont, cur->item, + cur->strlen)); cur->x /= 2; } } - mr->height = mr->items * Scr->EntryHeight; - mr->width += 10; + mr->height = (short)(mr->items * Scr->EntryHeight); + mr->width = (short)(mr->width + 10); if (Scr->Shadow) { @@ -849,8 +849,8 @@ MakeMenu(MenuRoot *mr) valuemask, &attributes); - XSaveContext(dpy, mr->w, MenuContext, (caddr_t)mr); - XSaveContext(dpy, mr->w, ScreenContext, (caddr_t)Scr); + XSaveContext(dpy, mr->w, MenuContext, (XPointer)mr); + XSaveContext(dpy, mr->w, ScreenContext, (XPointer)Scr); mr->mapped = UNMAPPED; } @@ -932,14 +932,15 @@ MakeMenu(MenuRoot *mr) num -= 1; for (i = 0, cur = start->next; i < num && cur; i++, cur = cur->next) { - f3.red += fred; - f3.green += fgreen; - f3.blue += fblue; +#define AddColor(target,source) target = (unsigned short)(target + source) + AddColor(f3.red, fred); + AddColor(f3.green, fgreen); + AddColor(f3.blue, fblue); save_fore = f3; - b3.red += bred; - b3.green += bgreen; - b3.blue += bblue; + AddColor(b3.red, bred); + AddColor(b3.green, bgreen); + AddColor(b3.blue, bblue); save_back = b3; XAllocColor(dpy, cmap, &f3); @@ -999,7 +1000,7 @@ PopUpMenu (MenuRoot *menu, int x, int y, Bool center) WindowNameCount++; if (WindowNameCount != 0) { - WindowNames = malloc(sizeof(TwmWindow *) * WindowNameCount); + WindowNames = malloc(sizeof(TwmWindow *) * (size_t)WindowNameCount); WindowNames[0] = Scr->TwmRoot.next; for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1; tmp_win != NULL; @@ -1228,7 +1229,7 @@ resizeFromCenter(Window w, TwmWindow *tmp_win) if (event.type == ButtonPress) { MenuEndResize(tmp_win); - XMoveResizeWindow(dpy, w, AddingX, AddingY, AddingW, AddingH); + XMoveResizeWindow(dpy, w, AddingX, AddingY, (unsigned)AddingW, (unsigned)AddingH); break; } @@ -1402,7 +1403,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, else Bell(XkbBI_Info,0,tmp_win->w); - Scr->SortIconMgr = save_sort; + Scr->SortIconMgr = (short)save_sort; } break; @@ -1576,16 +1577,16 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, * in case of stupid or wicked fast servers */ if (ConstrainedMoveTime && - (eventp->xbutton.time - last_time) < ConstrainedMoveTime) + (eventp->xbutton.time - last_time) < (Time)ConstrainedMoveTime) { int width, height; ConstMove = TRUE; ConstMoveDir = MOVE_NONE; - ConstMoveX = eventp->xbutton.x_root - DragX - JunkBW; - ConstMoveY = eventp->xbutton.y_root - DragY - JunkBW; - width = DragWidth + 2 * JunkBW; - height = DragHeight + 2 * JunkBW; + ConstMoveX = (int)((unsigned)eventp->xbutton.x_root - (unsigned)DragX - JunkBW); + ConstMoveY = (int)((unsigned)eventp->xbutton.y_root - (unsigned)DragY - JunkBW); + width = (int)((unsigned)DragWidth + 2 * JunkBW); + height = (int)((unsigned)DragHeight + 2 * JunkBW); ConstMoveXL = ConstMoveX + width/3; ConstMoveXR = ConstMoveX + 2*(width/3); ConstMoveYT = ConstMoveY + height/3; @@ -1611,8 +1612,10 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, * MoveOutline's below. */ MoveOutline(rootw, - origDragX - JunkBW, origDragY - JunkBW, - DragWidth + 2 * JunkBW, DragHeight + 2 * JunkBW, + (int)((unsigned)origDragX - JunkBW), + (int)((unsigned)origDragY - JunkBW), + (int)((unsigned)DragWidth + 2 * JunkBW), + (int)((unsigned)DragHeight + 2 * JunkBW), tmp_win->frame_bw, moving_icon ? 0 : tmp_win->title_height); /* @@ -1692,7 +1695,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, WindowMoved = FALSE; if (!Scr->OpaqueMove) UninstallRootColormap(); - return TRUE; /* XXX should this be FALSE? */ + return TRUE; /* XXX should this be FALSE? */ } if (Event.type == releaseEvent) { @@ -1745,32 +1748,32 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, break; case MOVE_VERT: - ConstMoveY = eventp->xmotion.y_root - DragY - JunkBW; + ConstMoveY = (int)((unsigned)eventp->xmotion.y_root - (unsigned)DragY - JunkBW); break; case MOVE_HORIZ: - ConstMoveX= eventp->xmotion.x_root - DragX - JunkBW; + ConstMoveX= (int)((unsigned)eventp->xmotion.x_root - (unsigned)DragX - JunkBW); break; } if (ConstMoveDir != MOVE_NONE) { - int xl, yt, xr, yb, w, h; + int xl, yt, xr, yb, w2, h; xl = ConstMoveX; yt = ConstMoveY; - w = DragWidth + 2 * JunkBW; - h = DragHeight + 2 * JunkBW; + w2 = (int)((unsigned)DragWidth + 2 * JunkBW); + h = (int)((unsigned)DragHeight + 2 * JunkBW); if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { - xr = xl + w; + xr = xl + w2; yb = yt + h; if (xl < 0) xl = 0; if (xr > Scr->MyDisplayWidth) - xl = Scr->MyDisplayWidth - w; + xl = Scr->MyDisplayWidth - w2; if (yt < 0) yt = 0; @@ -1782,34 +1785,34 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, if (Scr->OpaqueMove) XMoveWindow(dpy, DragWindow, xl, yt); else - MoveOutline(eventp->xmotion.root, xl, yt, w, h, + MoveOutline(eventp->xmotion.root, xl, yt, w2, h, tmp_win->frame_bw, moving_icon ? 0 : tmp_win->title_height); } } else if (DragWindow != None) { - int xl, yt, xr, yb, w, h; + int xl, yt, xr, yb, w2, h; if (!menuFromFrameOrWindowOrTitlebar) { - xl = eventp->xmotion.x_root - DragX - JunkBW; - yt = eventp->xmotion.y_root - DragY - JunkBW; + xl = (int)((unsigned)eventp->xmotion.x_root - (unsigned)DragX - JunkBW); + yt = (int)((unsigned)eventp->xmotion.y_root - (unsigned)DragY - JunkBW); } else { - xl = eventp->xmotion.x_root - (DragWidth / 2); - yt = eventp->xmotion.y_root - (DragHeight / 2); + xl = (int)(eventp->xmotion.x_root - (DragWidth / 2)); + yt = (int)(eventp->xmotion.y_root - (DragHeight / 2)); } - w = DragWidth + 2 * JunkBW; - h = DragHeight + 2 * JunkBW; + w2 = (int)((unsigned)DragWidth + 2 * JunkBW); + h = (int)((unsigned)DragHeight + 2 * JunkBW); if (Scr->DontMoveOff && MoveFunction != F_FORCEMOVE) { - xr = xl + w; + xr = xl + w2; yb = yt + h; if (xl < 0) xl = 0; if (xr > Scr->MyDisplayWidth) - xl = Scr->MyDisplayWidth - w; + xl = Scr->MyDisplayWidth - w2; if (yt < 0) yt = 0; @@ -1822,7 +1825,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, if (Scr->OpaqueMove) XMoveWindow(dpy, DragWindow, xl, yt); else - MoveOutline(eventp->xmotion.root, xl, yt, w, h, + MoveOutline(eventp->xmotion.root, xl, yt, w2, h, tmp_win->frame_bw, moving_icon ? 0 : tmp_win->title_height); } @@ -2000,7 +2003,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, case F_CUT: strlcpy(tmp, action, sizeof(tmp)); strlcat(tmp, "\n", sizeof(tmp)); - XStoreBytes(dpy, tmp, strlen(tmp)); + XStoreBytes(dpy, tmp, (int)strlen(tmp)); break; case F_CUTFILE: @@ -2012,7 +2015,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, if (ptr) { fd = open (ptr, O_RDONLY); if (fd >= 0) { - count = read (fd, buff, MAX_FILE_SIZE - 1); + count = (int)read (fd, buff, MAX_FILE_SIZE - 1); if (count > 0) XStoreBytes (dpy, buff, count); close(fd); } else { @@ -2095,20 +2098,20 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, register TwmWindow *t; int len; - len = strlen(action); + len = (int)strlen(action); for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->name, len)) + if (!strncmp(action, t->name, (size_t)len)) if (WarpThere(t)) break; } if (!t) { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->class.res_name, len)) + if (!strncmp(action, t->class.res_name, (size_t)len)) if (WarpThere(t)) break; } if (!t) { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (!strncmp(action, t->class.res_class, len)) + if (!strncmp(action, t->class.res_class, (size_t)len)) if (WarpThere(t)) break; } } @@ -2125,7 +2128,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, int len; Window raisewin = None, iconwin = None; - len = strlen(action); + len = (int)strlen(action); if (len == 0) { if (tmp_win && tmp_win->list) { raisewin = tmp_win->list->iconmgr->twm_win->frame; @@ -2136,7 +2139,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, } } else { for (t = Scr->TwmRoot.next; t != NULL; t = t->next) { - if (strncmp (action, t->icon_name, len) == 0) { + if (strncmp (action, t->icon_name, (size_t)len) == 0) { if (t->list && t->list->iconmgr->twm_win->mapped) { raisewin = t->list->iconmgr->twm_win->frame; iconwin = t->list->icon; @@ -2175,7 +2178,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win, fd = open(ptr, O_RDONLY); if (fd >= 0) { - count = read(fd, buff, MAX_FILE_SIZE - 1); + count = (int)read(fd, buff, MAX_FILE_SIZE - 1); if (count > 0) XStoreBytes(dpy, buff, count); @@ -2505,7 +2508,7 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) XMapWindow(dpy, tmp_win->list->icon); XGetWindowAttributes(dpy, tmp_win->w, &winattrs); - eventMask = winattrs.your_event_mask; + eventMask = (unsigned long)winattrs.your_event_mask; /* iconify transients first */ for (t = Scr->TwmRoot.next; t != NULL; t = t->next) @@ -2525,9 +2528,9 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) * cause a transition to the Withdrawn state. */ t->mapped = FALSE; - XSelectInput(dpy, t->w, eventMask & ~StructureNotifyMask); + XSelectInput(dpy, t->w, (long)(eventMask & (unsigned long)(~StructureNotifyMask))); XUnmapWindow(dpy, t->w); - XSelectInput(dpy, t->w, eventMask); + XSelectInput(dpy, t->w, (long)eventMask); XUnmapWindow(dpy, t->frame); if (t->icon_w) XUnmapWindow(dpy, t->icon_w); @@ -2553,9 +2556,9 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y) * cause a transition to the Withdrawn state. */ tmp_win->mapped = FALSE; - XSelectInput(dpy, tmp_win->w, eventMask & ~StructureNotifyMask); + XSelectInput(dpy, tmp_win->w, (long)(eventMask & (unsigned long)(~StructureNotifyMask))); XUnmapWindow(dpy, tmp_win->w); - XSelectInput(dpy, tmp_win->w, eventMask); + XSelectInput(dpy, tmp_win->w, (long)eventMask); XUnmapWindow(dpy, tmp_win->frame); SetMapStateProp(tmp_win, IconicState); @@ -2623,7 +2626,7 @@ Identify (TwmWindow *t) for (i = 0; i < n; i++) { twidth = MyFont_TextWidth(&Scr->DefaultFont, Info[i], - strlen(Info[i])); + (int)strlen(Info[i])); if (twidth > width) width = twidth; } @@ -2643,7 +2646,7 @@ Identify (TwmWindow *t) } else { px = py = 0; } - XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, width, height); + XMoveResizeWindow(dpy, Scr->InfoWindow, px, py, (unsigned)width, (unsigned)height); XMapRaised(dpy, Scr->InfoWindow); InfoLines = n; } @@ -2743,7 +2746,7 @@ BumpWindowColormap (TwmWindow *tmp, int inc) if (!tmp) return; if (inc && tmp->cmaps.number_cwins > 0) { - cwins = malloc(sizeof(ColormapWindow *) * tmp->cmaps.number_cwins); + cwins = malloc(sizeof(ColormapWindow *) * (size_t)tmp->cmaps.number_cwins); if (cwins) { if ((previously_installed = /* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps && @@ -2921,8 +2924,8 @@ send_clientmessage (Window w, Atom a, Time timestamp) ev.window = w; ev.message_type = _XA_WM_PROTOCOLS; ev.format = 32; - ev.data.l[0] = a; - ev.data.l[1] = timestamp; + ev.data.l[0] = (long)a; + ev.data.l[1] = (long)timestamp; XSendEvent (dpy, w, False, 0L, (XEvent *) &ev); } diff --git a/src/parse.c b/src/parse.c index 787e1b1..044e02c 100644 --- a/src/parse.c +++ b/src/parse.c @@ -179,7 +179,7 @@ int ParseTwmrc (char *filename) if (!filename) { home = getenv ("HOME"); if (home) { - homelen = strlen (home); + homelen = (int)strlen (home); cp = tmpfilename; (void) snprintf (tmpfilename, sizeof(tmpfilename), "%s/.twmrc.%d", home, Scr->screen); @@ -246,7 +246,7 @@ static int twmFileInput(void) return 0; ptr = 0; - len = strlen((char *) buff); + len = (int)strlen((char *) buff); } return ((int)buff[ptr++]); } @@ -261,7 +261,7 @@ static int twmStringListInput(void) if (currentString) { unsigned int c = (unsigned int) *currentString++; - if (c) return c; /* if non-nul char */ + if (c) return (int)c; /* if non-nul char */ currentString = *++stringListSource; /* advance to next bol */ return '\n'; /* but say that we hit last eol */ } @@ -276,7 +276,7 @@ static int twmStringListInput(void) */ void twmUnput (int c) { - if (overflowlen < sizeof overflowbuff) { + if ((size_t)overflowlen < sizeof overflowbuff) { overflowbuff[overflowlen++] = (unsigned char) c; } else { twmrc_error_prefix (); @@ -738,7 +738,7 @@ int do_string_keyword (int keyword, char *s) fprintf (stderr, "ignoring invalid UsePPosition argument \"%s\"\n", s); } else { - Scr->UsePPosition = ppos; + Scr->UsePPosition = (short)ppos; } return 1; } @@ -772,7 +772,7 @@ int do_string_keyword (int keyword, char *s) return 1; case kws_MaxWindowSize: - JunkMask = XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight); + JunkMask = (unsigned)XParseGeometry (s, &JunkX, &JunkY, &JunkWidth, &JunkHeight); if ((JunkMask & (WidthValue | HeightValue)) != (WidthValue | HeightValue)) { twmrc_error_prefix(); @@ -784,8 +784,8 @@ int do_string_keyword (int keyword, char *s) fprintf (stderr, "MaxWindowSize \"%s\" must be positive\n", s); return 0; } - Scr->MaxWindowWidth = JunkWidth; - Scr->MaxWindowHeight = JunkHeight; + Scr->MaxWindowWidth = (int)JunkWidth; + Scr->MaxWindowHeight = (int)JunkHeight; return 1; } @@ -801,11 +801,11 @@ int do_number_keyword (int keyword, int num) return 1; case kwn_MoveDelta: - Scr->MoveDelta = num; + Scr->MoveDelta = (short)num; return 1; case kwn_XorValue: - if (Scr->FirstTime) Scr->XORvalue = num; + if (Scr->FirstTime) Scr->XORvalue = (unsigned long)num; return 1; case kwn_FramePadding: @@ -959,7 +959,7 @@ put_pixel_on_root(Pixel pixel) &retFormat, &nPixels, &retAfter, &retProp) == Success) { pixelProp = (Pixel *) retProp; - for (i = 0; i < nPixels; i++) + for (i = 0; (unsigned long)i < nPixels; i++) if (pixel == pixelProp[i]) addPixel = 0; } diff --git a/src/resize.c b/src/resize.c index 7cb4aa6..5a93ac5 100644 --- a/src/resize.c +++ b/src/resize.c @@ -174,8 +174,8 @@ StartResize(XEvent *evp, TwmWindow *tmp_win, Bool fromtitlebar) Scr->SizeStringOffset = SIZE_HINDENT; XResizeWindow (dpy, Scr->SizeWindow, - Scr->SizeStringWidth + SIZE_HINDENT * 2, - Scr->SizeFont.height + SIZE_VINDENT * 2); + (unsigned)(Scr->SizeStringWidth + SIZE_HINDENT * 2), + (unsigned)(Scr->SizeFont.height + SIZE_VINDENT * 2)); XMapRaised(dpy, Scr->SizeWindow); InstallRootColormap(); last_width = 0; @@ -208,8 +208,8 @@ MenuStartResize(TwmWindow *tmp_win, int x, int y, int w, int h) last_height = 0; Scr->SizeStringOffset = SIZE_HINDENT; XResizeWindow (dpy, Scr->SizeWindow, - Scr->SizeStringWidth + SIZE_HINDENT * 2, - Scr->SizeFont.height + SIZE_VINDENT * 2); + (unsigned)(Scr->SizeStringWidth + SIZE_HINDENT * 2), + (unsigned)(Scr->SizeFont.height + SIZE_VINDENT * 2)); XMapRaised(dpy, Scr->SizeWindow); DisplaySize(tmp_win, origWidth, origHeight); MoveOutline (Scr->Root, dragx - tmp_win->frame_bw, @@ -536,7 +536,7 @@ EndResize(void) MoveOutline(Scr->Root, 0, 0, 0, 0, 0, 0); XUnmapWindow(dpy, Scr->SizeWindow); - XFindContext(dpy, ResizeWindow, TwmContext, (caddr_t *)&tmp_win); + XFindContext(dpy, ResizeWindow, TwmContext, (XPointer *)&tmp_win); ConstrainSize (tmp_win, &dragWidth, &dragHeight); @@ -829,7 +829,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se xwcm |= (CWX | CWY | CWBorderWidth); } - XConfigureWindow(dpy, tmp_win->title_w, xwcm, &xwc); + XConfigureWindow(dpy, tmp_win->title_w, (unsigned)xwcm, &xwc); } if (tmp_win->attr.width != w) @@ -842,7 +842,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se tmp_win->attr.height = h - tmp_win->title_height; XMoveResizeWindow (dpy, tmp_win->w, 0, tmp_win->title_height, - w, h - tmp_win->title_height); + (unsigned)w, (unsigned)(h - tmp_win->title_height)); /* * fix up frame and assign size/location values in tmp_win @@ -857,7 +857,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se frame_wc.width = tmp_win->frame_width = w; frame_wc.height = tmp_win->frame_height = h; frame_mask |= (CWX | CWY | CWWidth | CWHeight); - XConfigureWindow (dpy, tmp_win->frame, frame_mask, &frame_wc); + XConfigureWindow (dpy, tmp_win->frame, (unsigned)frame_mask, &frame_wc); /* * fix up highlight window @@ -874,7 +874,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se } xwcm = CWX | CWWidth; - XConfigureWindow(dpy, tmp_win->hilite_w, xwcm, &xwc); + XConfigureWindow(dpy, tmp_win->hilite_w, (unsigned)xwcm, &xwc); } if (HasShape && reShape) { @@ -941,10 +941,10 @@ fullzoom(TwmWindow *tmp_win, int flag) tmp_win->save_frame_y = dragy; tmp_win->save_frame_width = dragWidth; tmp_win->save_frame_height = dragHeight; - tmp_win->zoomed = flag; + tmp_win->zoomed = (short)flag; } else - tmp_win->zoomed = flag; + tmp_win->zoomed = (short)flag; frame_bw_times_2 = 2*tmp_win->frame_bw; @@ -1053,25 +1053,25 @@ SetFrameShape (TwmWindow *tmp) * The frame_width and frame_height do *not* include borders. */ /* border */ - newBounding[0].x = tmp->title_x; - newBounding[0].y = tmp->title_y; - newBounding[0].width = tmp->title_width + fbw2; - newBounding[0].height = tmp->title_height; - newBounding[1].x = -tmp->frame_bw; - newBounding[1].y = Scr->TitleHeight; - newBounding[1].width = tmp->attr.width + fbw2; - newBounding[1].height = tmp->attr.height + fbw2; + newBounding[0].x = (short)tmp->title_x; + newBounding[0].y = (short)tmp->title_y; + newBounding[0].width = (unsigned short)(tmp->title_width + fbw2); + newBounding[0].height = (unsigned short)tmp->title_height; + newBounding[1].x = (short)-tmp->frame_bw; + newBounding[1].y = (short)Scr->TitleHeight; + newBounding[1].width = (unsigned short)(tmp->attr.width + fbw2); + newBounding[1].height = (unsigned short)(tmp->attr.height + fbw2); XShapeCombineRectangles (dpy, tmp->frame, ShapeBounding, 0, 0, newBounding, 2, ShapeSet, YXBanded); /* insides */ - newClip[0].x = tmp->title_x + tmp->frame_bw; + newClip[0].x = (short)(tmp->title_x + tmp->frame_bw); newClip[0].y = 0; - newClip[0].width = tmp->title_width; - newClip[0].height = Scr->TitleHeight; + newClip[0].width = (unsigned short)tmp->title_width; + newClip[0].height = (unsigned short)Scr->TitleHeight; newClip[1].x = 0; - newClip[1].y = tmp->title_height; - newClip[1].width = tmp->attr.width; - newClip[1].height = tmp->attr.height; + newClip[1].y = (short)tmp->title_height; + newClip[1].width = (unsigned short)tmp->attr.width; + newClip[1].height = (unsigned short)tmp->attr.height; XShapeCombineRectangles (dpy, tmp->frame, ShapeClip, 0, 0, newClip, 2, ShapeSet, YXBanded); } else { diff --git a/src/session.c b/src/session.c index e12a6c0..a908efc 100644 --- a/src/session.c +++ b/src/session.c @@ -145,8 +145,8 @@ write_ushort (FILE *file, unsigned short s) { unsigned char file_short[2]; - file_short[0] = (s & (unsigned)0xff00) >> 8; - file_short[1] = s & 0xff; + file_short[0] = (unsigned char)((s & (unsigned)0xff00) >> 8); + file_short[1] = (unsigned char)(s & 0xff); if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; return 1; @@ -158,8 +158,8 @@ write_short (FILE *file, short s) { unsigned char file_short[2]; - file_short[0] = (s & (unsigned)0xff00) >> 8; - file_short[1] = s & 0xff; + file_short[0] = (unsigned char)(((unsigned)s & (unsigned)0xff00) >> 8); + file_short[1] = (unsigned char)(s & 0xff); if (fwrite ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; return 1; @@ -171,7 +171,7 @@ write_counted_string (FILE *file, char *string) { if (string) { - unsigned char count = strlen (string); + unsigned char count = (unsigned char)strlen (string); if (write_byte (file, count) == 0) return 0; @@ -205,7 +205,7 @@ read_ushort (FILE *file, unsigned short *shortp) if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; - *shortp = file_short[0] * 256 + file_short[1]; + *shortp = (unsigned short)(file_short[0] * 256 + file_short[1]); return 1; } @@ -217,7 +217,7 @@ read_short (FILE *file, short *shortp) if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) return 0; - *shortp = file_short[0] * 256 + file_short[1]; + *shortp = (short)(file_short[0] * 256 + file_short[1]); return 1; } @@ -335,7 +335,7 @@ WriteWinConfigEntry (FILE *configFile, TwmWindow *theWindow, } else { - if (!write_byte (configFile, (char) wm_command_count)) + if (!write_byte (configFile, (unsigned char) wm_command_count)) return 0; for (i = 0; i < wm_command_count; i++) if (!write_counted_string (configFile, wm_command[i])) @@ -426,7 +426,7 @@ ReadWinConfigEntry (FILE *configFile, unsigned short version, entry->wm_command = NULL; else { - entry->wm_command = malloc (entry->wm_command_count * + entry->wm_command = malloc ((size_t)entry->wm_command_count * sizeof (char *)); if (!entry->wm_command) @@ -720,7 +720,7 @@ unique_filename ( static void -SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) +SaveYourselfPhase2CB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) { int scrnum; ScreenInfo *theScreen; @@ -744,23 +744,23 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) char userId[20]; char hint = SmRestartIfRunning; - prop1.name = SmProgram; - prop1.type = SmARRAY8; + prop1.name = strdup(SmProgram); + prop1.type = strdup(SmARRAY8); prop1.num_vals = 1; prop1.vals = &prop1val; prop1val.value = Argv[0]; - prop1val.length = strlen (Argv[0]); + prop1val.length = (int)strlen (Argv[0]); snprintf (userId, sizeof(userId), "%ld", (long)getuid()); - prop2.name = SmUserID; - prop2.type = SmARRAY8; + prop2.name = strdup(SmUserID); + prop2.type = strdup(SmARRAY8); prop2.num_vals = 1; prop2.vals = &prop2val; prop2val.value = (SmPointer) userId; - prop2val.length = strlen (userId); + prop2val.length = (int)strlen (userId); - prop3.name = SmRestartStyleHint; - prop3.type = SmCARD8; + prop3.name = strdup(SmRestartStyleHint); + prop3.type = strdup(SmCARD8); prop3.num_vals = 1; prop3.vals = &prop3val; prop3val.value = (SmPointer) &hint; @@ -770,7 +770,7 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) props[1] = &prop2; props[2] = &prop3; - SmcSetProperties (smcConn, 3, props); + SmcSetProperties (smcConn2, 3, props); first_time = 0; } @@ -828,10 +828,10 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) } } - prop1.name = SmRestartCommand; - prop1.type = SmLISTofARRAY8; + prop1.name = strdup(SmRestartCommand); + prop1.type = strdup(SmLISTofARRAY8); - prop1.vals = malloc ((Argc + 4) * sizeof (SmPropValue)); + prop1.vals = malloc ((size_t)(Argc + 4) * sizeof (SmPropValue)); if (!prop1.vals) { @@ -851,40 +851,40 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) else { prop1.vals[numVals].value = (SmPointer) Argv[i]; - prop1.vals[numVals++].length = strlen (Argv[i]); + prop1.vals[numVals++].length = (int)strlen (Argv[i]); } } - prop1.vals[numVals].value = (SmPointer) "-clientId"; + prop1.vals[numVals].value = strdup("-clientId"); prop1.vals[numVals++].length = 9; - prop1.vals[numVals].value = (SmPointer) twm_clientId; - prop1.vals[numVals++].length = strlen (twm_clientId); + prop1.vals[numVals].value = strdup(twm_clientId); + prop1.vals[numVals++].length = (int)strlen (twm_clientId); - prop1.vals[numVals].value = (SmPointer) "-restore"; + prop1.vals[numVals].value = strdup("-restore"); prop1.vals[numVals++].length = 8; - prop1.vals[numVals].value = (SmPointer) filename; - prop1.vals[numVals++].length = strlen (filename); + prop1.vals[numVals].value = strdup(filename); + prop1.vals[numVals++].length = (int)strlen (filename); prop1.num_vals = numVals; snprintf (discardCommand, sizeof(discardCommand), "rm %s", filename); - prop2.name = SmDiscardCommand; - prop2.type = SmARRAY8; + prop2.name = strdup(SmDiscardCommand); + prop2.type = strdup(SmARRAY8); prop2.num_vals = 1; prop2.vals = &prop2val; prop2val.value = (SmPointer) discardCommand; - prop2val.length = strlen (discardCommand); + prop2val.length = (int)strlen (discardCommand); props[0] = &prop1; props[1] = &prop2; - SmcSetProperties (smcConn, 2, props); + SmcSetProperties (smcConn2, 2, props); free (prop1.vals); bad: - SmcSaveYourselfDone (smcConn, success); + SmcSaveYourselfDone (smcConn2, success); sent_save_done = 1; if (configFile) @@ -898,16 +898,16 @@ SaveYourselfPhase2CB (SmcConn smcConn, SmPointer clientData) static void SaveYourselfCB ( - SmcConn smcConn, - SmPointer clientData, - int saveType, - Bool shutdown, - int interactStyle, - Bool fast) + SmcConn smcConn2, + SmPointer clientData _X_UNUSED, + int saveType _X_UNUSED, + Bool shutdown _X_UNUSED, + int interactStyle _X_UNUSED, + Bool fast _X_UNUSED) { - if (!SmcRequestSaveYourselfPhase2 (smcConn, SaveYourselfPhase2CB, NULL)) + if (!SmcRequestSaveYourselfPhase2 (smcConn2, SaveYourselfPhase2CB, NULL)) { - SmcSaveYourselfDone (smcConn, False); + SmcSaveYourselfDone (smcConn2, False); sent_save_done = 1; } else @@ -917,9 +917,9 @@ SaveYourselfCB ( static void -DieCB (SmcConn smcConn, SmPointer clientData) +DieCB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) { - SmcCloseConnection (smcConn, 0, NULL); + SmcCloseConnection (smcConn2, 0, NULL); XtRemoveInput (iceInputId); Done(NULL, NULL); } @@ -927,7 +927,7 @@ DieCB (SmcConn smcConn, SmPointer clientData) static void -SaveCompleteCB (SmcConn smcConnm, SmPointer clientData) +SaveCompleteCB (SmcConn smcConnm _X_UNUSED, SmPointer clientData _X_UNUSED) { ; } @@ -935,11 +935,11 @@ SaveCompleteCB (SmcConn smcConnm, SmPointer clientData) static void -ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData) +ShutdownCancelledCB (SmcConn smcConn2, SmPointer clientData _X_UNUSED) { if (!sent_save_done) { - SmcSaveYourselfDone (smcConn, False); + SmcSaveYourselfDone (smcConn2, False); sent_save_done = 1; } } @@ -947,7 +947,7 @@ ShutdownCancelledCB (SmcConn smcConn, SmPointer clientData) static void -ProcessIceMsgProc (XtPointer client_data, int *source, XtInputId *id) +ProcessIceMsgProc (XtPointer client_data, int *source _X_UNUSED, XtInputId *id _X_UNUSED) { IceConn ice_conn = (IceConn) client_data; @@ -82,10 +82,15 @@ in this Software without prior written authorization from The Open Group. #include <X11/Xmu/Error.h> #include <X11/extensions/sync.h> #include <X11/Xlocale.h> + #ifdef XPRINT #include <X11/extensions/Print.h> #endif /* XPRINT */ +#ifdef HAVE_XRANDR +#include <X11/extensions/Xrandr.h> +#endif + static void InitVariables ( void ); XtAppContext appContext; /* Xt application context */ @@ -98,6 +103,12 @@ int MultiScreen = TRUE; /* try for more than one screen? */ int NoPrintscreens = False; /* ignore special handling of print screens? */ int NumScreens; /* number of screens in ScreenList */ int HasShape; /* server supports shape extension? */ + +#ifdef HAVE_XRANDR +int HasXrandr; /* server supports Xrandr extension? */ +int XrandrEventBase, XrandrErrorBase; +#endif + int ShapeEventBase, ShapeErrorBase; int HasSync; /* server supports SYNC extension? */ int SyncEventBase, SyncErrorBase; @@ -320,7 +331,7 @@ main(int argc, char *argv[]) if (Home == NULL) Home = "./"; - HomeLen = strlen(Home); + HomeLen = (int)strlen(Home); NoClass.res_name = NoName; NoClass.res_class = NoName; @@ -349,6 +360,9 @@ main(int argc, char *argv[]) HasShape = XShapeQueryExtension (dpy, &ShapeEventBase, &ShapeErrorBase); HasSync = XSyncQueryExtension(dpy, &SyncEventBase, &SyncErrorBase); +#ifdef HAVE_XRANDR + HasXrandr = XRRQueryExtension(dpy, &XrandrEventBase, &XrandrErrorBase); +#endif TwmContext = XUniqueContext(); MenuContext = XUniqueContext(); IconManagerContext = XUniqueContext(); @@ -375,7 +389,7 @@ main(int argc, char *argv[]) InfoLines = 0; /* for simplicity, always allocate NumScreens ScreenInfo struct pointers */ - ScreenList = calloc (NumScreens, sizeof (ScreenInfo *)); + ScreenList = calloc ((size_t)NumScreens, sizeof (ScreenInfo *)); if (ScreenList == NULL) { fprintf (stderr, "%s: Unable to allocate memory for screen list, exiting.\n", @@ -469,7 +483,7 @@ main(int argc, char *argv[]) Scr->d_depth = DefaultDepth(dpy, scrnum); Scr->d_visual = DefaultVisual(dpy, scrnum); Scr->Root = RootWindow(dpy, scrnum); - XSaveContext (dpy, Scr->Root, ScreenContext, (caddr_t) Scr); + XSaveContext (dpy, Scr->Root, ScreenContext, (XPointer) Scr); Scr->TwmRoot.cmaps.number_cwins = 1; Scr->TwmRoot.cmaps.cwins = malloc(sizeof(ColormapWindow *)); @@ -587,13 +601,13 @@ main(int argc, char *argv[]) /* * weed out icon windows */ - for (i = 0; i < nchildren; i++) { + for (i = 0; (unsigned)i < nchildren; i++) { if (children[i]) { XWMHints *wmhintsp = XGetWMHints (dpy, children[i]); if (wmhintsp) { if (wmhintsp->flags & IconWindowHint) { - for (j = 0; j < nchildren; j++) { + for (j = 0; (unsigned)j < nchildren; j++) { if (children[j] == wmhintsp->icon_window) { children[j] = None; break; @@ -608,7 +622,7 @@ main(int argc, char *argv[]) /* * map all of the non-override windows */ - for (i = 0; i < nchildren; i++) + for (i = 0; (unsigned)i < nchildren; i++) { if (children[i] && MappedNotOverride(children[i])) { @@ -856,7 +870,7 @@ RestoreWithdrawnLocation (TwmWindow *tmp) GetGravityOffsets (tmp, &gravx, &gravy); if (gravy < 0) xwc.y -= tmp->title_height; - if (bw != tmp->old_bw) { + if (bw != (unsigned)tmp->old_bw) { int xoff, yoff; if (!Scr->ClientBorderWidth) { @@ -876,7 +890,7 @@ RestoreWithdrawnLocation (TwmWindow *tmp) } mask = (CWX | CWY); - if (bw != tmp->old_bw) { + if (bw != (unsigned)tmp->old_bw) { xwc.border_width = tmp->old_bw; mask |= CWBorderWidth; } @@ -918,7 +932,7 @@ Reborder (Time time) } static void -sigHandler(int sig) +sigHandler(int sig _X_UNUSED) { XtNoticeSignal(si); } @@ -927,7 +941,7 @@ sigHandler(int sig) * cleanup and exit twm */ void -Done(XtPointer client_data, XtSignalId *si) +Done(XtPointer client_data _X_UNUSED, XtSignalId *si2 _X_UNUSED) { if (dpy) { @@ -948,7 +962,7 @@ Bool ErrorOccurred = False; XErrorEvent LastErrorEvent; static int -TwmErrorHandler(Display *dpy, XErrorEvent *event) +TwmErrorHandler(Display *dpy2, XErrorEvent *event) { LastErrorEvent = *event; ErrorOccurred = True; @@ -957,13 +971,13 @@ TwmErrorHandler(Display *dpy, XErrorEvent *event) event->error_code != BadWindow && /* watch for dead puppies */ (event->request_code != X_GetGeometry && /* of all styles */ event->error_code != BadDrawable)) - XmuPrintDefaultErrorMessage (dpy, event, stderr); + XmuPrintDefaultErrorMessage (dpy2, event, stderr); return 0; } static int -CatchRedirectError(Display *dpy, XErrorEvent *event) +CatchRedirectError(Display *dpy2 _X_UNUSED, XErrorEvent *event) { RedirectError = TRUE; LastErrorEvent = *event; @@ -212,8 +212,8 @@ typedef struct Colormaps char *scoreboard; /* conflicts between installable colortables */ } Colormaps; -#define ColormapsScoreboardLength(cm) ((cm)->number_cwins * \ - ((cm)->number_cwins - 1) / 2) +#define ColormapsScoreboardLength(cm) (size_t)((cm)->number_cwins * \ + ((cm)->number_cwins - 1) / 2) /* for each window that is on the display, one of these structures * is allocated and linked into a list @@ -355,6 +355,10 @@ extern Window ResizeWindow; /* the window we are resizing */ extern int HasShape; /* this server supports Shape extension */ extern int HasSync; /* this server supports SYNC extension */ +#ifdef HAVE_XRANDR +extern int HasXrandr; /* this server supports Xrandr extension */ +#endif + extern int PreviousScreen; extern Cursor UpperLeftCursor; @@ -410,6 +414,11 @@ extern Bool use_fontset; extern int ShapeEventBase; extern int ShapeErrorBase; +#ifdef HAVE_XRANDR +extern int XrandrEventBase; +extern int XrandrErrorBase; +#endif + #define _XA_MIT_PRIORITY_COLORS TwmAtoms[0] #define _XA_WM_CHANGE_STATE TwmAtoms[1] #define _XA_WM_STATE TwmAtoms[2] @@ -123,59 +123,59 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t xthird = (xinnerr - xinnerl) / 3; \ ythird = (yinnerb - yinnert) / 3; \ \ - r->x1 = xl; \ - r->y1 = yt; \ - r->x2 = xr; \ - r->y2 = yt; \ + r->x1 = (short)(xl); \ + r->y1 = (short)(yt); \ + r->x2 = (short)(xr); \ + r->y2 = (short)(yt); \ r++; \ \ - r->x1 = xl; \ - r->y1 = yb; \ - r->x2 = xr; \ - r->y2 = yb; \ + r->x1 = (short)(xl); \ + r->y1 = (short)(yb); \ + r->x2 = (short)(xr); \ + r->y2 = (short)(yb); \ r++; \ \ - r->x1 = xl; \ - r->y1 = yt; \ - r->x2 = xl; \ - r->y2 = yb; \ + r->x1 = (short)(xl); \ + r->y1 = (short)(yt); \ + r->x2 = (short)(xl); \ + r->y2 = (short)(yb); \ r++; \ \ - r->x1 = xr; \ - r->y1 = yt; \ - r->x2 = xr; \ - r->y2 = yb; \ + r->x1 = (short)(xr); \ + r->y1 = (short)(yt); \ + r->x2 = (short)(xr); \ + r->y2 = (short)(yb); \ r++; \ \ - r->x1 = xinnerl + xthird; \ - r->y1 = yinnert; \ - r->x2 = r->x1; \ - r->y2 = yinnerb; \ + r->x1 = (short)(xinnerl + xthird); \ + r->y1 = (short)(yinnert); \ + r->x2 = (short)(r->x1); \ + r->y2 = (short)(yinnerb); \ r++; \ \ - r->x1 = xinnerl + (2 * xthird); \ - r->y1 = yinnert; \ - r->x2 = r->x1; \ - r->y2 = yinnerb; \ + r->x1 = (short)(xinnerl + (2 * xthird)); \ + r->y1 = (short)(yinnert); \ + r->x2 = (short)(r->x1); \ + r->y2 = (short)(yinnerb); \ r++; \ \ - r->x1 = xinnerl; \ - r->y1 = yinnert + ythird; \ - r->x2 = xinnerr; \ - r->y2 = r->y1; \ + r->x1 = (short)(xinnerl); \ + r->y1 = (short)(yinnert + ythird); \ + r->x2 = (short)(xinnerr); \ + r->y2 = (short)(r->y1); \ r++; \ \ - r->x1 = xinnerl; \ - r->y1 = yinnert + (2 * ythird); \ - r->x2 = xinnerr; \ - r->y2 = r->y1; \ + r->x1 = (short)(xinnerl); \ + r->y1 = (short)(yinnert + (2 * ythird)); \ + r->x2 = (short)(xinnerr); \ + r->y2 = (short)(r->y1); \ r++; \ \ if (lastTH != 0) { \ - r->x1 = xl; \ - r->y1 = yt + lastTH; \ - r->x2 = xr; \ - r->y2 = r->y1; \ + r->x1 = (short)(xl); \ + r->y1 = (short)(yt + lastTH); \ + r->x2 = (short)(xr); \ + r->y2 = (short)(r->y1); \ r++; \ } \ } @@ -198,7 +198,7 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t if (r != outline) { - XDrawSegments(dpy, root, Scr->DrawGC, outline, r - outline); + XDrawSegments(dpy, root, Scr->DrawGC, outline, (int)(r - outline)); } } @@ -259,17 +259,17 @@ char * ExpandFilename(const char *name) { char *newname; + int retval; if (name[0] != '~') return strdup(name); - asprintf(&newname, "%s/%s", Home, &name[1]); - if (!newname) { + retval = asprintf(&newname, "%s/%s", Home, &name[1]); + if (retval == -1 || !newname) { fprintf (stderr, "%s: unable to allocate %ld bytes to expand filename %s/%s\n", - ProgramName, HomeLen + (unsigned long)strlen(name) + 2, + ProgramName, (unsigned long)HomeLen + (unsigned long)strlen(name) + 2, Home, &name[1]); } - return newname; } @@ -325,7 +325,7 @@ FindBitmap (const char *name, unsigned *widthp, unsigned *heightp) { TBPM_QUESTION, CreateQuestionPixmap }, }; - for (i = 0; i < (sizeof pmtab)/(sizeof pmtab[0]); i++) { + for (i = 0; (size_t)i < (sizeof pmtab)/(sizeof pmtab[0]); i++) { if (XmuCompareISOLatin1 (pmtab[i].name, name) == 0) return (*pmtab[i].proc) (widthp, heightp); } @@ -520,13 +520,13 @@ GetColor(int kind, Pixel *what, const char *name) if (stdcmap) { color.pixel = (stdcmap->base_pixel + ((Pixel)(((float)color.red / 65535.0) * - stdcmap->red_max + 0.5) * + (double)stdcmap->red_max + 0.5) * stdcmap->red_mult) + ((Pixel)(((float)color.green /65535.0) * - stdcmap->green_max + 0.5) * + (double)stdcmap->green_max + 0.5) * stdcmap->green_mult) + ((Pixel)(((float)color.blue / 65535.0) * - stdcmap->blue_max + 0.5) * + (double)stdcmap->blue_max + 0.5) * stdcmap->blue_mult)); } else { fprintf (stderr, "%s: unable to allocate color \"%s\"\n", @@ -563,20 +563,9 @@ GetColorValue(int kind, XColor *what, const char *name) } } -/* - * The following functions are sensible to 'use_fontset'. - * When 'use_fontset' is True, - * - XFontSet-related internationalized functions are used - * so as multibyte languages can be displayed. - * When 'use_fontset' is False, - * - XFontStruct-related conventional functions are used - * so as 8-bit characters can be displayed even when - * locale is not set properly. - */ -void -GetFont(MyFont *font) +static Boolean +FindFontSet(MyFont *font, const char *fontname) { - const char *deffontname = "fixed"; char **missing_charset_list_return; int missing_charset_count_return; char *def_string_return; @@ -593,13 +582,11 @@ GetFont(MyFont *font) XFreeFontSet(dpy, font->fontset); } - if( (font->fontset = XCreateFontSet(dpy, font->name, + if( (font->fontset = XCreateFontSet(dpy, fontname, &missing_charset_list_return, &missing_charset_count_return, &def_string_return)) == NULL) { - fprintf (stderr, "%s: unable to open fontset \"%s\"\n", - ProgramName, font->name); - exit(1); + return False; } for(i=0; i<missing_charset_count_return; i++){ printf("%s: warning: font for charset %s is lacking.\n", @@ -617,29 +604,52 @@ GetFont(MyFont *font) font->y = ascent; font->ascent = ascent; font->descent = descent; - return; + return True; } if (font->font != NULL) XFreeFont(dpy, font->font); - if ((font->font = XLoadQueryFont(dpy, font->name)) == NULL) + if ((font->font = XLoadQueryFont(dpy, fontname)) == NULL) { - if (Scr->DefaultFont.name) { - deffontname = Scr->DefaultFont.name; - } - if ((font->font = XLoadQueryFont(dpy, deffontname)) == NULL) - { - fprintf (stderr, "%s: unable to open fonts \"%s\" or \"%s\"\n", - ProgramName, font->name, deffontname); - exit(1); - } - + return False; } font->height = font->font->ascent + font->font->descent; font->y = font->font->ascent; font->ascent = font->font->ascent; font->descent = font->font->descent; + return True; +} + +/* + * The following functions are sensible to 'use_fontset'. + * When 'use_fontset' is True, + * - XFontSet-related internationalized functions are used + * so as multibyte languages can be displayed. + * When 'use_fontset' is False, + * - XFontStruct-related conventional functions are used + * so as 8-bit characters can be displayed even when + * locale is not set properly. + */ +void +GetFont(MyFont *font) +{ + const char *deffontname = "fixed"; + + if (!FindFontSet(font, font->name)) { + const char *what = "fonts"; + + if (use_fontset) { + what = "fontsets"; + } else if (Scr->DefaultFont.name) { + deffontname = Scr->DefaultFont.name; + } + if (!FindFontSet(font, deffontname)) { + fprintf (stderr, "%s: unable to open %s \"%s\" or \"%s\"\n", + ProgramName, what, font->name, deffontname); + exit(1); + } + } } int @@ -657,25 +667,25 @@ MyFont_TextWidth(MyFont *font, const char *string, int len) } void -MyFont_DrawImageString(Display *dpy, Drawable d, MyFont *font, GC gc, +MyFont_DrawImageString(Display *dpy2, Drawable d, MyFont *font, GC gc, int x, int y, const char *string, int len) { if (use_fontset) { - XmbDrawImageString(dpy, d, font->fontset, gc, x, y, string, len); + XmbDrawImageString(dpy2, d, font->fontset, gc, x, y, string, len); return; } - XDrawImageString (dpy, d, gc, x, y, string, len); + XDrawImageString (dpy2, d, gc, x, y, string, len); } void -MyFont_DrawString(Display *dpy, Drawable d, MyFont *font, GC gc, +MyFont_DrawString(Display *dpy2, Drawable d, MyFont *font, GC gc, int x, int y, const char *string, int len) { if (use_fontset) { - XmbDrawString(dpy, d, font->fontset, gc, x, y, string, len); + XmbDrawString(dpy2, d, font->fontset, gc, x, y, string, len); return; } - XDrawString (dpy, d, gc, x, y, string, len); + XDrawString (dpy2, d, gc, x, y, string, len); } void @@ -701,19 +711,19 @@ MyFont_ChangeGC(unsigned long fix_fore, unsigned long fix_back, * not XFree(). */ Status -I18N_FetchName(Display *dpy, Window w, char **winname) +I18N_FetchName(Display *dpy2, Window w, char **winname) { int status; XTextProperty text_prop; char **list; int num; - status = XGetWMName(dpy, w, &text_prop); + status = XGetWMName(dpy2, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) { *winname = NULL; return 0; } - status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); + status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num); if (status < Success || !num || !*list) { *winname = NULL; return 0; @@ -725,16 +735,16 @@ I18N_FetchName(Display *dpy, Window w, char **winname) } Status -I18N_GetIconName(Display *dpy, Window w, char **iconname) +I18N_GetIconName(Display *dpy2, Window w, char **iconname) { int status; XTextProperty text_prop; char **list; int num; - status = XGetWMIconName(dpy, w, &text_prop); + status = XGetWMIconName(dpy2, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) return 0; - status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); + status = XmbTextPropertyToTextList(dpy2, &text_prop, &list, &num); if (status < Success || !num || !*list) return 0; XFree(text_prop.value); *iconname = (char *)strdup(*list); @@ -773,10 +783,10 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp) if (Scr->tbpm.xlogo == None) { GC gc, gcBack; - Scr->tbpm.xlogo = XCreatePixmap (dpy, Scr->Root, h, h, 1); + Scr->tbpm.xlogo = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1); gc = XCreateGC (dpy, Scr->tbpm.xlogo, 0L, NULL); XSetForeground (dpy, gc, 0); - XFillRectangle (dpy, Scr->tbpm.xlogo, gc, 0, 0, h, h); + XFillRectangle (dpy, Scr->tbpm.xlogo, gc, 0, 0, (unsigned)h, (unsigned)h); XSetForeground (dpy, gc, 1); gcBack = XCreateGC (dpy, Scr->tbpm.xlogo, 0L, NULL); XSetForeground (dpy, gcBack, 0); @@ -785,8 +795,8 @@ CreateXLogoPixmap (unsigned *widthp, unsigned *heightp) * draw the logo large so that it gets as dense as possible; then white * out the edges so that they look crisp */ - XmuDrawLogo (dpy, Scr->tbpm.xlogo, gc, gcBack, -1, -1, h + 2, h + 2); - XDrawRectangle (dpy, Scr->tbpm.xlogo, gcBack, 0, 0, h - 1, h - 1); + XmuDrawLogo (dpy, Scr->tbpm.xlogo, gc, gcBack, -1, -1, (unsigned)(h + 2), (unsigned)(h + 2)); + XDrawRectangle (dpy, Scr->tbpm.xlogo, gcBack, 0, 0, (unsigned)(h - 1), (unsigned)(h - 1)); /* * done drawing @@ -814,34 +824,34 @@ CreateResizePixmap (unsigned *widthp, unsigned *heightp) /* * create the pixmap */ - Scr->tbpm.resize = XCreatePixmap (dpy, Scr->Root, h, h, 1); + Scr->tbpm.resize = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1); gc = XCreateGC (dpy, Scr->tbpm.resize, 0L, NULL); XSetForeground (dpy, gc, 0); - XFillRectangle (dpy, Scr->tbpm.resize, gc, 0, 0, h, h); + XFillRectangle (dpy, Scr->tbpm.resize, gc, 0, 0, (unsigned)h, (unsigned)h); XSetForeground (dpy, gc, 1); lw = h / 16; if (lw == 1) lw = 0; - XSetLineAttributes (dpy, gc, lw, LineSolid, CapButt, JoinMiter); + XSetLineAttributes (dpy, gc, (unsigned)lw, LineSolid, CapButt, JoinMiter); /* * draw the resize button, */ w = (h * 2) / 3; - points[0].x = w; + points[0].x = (short)w; points[0].y = 0; - points[1].x = w; - points[1].y = w; + points[1].x = (short)w; + points[1].y = (short)w; points[2].x = 0; - points[2].y = w; + points[2].y = (short)w; XDrawLines (dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin); w = w / 2; - points[0].x = w; + points[0].x = (short)w; points[0].y = 0; - points[1].x = w; - points[1].y = w; + points[1].x = (short)w; + points[1].y = (short)w; points[2].x = 0; - points[2].y = w; + points[2].y = (short)w; XDrawLines (dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin); /* @@ -867,11 +877,11 @@ CreateDotPixmap (unsigned *widthp, unsigned *heightp) GC gc; Pixmap pix; - pix = Scr->tbpm.delete = XCreatePixmap (dpy, Scr->Root, h, h, 1); + pix = Scr->tbpm.delete = XCreatePixmap (dpy, Scr->Root, (unsigned)h, (unsigned)h, 1); gc = XCreateGC (dpy, pix, 0L, NULL); - XSetLineAttributes (dpy, gc, h, LineSolid, CapRound, JoinRound); + XSetLineAttributes (dpy, gc, (unsigned)h, LineSolid, CapRound, JoinRound); XSetForeground (dpy, gc, 0L); - XFillRectangle (dpy, pix, gc, 0, 0, h, h); + XFillRectangle (dpy, pix, gc, 0, 0, (unsigned)h, (unsigned)h); XSetForeground (dpy, gc, 1L); XDrawLine (dpy, pix, gc, h/2, h/2, h/2, h/2); XFreeGC (dpy, gc); @@ -929,16 +939,16 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp) h = 1; if (w < 1) w = 1; - *widthp = w; - *heightp = h; + *widthp = (unsigned)w; + *heightp = (unsigned)h; if (Scr->tbpm.menu == None) { Pixmap pix; GC gc; - pix = Scr->tbpm.menu = XCreatePixmap (dpy, Scr->Root, w, h, 1); + pix = Scr->tbpm.menu = XCreatePixmap (dpy, Scr->Root, (unsigned)w, (unsigned)h, 1); gc = XCreateGC (dpy, pix, 0L, NULL); XSetForeground (dpy, gc, 0L); - XFillRectangle (dpy, pix, gc, 0, 0, w, h); + XFillRectangle (dpy, pix, gc, 0, 0, (unsigned)w, (unsigned)h); XSetForeground (dpy, gc, 1L); ix = 1; iy = 1; @@ -952,10 +962,10 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp) bw = 1; tw = mw - bw * 2; th = mh - bw * 2; - XFillRectangle (dpy, pix, gc, ix, iy, mw, mh); - XFillRectangle (dpy, pix, gc, ix + iw - mw, iy + ih - mh, mw, mh); + XFillRectangle (dpy, pix, gc, ix, iy, (unsigned)mw, (unsigned)mh); + XFillRectangle (dpy, pix, gc, ix + iw - mw, iy + ih - mh, (unsigned)mw, (unsigned)mh); XSetForeground (dpy, gc, 0L); - XFillRectangle (dpy, pix, gc, ix+bw, iy+bw, tw, th); + XFillRectangle (dpy, pix, gc, ix+bw, iy+bw, (unsigned)tw, (unsigned)th); XSetForeground (dpy, gc, 1L); lw = tw / 2; if ((tw & 1) ^ (lw & 1)) @@ -975,7 +985,7 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp) dly = lh / (lines - 1); while (lines--) { - XFillRectangle (dpy, pix, gc, lx, ly, lw, bw); + XFillRectangle (dpy, pix, gc, lx, ly, (unsigned)lw, (unsigned)bw); ly += dly; } XFreeGC (dpy, gc); @@ -984,7 +994,7 @@ CreateMenuIcon (int height, unsigned *widthp, unsigned *heightp) } void -Bell(int type, int percent, Window win) +Bell(int type _X_UNUSED, int percent, Window win _X_UNUSED) { #ifdef XKB XkbStdBell(dpy, win, percent, type); |