Commit Graph

97 Commits

Author SHA1 Message Date
Piotr Caban 34b108dd1d user32: Switch to normal window drawing on SetLayeredWindowAttributes call.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-19 20:02:55 +02:00
Ken Thomases 2a28e4d843 winemac: Don't set a view's frame if the backend's value hasn't changed.
With windows, the Cocoa main thread may have changed the frame and messages to
that effect may be in the queue, so it can be important to reassert the
"current" value and discard those messages.  With views, by contrast, Cocoa
will never change the frame on its own and there are no messages to discard.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-01 21:19:39 +01:00
Ken Thomases af54f956bf winemac: Don't attempt to set surface for child windows in macdrv_WindowPosChanged().
The skipped code is a no-op for the child window case, except that the call to
set_window_surface() synchronizes with the main thread, even with null arguments.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-01 21:19:39 +01:00
Ken Thomases e5a9055dac winemac: Update the clipboard when the process activates.
If another app grabbed the clipboard, that most likely happened while it was
active and the Wine process was inactive.  Our process being made active again
is a good opportunity to check for that.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-12 19:14:19 +01:00
Ken Thomases b5194d6f83 winemac: Set the parent of Cocoa views for child windows when they are created.
This fixes an oversight in commit d91e56863.  Some of the views created for
Win32 child windows were being left out of any view hierarchy.  OpenGL contexts
attached to such child windows and views were not able to render to screen,
leaving blank areas.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-02 11:43:30 +01:00
Ken Thomases fa573553bc winemac: Run a single clipboard manager thread per window station, inside the explorer process.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:10 +02:00
Hadrien Boizard 5d96ef42a5 winemac.drv: Use EqualRect() instead of memcmp() to compare RECTs.
Signed-off-by: Hadrien Boizard <h.boizard@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-04 20:33:33 +02:00
Ken Thomases 5c5eef8d40 winemac: Trace when a window's per-pixel-alpha setting changes.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-09-02 23:30:52 +09:00
Piotr Caban f68e131e88 winemac.drv: Fix setting Cocoa focus when window is shown by other thread.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-08-25 13:28:08 +09:00
Piotr Caban a04c393a73 winemac.drv: Don't assume that owner is top-level window in set_cocoa_window_properties.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-07-03 10:23:10 +09:00
Ken Thomases 053b4a81ed winemac: When a child window's client area is equal to its whole area, use a single Cocoa view for both.
This should be a common case and will reduce the number of Cocoa views.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:54 +09:00
Ken Thomases d91e568635 winemac: Mirror the hierarchy of Win32 child windows with Cocoa views.
This only really affects OpenGL child windows.  GDI rendering to the window
surface is still only blitted to the window's content view.  The descendant
views don't draw and so are transparent, letting the content view show through.

Using Cocoa views for child windows fixes a problem where changes to the
position and visibility of child GL windows didn't properly affect the Cocoa GL
view.  Hiding, showing, and moving the top-level window affected the Cocoa
window and thus, indirectly, the GL view.  Moving the child GL window itself
was propagated to the GL view, so that worked.  But hiding, showing, or moving
any of the intervening ancestors of the child GL window didn't properly affect
the GL view.  Neither did hiding or showing the child GL window itself.

This also slightly improves the clipping of the GL view by its ancestors,
although it still doesn't work quite right due to Cocoa bugs.  There are also
remaining bugs with z-order among multiple GL views and clipping by overlapping
siblings.  I hope to eventually fix those using Core Animation layers, for
which this is a prerequisite.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:54 +09:00
Ken Thomases 321a1511da winemac: Extract some logic into a new function, sync_window_z_order().
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:54 +09:00
Ken Thomases 225482f5ad winemac: Make show_window() and hide_window() tolerate being called when there's no Cocoa window.
Minor no-op refactoring that makes subsequent commits cleaner.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:54 +09:00
Ken Thomases 9372af77a5 winemac: Queue an event to reassert the WinAPI window position before Cocoa adjusts its position for a display change.
When the display mode changes such that the screen height changes, we'd like
our windows to keep their position relative to the top-left of the primary
screen.  That's how WinAPI's coordinate system works and we want the WinAPI
position of the window to not change just because the display mode changed.

Unfortunately that's not achievable in Cocoa.  Cocoa keeps the window
stationary relative to the screen it's on, not necessarily the primary screen,
and it's sometimes relative to the bottom-left and sometimes the top-left of
that screen.

