Commit Graph

335 Commits

Author SHA1 Message Date
Ken Thomases ed3ed03519 winemac: Ignore failure to send or 0 result from WM_QUERYENDSESSION if target window was destroyed. 2014-01-17 11:02:46 +01:00
Ken Thomases f4b41eeb17 winemac: Eliminate unused "hdc" field of OpenGL context structure. 2014-01-16 10:55:16 +01:00
Ken Thomases e21192469d winemac: Make WineOpenGLContext hold a strong reference to its view.
Its superclass, NSOpenGLContext, only holds a weak reference.  The view was
sometimes being deallocated before the context was disposed of, resulting in
crashes.
2014-01-14 11:17:40 +01:00
Ken Thomases 2963a2d4ab winemac: Don't remove an OpenGL context from its view if we're only going to re-add it.
If the context is being made current with its existing view, just update it
before making it current.
2014-01-14 11:17:38 +01:00
Ken Thomases 2cc5337940 winemac: Consolidate code paths for clearing the OpenGL context.
We clear it if the context or the view is NULL.  If the context is non-NULL,
we want to disassociate the views of both the current and passed-in contexts,
if they differ.
2014-01-14 11:17:35 +01:00
Ken Thomases d57a99b482 winemac: When setting a view for an OpenGL context and it is latent, clear any existing view. 2014-01-14 11:17:31 +01:00
Ken Thomases 1896396330 winemac: When clearing the OpenGL context, disassociate it from its view. 2014-01-14 11:17:28 +01:00
Ken Thomases c072a4564e winemac: For ChangeDisplaySettingsEx(), if caller didn't specify, prefer non-interlaced and unstretched modes. 2014-01-10 12:05:45 +01:00
Ken Thomases ce5a87b1ef winemac: Simplify display mode code.
When originalDisplayModes has entries, the app is active.  When the app is
active, latentDisplayModes is empty.
2014-01-10 12:05:41 +01:00
Ken Thomases d4d92a759e winemac: Clear the latentDisplayModes instance variable before realizing the latent modes. 2014-01-10 12:05:38 +01:00
Ken Thomases 42a7d7209b winemac: Restore display mode to original in more cases.
We only care if we have changed the mode and we're changing it back to its
original.  Even if the current mode matches the target mode, we may still
need to release the displays and clear the entry from originalDisplayModes.
2014-01-10 12:05:34 +01:00
Ken Thomases 9c65d672a2 winemac: Don't assume the current display mode is the original if we don't have the displays captured.
Another process may have changed the display mode before we queried the
current mode, so we may be seeing a non-original mode.
2014-01-10 12:05:30 +01:00
Ken Thomases fe1c0ab952 winemac: Don't record original display modes when not the active app.
originalDisplayModes should be used when active, empty when inactive.
latentDisplayModes is used when inactive, empty when active.

The count of entries in originalDisplayModes is used to test whether the
process has the displays captured so adding entries when inactive would give
incorrect results.  This could have led us to mistakenly change the display
mode when we don't have the displays captured.
2014-01-10 12:05:25 +01:00
Alexandre Julliard 5e7416e5c8 makefiles: Get rid of the MAKE_DLL_RULES variable. 2014-01-02 12:08:18 +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 94cfa7799b winemac: For WINDOW_DID_UNMINIMIZE events, don't attempt to restore windows which aren't minimized and visible.
The Win32 window state might have changed while the event was in the queue,
making it obsolete.  Sending WM_SYSCOMMAND/SC_RESTORE might re-show a hidden
window, for example.
2013-12-31 12:31:33 +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 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 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 2d1396af32 winemac: Extract some duplicated code to a new perform_window_command() function.
This also changes to posting rather than sending WM_SYSCOMMAND/SC_MINIMIZE.
2013-12-30 19:01:47 +01:00
Ken Thomases 2c6ad1829d winemac: Don't check the state of the SC_MINIMIZE item of the window menu when asked to minimize.
The window menu items are not updated as the window state changes; they only
update when the menu is shown.  So the item state is not a reliable indicator
of whether minimization is allowed.
2013-12-30 19:01:46 +01:00
Frédéric Delanoy f2e1589b34 winemac.drv: Constify a character string. 2013-12-19 17:09:08 +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 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
Frédéric Delanoy e0b68129fa winemac.drv: Use BOOL type where appropriate. 2013-12-13 12:36:10 +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
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 f0c4354a6b winemac: Include the OpenGL headers to fix building on OS X 10.9. 2013-12-03 12:33:44 +01:00
Frédéric Delanoy 69d35a01cf winemac.drv: Use BOOL type where appropriate. 2013-11-29 13:32:44 +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 eac789c6da winemac: Put clipboard formats synthesized from other standard clipboard formats at the end of the list. 2013-11-22 13:59:33 +01:00
Ken Thomases f2640745b3 winemac: Make macdrv_EnumClipboardFormats() always use macdrv_copy_pasteboard_formats().
This makes sure that the formats are enumerated in a consistent order.
2013-11-22 13:59:08 +01:00
Ken Thomases b28a014c44 winemac: Cache the "natural" clipboard format entry associated with synthesized built-in entries at startup. 2013-11-22 13:59:03 +01:00
Ken Thomases ee53ea4b93 winemac: Add a function to find the "natural" clipboard format entry for a format ID. 2013-11-22 13:58:48 +01:00
Ken Thomases a0061e0a30 winemac: Synthesize text clipboard formats in CF_TEXT, CF_OEMTEXT, CF_UNICODETEXT order. 2013-11-22 13:58:42 +01:00
Ken Thomases d98dbf8fbd winemac: Synthesize CF_METAFILEPICT from CF_ENHMETAFILE. 2013-11-22 13:58:33 +01:00
Ken Thomases 53089bff2e winemac: Synthesize CF_ENHMETAFILE from CF_METAFILEPICT. 2013-11-22 13:58:28 +01:00
Ken Thomases 29236cce4c winemac: Add support for the CF_ENHMETAFILE clipboard format. 2013-11-22 13:58:20 +01:00
Ken Thomases cdad61369c winemac: Add support for the CF_METAFILEPICT clipboard format. 2013-11-22 13:58:12 +01:00
Ken Thomases a983cfb01d winemac: Ignore Mac-originating pasteboard types which aren't mapped to standard clipboard formats.
New clipboard formats had been registered for them, but that was pointless.
No Windows app would ever expect or make use of such clipboard formats or the
associated pasteboard data.
2013-11-22 13:58:02 +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
Ken Thomases f6a8c5b50e winemac: Take WS_EX_TOOLWINDOW into account when computing how much of a window is replaced by the Mac decorations. 2013-11-21 19:39:01 +01:00
Ken Thomases 682ed91017 winemac: Defer attaching OpenGL context to a view which is zero-sized or outside its window's bounds.
That fails with the dread "invalid drawable" message.
2013-11-21 13:31:33 +01:00