Commit Graph

102 Commits

Author SHA1 Message Date
Jacek Caban b34018db20 winemac: Implement DesktopWindowProc driver entry point.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-20 18:44:10 +02:00
Jacek Caban 43993a3986 winemac: Use pthread for window data locking.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-18 17:38:54 +02:00
Jacek Caban c883822d2b winemac: Directly use ntdll for registry access in copy_system_cursor_name.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-17 10:23:20 +02:00
Jacek Caban 6045ad5bcf winemac: Directly use ntdll for registry access in init_original_display_mode.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-17 10:23:20 +02:00
Jacek Caban 9b66a5397a winemac: Directly use ntdll in get_display_device_reg_key.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-17 10:23:20 +02:00
Jacek Caban ffa7c40951 winemac: Directly use ntdll for querying display settings.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-17 10:23:19 +02:00
Jacek Caban 718db04398 winemac: Directly use ntdll in setup_options.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-17 10:23:19 +02:00
Jacek Caban ac9b635800 win32u: Use NT interface for MsgWaitForMultipleObjectsEx user driver entry point.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-03 19:01:13 +02:00
Jacek Caban f6524f7a3a win32u: Don't use CDECL for user driver functions.
They are no longer used from PE code.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-07 22:44:39 +02:00
Paul Gofman e53b68acec win32u: Move wine_get_wgl_driver() from DC driver.
To get rid of get_dc_ptr() and thus not to fail
concurrent __wine_get_wgl_driver().

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-02 20:17:25 +01:00
Jacek Caban 9596e7f2a4 win32u: Use user driver for wine_get_vulkan_driver.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 09:57:56 +01:00
Jacek Caban 95a106bc93 winemac.drv: Use UpdateDisplayDevices driver entry point for registering devices.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-01 19:47:34 +01:00
Jacek Caban fd675485be user32: Use user_driver_funcs to expose user driver function from drivers.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-11 18:39:48 +01:00
Tim Clem 5e543fee7a winemac.drv: Stop cursor clipping when all windows are minimized.
There's no analogous state on Windows, where an app is focused but has no
visible windows, but this seems like the best behavior.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-20 20:12:08 +02:00
Zhiyi Zhang b8415e0310 winemac.drv: Handle display device change events.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-30 20:07:39 +02:00
Zhiyi Zhang d8d1fe486b winemac.drv: Add GPU initialization functions.
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-08-30 20:07:24 +02:00
Alexandre Julliard 4a902de213 gdi32: Make GDI driver functions cdecl.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-06 21:47:58 +02:00
Andrew Eikum 10035f1b97 winemac: Implement Vulkan driver on top of MoltenVK.
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-13 17:20:43 +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 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 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
Ken Thomases 782959168a winemac: Change macdrv_copy_pasteboard_formats() to return a C array instead of a CFArray.
Renamed it to macdrv_get_pasteboard_formats(), since the "copy" was meant to
convey Core Foundation ownership semantics which no longer apply.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:06 +02: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 1c94bf396f winemac: Add support for a high-resolution ("Retina") rendering mode.
When this Retina mode is enabled and the primary display is in the user's
default configuration, Wine gets told that screen and window sizes and mouse
coordinates are twice what Cocoa reports them as in its virtual coordinate
system ("points").  The Windows apps then renders at that high resolution and
the Mac driver blits it to screen.  If the screen is actually a Retina display
in a high-DPI mode, then this extra detail will be preserved.  Otherwise, the
rendering will be downsampled and blurry.

This is intended to be combined with increasing the Windows DPI, as via winecfg.
If that is doubled to 192, then, in theory, graphical elements will remain the
same visual size on screen but be rendered with finer detail.  Unfortunately,
many Windows programs don't correctly handle non-standard DPI so the results
are not always perfect.

The registry setting to enable Retina mode is:

[HKEY_CURRENT_USER\Software\Wine\Mac Driver]
"RetinaMode"="y"

Note that this setting is not looked for in the AppDefaults\<exe name> key
because it doesn't make sense for only some processes in a Wine session to see
the high-resolution sizes and coordinates.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-06 11:45:24 +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 0c395c24e3 winemac: Remove extraneous CDECL attribute. 2015-06-05 14:10:12 +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 50cd5b6a57 winemac: Fix conversion of empty RECT to an empty CGRect.
For some empty RECTs, such as { INT_MAX, INT_MAX, INT_MIN, INT_MIN }, right
minus left or bottom minus top underflow and wrap around to positive values.
2015-01-20 11:10:36 +01: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 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 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
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 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
Huw Davies 22008f7fd9 winemac: Update the thread's active_keyboard_layout on keyboard change. 2013-11-20 19:39:01 +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 742c48b348 winemac: Disable software GL rendering unless it's enabled via a new registry setting, AllowSoftwareRendering. 2013-10-22 16:37:40 +02:00
Alexandre Julliard 639c202ea7 winemac: Use an init once function to register IME classes. 2013-10-22 10:25:36 +02:00
Alexandre Julliard 5435dad997 winemac: Only register the IME class when needed. 2013-10-21 14:46:25 +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 4d9340eb41 winemac: Update the window min/max size info and enforce it when zooming. 2013-10-08 15:39:01 +02:00
Ken Thomases 0e8e45cf99 winemac: Use unsigned type for bitfields. 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 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 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