Commit Graph

204 Commits

Author SHA1 Message Date
Ken Thomases 9fbc364ea1 winemac: Remove an unnecessary call to -[NSView removeFromSuperview].
It's only obliquely documented, but -[NSView addSubview:positioned:relativeTo:]
will remove the view from its old superview if it's changing superviews.  If
it's just changing z-order within its current superview, it won't.

This avoids some flicker of OpenGL surfaces being removed and re-added.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-06-03 14:39:27 +09:00
Ken Thomases 102cd6dcae winemac: Fix the logic for checking if a view is already in the intended z-order.
-[NSView subviews] returns the views in back-to-front order, not front-to-back
as I had thought.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-06-03 14:39:25 +09:00
Ken Thomases 4a76289464 winemac: Adjust sizes of all descendant views when Retina mode changes.
As opposed to just the immediate subviews of the window contentView.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-19 12:00:17 +09:00
Ken Thomases eef99122f7 winemac: Change macdrv_create_view() to not add the new view to a window's content view.
Callers can use macdrv_set_view_superview() to do that separately.

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 ca49b8070c winemac: Create views hidden initially and add macdrv_set_view_hidden() to change that.
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 587bdb8db7 winemac: Change macdrv_set_view_window_and_frame() to macdrv_set_view_frame().
Remove the no-longer-used functionality of potentially moving the view from one
window to another.  That has been taken over by macdrv_set_view_superview().

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:53 +09:00
Ken Thomases 8223756ba4 winemac: Add function macdrv_set_view_superview().
This allows for nesting views in a hierarchy rather than only ever adding them
as direct subviews of the window content view.  This functionality will be used
in subsequent commits.

This takes over some of the functionality of macdrv_set_view_window_and_frame(),
which will be removed in a subsequent commit.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:53 +09:00
Ken Thomases 742734b44f winemac: Remove the assumption that OpenGL views are always immediate subviews of the window content view.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-14 14:39:53 +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 3d73f62f01 winemac: Use floor() rather than truncation when converting Cocoa event positions to integers.
This is so negative coordinates are adjusted in the same direction as
positive ones (left and up).

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-05-05 13:18:39 +09: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 a1a93ce193 winemac: Change the processEvents parameter of -[WineEventQueue query:timeout:processEvents:] to a flags bitmask.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-02-05 13:53:22 +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 ebcf8aadc5 winemac: Remove a window from the NSWorkspace notification center when it's deallocated.
It was added as an observer in commit 3beec95a0.  Failing to remove it caused
the notification center to have a dangling pointer and caused crashes and hangs.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-12-01 12:44:10 +09:00
Ken Thomases 682820d3cb winemac: Fix a crash on versions of OS X prior to 10.9 which don't have the -[NSImage drawInRect:] method.
[image drawInRect:rect] is documented as being "exactly equivalent to calling
[image drawInRect:rect fromRect:NSZeroRect operation:NSCompositeSourceOver
fraction:1 respectFlipped:YES hints:nil]".  So, that's what I replace it with.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-10 18:29:27 +09:00
Ken Thomases b4fc81bdf2 winemac: Stop the CVDisplayLink when there are no more changes to flush.
The change to a CVDisplayLink-driven display mechanism introduced a problem: a
Wine process never went completely idle for long periods.  The display link
would fire for every refresh cycle of the display, waking a CPU from idle and
wasting energy.

To fix that, I have the display link stop itself when it determines that none
of its windows need to be displayed.  When a window is subsequently marked as
needing display, it either temporarily re-enables Cocoa's normal autodisplay
mechanism so that it displays at the end of the current turn of the run loop,
or it restarts the display link.  It chooses the former if it's been a long
time since the window was last displayed so that the display is done more
immediately.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-10 11:58:42 +09:00
Ken Thomases d6574111c2 winemac: Check the window's display link after adding it as a child of another window, which may order it on screen.
This fixes a problem where child windows ("owned" windows in Windows
parlance) would never display their contents on OS X 10.8 or earlier.
Beginning with 10.9, Cocoa calls -windowDidChangeOcclusionState: when
the window becomes visible, which is why they display on that version
and later.

