Commit Graph

130 Commits

Author SHA1 Message Date
Ken Thomases 6447e8e75c winemac: Defer adjusting window levels while the process is hidden.
While the process is hidden, it can't get a list of its windows which would
be visible were it not hidden.
2013-12-31 12:31:15 +01:00
Ken Thomases 77f0a63b4f winemac: When ClipCursor() is called redundantly, don't warp the cursor or discard mouse move events.
Fixes a problem in some games which repeatedly (re)establish the same cursor
clipping rect, making it exceedingly difficult to move the camera with the
mouse.
2013-12-17 16:53:44 +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 b3cc34e5b0 winemac: While a window is being dragged, suppress mouse events and disable cursor clipping and warping. 2013-12-12 12:06:39 +01:00
Ken Thomases cd10a0df5e winemac: Consolidate the logic for deciding if cursor clipping should be active. 2013-12-12 12:06:38 +01:00
Huw Davies c4761d8002 winemac: Actually set the system's keyboard layout. 2013-11-20 19:39:05 +01:00
Huw Davies 22008f7fd9 winemac: Update the thread's active_keyboard_layout on keyboard change. 2013-11-20 19:39:01 +01:00
Huw Davies f344d7a213 winemac: Update the layout list if the enabled input sources change. 2013-11-20 19:38:59 +01:00
Huw Davies fecaab9cfd winemac: Implement GetKeyboardLayoutList. 2013-11-20 19:38:56 +01:00
Ken Thomases 6b9f81271b winemac: Hide cursor when first requested even if we don't know it's over a window.
The tracking of whether it is over a window or not is only updated when the
mouse moves.  If a window was created or moved under it, then the state can be
stale.  That caused us to defer hiding the cursor until the mouse was moved.
This happens at the start of games pretty often.
2013-10-30 15:29:42 +01:00
Ken Thomases 1c049e5031 winemac: Restore app cursor settings when cursor moves back into an app window.
The code had previously set the cursor back to the standard arrow and unhid
it when it left all app windows.  Now it restores the cursor image that the
app set and re-hides it if necessary when it moves back over any app window.
2013-10-18 11:33:32 +02:00
Ken Thomases 8747df094d winemac: Treat mouse moves in a window title bar as outside the window.
Don't queue mouse-moved events.  Reset the cursor.
2013-10-18 11:32:53 +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 1186c36c89 winemac: Make clicking on the app's dock icon unminimize a window if there are only minimized windows.
Cocoa would automatically do this for a normal app.  However, the Mac driver
makes all of its windows inherit from NSPanel and Cocoa ignores panels for
this feature.
2013-10-04 12:45:56 +02:00
Ken Thomases b7709771d1 winemac: Reapply display modes when switching back to app after "escaping" with Command-Tab.
The Mac driver captures the displays when the program changes the display
mode.  If the user types Command-Tab to switch away, it resets the displays
to their original modes and releases them.  However, if they switched back,
it didn't restore the mode to what the program had set, so the program often
showed the game window in a corner of the screen with the top behind the Mac
menu bar.
2013-10-02 11:00:36 +02:00
Ken Thomases 7c55e912da winemac: Remove a too-early attempt to set the process's Dock icon. 2013-10-01 23:05:08 +02:00
Ken Thomases d7f4d67514 winemac: Fix hiding windows that are minimized using -close instead of -orderOut:.
Cocoa won't order a minimized window out of the screen list using -orderOut:.
This leaves a window that should be hidden still visible in the Dock, where
it can be unminimized.
2013-09-27 10:39:13 +02:00
Ken Thomases 018d629b3c winemac: Use NSMouseInRect() instead of NSPointInRect() to compensate for Cocoa's off-by-one coordinate system.
This matches what Cocoa does when determining how to handle an event so that,
for example, our test if a click is in the window grow box corresponds to
whether Cocoa will run an internal mouse-tracking loop to resize the window
when we pass it the event.  This fixes a problem where both Cocoa and user32
would try to run a resize loop and the cursor would get "stuck" resizing the
window after the button was released.
2013-09-19 09:30:18 +02:00
Ken Thomases b550ee8d59 winemac: On click, don't reorder Cocoa child window after siblings of higher level.
It may be necessary to reorder to some extent because the clicked window is
behind a sibling at the same level, but that shouldn't move it later in the
list than higher-level siblings.

