Commit Graph

66 Commits

Author SHA1 Message Date
Jon Turney a588e6f81b hw/xwin: Rename WM_WM_MAP{2,3} to WM_WM_MAP_{UN,}MANAGED
WM_WM_MAP was removed in 52e05b92

Rename WM_WM_MAP2 as WM_WM_MAP_UNMANAGED (meaning an override-redirect
window, which manages it's own activation)

Rename WM_WM_MAP3 as WM_WM_MAP_MANAGED (meaning a normal window, which
is activated when clicked)
2019-07-21 14:44:23 +01:00
Jon Turney 2afee831a4 hw/xwin: Add an option to use alpha channel in multiwindow mode
Add an option to turn on the use of the X window's alpha channel in
multiwindow mode, i.e. this uses the X window's alpha channel for
compositing into the native desktop.

This works on W7/Vista (using DwmEnableBlurBehindWindow()), and Windows
10 (using the undocumented SetWindowCompositionAttribute()), but not on
Windows 8/8.1

-compositewm must be enabled for this to be useful, as we only have a
pixmap with an alpha channel for the X window in that case.  The
framebuffer/root window doesn't have one (unless perhaps you are using
the rootless extension, maybe...).

v2:
Update meson.build

Future work:

A window property to control use of alpha?
Option to turn off blur on W7/Vista
Implement _NET_WM_WINDOW_OPACITY
2019-06-17 21:56:35 +00:00
Jon Turney 2e1bc74373 hw/xwin: Set convenience variables for WM_CREATE as well
Set convenience variables in winTopLevelWindowProc() for WM_CREATE as
well.
2019-06-17 21:56:35 +00:00
Jon Turney adebc376b9 hw/xwin: Push multiwindow wndproc WM_PAINT down into drawing engine
Push the multiwindow wndproc WM_PAINT handling down into the drawing
engine.  Only the GDI engine is supported in multiwindow mode currently,
so we only need to do this in the GDI engine.
2019-06-17 21:56:35 +00: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 4f8661fac9 hw/xwin: printf format fixes for LONG type
Some Win32 API types are different fundamental types in the 32-bit and 64-bit
versions.

This problem is then further compounded by the fact that whilst both 32-bit
Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64
data model, but 64-bit Cygwin uses the LP64 data model.

This makes it impossible to write printf format specifiers which are correct for
all those targets

In the Win32 API, DWORD is an signed, 32-bit type.  It is defined in terms of a
long, except in the LP64 data model, where it is an int.

It should always be safe to cast it to int and use %d.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:47 +01:00
Jon TURNEY aa83c61f51 hw/xwin: printf format fixes for DWORD type
Some Win32 API types are different fundamental types in the 32-bit and 64-bit
versions.

This problem is then further compounded by the fact that whilst both 32-bit
Cygwin and 32-bit MinGW use the ILP32 data model, 64-bit MinGW uses the LLP64
data model, but 64-bit Cygwin uses the LP64 data model.

This makes it impossible to write printf format specifiers which are correct for
all those targets

In the Win32 API, DWORD is an unsigned, 32-bit type.  It is defined in terms of
an unsigned long, except in the LP64 data model, where it is an unsigned int.

It should always be safe to cast it to unsigned int and use %u or %x.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:44 +01:00
Jon TURNEY 38f340b13e hw/xwin: Remove GetTickCount() from various pieces of debugging output
The use of %d format for the DWORD return value of GetTickCount() isn't
portable, but it doesn't seem to be worth fixing it when this information isn't
very useful (and is redundant to the timestamping of log messages we now have)