Reported by Huw Davies.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-10 11:58:36 +09:00
Ken Thomases bb44de787d winemac: Remove the live-resize display timer.
It's redundant with the new CVDisplayLink-driven display mechanism.

This reverts commits d55d2ec85 and 94dc91a45.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-06 23:20:35 +09:00
Ken Thomases 3beec95a09 winemac: Use CVDisplayLink to limit window redrawing to the display refresh rate.
Some Windows apps cause user32 to flush the window surface much faster than the
display refresh rate.  The Mac driver only marks its window as needing to be
redrawn and lets Cocoa decide how often to actually redraw.  Unfortunately,
Cocoa redraws each time through the run loop and, since the Mac driver uses a
run loop source to convey messages from background threads to the main thread,
it redraws after every batch of messages.

On some versions of OS X, this excessive drawing provokes synchronization with
the window server's buffer swaps, preventing the main thread from being
responsive.  Even when that doesn't happen, it's wasteful.

So, we set our windows' autodisplay property to false so that Cocoa never
displays windows itself.  Then, we arrange to call -displayIfNeeded once per
display refresh cycle using a CVDisplayLink.  We maintain one CVDisplayLink per
display (on demand), move windows among them as the windows change screens,
start them when they acquire their first window, and stop them when they have
none left.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-06 23:20:29 +09:00
Ken Thomases 496b001ae0 winemac: Use a snapshot of an owned window when a zero-sized owner window is minimized.
Some apps create a zero-sized window as their "main" window and then create
all of the other top-level windows as owned windows with that main window as
the owner.  The user interacts with these owned windows.  When the user
attempts to minimize one of these owned windows, the app instead minimizes the
zero-sized owner window.  When an owner window is minimized, all of its owned
windows are hidden.

The Mac driver faithfully carries out these window operations.  The only
visible windows are hidden and the zero-sized window is minimized.  This
results in an invisible animation of the window down to a slot in the Dock -
a slot which appears mostly empty.  The invisible window thumbnail is badged
with the app icon, but it still looks strange.

On Windows, the Alt-Tab switcher uses the image of the owned window to
represent the zero-sized owner.

This commit attempts to do something similar.  It takes over drawing of the
Dock icon for minimized, zero-sized window.  It grabs a snapshot of one of the
owned windows and draws the app badge onto it.  Since the owned windows are
hidden before the zero-sized owner is minimized and we can't take snapshots of
hidden windows, we use heuristics to guess when it may be useful to grab the
snapshot.  If the user minimizes an owned window from the Cocoa side, we grab
that window's snapshot.  If an owned window is being hidden and no snapshot has
been taken recently, we grab its snapshot on the theory that this may be the
beginning of hiding all of the owned windows before minimizing the owner.

Unfortunately, this doesn't address the invisible animations when minimizing
and unminimizing the zero-sized owner window.

Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-10-23 19:20:00 +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 47708c2635 winemac: Add a new registry setting, OpenGLSurfaceMode, to control how GL surfaces relate to the window.
The default behavior is that GL surfaces are on top of all non-GL content in
the window.  This maximizes the performance for the common case of games, but
clipping by parents, siblings, and child windows isn't respected.

Setting OpenGLSurfaceMode to "behind" pushes the GL surface to be behind the
Mac window.  The window has transparent holes punched through it so that the GL
surface shows through.  USER32 and the wineserver take care of making sure the
holes are only where the GL windows would be unclipped and unoccluded.  Because
the OS X window server has to composite the GL surface with the window, this
limits the framerate.

Since the Mac driver has no server-side rendering path, GDI rendering to a
window which has a GL surface doesn't work.  As a partial workaround, mostly
for cases where a GL surface is created but never used, setting
OpenGLSurfaceMode to "transparent" allows the GDI rendering to show through the
transparent parts of the GL surface.  The GDI rendering is drawn to the
top-level window's surface as normal.  (The behavior of user32 to exclude the
portion covered by a GL window from GDI rendering is disabled.)  The GL surface
is in front of the window but potentially wholly or partially transparent.  It
is composited with the window behind it.