So, what we do instead is queue an event to get the back end to reassert the
WinAPI position of the window.  This is queued before Cocoa can adjust the
Cocoa position of the window which would queue a WINDOW_FRAME_CHANGED to the
back end and mess up the WinAPI position.  The back end's reassertion of the
WinAPI position won't be processed by the Cocoa thread until after Cocoa has
adjusted the position and will thus override it.  It will also discard any
wrong WINDOW_FRAME_CHANGED that may have been queued.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
2015-10-06 17:21:01 +09:00
Piotr Caban a90592c8d2 winemac.drv: Release mouse capture when destroying window specified in SetCapture call. 2015-07-17 20:19:51 +09:00
Ken Thomases eea6ba9ae9 winemac: Don't process WM_EXITSIZEMOVE through filters in macdrv_window_drag_begin(). 2015-05-12 15:31:37 +09:00
Ken Thomases 8d581d0e48 winemac: Allow the user to attempt to resize a maximized window and try to restore it if they do.
OS X doesn't have the same concept of maximized windows as Windows does.
There's no mode that prevents a normally-resizable window from being resized.
If a window is "zoomed", it mostly fills the screen but the user can still
move or resize it, at which point it ceases to be in the zoomed state.  So,
users are confused and frustrated when they can't resize a window that's
maximized.

To get similar behavior while still respecting Win32 semantics, we now let the
user try to resize maximized windows.  (The resize cursors are shown at the
edges of the window frame.)  When they start, a request is submitted to the app
to restore the window.  Unless and until the window is restored, we don't
actually allow the window to change its size.

The user expects to resize the window from its current (maximized) position.
It should not jump to its normal position upon being restored.  So, we set the
window's normal position to its current position before restoring it.
2015-03-24 13:55:18 +09:00
Huw Davies bc47d4925a winemac: WS_EX_DLGMODALFRAME shouldn't prevent the window being resizeable. 2014-11-13 18:46:40 +09:00
Alexandre Julliard 6a0f3df68c user32: Don't bother returning a value from the SetWindowRgn driver entry point. 2014-05-01 12:31:14 +02:00
Ken Thomases d1f554711f winemac: Send WM_SIZING messages during resizing to let app alter the proposed size. 2014-04-24 11:37:34 +02:00
Ken Thomases 15612dd762 winemac: Make the swap interval a property of the window, not the context. 2014-03-21 11:16:58 +01:00
Ken Thomases 0d23637e0d winemac: Ignore window dragging if window is disabled, maximized, minimized, or hidden. 2014-01-29 12:39:00 +01:00
Ken Thomases a86cfc683d winemac: Reset cursor clipping and capture when window dragging begins. 2014-01-29 12:38:56 +01:00
Ken Thomases ed3ed03519 winemac: Ignore failure to send or 0 result from WM_QUERYENDSESSION if target window was destroyed. 2014-01-17 11:02:46 +01:00
Ken Thomases 94cfa7799b winemac: For WINDOW_DID_UNMINIMIZE events, don't attempt to restore windows which aren't minimized and visible.
The Win32 window state might have changed while the event was in the queue,
making it obsolete.  Sending WM_SYSCOMMAND/SC_RESTORE might re-show a hidden
window, for example.
2013-12-31 12:31:33 +01:00
Ken Thomases 66736b4ab3 winemac: Implement support for maximizing windows.
The user is prevented from moving or resizing a maximized window.  The zoom
button is still present and enabled for a maximized window but requests that
it be restored rather than simply resizing it, which is what it does for
normal windows.

