Commit Graph

38 Commits

Author SHA1 Message Date
Alan Coopersmith 23e83724df Fix spelling/wording issues
Most (but not all) of these were found by using
  codespell --builtin clear,rare,usage,informal,code,names
but not everything reported by that was fixed.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2020-07-05 13:07:33 -07:00
Jon Turney bcf2dd0cd2 hw/xwin: Add -icon option to set the screen window icon in windowed mode
Add an -icon option to set the screen window icon in windowed mode

Allow cygwin paths in an icon-specification

Update man pages and system.XWinrc appropriately

Also, log an error if the icon specified for TRAYICON cannot be loaded

Also, fix a bug in appending a '\' to IconDirectory only if it doesn't
already end with one, which was fortunately benign.

Note: LoadImageComma would be simpler if we just stated that XWinrc
paths are Cygwin paths on Cygwin, Windows paths on MinGW, but that could
break existing .XWinrc files

Note: Given that we can specify paths in an icon-specifier, I'm not sure
what IconDirectory wins us.

v2:
Fix formatting problems in man page additions

v3:
Fix some more s/_/@/g in man pages
2019-09-18 19:11:45 +00:00
Emil Velikov 8f1a200d0b xwin: remove always true/set XWIN_MULTIWINDOW conditional/define
v2: drop trailing endif (Jon)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-08-22 10:59:41 -04:00
Jon Turney 0a0c1bd932 hw/xwin: Fix a crash trying to reload window icons when not in multiwindow mode
ReloadEnumWindowsProc() accesses window privates, which are only valid in
multiwindow mode, but is called in all modes.

Fix this potential crash by not doing this unless in multiwindow mode.

Reproduction steps:
1/ XWin -mwextwm
2/ Run a client which creates an X window e.g. xterm
3/ Right click on notification area icon, and choose 'Reload .XWinrc' from the menu

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2016-06-28 14:29:30 +01:00
Jon Turney 6a64b9d7af hw/xwin: xcbify code for converting X11 icon to Win32 icon
Convert the code for converting an X11 icon to Win32 icon from Xlib to xcb.

v2: some warning fixes in winXIconToHICON()
v3: declaration-after-statement warning fixes
v4: printf format fixes
v5: convert in place rather than in a library

This also avoids the xlib/xserver namespace collision issues, so
winmultiwindowicons.h can be included everywhere it should be, which fixes
compilation with -Werror=implicit-function-declaration

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2016-04-07 10:30:48 +01:00
Jon TURNEY f0f0c92a08 hw/xwin: Fix const warning in winPrefsLoadPreferences()
winprefs.c:643:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2014-10-09 16:34:12 +01:00
Jon TURNEY 16d9da0886 hw/xwin: Improve choice of display name used by internal clients
Choose the display name used to connect to internal clients and exported into
environment of processes started from the traymenu so that it uses a transport
we know is working

This should mean the server can start correctly with -multiwindow and/or
-clipboard and any two of -nolisten inet6, -nolisten inet and -nolisten unix
(the server will correctly refuse to start if all 3 are used, as it must be
listening on at least one socket)

v2:
Place prototype for winGetDisplayName() in windisplay.h, and include it where
needed.

v3:
Include xwin-config.h, so that _XSERVER64 is defined, just in case anything
relies on that.

v4:
Replace grovelling around in the server's list of listeners with new Xtrans
TransIsListening() interface, added in Xtrans 1.3.3

See also [1]

[1] https://sourceware.org/bugzilla/show_bug.cgi?id=10725

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2014-08-29 13:28:00 +01:00
Colin Harrison 390cfec10e hw/xwin: Correct winprefs.c function signatures for x64.
Correct SetupRootMenu(), SetupSysMenu(), HandleCustomWM_INITMENU() and
HandleCustomWM_COMMAND() function signatures which use unsigned long parameters,
where just a specific HWND or HMENU handle type should have been used.

Signed-off-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Marc Haesen <marha@users.sourceforge.net>
2013-08-30 12:56:35 +01:00
Jon TURNEY 689e7ad9b0 hw/xwin: Win32 Windows properties are of pointer type HANDLE, not an integer type
Win32 Windows properties are of pointer type HANDLE, not an integer type, but we
use the Windows property WINDOW_WID_PROP to store the X window XID.

