Commit Graph

501 Commits

Author SHA1 Message Date
Ken Thomases 611c15953e winemac: Scale cursors for Retina mode, now that user32 scales them with DPI.
When they were always 32x32, treating that size as though it were in Cocoa's
virtual "points" rather than pixels produced good results even though it wasn't
really correct.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-07-31 22:00:33 +02:00
Huw Davies 97546cfbb7 winemac: Use logical co-ords to call GdiAlphaBlend().
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-06-29 19:02:47 +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
Piotr Caban 1cd883fcb5 winemac: Don't update clipboard if its content didn't change.
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-30 21:49:49 +02:00
Ken Thomases 416180a856 winemac: Fall back to the null driver for common device capabilities.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-22 13:45:08 +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
Stefan Dösinger 7003ec34c9 winemac.drv: Implement systray version 1-4 notifications.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-11 13:40:14 -05:00
Ken Thomases b6a4b2f593 winemac: Track whether a view has ever had an OpenGL context attached.
... rather than whether it currently has one.

This is for OpenGLSurfaceMode=behind.  In that mode, we need to make the window
transparent wherever a GL-rendered view should not be clipped by GDI-rendered
children or sibling views.

Some apps attach a GL context to the view only temporarily, do some rendering,
and then detach it.  But the GL surface remains, with the rendered graphics.
In order for those to show, the window needs to remain transparent even though
none of its views has a GL context currently attached.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-08 16:25:55 -05:00
Ken Thomases 24d3795285 winemac: Move CVDisplayLink operations out of @synchronized blocks to avoid potential deadlock.
The -fire method called by the display link callback also synchronizes on self
(while accessing the windows array).  Display link operations use a lock to
synchronize, too, and it's held while the callback is running.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-05-08 16:25:54 -05:00
Huw Davies d74348f9b5 winemac: Try to read the dpi from the user key first.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-27 22:22:44 +02:00
Ken Thomases e49feb63f4 winemac: Opt out of macOS 10.12's automatic window tabbing feature.
It doesn't seem to work well.  In full-screen mode, newly-added windows don't
always properly resize to fill the screen, so they're not the same size as the
windows they're nominally tabbed with.  In non-full-screen mode, switching
between tabs sometimes causes the windows to grow in height each time.  Etc.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:32:20 +02:00
Ken Thomases e0ef30e542 winemac: Don't let child (owned) windows be Cocoa primary full-screen windows.
They shouldn't get a separate space; they should stick with their parent (owner).

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:32:18 +02:00
Ken Thomases ff3766c759 winemac: Use the -close method rather than -orderOut: for full-screen windows.
Simply ordering them out leaves the user on the full-screen space, which is now
an empty black screen.  Closing the window closes the space, too.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:32:14 +02:00
Ken Thomases 5ebb83ad4e winemac: Defer ordering a window out if it's in the process of entering or exiting Cocoa full-screen mode.
Cocoa doesn't handle the window being ordered out or closed during the
animation well and leaves a ghost window around.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:32:11 +02:00
Ken Thomases 302593c9c0 winemac: Better handle z-ordering windows that are in Cocoa parent-child window relationships.
The code had been handling ordering sibling windows relative to each other,
including windows neither of which were child windows.  However, it wasn't
properly handling other relationships (e.g. cousins, nieces, uncles, etc.).

The reason this is complicated is that Cocoa keeps child windows in a fixed
relative order to their parent and siblings.  The normal -orderWindow:relativeTo:
method doesn't work.  One has to remove the children from the parent and re-add
them in the desired order.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:32:07 +02:00
Ken Thomases e30b1aef1b winemac: When realizing latent child windows, maintain their relative z-order.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:32:03 +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 af2690ab06 winemac: Add a category on NSEvent to simplify checking if the Command key (and only that modifier) is pressed for an event.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:31:50 +02:00
Ken Thomases 04317b5571 winemac: Move the window to the front of the z-order in SetFocus if it's the foreground window and not already in the front.
Ideally, user32 would adjust its z-order for window activation as happens on
Windows.  Then, the Mac driver would just reflect such changes in the Cocoa
windows.  But user32 doesn't do that.  SetActiveWindow() and SetForegroundWindow()
just adjust focus and status.

This is an attempt to achieve a similar result.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:31:43 +02:00
Ken Thomases 49964b3bc4 winemac: Sync the frame of the Cocoa view for a window's client area while handling a frame-changed event.
Fixes a problem where the client area view would not be resized as the user
resizes the Cocoa window.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-24 20:31:39 +02:00
Ken Thomases c9528f0907 winemac: Invalidate cached hasGLDescendant value unconditionally when the view is hidden or unhidden.
Even if the (un)hidden view doesn't have attached GL contexts itself, its
descendants may.  It doesn't make sense not to check them just because this
view doesn't have GL contexts.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-21 10:53:49 +02:00
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 4b8c0d8784 winemac: Send Help key presses directly to the window, bypassing -[NSApplication sendEvent:].
-[NSApplication sendEvent:] seems to consume the event and doesn't pass it along
to the window.