If a window is not resizable (lacks WS_THICKFRAME) but has a maximize box
(WS_MAXIMIZEBOX), then the zoom button requests that it be maximized rather
than resizing it.
2013-12-30 19:01:50 +01:00
Ken Thomases 2d1396af32 winemac: Extract some duplicated code to a new perform_window_command() function.
This also changes to posting rather than sending WM_SYSCOMMAND/SC_MINIMIZE.
2013-12-30 19:01:47 +01:00
Ken Thomases 2c6ad1829d winemac: Don't check the state of the SC_MINIMIZE item of the window menu when asked to minimize.
The window menu items are not updated as the window state changes; they only
update when the menu is shown.  So the item state is not a reliable indicator
of whether minimization is allowed.
2013-12-30 19:01:46 +01:00
Ken Thomases b877885400 winemac: When dragging an undecorated window, keep the title bar vertically within the work area.
In particular, keep the title bar from moving behind the menu bar or Dock (when
it's on the bottom).
2013-12-17 16:53:36 +01:00
Frédéric Delanoy e0b68129fa winemac.drv: Use BOOL type where appropriate. 2013-12-13 12:36:10 +01:00
Ken Thomases f068e329c1 winemac: Send WM_{ENTER, EXIT}SIZEMOVE before/after window dragging and run an internal event loop during.
This simulates some of what would happen if user32 were managing the drag.  The
click in the caption would cause WM_SYSCOMMAND/SC_MOVE.  The processing of that
message is synchronous and doesn't return until the move is complete.

Some games require that "blocking" in the internal event loop to prevent them
from misbehaving during the drag.
2013-12-12 12:06:47 +01:00
Frédéric Delanoy 69d35a01cf winemac.drv: Use BOOL type where appropriate. 2013-11-29 13:32:44 +01:00
Ken Thomases 788e2034f6 winemac: Add support for a "Decorated" registry setting to control whether windows get Mac-style decorations. 2013-11-22 13:57:28 +01:00
Ken Thomases f6a8c5b50e winemac: Take WS_EX_TOOLWINDOW into account when computing how much of a window is replaced by the Mac decorations. 2013-11-21 19:39:01 +01:00
Ken Thomases 784a91390e winemac: Allow ordering a window into Cocoa's window list even if it's positioned outside of the desktop.
Some programs minimize windows which are outside of the desktop.  The Mac
driver had been leaving such windows ordered out, which prevented them from
minimizing and appearing on the Dock.  That, in turn, made it difficult for
the user to restore them.
2013-11-15 11:59:47 +01:00
Ken Thomases 8e1fdb845e winemac: Trace flags of WINDOW_FRAME_CHANGED events. 2013-11-01 10:51:27 +01:00
Ken Thomases 83f6470c0e winemac: Convert the QUERY_RESIZE_END query to an event, WINDOW_RESIZE_ENDED.
Queries can be run out of order because the main thread is waiting on the
response.  The main thread didn't really need a response from QUERY_RESIZE_END.
It was only a query for symmetry with QUERY_RESIZE_START.
2013-11-01 10:51:23 +01:00
Ken Thomases de3fb34af7 winemac: Send WM_{ENTER, EXIT}SIZEMOVE around window frame changes initiated by Cocoa.
The Mac driver was already sending these events when the user resizes the
window by dragging its corner/edges, but there are other occasions when the
window frame changes.  For example, when the user zooms the window.
2013-11-01 10:51:11 +01:00
Alexandre Julliard e4a43cfa1f winemac: Don't try to set the app icon before GDI is properly initialized. 2013-10-24 19:00:10 +02:00
Ken Thomases f4f50c9e4a winemac: Implement support for Cocoa-style full-screen mode.
Based in large part on a patch submitted by Kevin Eaves.
2013-10-11 11:04:53 +02:00
Ken Thomases c043587d56 winemac: Tell Wine when Cocoa has brought a window to the front. 2013-10-08 15:39:01 +02:00
Ken Thomases 9779f0ace4 winemac: If the app doesn't specify a custom max. tracking size, don't restrict Cocoa. 2013-10-08 15:39:01 +02:00
Ken Thomases 4d9340eb41 winemac: Update the window min/max size info and enforce it when zooming. 2013-10-08 15:39:01 +02:00
Ken Thomases dd59ab26fe winemac: Only update window minimized state when it has changed from what processed events told us it was.
This fixes a problem where windows could spontaneously re-minimize after
being unminimized.  Cocoa would see the window unminimize.  It would queue
a WINDOW_DID_UNMINIMIZE event.  While that event was pending, Wine might do
something which caused set_cocoa_window_properties() to be called and tell
Cocoa to conform itself to the current Win32 state.  The current Win32 state
still had the window minimized, so Cocoa would re-minimize the window.  It
would even discard the WINDOW_DID_UNMINIMIZE event.
2013-10-08 15:39:01 +02:00
Ken Thomases 63fe00eae7 winemac: Allow zero-sized windows to be selected from the Mac Window menu.
They show up in the taskbar on Windows 7.  Selecting them from there is
meaningful and useful, as is selecting them from the Window menu.

In addition to just switching among windows from that menu, this is also
important to recovering a minimized window if the user has configured their
system preferences to minimize windows into the process's dock icon (rather
than as separate dock icons).
2013-10-04 12:45:52 +02:00
Ken Thomases 54291ad3d1 winemac: Let Wine always drive window minimization; Cocoa just requests it. 2013-09-30 20:36:34 +02:00
Ken Thomases 12e0b0577c winemac: Activate an app if it sets focus on a window shortly after a hot key is pressed.
The Mac driver doesn't normally steal focus, but a press of a hot key counts
as the user giving permission.
2013-09-27 10:41:17 +02:00
Ken Thomases 5a859655d7 winemac: Re-sync the window region whenever factors affecting its conversion to Cocoa coordinates change. 2013-09-27 10:39:22 +02:00
Ken Thomases 4ad9d5f04a winemac: Send WM_ENTER/EXITSIZEMOVE messages at start/end of a resizing operation. 2013-09-18 22:23:09 +02:00