The GL surface is initially cleared to be completely transparent.  So, if
no GL rendering is done, the window will appear as though the GL surface didn't
exist.
2015-09-15 16:59:03 +09: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 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 14a0fc3ccc winemac: Prevent maximized windows from entering Cocoa full-screen mode.
OS X doesn't really have the concept of windows being maximized; that is, being
in a mode where they can't be moved or resized.  As a consequence, it doesn't
have a button in the window title bar to restore a maximized window to normal.
So, when a Wine window is maximized, the Mac driver hijacks the green zoom
button to act as a restore button.  (When a window is zoomed, the green button
"unzooms" back to its last user size and position, so it's analogous.)

However, with OS X 10.10 (Yosemite), the green button prefers to act as a
toggle for the Cocoa full-screen mode rather than zooming and unzooming.  This
made it difficult for users to restore a maximized window.  They would have to
Option-click the green button, double-click the title bar, or choose Zoom
from the Window menu, none of which is obvious.

The fix is to disable Cocoa full-screen mode for maximized windows.  Then, the
green button reverts to unzoom and restoring the window.
2015-03-13 21:52:14 +09:00
Ken Thomases 4af5d5bd99 winemac: When exiting Cocoa full-screen mode for a no-longer-eligible window, bypass the override of -toggleFullScreen:.
The override checks the disabled state of the window, but that's for user-
driven changes, not programmatic changes.
2015-03-13 21:52:12 +09:00
Ken Thomases 71b9e02265 winemac: Raise full-screen windows in front of the status items in the Mac menu bar.
Status items are the things on the right end of the Mac menu bar, like the
clock and volume widget.  It turns out that they are displayed at a higher
window level than everything else in the menu bar.  For the case where the
displays are not captured for a full-screen window, the window ends up at the
same window level as the status items, and they would sometimes end up on top.
They would draw over the full-screen window and could be clicked.
2015-02-05 19:57:56 +09:00
Ken Thomases 530a039dac winemac: Prevent interpolation of the window surface image when it's blitted to the actual window.
On high-resolution Retina displays, the OS X window backing store has twice the
pixels as Wine's window backing store.  So, our images get scaled up.  Core
Graphics had been interpolating/smoothing the image, which resulted in
fuzziness.  This tells it not to do that.

I had assumed this wouldn't be necessary since we pass FALSE for the
shouldInterpolate parameter of CGImageCreate() when we create the images.
Apparently, that's not sufficient.
2015-02-03 16:30:55 +09:00
Ken Thomases b8da8fa4b1 winemac: Ignore Cocoa child windows which aren't instances of WineWindow.
On Yosemite, in full-screen mode, Cocoa adds child windows of its own to our
windows.  These windows are, of course, not instances of WineWindow.  So, when
we call WineWindow-specific methods on them, it throws exceptions.
2014-12-17 17:08:29 +01:00
Ken Thomases d9ed0fb8e5 winemac: Don't allow double-clicks in the content area to zoom the window.
On Yosemite, double-clicking a window's title bar zooms it.  (This is to
compensate for the fact that the zoom button has been replaced by a full-screen
button.)  Sometimes, double-clicking in the content area would count as double-
clicking in the title bar.

This is controlled, in part, by the -mouseDownCanMoveWindow method of the view
that was hit in the window.  The default implementation of that returns YES
for non-opaque views, as the views are in the Mac driver.  Overriding it to
return NO prevents the problem.
2014-10-28 15:25:57 +09:00
Ken Thomases 31d7f61cc3 winemac: Properly ignore attempts to set a window's shape to its current shape.
NSBezierPath doesn't override the -isEqual: method to actually compare paths,
so it just falls back to object identity which, in our case, makes paths seem
like they're never equal.