Add appropriate casts to show it doesn't matter that an XID is smaller than a
pointer on 64-bit build.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-06-10 15:48:31 +01:00
Jon TURNEY be201ac257 hw/xwin: Change winIconIsOverride() to take a HICON parameter
Change winIconIsOverride() to take a HICON parameter, so some unneccessary
casts, which weren't portable to 64-bit Cygwin, can be removed.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-06-10 15:25:44 +01:00
Colin Harrison 74735c5ebf hw/xwin: fmemopen is available on cygwin but not MinGW
This is a follow-up to commit 0659437f5e.

Signed-off-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
2012-10-29 12:22:07 +00:00
Jon TURNEY 97c9ed026a hw/xwin: Fix shadowed local variable i in HandleCustomWM_COMMAND()
Fix shadowed local variable i in HandleCustomWM_COMMAND()

Also, fds are meant to be representable as an int

winprefs.c: In function ‘HandleCustomWM_COMMAND’:
winprefs.c:346:23: error: declaration of ‘i’ shadows a previous local
winprefs.c:322:7: error: shadowed declaration is here

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-10-16 21:26:11 +01:00
Jon TURNEY 21faee4b38 hw/xwin: Fix using index as a local variable shadows index()
Using index as a local variable shadows index() from strings.h

winprefs.c: In function ‘LoadImageComma’:
winprefs.c:574:7: error: declaration of ‘index’ shadows a global declaration

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-10-16 21:23:05 +01:00
Jon TURNEY 4231b9541c hw/xwin: Fix redundant declaration in winprefs.c
winprefs.c:63:14: error: redundant redeclaration of ‘display’
../../include/opaque.h:52:14: note: previous declaration of ‘display’ was here

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-10-16 21:16:55 +01:00
Jon TURNEY 527cf13135 hw/xwin: Make winOverrideIcon() thread-safe for icon data access
winOverrideIcon() is called from the internal WM client thread.

Accessing server-internal data structures to get icon data or window hints is
not safe, as there is no lock to ensure we do not collide with these data
structures being updated in the server thread.

Rewrite so the internal client thread uses X client calls to obtain this data
safely

We used to also set the icon inside the server when the window was initially
created.  For simplicity, we simply send a message to the internal WM to update
the icon when the window is created (rather than writing different icon update
code which can work in the server thread for that one case...)

extwm mode used to do the icon update in the server. I'm not sure that actually
made much sense.  Let's assume the external WM client can do it instead...

v2
Make sure that WM_WM_ICON_EVENT does nothing for override-redirect windows

v3
Reinstate check that native window actually has expected properties for an X
window before trying to update it's icon; some auxiliary windows owned by the
XWin process don't, which would cause a crash

v4
Various fixes to pixmap icon conversion:
- remove left-over malloc in winScaleXimageToWindowsIcon causing a memory leak
- don't recalculate DDBitmap stride in winScaleXimageToWindowsIcon, when we already have worked it out
- properly check that XGetWindowProperty(NET_WM_ICON) returned some data
- don't try to retrieve WM_HINTS icon_mask if it isn't set
- restore accidentally dropped calculation of effBpp, stride, maskStride of output DDBitmap
- make sure imageMask is zero-initalized before we use it to mask the DDBitmap

v5
Remove a left-over unused variable

v6
Avoid XDestroyImage(NULL) crash if XGetImage failed for icon_pixmap

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-08-03 22:47:42 +01:00
Keith Packard 9838b7032e Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Daniel Stone <daniel@fooishbar.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-03-21 13:54:42 -07:00
Yaakov Selkowitz 0659437f5e hw/xwin: Improve XWinrc loading and error recovery
If $HOME/.XWinrc is present but badly formed, ignore it and try
system.XWinrc instead.  If neither file is present or both are badly
formed, provide a built-in default which gives the user the chance to
load their new or fixed configuration without restarting.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-01-26 14:10:12 +00:00
Jon TURNEY ce6136f8c5 Cygwin/X: Make winOverrrideStyle() thread-safe
Make winOverrrideStyle() thread-safe

winOverrideStyle() is called from the internal WM client thread.

Accessing server-internal data structures to get window name and
class is not safe, as there is no lock to ensure we do not collide
with these data structures being updated in the server thread.

Rewrite so the internal client thread uses X client calls to
obtain this data safely

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Tested-by: Colin Harrison <colin.harrison@virgin.net>
2011-04-27 14:24:17 +01:00
Jon TURNEY 25801a2556 Cygwin/X: Move duplicate extern variable declarations from various .c files to a new header file
For the global variables defined in winglobals.c, remove duplicate extern
declarations from the beginning of various .c files, and move most of them
into a new header file, winglobals.h