Cocoa gets buggy if the list of child windows isn't in z-order.
2013-08-30 11:18:07 +02:00
Ken Thomases d14f787192 winemac: Don't reorder clicked window relative to sibling owned windows if it's in the right place.
The right place may not be the end of the list of Cocoa child windows if some
of the siblings are at a higher window level (i.e. floating if the clicked
window is not).
2013-08-30 11:17:56 +02:00
Ken Thomases a39b02c3e7 winemac: Dispatch key-up events directly to window to be sure to get them.
For keys pressed in combination with Command, -[NSApplication sendEvent:]
simply doesn't pass the key-up event through to the window.  We have to
track which keys we've told Wine are pressed because Cocoa may consume
key-downs that trigger menus or system behaviors.
2013-07-09 10:30:45 +02:00
Ken Thomases a723af61ac Revert "winemac: Dispatch key events directly to window to be sure to get key-up events.".
This reverts commit 0d20ac02f7.
2013-07-09 10:30:43 +02:00
Ken Thomases 0d20ac02f7 winemac: Dispatch key events directly to window to be sure to get key-up events.
For keys pressed in combination with Command, -[NSApplication sendEvent:]
simply doesn't pass the key-up event through to the window.
2013-06-28 11:40:41 +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
Ken Thomases f035cc73d0 winemac: Don't give windows focus on click if the click was sent to Wine.
Only clicks on the title bar (outside the close or minimize buttons) or the
grow box give windows focus.
2013-06-18 12:57:44 +02:00
Ken Thomases 3faf1a92b0 winemac: Don't bring disabled or no-activate windows forward when clicked. 2013-06-18 12:57:43 +02:00
Ken Thomases d22ac28f5e winemac: Allow clicks on owned windows to reorder them relative to other owned windows of the same owner. 2013-06-07 11:59:02 +02:00
Ken Thomases 220b8b7946 winemac: Add an option to capture the displays for full-screen windows in addition to display mode changes.
Under HKCU\Software\Wine\Mac Driver, set string value
CaptureDisplaysForFullscreen to "y" to enable the new behavior.
2013-06-07 11:57:06 +02:00
Ken Thomases 4c651e39e4 winemac: Don't unminimize a window on first activation during start-up. 2013-06-04 15:00:28 +02:00
Ken Thomases d8269a0586 winemac: Add Hide, Hide Others, and Show All items to the application menu. 2013-05-29 19:49:42 +02:00
Ken Thomases 27510fae8e winemac: Centralize adjusting of window levels using the window server's z-order. 2013-05-17 16:36:24 +02:00
Ken Thomases 0d4a26eff5 winemac: Use window server's window list to find next window to offer focus to.
... rather than our orderedWineWindows array, which is going away.
2013-05-17 16:35:54 +02:00
Ken Thomases c3183fc007 winemac: Implement simpler way to find front Wine window.
This uses Cocoa and the window server to track windows and their z-order,
which is more reliable than our own tracking.
2013-05-17 16:35:27 +02:00
Ken Thomases 08e940fb1d winemac: Unminimize a window on activation if there are only minimized windows. 2013-05-08 19:35:04 +02:00
Ken Thomases 1a697e15b9 winemac: Implement SetCapture(). 2013-05-07 11:20:32 +02:00
Ken Thomases 3eee56668a winemac: Mouse drags don't imply anything about z-order of target window because of implicit capture. 2013-05-07 11:20:11 +02:00
Ken Thomases 3e3d982185 winemac: Prefer absolute mouse moves unless cursor is pinned by clipping or desktop edges.
This fixes an issue with sub-pixel-precise pointing devices on Lion and later.
Wine's notion of the cursor position would get out of sync with the actual position
because deltas don't convey the actual movement distance.
2013-05-07 11:19:43 +02:00
Ken Thomases 1c4d8938ec winemac: Apply cursor clipping to events that were in Cocoa's queue when clipping started. 2013-05-07 11:19:37 +02:00
Ken Thomases d9ae2f3e38 winemac: Consolidate scroll wheel handling into -[WineApplicationController handleScrollWheel:]. 2013-05-07 11:19:33 +02:00
Ken Thomases e15b82ad1b winemac: Consolidate mouse button handling into -[WineApplicationController handleMouseButton:]. 2013-05-07 11:19:27 +02:00
Ken Thomases 72e893237c winemac: Consolidate mouse move handling into -[WineApplicationController handleMouseMove:]. 2013-05-07 11:19:21 +02:00
Ken Thomases 76691853f5 winemac: Extract application-level handling of mouse move events to a separate method. 2013-05-07 11:19:00 +02:00
Ken Thomases 51129752bc winemac: For SetCursorPos(), reset positions of pending mouse button and scroll events.
They are effectively deemed to have happened after the SetCursorPos().
2013-04-26 11:48:53 +02:00
Ken Thomases a6722029e5 winemac: Work around mouse "pausing" after CGWarpMouseCursorPosition(). 2013-04-26 11:48:36 +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 72be23270e winemac: Set up and drain autorelease pool in LogErrorv() so it's safe to call from background threads. 2013-04-22 12:37:50 +02:00
Ken Thomases e7d5f329e5 winemac: Refactor WineApplication class to separate most logic into a controller class. 2013-04-16 12:10:36 +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 ca2d7140fb winemac: Add a delivery limit to events.
Some events are application-wide, not specific to a thread.  Such an event
needs to be broadcast to all GUI-attached threads because we don't know which
are handling events, but we don't want the event to be processed in each.
Often it should only be processed by the first to pull it from its queue.
2013-04-04 12:14:56 +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 6ee486644a winemac: Allow Command-[Shift-]Tab to switch apps even when the displays are captured. 2013-03-25 14:03:02 +01:00
Ken Thomases b1de532393 winemac: Set application Dock icon from first icon resource in process's .exe file. 2013-03-25 14:01:04 +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 69e631e04e winemac: Add support for "query" events which wait for synchronous responses. 2013-03-11 10:53:32 +01:00
Ken Thomases 9b0fdc645f winemac: Implement ClipCursor(). 2013-02-25 10:40:39 +01:00
Ken Thomases 5c933c89ad winemac: Implement SetCursorPos(). 2013-02-25 10:40:39 +01:00
Ken Thomases de079223bf winemac: Reset the cursor to the normal Mac arrow when it's outside all Wine windows. 2013-02-25 10:40:39 +01:00
Ken Thomases 5d8e685297 winemac: Request mouse move events when our window is active even when cursor is outside it. 2013-02-25 10:40:38 +01:00
Ken Thomases 0a56ef356a winemac: Handle mouse moves in -[WineApplication sendEvent:] instead of WineWindow. 2013-02-25 10:40:38 +01:00
Ken Thomases 38f7a4d518 winemac: Implement GetCursorPos(). 2013-02-25 10:40:38 +01:00
Ken Thomases a49df4b317 winemac: Implement SetCursor() and DestroyCursorIcon(). 2013-02-25 10:40:37 +01:00
Ken Thomases d26a6bf451 winemac: Implement ChangeDisplaySettingsEx(). 2013-02-18 10:35:46 +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 be6af9a169 winemac: Implement support for full-screen windows. 2013-02-18 10:34:46 +01:00
Ken Thomases ba86e67792 winemac: Track Cocoa windows in a z-ordered list. 2013-02-18 10:34:40 +01:00
Ken Thomases 6289a612ae winemac: Add WineApplication methods to convert from Cocoa to Win32 coordinate space.
Cocoa coordinate space has its origin in the lower left of the primary screen
and y increases up.
2013-02-07 12:04:46 +01:00
Ken Thomases 3fcb69b7ca winemac: Implement Beep(). 2013-02-06 20:28:28 +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 b78eee3172 winemac: Build a map from Mac virtual key codes to Win32 vkeys and scan codes based on Mac keyboard layout. 2013-02-05 11:06:02 +01:00
Ken Thomases b564d97229 winemac: Implement an APP_DEACTIVATED event. 2013-01-28 14:03:51 +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 beccf0f8c0 winemac: Maintain a list of which windows have been "key" (focused) recently. 2013-01-28 14:03:25 +01:00
Ken Thomases a22be47fcf winemac: Add infrastructure to convert from Cocoa event time to Wine tick count. 2013-01-28 14:02:08 +01:00
Ken Thomases 3c995bb682 winemac: Add WineEventQueue class for conveying events from Cocoa to Wine threads. 2013-01-21 12:51:17 +01:00
Ken Thomases b6d902ee46 winemac: Add a simple ERR() logging macro that can be used from Cocoa code. 2013-01-21 12:51:16 +01:00
Ken Thomases b3f71fdeb1 winemac: Implement the Mac "Window" menu. 2013-01-11 18:14:08 +01:00
Ken Thomases 8da2cb1698 winemac: Implement basic window functionality. 2013-01-09 17:39:38 +01:00
Ken Thomases daf0fd75e6 winemac: Add a custom NSApplication subclass, WineApplication. 2013-01-09 17:39:37 +01:00