Instead just remove these uses of GetTickCount()

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2015-07-07 16:52:18 +01:00
Peter Hutterer 732fd7e571 Drop trailing whitespaces
sed -i "s/[ ]\+$//g" **/*.(c|h)

happy reviewing...
git diff -w is an empty diff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-12 10:25:00 +10:00
Oliver Schmidt 3b4d472b72 hw/xwin: Minimize redraw events after resizing/moving windows in multiwindow mode
In multiwindow mode the modal moving/resizing of windows causes a lot of redraw
events to be sent to the X clients after the user releases the mouse button.
During the moving/resizing client windows are not redrawn as long as the mouse
button is pressed, but all redraw/resizing events are queued and executed step
after step after the moving/resizing ends.

Some clients collect and combine multiple redraw or resizing events, other
clients (e.g. xterm) simply execute each redraw or sizing event.

The enclosed patch minimizes the events for clients to only one event after the
user releases the mouse button to end the moving/resizing. This improves the
user experience and reduces strange screen flickerings, especially on slow
platforms.

The enclosed patch modifies winmultiwindowwndproc.c such that the windows events
WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE that are sent by Windows when the modal
window resizing/moving begins or ends are considered. Only after WM_EXITSIZEMOVE
is the redraw/resizing executed.

Signed-off-by: Oliver Schmidt <oschmidt-mailinglists@gmx.de>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2014-03-22 18:56:38 +00:00
Colin Harrison cf59f4888e hw/xwin: Fix typo in comment
Signed-off-by: Colin Harrison <colin.harrison@virgin.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2014-03-22 17:16:41 +00:00
Marc Haesen 3752a81580 hw/xwin: Remove unnecessary and incorrect HWND casts
Signed-off-by: Marc Haesen <marha@users.sourceforge.net>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-08-30 14:22:22 +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 71b5f56302 hw/xwin: Handle WM_MOUSEHWHEEL
Handle WM_MOUSEHWHEEL tilt wheel messages, similarly to WM_MOUSEWHEEL scroll
wheel messages, to generate X button 6 and 7 presses and releases.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-07-23 23:59:27 +01:00
Jon TURNEY cf9c777ee0 hw/xwin: Map extra mouse buttons 1 and 2 to X buttons 8 and 9
Map extra mouse buttons 1 and 2 to X buttons 8 and 9, as conventional, leaving X
buttons 6 and 7 for tilt wheel.

Also add button labels for buttons 6, 7, 8 and 9 and change btn_labels in from a
dynamic allocation to a fixed one of the required size for all the labels we
use.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-07-23 23:59:24 +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 d6dcde7a03 hw/xwin: Stop assuming WS_EX_APPWINDOW style in WM_SHOWWINDOW
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-01-16 16:50:39 +00:00
Jon TURNEY 066ecbd11d hw/xwin: Move reshape code from winUpdateWindowPosition() to the map event handler
Move reshape code, which was only used when handling a map event, from
winUpdateWindowPosition(), to put it explicitly in the map event handler.

Remove 'reshape' parameter from winUpdatePosition().

(Note that there's no handling of the ShapeNotify event to notice when the
window shape changes, instead we hook the screen SetShape procedure and reshape
the native window then)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2013-01-16 16:49:15 +00:00
Yaakov Selkowitz ea1d76d1b6 Fix formatting of address operators
The formatter confused address operators preceded by casts with
bitwise-and expressions, placing spaces on either side of both.
That syntax isn't used by ordinary address operators, however,
so fix them for consistency.

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2012-12-05 18:09:48 -06:00
Tobias Häußler 8aa27ae821 hw/xwin: Add correct taskbar grouping of X windows on Windows 7
I created a small patch for XWin that adds correct grouping of taskbar icons
when 'Always combine, hide labels' is set in the taskbar properties. It uses the
new taskbar APIs introduced in Windows 7 to set an application id for each
window. The id is based on the X11 class hints.

v2: Add file to _SOURCES to fix distcheck

v3 : Fix compilation with mingw-w64 w32api headers
Include propkey.h, propsys.h rather than defining necessary stuff ourselves

v4: Fix up names taskbar->propertystore, AppID->AppUserModelID, etc.
Link directly with ole32 for PropVariantClear(), prototyping it if neccessary.

v5: Put winSetAppUserModelID()-related code in a separate file.
Drop a superfluous assign to hr of ignored HRESULT of SetValue()

Signed-off-by: Tobias Häußler <tobias.haeussler@gmx.de>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-11-27 16:08:22 +00: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
Jon TURNEY bea6fb6c7a hw/xwin: Avoid WIN_WINDOW_PROP races during Windows window destruction
The WIN_WINDOW_PROP is removed during WM_DESTROY handling, so it is not neccessary to
remove it in winDestroyWindowsWindow(), and doing so opens a race condition, as we may
attempt to access that property in the wndproc before the WM_DESTROY has completed.

A specific example of that race is if a WM_KILLFOCUS occurs in the window between property
removal and WM_DESTROY processing, where we will attempt to apply DeleteWindowFromAnyEvents()
on an invalid (null) WindowPtr.

Also guard against null WindowPtr in the WM_KILLFOCUS handler

See http://cygwin.com/ml/cygwin-xfree/2012-01/msg00009.html

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-01-26 14:40:31 +00:00
Jon TURNEY c0f3709501 hw/xwin: In multiwindow mode, don't grab native input focus for new windows which hint they don't want it
In multiwindow mode, avoid grabbing the input focus for newly
created windows which have InputHint FALSE

(this is used by e.g. glean to avoid every test window grabbing
the focus)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2012-01-26 14:40:23 +00:00
Jon TURNEY ee19853867 hw/xwin: Link directly to TrackMouseEvent()
TrackMouseEvent has existed in user32 since at least NT4, so
don't bother with jumping through all the ancient compatibility hoops
of finding if _TrackMouseEvent() exists in comctl32 so it can check
if TrackMouseEvent() exists in user32 to see if it needs to emulate
it...

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
2011-11-02 14:05:34 +00:00
Jon TURNEY b0b54338e2 hw/xwin: Add a flag to track which windows have been drawn to using WGL.
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2011-07-07 18:03:42 +01:00
Jon TURNEY e78628406f Cygwin/X: Preserve client area size and position on Windows window style change
When the style changes, adjust the window size so the client area remains the same.

Otherwise the window size may change when sizing is reflected from Windows to X, and
some windows are drawn expecting them to be exactly the requested size (e.g. the
gmplayer control window)

Use DeferWindowPos to delay the resize to preserve client area on WM_STYLECHANGING
until after the style change has actually happened in WM_STYLECHANGED

As a consquence of this, we need to be more careful to create windows with exactly
the requested placement and client area initially, so the client area matches what
the X client requested

Also synchronize the X windows idea of the placement of a window which Windows is
allowed to place

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-06-29 19:14:35 +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
Colin Harrison 83d120b904 Xming: Fix various 'ISO C90 forbids mixed declarations and code' warnings
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-10-14 20:28:11 +01:00
Colin Harrison a49ae50370 Xming: Apply window style hints in -multiwindow mode
Remove frames from 'dock' windows and make them topmost in -multiwindow mode.
Remove frames from windows with MOTIF_WM_HINTS of no decorations in -multiwindow mode.
Apply some _NET_WM_STATE hints in -multiwindow mode.
Apply window styles overrides from .rc file
Correctly update region of shaped windows when applying styles

Copyright (C) Colin Harrison 2005-2009
http://www.straightrunning.com/XmingNotes/
http://sourceforge.net/projects/xming/
2009-07-03 11:19:38 +01:00
Jon TURNEY 638ca9a7a2 Cygwin/X: Avoid a visual glitch on window move in rootless modes
Handle and ignore WM_ERASEBKGND since we repaint the entire invalidated region anyhow
(this avoids a white flickering on window resize)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-06-29 17:54:40 +01:00
Jon TURNEY 85614946ba Cygwin/X: Improve mouse tracking for moving/resizing undecorated windows
In -multiwindow mode, tell Windows we wish to capture the mouse when a button
is down.  This causes Windows to continue to send movement events for the mouse
even if the mouse pointer moves outside the window frame.

This helps greatly with undecorated windows which have regions you can grab
to move (e.g. gmplayer, xine control panels) or resize (e.g. Songbird) the
window, as it means the window continues to receive the mouse motion even if the
mouse pointer  moves out of the window (which presumably happens if we don't
manage to update the window fast enough to track the mouse pointer)

Consolidate the multiple instances of the code to start the mouse position
polling timer into a new function winStartMousePolling(), and use that to
restart the polling timer when we release the mouse.

Also, start the timer on WM_SHOW, so that xeyes will track the mouse position
when it is first shown, even if the mouse doesn't enter it's window
(You probably need focus-stealing turned off to see this problem)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-06-29 17:54:35 +01:00
Colin Harrison 4ec110327b Xming: Prevent the mouse wheel from stalling when another window is minimized.
Fix internal WM to prevent the mouse wheel from stalling when another window is minimized.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-05-27 14:11:54 +01:00
Jon TURNEY 888e6961a4 Cygwin/X: Correctly allow for the native window frame width in ValidateSizing()
Fix internal WM to correctly calculate the native window border when validating window sizing

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-05-27 14:11:36 +01:00
Colin Harrison 847a91ad2e Xming: Notify X when the keyboard focus is lost to a pure Windows window in -multiwindow mode.
Fix internal WM to notify X when the keyboard focus is lost to a pure Windows window in -multiwindow mode.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-01-19 14:49:08 +00:00
Colin Harrison 6c3e7e4d05 Xming: Only allow WM_MOUSEWHEEL messages to act on the client area of a focused window.
Fix internal WM so it only allows WM_MOUSEWHEEL messages to act on the client area of a focused window.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-01-19 14:48:38 +00:00
Colin Harrison d84e0e3877 Xming: Correctly parent XA_WM_TRANSIENT_FOR windows in -multiwindow mode when a windows window is created.
Fix internal WM to correctly parent XA_WM_TRANSIENT_FOR windows in -multiwindow mode when a windows window is created,
and to de-iconize parent windows when a child window acquires focus.

XXX: Perhaps we should also shuffle parent(s) forward through Z-order when a child acquires focus?

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2009-01-19 14:48:07 +00:00
Colin Harrison 6f065a26db Xming: Reduce MOUSE_POLLING_INTERVAL
Reduce MOUSE_POLLING_INTERVAL from 500ms to 50ms

In -multiwindow mode, this determines how quickly X windows can track the mouse
when it is outside any X window... Move the cursor around an xeyes, and you will
see what this timing effects.
2009-01-15 21:49:52 +00:00
Jon TURNEY 35d7602830 Cygwin/X: enqueue a pointer motion event on mouse movement
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2008-12-17 13:37:38 +00:00
Jon TURNEY bca7483c4e Cygwin/X: update for MPX device changes
Bring Cygwin/X up to date with MPX device API changes

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2008-12-17 13:37:36 +00:00
Eamon Walsh 4017d31902 devPrivates rework: since API is already broken, switch everything
over to new system.

Need to update documentation and address some remaining vestiges of
old system such as CursorRec structure, fb "offman" structure, and
FontRec privates.
2007-08-28 09:28:25 -04:00
Colin Harrison 178d426311 Missing piece from bug 9808 2007-05-11 10:08:42 +01:00
Colin Harrison be44018a3c Fix bad use of hwnd (bug: 9808) 2007-05-09 16:55:09 +01:00
Alan Hourihane ce4a0a4dda Apply patch in bug #7919, blit improvements in
multiwindow mode for Xming/CygwinX
2006-08-24 13:56:22 +01:00
Alan Hourihane a1a8e4f7f5 Fix bug #7280, round title corner background
should be transparent not black in Xming/CygwinX
(Colin Harrison)
2006-08-18 09:08:12 +01:00
Adam Jackson 0aaac95b0d Remove RCS tags. Fix Xprint makefile braindamage. 2006-07-21 17:56:00 -04:00
Alan Hourihane 29237c1977 https://bugs.freedesktop.org/show_bug.cgi?id=4538 Fix mouse button release
on multiwindows scrolling.
2006-03-03 09:50:55 +00:00
Alexander Gottwald 0bb2eb8eaa Fix problem with fake Control press on Alt-Gr
https://bugs.freedesktop.org/show_bug.cgi?id=3680
    https://bugs.freedesktop.org/show_bug.cgi?id=3497
Fix static declaration of winGetBaseDir
2005-07-05 15:43:20 +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 1230c55ac3 Pass serverClient instead of NULL to ConfigureWindow. This should fix a
crash reported by Øyvind Harboe
2005-06-30 18:50:20 +00:00
Alexander Gottwald 0d206e177f Backout last winRaiseWindow patch which caused stacking problems 2005-06-03 08:12:22 +00:00