Also, memcmp()-ing the rectangle array is almost certainly faster than any
general test for equality between two paths.
2014-10-03 08:39:49 +02:00
Ken Thomases 170d80dc90 winemac: Don't invalidate the window shadow on every draw if it's merely shaped and not color-keyed or using per-pixel alpha.
This avoids flickering and tearing on some versions of OS X during frequent
redrawing in a shaped window, such as when scrolling a document in Word 2007.

Since we aren't guaranteed that the window surface has updated bits for us to
draw, we mark the whole content view as needing redisplay and draw the window's
shape in the background color on the first -drawRect: after the shape change.
2014-10-03 08:39:43 +02:00
Aric Stewart 20daa8b61c winemac: Reposition cursor for IME composition.
It is more natural for the cursor to be at the end of the selection
being composed instead of being at the beginning.
2014-05-24 11:02:08 +09: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 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 06f80d6542 winemac: Make the window's contentView its firstResponder again after changing its style. 2014-03-11 19:39:24 +01:00
Ken Thomases 4f9de6bcdf winemac: More thoroughly discard events which have been obsoleted by subsequent Wine- or program-driven changes.
Among other things, this fixes Syberia 2.  That game shows, hides, and then
shows its window.  Hiding it caused a WINDOW_LOST_FOCUS event to be queued.
By the time it was processed, the window was the foreground window again.
In response to being told it had lost focus, the game minimized its window.

Hiding the window should have prevented or discarded the WINDOW_LOST_FOCUS
event since the change was driven from Wine and the Win32 foreground/active
window state would already be correct.  In addition, when the program
re-showed its window and made it foreground, that should have discarded the
event as being out of date.  Now they do.
2013-12-31 12:31:39 +01:00
Ken Thomases bcde44fb8a winemac: Explicitly unhide the app early when showing windows.
Cocoa would implictly unhide it when we order a window, anyway.  Doing it
early avoids problems from querying -[NSWindow isVisible] while the app is
hidden.  That method returns FALSE even for windows which would be visible
if the app weren't hidden.
2013-12-31 12:31:29 +01:00
Ken Thomases ae47323604 winemac: Track whether our windows would be visible if the process weren't hidden.
The -[NSWindow isVisible] method returns FALSE when the process is hidden,
but that's not what we need to know in some cases.

This fixes full-screen games which minimize their window when they lose
focus.  Command-Tabbing away hides the process.  Because the window was not
visible, the code didn't actually minimize it.  When switching back to the
process, no event was sent to the Wine back-end telling it the window had
been restored, so it never resumed drawing to it.
2013-12-31 12:31:21 +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 0137b07973 winemac: Allow programmatic changes of the window frame even if a window is disabled (prevented from resizing). 2013-12-30 19:01:49 +01:00
Ken Thomases 8876751e93 winemac: Prevent disabled windows from being moved.
This won't be enforced if AllowImmovableWindows=n is set in the registry.
2013-12-30 19:01:48 +01:00
Ken Thomases 5f7b30aee2 winemac: Move some state-based feature adjustment into the -adjustFeaturesForState method. 2013-12-30 19:01:47 +01:00
Ken Thomases e3dd277586 winemac: Don't change window order for SetFocus().
This fixes a problem where some apps move their window to the front after
the user switches away to another app.  OS X prevents the background app
from actually coming in front of the active app's front window, but the
window gets ordered in second place, possibly obscuring other windows of the
active app.
2013-12-12 12:06:35 +01:00
Ken Thomases 4124478b85 winemac: Clear OpenGL views to black the first time a context is attached.
This prevents VRAM garbage from being displayed before the program draws.
2013-11-28 11:16:17 +01:00
Ken Thomases fd04552fe3 winemac: Move test for valid GL drawable into -[WineContentView addGLContext:].
Improves encapsulation.  Avoids a round trip to the main thread.
2013-11-28 11:16:12 +01:00
Ken Thomases 19862b4138 winemac: Make macdrv_set_cocoa_window_frame() synchronous again.
It has a non-object pointer from the caller, so it can't allow the caller
to continue until it's finished with it.  Also, it discards events from the
event queue and we don't want the caller to process them first.