Leave some clipboard related variables alone for the moment, they need treating
more carefully, to avoid mixing client and server type definitions.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2010-10-19 15:02:00 +01:00
Mikhail Gusarov 0a4d8cbdcd Remove more superfluous if(p) checks around free(p)
This patch has been generated by the following Coccinelle semantic patch:

@@
expression E;
@@

-if(E) { free(E); }
+free(E);

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br>
Reviewed-by: Matt Turner <mattst88@gmail.com>
2010-06-06 20:27:18 +07:00
Yaakov Selkowitz 11252ed82e Cygwin/X: Look for system.Xwinrc in SYSCONFDIR/X11
Look for system.Xwinrc in SYSCONFDIR/X11 (usually /etc/X11)
Rename sample system.Xwinrc file not to have a X11R6 path in it's name
Add makefile install rule for system.XWinrc

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2010-02-05 19:14:52 +00:00
Colin Harrison b3751454cb Cygwin/X: Update Get/SetWindowLong() to Get/SetWindowLongPtr() everywhere
Get/SetWindowLong() is superseded by Get/SetWindowLongPtr(), so change to
using that everywhere it remains

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-07-26 15:15:37 +01:00
Joe Krahn 996357e905 Cygwin/X: Update icons directly, rather than modifying the window's class
Update icons directly to windows rather than modifying
the window's class.  Respect custom icons overriden via
the configuration file.

fd.o bugzilla #4491

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-05-27 14:14:32 +01:00
Jon TURNEY 7c2fb098b2 Cygwin/X: Fix several prototypes to return HICON
Fix prototypes of winOverrideIcon(), winTaskbarIcon() and winOverrideDefaultIcon() to return HICON
Also use HICON type in WINPREFS stucture
Remove various casts these changes make unnecessary

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-02-12 12:04:17 +00:00
Jon TURNEY 19b3e44ce5 Cygwin/X: Fix -Wold-style-definition warnings
Fix old-style definition warnings caused by definitions with empty
parameter lists "()", which should be "(void)" to indicate the function
takes no parameters, rather than unspecified parameters

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-02-12 12:03:55 +00:00
Colin Harrison c612f0df45 Xming: Add styles keyword and attributes.
Add handling for style keyword and atttributes in .XWinrc
Update man page to document these additions

Copyright (C) Colin Harrison 2005-2008
http://www.straightrunning.com/XmingNotes/
http://sourceforge.net/projects/xming/

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-01-19 14:49:44 +00:00
Adam Jackson 4d76075dbb Death to RCS tags. 2007-06-29 14:06:52 -04:00
Alan Hourihane b2f8f410c0 https://bugs.freedesktop.org/show_bug.cgi?id=4341 Make Xming error messages
more meaningful.
2006-03-03 09:54:54 +00:00
Alexander Gottwald 508cdb5cb0 Include xwin-config.h if HAVE_XWIN_CONFIG is defined Cleanup X11 includes
handling Warning fixes
2005-07-04 22:10:43 +00:00
Alexander Gottwald 9bd1328c49 redone ddraw.h to be able to mix it with w32api style COM header files.
obj_base.h is not needed anymore. Using <objbase.h> instead.
Use Xwindows.h instead of windows.h
do not include win_ms.h
remove extra definition of sleep()
Set HOME to Documents and Settings/username if not set
Use Xming basedir instead of ProjectRoot for system.XWinrc
Fix callback functions to use wBOOL instead of BOOL
Fix compiler warnings. Added debug output.
Fix warning about undefined macro max
2004-12-05 21:24:48 +00:00
Alexander Gottwald 9826b83826 Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802 Added
mingw (Win32) port
2004-11-15 15:06:51 +00:00
Alexander Gottwald d6e8b1affe Bug 777: Merge from CYGWIN branch 2004-06-21 13:19:32 +00:00
Egbert Eich 2fb5886200 Merging XORG-CURRENT into trunk 2004-04-23 19:54:30 +00:00
Egbert Eich dae90c3af9 Importing vendor version xf86-4_4_99_1 on Sun Mar 14 00:26:39 PST 2004 2004-03-14 08:34:49 +00:00
Egbert Eich 867451f1ab Importing vendor version xf86-4_4_0 on Wed Mar 3 04:09:24 PST 2004 2004-03-03 12:12:50 +00:00
Egbert Eich df0313d35b readding XFree86's cvs IDs 2004-02-26 13:36:15 +00:00
Egbert Eich 147aae87fd Importing vendor version xf86-4_3_99_903 on Wed Feb 26 01:21:00 PST 2004 2004-02-26 09:23:53 +00:00
Kaleb Keithley 90f1536dd3 Initial revision 2003-11-25 19:29:01 +00:00