Commit Graph

45 Commits

Author SHA1 Message Date
Ken Thomases 49bb11fef2 winemac: Move a window to the front when its Mac title bar is clicked.
Cocoa does this automatically for non-owned windows and informs the back end
via a different mechanism (WINDOW_BROUGHT_FORWARD).  However, for owned windows
(child windows in Cocoa parlance), Cocoa does not change their z-order relative
to the owner (parent) or sibling owned windows when clicked.  So, we have to
move the window in user32's z-order so that it gets moved appropriately on
screen in response.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:31:59 +02: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 eba417a477 winemac: Detect loss of ownership of the Mac pasteboard and update the clipboard manager status.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:18 +02:00
Ken Thomases 33610da6b4 winemac: Don't process QUERY_IME_CHAR_RECT while waiting in OnMainThread().
Most queries are handled even by threads which are otherwise blocked in
OnMainThread().  There's a problem with QUERY_IME_CHAR_RECT, though, in that it
can be handled before a previously-queued IM_SET_TEXT event, in which case its
character range may be out of bounds.  Some apps (e.g. Excel 2007) hang due to
the bad range.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-05 13:53:36 +09:00
Ken Thomases 3482c47469 winemac: Make macdrv_process_text_input() asynchronous and process internal events while awaiting its result.
It had been using the synchronous OnMainThread() to submit its work to the
Cocoa thread, but only queries are processed while OnMainThread() waits for the
work to complete.  This led to QUERY_IME_CHAR_RECT queries being processed out
of order relative to IM_SET_TEXT events, making the character range out of
bounds with respect to the composition string.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-05 13:53:13 +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
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
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 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 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
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 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 4d9340eb41 winemac: Update the window min/max size info and enforce it when zooming. 2013-10-08 15:39:01 +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 6bae7cf796 winemac: Implement support for global hot keys.
Partially based on a patch for winex11 previously submitted by Vincent Povirk.
2013-09-27 10:41:05 +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
Ken Thomases a3197b8ad0 winemac: At the start of a resize operation, get window min/max size info and pass it to Cocoa. 2013-09-18 22:23:09 +02:00
Ken Thomases 7ed00f6d97 winemac: Add support for mouse-move and right- and middle-click events on systray icons in the Mac status bar. 2013-09-06 11:59:13 +02:00
Ken Thomases 153f3e27c4 winemac: Forcibly release mouse capture for clicks in Mac menu bar or app deactivation. 2013-06-20 11:31:25 +02:00
Aric Stewart c6d307533b macdrv: Rework the way we handle cursor position and composition text. 2013-05-30 20:19:34 +02:00
Ken Thomases 939d9a906f winemac: Improve positioning of input method candidate window. 2013-05-17 12:14:51 +02:00
Ken Thomases 192b8dbf9d winemac: Implement an IME that uses the OS X input methods.
Developed with Aric Stewart.
2013-04-22 12:37:50 +02:00
Ken Thomases fd1e187ac7 winemac: Handle a Cocoa quit request as a single-process session shutdown.
This lets programs ask the user to save documents, etc., and possibly cancel
the quit.
2013-04-04 12:16:31 +02:00
Ken Thomases 1ee93853c2 winemac: Make macdrv_event structs heap-allocated and reference-counted. 2013-04-04 12:14:33 +02:00
Ken Thomases b55d7aae10 winemac: Constify some macdrv_event pointer parameters. 2013-04-04 12:13:45 +02:00
Ken Thomases 9714e6ee63 winemac: Implement rudimentary support for system tray icons as Mac status items. 2013-03-25 14:02:56 +01:00
Ken Thomases 7993bd3d90 winemac: Implement support for drag-and-drop. 2013-03-14 12:03:32 +01:00
Ken Thomases 761ad810d9 winemac: Allow for processing Cocoa events while waiting for query results. 2013-03-14 12:02:28 +01:00
Ken Thomases 449e2655c2 winemac: Add support for delay-rendered (a.k.a. promised) clipboard data. 2013-03-11 10:53:38 +01:00
Ken Thomases 69e631e04e winemac: Add support for "query" events which wait for synchronous responses. 2013-03-11 10:53:32 +01:00
Ken Thomases bc75a9baff winemac: Implement DISPLAYS_CHANGED event for when display configuration has changed. 2013-02-18 10:34:55 +01:00
Ken Thomases 3748c39308 winemac: Implement MOUSE_SCROLL events. 2013-02-11 11:46:10 +01:00
Ken Thomases 572324bae3 winemac: Implement MOUSE_MOVED(_ABSOLUTE) events. 2013-02-07 12:04:49 +01:00
Ken Thomases 77de57683f winemac: Generate KEY_PRESS/RELEASE events from Cocoa key events. 2013-02-05 11:06:43 +01:00
Ken Thomases d0e1a02515 winemac: Rebuild key map when Mac keyboard layout changes. 2013-02-05 11:06:27 +01:00
Ken Thomases 8a0c8d9264 winemac: Implement support for minimizing windows. 2013-02-05 11:05:23 +01:00
Ken Thomases b564d97229 winemac: Implement an APP_DEACTIVATED event. 2013-01-28 14:03:51 +01:00
Ken Thomases 3c5973139f winemac: Implement a WINDOW_LOST_FOCUS event. 2013-01-28 14:03:45 +01:00
Ken Thomases 7863a230ec winemac: Implement a WINDOW_GOT_FOCUS event for when Cocoa tries to focus a window. 2013-01-28 14:03:40 +01:00
Ken Thomases bd269786a5 winemac: Implement a MOUSE_BUTTON event for mouse clicks. 2013-01-28 14:02:45 +01:00
Ken Thomases 6e59740e18 winemac: Implement WINDOW_FRAME_CHANGED event to tell Wine when window is moved or resized. 2013-01-28 14:00:49 +01:00
Ken Thomases ed367c504d winemac: Implement a WINDOW_CLOSE_REQUESTED event to allow closing windows. 2013-01-21 12:51:19 +01:00
Ken Thomases 4e83d2fca0 winemac: Implement MsgWaitForMultipleObjectsEx and infrastructure for processing events. 2013-01-21 12:51:18 +01:00