Fixes brokenness introduced by 784a9139.
2013-11-21 13:31:14 +01:00
Ken Thomases 3a03dcf097 winemac: Avoid moving owned windows when programmatically moving the owner.
Cocoa normally maintains the relative position of owned windows with respect
to the owner, which differs from Windows.
2013-11-15 12:00:12 +01:00
Ken Thomases 784a91390e winemac: Allow ordering a window into Cocoa's window list even if it's positioned outside of the desktop.
Some programs minimize windows which are outside of the desktop.  The Mac
driver had been leaving such windows ordered out, which prevented them from
minimizing and appearing on the Dock.  That, in turn, made it difficult for
the user to restore them.
2013-11-15 11:59: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 de3fb34af7 winemac: Send WM_{ENTER, EXIT}SIZEMOVE around window frame changes initiated by Cocoa.
The Mac driver was already sending these events when the user resizes the
window by dragging its corner/edges, but there are other occasions when the
window frame changes.  For example, when the user zooms the window.
2013-11-01 10:51:11 +01:00
Ken Thomases b11d6850f2 winemac: Tell Cocoa that we don't draw a focus ring for our views.
This seems to eliminate a lot of house-keeping work inside Cocoa.
2013-11-01 10:51:01 +01:00
Kevin Eaves 771fcd894a winemac: Restore the window title when the window style is changed. 2013-10-17 20:29: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 79d45585bc winemac: Add registry settings to make Option keys send Alt rather than accessing additional characters from the keyboard layout. 2013-10-10 10:45:22 +02:00
Ken Thomases 05e3d0e5cc winemac: Make sure the same housekeeping is done when closing a window as is done when hiding it. 2013-10-10 10:45:13 +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 bdcb8138fe winemac: Don't accidentally clear Cocoa window style mask bits. 2013-10-08 15:39:01 +02:00
Ken Thomases dd59ab26fe winemac: Only update window minimized state when it has changed from what processed events told us it was.
This fixes a problem where windows could spontaneously re-minimize after
being unminimized.  Cocoa would see the window unminimize.  It would queue
a WINDOW_DID_UNMINIMIZE event.  While that event was pending, Wine might do
something which caused set_cocoa_window_properties() to be called and tell
Cocoa to conform itself to the current Win32 state.  The current Win32 state
still had the window minimized, so Cocoa would re-minimize the window.  It
would even discard the WINDOW_DID_UNMINIMIZE event.
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 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 4e0e9ca84a winemac: When programmatically focusing a window, don't generate WINDOW_LOST_FOCUS event for previously focused window.
That event can confuse things if the program switches focus from A to B and
then back to A and then processes events.  It will get an event saying that
A lost focus in Cocoa, check that A does indeed have current focus in Wine,
and so switch focus away from it (to the desktop window).  (It then gets an
event that B lost focus, but that does nothing at that point.)
2013-09-26 20:05:41 +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 d55d2ec85a winemac: Move memory management of liveResizeDisplayTimer into property setter. 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 675b052572 winemac: When ordering sibling child windows, don't remove and re-add ones already in the right order. 2013-09-03 16:58:15 +02:00
Ken Thomases 987309e528 winemac: Don't use Cocoa parent-child relationship when topmost state is enough to keep owned in front of owner.
The Cocoa parent-child relationship has undesirable side effects and bugs.  In
the general case, it's the only way to maintain the z-order of owned windows
relative to their owner.  But when the owner is non-topmost and an owned
window is topmost, the Cocoa window level will enforce that and we don't
need it.
2013-09-03 16:58:15 +02:00
Ken Thomases fad48773f6 winemac: A window is ineligible to be a Cocoa parent or child while minimized. 2013-08-30 11:18:38 +02:00
Ken Thomases 84903c5db3 winemac: Track latent child windows (the inverse of the latent parent window relationship).
This allows the relationship to be restored when the window becomes eligible
again.
2013-08-30 11:18:35 +02:00
Ken Thomases a68d0a24ef winemac: When a window becomes ineligible to be a parent, make the relationship latent in its children, too. 2013-08-30 11:18:30 +02:00
Ken Thomases 029bcf97dd winemac: Clear latent parent on window close to break potential retain cycle. 2013-08-30 11:18:27 +02:00
Ken Thomases 512237ebe6 winemac: Consolidate the code for managing the Cocoa parent/child window relationship. 2013-08-30 11:18:23 +02:00
Ken Thomases 6873c3ee66 winemac: Make -setMacDrvParentWindow: do nothing if new parent is same as latent parent. 2013-08-30 11:18:18 +02:00
Ken Thomases 4b2f4eb600 winemac: Remove some duplicated code from -makeKeyAndOrderFront:. 2013-08-30 11:18:15 +02:00
Ken Thomases b755674df3 winemac: Don't unminimize a window for SetFocus(). 2013-08-27 11:50:52 +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 d30705bdfe winemac: Use screen color space for windows covered by OpenGL views. 2013-07-02 10:04:59 +02:00
Ken Thomases 941ce31adb winemac: Fix ordering of windows owned by same owner when on inactive desktop space. 2013-06-28 11:40:55 +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 1d10457aee winemac: Also activate if a window is ordered front shortly after tray icon clicked.
... in addition to if one is focused.
2013-06-20 11:30:16 +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 f6924b9603 winemac: Honor requests to order owned windows relative to other owned windows of the same owner. 2013-06-07 11:58:59 +02:00
Ken Thomases b96b565514 winemac: Command-clicks shouldn't give windows focus. 2013-06-07 11:58:52 +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 a6dc4906de winemac: Ignore window frame changes while minimized but check again when unminimized. 2013-06-04 15:01:15 +02:00
Ken Thomases 62a1907c9e winemac: Make windows key after unminimizing, if allowed.
We generally prevent Cocoa from making our windows key (focused) so that
Wine can be in control.  However, after unminimizing, Wine believes the
window is already focused but Cocoa doesn't, so key presses just cause beeps.
2013-06-04 15:01:12 +02:00
Ken Thomases b285c5706e winemac: Defer minimizing hidden windows until they are shown.
Minimizing invisible windows causes weird phantoms to appear in
Exposé, the Window menu, and the Dock.
2013-06-04 15:00:54 +02:00
Ken Thomases 841f158d81 winemac: Don't accidentally unminimize a window when trying to change z-order. 2013-06-04 15:00:31 +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 c3d2e43060 winemac: By default, make full-screen windows not float when not the active app.
Added a registry setting to control the behavior: WindowsFloatWhenInactive
with possible values "none", "all, and "nonfullscreen" which is the default.
2013-05-29 19:49:40 +02:00
Ken Thomases c8d4b1cc5e winemac: Order front in -makeKeyAndOrderFront:; we only override to control key status.
When we have windows on two different spaces and the user switches between them by
clicking our Dock icon, Cocoa inexplicably sends the switched-to window to the
back of the z-order.  It's only -makeKeyAndOrderFront: that brings it forward
again, but our override broke that.
2013-05-17 16:36:40 +02:00
Ken Thomases ef874a8eaa winemac: Don't reorder windows if they're already ordered as requested.
This avoids adjusting window levels.  It also avoid unnecessarily deinterleaving
the windows of this and other processes.
2013-05-17 16:36:35 +02:00
Ken Thomases 7a047af640 winemac: In -setFrameIfOnScreen:, don't adjust window levels if fullscreen-ness didn't change. 2013-05-17 16:36:31 +02:00
Ken Thomases 94746f1d2d winemac: In -setFrameIfOnScreen:, avoid some work if the frame didn't change. 2013-05-17 16:36: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 8343e7ce4d winemac: Set up window's latent parent-child relationship before ordering the window.
Making a window a child reorders it to be immediately above or below its parent,
potentially undoing the ordering we had just done.
2013-05-17 16:36:00 +02:00
Ken Thomases 6d4098ebd3 winemac: Consider minimized windows as "on screen" for our purposes. 2013-05-17 16:35:48 +02:00