Mac keyboards haven't included a Help key for a long time, but users with PC
keyboards can use the Insert key, which is in the same position.  The Mac
driver translates either one to VK_INSERT.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-04-04 09:42:15 +02:00
Akihiro Sagawa 2680971ef4 winemac.drv: Use neutral language for the version resource.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-22 16:13:32 +01:00
Ken Thomases c5eca7be91 winemac: Discard key repeat events after a modifier key has been pressed.
Sierra (macOS 10.12) changed the behavior of key repeat.  In previous versions
of macOS, key repeat stops when a modifier key is pressed or released.  In
Sierra, it does not; it just keeps repeating as newly-modified.

On Windows, key repeat stops when a modifier key is pressed, although not when
one is released.  Some programs depend on this behavior.  So, the Mac driver
emulates it.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-03-10 10:03:56 +01:00
Ken Thomases 02c6e45302 winemac: Pass correct buffer length to RegQueryValueExW().
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-08 17:02:59 +01:00
Ken Thomases 2128125cbf winemac: Reattach OpenGL contexts to a view after it has been hidden and unhidden.
Hiding a view seems to semi-detach any attached OpenGL contexts such that
rendering no longer works.  There's no GL surface for the view.  Calling
-[NSOpenGLContext update] is not sufficient to reattach the context.  So,
fully detach the contexts and reattach them.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-03 09:35:23 +01:00
Ken Thomases c95d2de3dd winemac: Ignore clipboard updates provoked by our own call to GetClipboardData().
During a call to GetClipboardData(), the app may be asked to render the data
for a promised format.  This will cause us to receive WM_CLIPBOARDUPDATE.

Almost always, the app will have just rendered the requested format and not
made any other changes.  Therefore, we don't need to rebuild the Mac pasteboard
from the Win32 clipboard.  Doing so can cause a race with the other Mac app
which is querying the pasteboard (for a paste operation, for example).  We
basically delete the data we _just_ added and rebuild the list of available
types.  The symptom is that the other Mac app sees the available types change
and maybe be incomplete.

In theory, the Windows app could make other changes to the clipboard and this
change would cause us to fail to convey them to the Mac pasteboard.  I consider
that very unlikely and the tradeoff to improve the common case is worth it.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-03 09:35:18 +01: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 733e22d0c1 winemac: Make some operations on Cocoa views asynchronous.
There's no reason for them to be synchronous and this improves performance.

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 52e20d82f8 winemac: Ignore an additional expected error in the clipboard pipe communication code.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-13 20:42:06 +01:00
Ken Thomases 961703427d winemac: Export HTML Format clipboard data to the public.html pasteboard type.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-13 20:42:05 +01:00
Ken Thomases ed0de54f45 winemac: Add basic support for importing the public.html pasteboard format.
Continue exporting in the original format under org.winehq.registered.HTML Format
for fidelity when copying and pasting within Wine.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-13 20:41:42 +01:00
Ken Thomases 5f5807cbfe winemac: Periodically check for pasteboard changes using a timer.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-11 19:06:25 +01:00
Ken Thomases 525c0b1795 winemac: Don't update the clipboard if the Mac pasteboard hasn't changed.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-11 19:06:19 +01:00
Ken Thomases 3208d1497a winemac: Change some clipboard functions to void return.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-01-11 19:06:06 +01:00
Aric Stewart 333c5bd9dd ime: Do not send WM_IME_ENDCOMPOSITION on CPS_COMPLETE if there is no composition.
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-14 20:36:16 +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
Lauri Kenttä f447b644a5 winemac.drv: Compare handle to INVALID_HANDLE_VALUE, not NULL.
Signed-off-by: Lauri Kenttä <lauri.kentta@gmail.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-06 15:02:35 +01:00
Ken Thomases 7161df136f winemac: Keep floating windows in a higher window level than non-floating full-screen windows.
When windows aren't full-screen, non-floating windows go in NSNormalWindowLevel
and floating ones go in NSFloatingWindowLevel, which is higher.  However, a
non-floating full-screen window will go into a level higher than either of
those.  The prior logic of the -adjustWindowLevels: method would keep the
floating windows at a window level at least that high.  They should actually
be in a strictly higher level.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-02 11:43:44 +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 2a09548b59 winemac: Use min() rather than MIN(), which is not reliably defined.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-26 18:39:14 +02:00
Huw Davies c3dbe44347 winemac: Update the keyboard layout data immediately after changing the input source.
It would eventually get updated by the keyboard changed event, but
only after the message queue was pumped.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 19:42:24 +02: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 e7568d342a winemac: Implement the UpdateClipboard entry point to have the clipboard manager update its status.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:10:15 +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 019983e2c6 winemac: Reimplement query_pasteboard_data() using the user32 clipboard API.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-10-24 11:09:27 +02:00