The window being ordered was first put in the correct place and then was moved
to the other end of the children list by the loop that was intended to adjust
the windows strictly between the window and the ancestor.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
It had only been done when a window is shown. Some games change the display
mode before showing their first window. Following Mac conventions, the Mac
driver does not apply display mode changes when it's not the active GUI app.
If such a game were to change the mode and then query display-mode-related info,
it would get info for the original mode, not the requested mode.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Cocoa will draw the window frame immediately but if autodisplay of its content
view is disabled, that may leave the content area black briefly. This change
avoids that flicker.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This fixes an issue where some windows (on some systems) would never display
their content area. If they had a title bar, they'd just display that and
nothing else.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
The display link may be stopped even if there are associated windows, due to
idleness. So, it may need to be started when a window is added even if it's
not the first window.
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This is winemac.drv port from winex11.drv.
Please refer to b8dc1e7cde.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Aric Stewart <aric@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-[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>
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>
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>
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>
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>
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>
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>
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>