Commit Graph

45 Commits

Author SHA1 Message Date
Dean M Greer 2d784c8548 winemac.drv: Fix compile with pre macOS 10.12 SDKs.
Fixes a regression introduced by e58b1a2b39.

Signed-off-by: Dean M Greer <gcenx83@gmail.com>
Signed-off-by: Chip Davis <cdavis@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-24 10:19:20 +01:00
Tim Clem 2e25ba489a winemac.drv: Create a protocol to represent a cursor clipping handler.
Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-21 22:47:06 +01:00
Tim Clem 1c80eb5e5b winemac.drv: Factor out cursor clipping code to its own class.
Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-21 22:47:04 +01:00
Tim Clem 8dae8ad8d8 winemac.drv: Don't activate the app if its first window is WS_EX_NOACTIVATE.
This matches the behavior on Windows.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-19 20:37:46 +01:00
Tim Clem bb28d54d08 winemac.drv: Use window drag notifications when available.
When running on macOS 10.12+, there are private notification center
messages we can use to reliably detect when a window is being
dragged by its titlebar. These are less finicky than the current
combination of an undocumented event subtype and a left mouse up.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-15 09:44:22 +02:00
Brendan Shanks 7aa2601f94 winemac.drv: Fix warnings for constants deprecated by macOS 10.12.
Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-07-27 23:28:16 +02:00
Ken Thomases 6250eb54fe winemac: Break out of the window-dragging message loop if the window is hidden or destroyed.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-21 19:15:12 +02:00
Ken Thomases feb19ee669 winemac: Ignore spurious or redundant notifications that the keyboard input source changed.
In particular, when an input method for an Asian language (e.g. Pinyin) is
selected, we were getting repeated notifications.  Querying the selected input
method upon receiving them suggested that the keyboard layout changed to U.S.
then back to Pinyin, then several redundant notifications with no apparent
change.

Since the handler for the posted KEYBOARD_CHANGED events sends WM_CANCELMODE to
the active window, this was having bad effects.

The spurious notifications can be distinguished by there being no current
text input context or client.  To detect redundant notifications, we track the
last keyboard input source and keyboard layout input source and compare with
the new ones to see if they really changed.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-16 12:08:57 +02:00
Ken Thomases 48548812fe winemac: Move the logic for posting a KEYBOARD_CHANGED event if the keyboard type changes into the setter of the keyboardType property.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-16 12:08:55 +02:00
Ken Thomases 792b47ad3b winemac: Restore a maximized window if a user tries to move it by dragging its title bar.
OS X doesn't have the same concept of maximized windows as Windows does.
There's no mode that prevents a normally-movable window from being moved.  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 move a window that's maximized.

To get similar behavior while still respecting Win32 semantics, we detect when
the user tries to move a maximized window.  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 move.

The user expects to move 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:34 +09:00
Ken Thomases 451915100a winemac: Add the ability to disable high-resolution scrolling.
The Mac driver can generate scroll wheel events with values which are not integral
multiples of WHEEL_DELTA.  Apps should handle that by scrolling a corresponding
non-integral multiple of what they'd do for a WHEEL_DELTA-valued scroll or, if
they can't, then at least accumulate scroll distance until its magnitude exceeds
WHEEL_DELTA and do a "chunky" scroll.  However, many apps don't do that properly.
They may scroll way too far/fast or even in the opposite direction.

If the registry setting UsePreciseScrolling is set to "n", the Mac driver will do
that accumulation and chunking itself to work around such broken app behavior.
2014-05-15 11:28:52 +02:00
Ken Thomases ef4677106a winemac: Disable moving or resizing windows when cursor clipping is in effect.
Many games clip the cursor to the client area of the window.  However, on OS X,
the resizing controls extend into that client area.  So, it's possible that
while playing, the user might unintentionally click in the resizing area and
drag, resizing the window.
2014-04-29 11:22:58 +02: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 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 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 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 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 27510fae8e winemac: Centralize adjusting of window levels using the window server's z-order. 2013-05-17 16:36:24 +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 1a697e15b9 winemac: Implement SetCapture(). 2013-05-07 11:20:32 +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 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 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 e7d5f329e5 winemac: Refactor WineApplication class to separate most logic into a controller class. 2013-04-16 12:10:36 +02: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 0a56ef356a winemac: Handle mouse moves in -[WineApplication sendEvent:] instead of WineWindow. 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 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 77de57683f winemac: Generate KEY_PRESS/RELEASE events from Cocoa key events. 2013-02-05 11:06:43 +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 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 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