Commit Graph

334 Commits

Author SHA1 Message Date
Alexander Larsson
aa20a6b0b5 Refactor background clearing code so we can clear a general region 2009-04-02 10:16:25 +02:00
Alexander Larsson
490cbf84cd Be more explicit about when to flush moves
Also makes the non-doublebuffered case work better by flushing before we
call _gdk_windowing_window_process_updates_recurse.
2009-04-02 10:15:33 +02:00
Alexander Larsson
22da9d08da Destroy native children when recursing from a destroy on a virtual window
Native descendants of a virtual children are not automatically destroyed
with the parent as if it was a native window, so we need to handle
the native recursion tracking manually in _gdk_window_destroy_hierarchy()
2009-04-02 10:15:33 +02:00
Alexander Larsson
d35b723261 Only translate native motion events to motion events
Crossing events don't have the device field, which we would like to
pass on, so only do motion events from motion events.
2009-04-02 10:15:33 +02:00
Alexander Larsson
50a5f6046d Don't set the background for input only window
This is not allowed and will cause X errors.
2009-04-02 10:15:33 +02:00
Alexander Larsson
a7b6139029 Fix assert, it was checking the wrong window
We keep the update freeze count in the impl_window, not in
child windows.
2009-04-02 10:15:33 +02:00
Alexander Larsson
53511cb653 Enable custom event masks for native windows
Some apps really need to set custom event masks on native child windows,
for example emacs sets the event masks with gdk, but then reads out
the raw X events via a filter, so gdk event emulation doesn't work for that.

When we get motion or button events we map back from the event position and
window to the toplevel before doing anything, because a toplevel native window
could e.g. overlap a child window or whatever.
2009-04-02 10:15:32 +02:00
Alexander Larsson
fe3c410048 Filter out all native grab/ungrab events with detail INFERIOR
These are generated when we get an implicit grab on a native
child window, and we can't filter them with _has_grab() because
they are sent before the button press event where we detect
the implicit grab.

This makes clicks work in the flash plugin again
2009-04-02 10:15:32 +02:00
Alexander Larsson
20c81eca6a Return ignoring of native grab/ungrab events when we don't have a grab
It turns out we really have to ignore grab/ungrab events or we'll
report double crossing events when we grab or ungrab.

However, we also can't ignore crossing events from grabs from other clients
as that leads to missed enter/leave events on e.g. alt-tab in metacity.

Fortunately we now track grabs very precisely, so we know with certainty
whether we have a grab at the time (serial) of the native crossing events,
and only if we do we ignore them.
2009-04-02 10:15:30 +02:00
Alexander Larsson
53269a5042 Handle crossing events with subwindows unknown to gdk
If we get crossing events with subwindow unexpectedly being NULL
that means there is a native subwindow that gdk doesn't know about.
We track these and forward them, with the correct virtual window
events inbetween.

This is important to get right, as metacity uses gdk for the frame
windows, but gdk doesn't know about the client windows reparented
into the frame.
2009-04-02 10:15:30 +02:00
Alexander Larsson
5be3f38535 Move implicit grab tracking totally to common code 2009-04-02 10:15:30 +02:00
Alexander Larsson
26cbf87d7d New approach for grab tracking code
We try to track the exact grab state, i.e. whats valid on the client
now and whats comming soon via the xserver roundtrip (and when).
2009-04-02 10:15:30 +02:00
Alexander Larsson
a6e647863d Only sync the display if creating a native window implicitly 2009-04-02 10:15:29 +02:00
Alexander Larsson
e631d2d2d4 Sync the display when creating a native window.
This is needed because we want to be able to use the xid immediately
even from another process or another connection to the display.
2009-04-02 10:15:29 +02:00
Alexander Larsson
089c9ca2f1 Don't warn about unexpected events on foreign windows
We don't really control these events so its not wrong per se
to have them generate stuff we don't expect.
2009-04-02 10:15:29 +02:00
Alexander Larsson
177b53a079 Fix typo in gdk_window_input_shape_combine_region 2009-04-02 10:15:29 +02:00
Alexander Larsson
8b7d8431aa Make gdk_window_get_toplevel() for CHILD window with root as parent
Having GDK_WINDOW_CHILD windows with root as the parent apparently works,
and metacity uses it. The current gdk_window_get_toplevel() returns the
root window for that, which is wrong, so we check that explicitly.
2009-04-02 10:15:29 +02:00
Alexander Larsson
33c0c1fba8 Don't mess with any events on the root window.
This causes all sorts of weirdness with pointer_over_window
being the rootwindow and then crashing gdk_window_get_toplevel() later.

With this metacity stops crashing madly.
2009-04-02 10:15:29 +02:00
Alexander Larsson
6e56179b03 Don't crash if window->parent is NULL
This happens for events on the root window.
2009-04-02 10:15:28 +02:00
Alexander Larsson
de2d5f299d Simplify do_move_region_bits_on_impl by removing unused arguments 2009-04-02 10:15:28 +02:00
Alexander Larsson
b272456023 Remove unused label 2009-04-02 10:15:28 +02:00
Alexander Larsson
5ca1865f5d Don't ignore native CROSSING_GRAB/UNGRAB events
These are sent when someone else grabs the pointer, and we don't
want to miss these expose events. For instance, we missed enter
and leave events on alt-tab.

There were some issues with these wrt out-of-sync grab information
in the client, but that should now be handled. So, it should work
or at least be fixable if we find some bug.
2009-04-02 10:15:27 +02:00
Richard Hult
1a47356485 Remove invalidate_maybe_recurse and process_updates from the paintable interface
Replace them with two new functions
_gdk_windowing_{before,after}_process_all_updates() that are called
around the guts of gdk_window_process_all_updates(). Add empty ones
for X11 (nothing more needed), quartz ones will be implemented next.
2009-04-02 10:15:27 +02:00
Richard Hult
1ee03b35d0 Expose _gdk_window_process_updates_recurse for backends
We use this in the added windowing function
_gdk_windowing_window_process_updates_recurse. The X11 implementation
just calls _gdk_window_process_updates_recurse directly, but at least
quartz will need to do some more work.
2009-04-02 10:15:27 +02:00
Richard Hult
72d4403eed Add a window argument to begin_paint_region in the paintable interface
The paintable itself is now the impl window, which can be different
from the window.
2009-04-02 10:15:27 +02:00
Alexander Larsson
32a070d09a Fix gdk_window_has_no_impl typo 2009-04-02 10:15:26 +02:00
Alexander Larsson
ca1aeff814 Only set cursors on toplevel.
This fixes a problem where we used to set them on a native window, but we
never unset it becase when the pointer moved to another native window
we just set the cursor on that window. Always setting on the toplevel
fixes this.
2009-04-02 10:15:26 +02:00
Alexander Larsson
e24c9e291d Switch motion hint emulation to be serial based.
For backends not supporting serials, just have
_gdk_windowing_window_get_next_serial return zero.
2009-04-02 10:15:26 +02:00
Alexander Larsson
6a0d317866 Keep track of the impl windows wrapper directly with a ref
This is needed so that the ->wrapper of the impl window doesn't
go away while there are virtual windows referencing the impl
window.
2009-04-02 10:15:26 +02:00
Alexander Larsson
cf54a2c68e Ungrab keyboard if virtual window is hidden or destroyed 2009-04-02 10:15:26 +02:00
Alexander Larsson
cb05af0a61 Implement GDK_POINTER_MOTION_HINT_MASK support 2009-04-02 10:15:25 +02:00
Alexander Larsson
d267452bb7 New flicker flicker fixing approach
There was a performance problem with the old flicker fixing
approach. For moved windows we copied the window data to the double
buffer pixmap and then back to the window with the rest of the
expose data. In some cases the copy from window data to pixmap was
very slow because the pixmap was allocated in system memory and
the window in video memory.

The new approach is to delay all window moves and then replay them
after the expose has drawn to the double buffer pixmap but before
drawing it to the window. Furthermore, we remove all exposed areas
from the destination of the delayed moves so we won't copy something
just to then immediately draw over it.

This makes scrolling in firefox fast, and it makes tests/flicker not
show any (detectable) flicker.
2009-04-02 10:15:25 +02:00
Alexander Larsson
3155fdcd41 gdk_window_process_updates_internal only needs to flush outstanding moves 2009-04-02 10:15:25 +02:00
Alexander Larsson
4455db353f Split out the flushing of outstanding moves
Some places need to only flush the outstanding moves, split
this into gdk_window_flush_outstanding_move
2009-04-02 10:15:25 +02:00
Alexander Larsson
a9fd3ae249 Flush any outstanding stuff in the window in non-buffered get_internal_paint_info case
We return the raw window drawable, so its likely the app will do some
weird stuff to it, like draw using non-gdk operations. We don't want
the app to see any half-drawn state, so flush everything.

This fixes a scroll issue in firefox at least.
2009-04-02 10:15:25 +02:00
Alexander Larsson
815f0d7605 Clip exposed area to the visible region.
This avoids extra work, and it means we won't allocate large pixmaps
for double buffering.
2009-04-02 10:15:25 +02:00
Alexander Larsson
d82cee80c3 Don't send expose events if region is empty 2009-04-02 10:15:21 +02:00
Alexander Larsson
7cebc68bde Handle native children correctly in gdk_window_scroll
This is basically the same fix as was done for
gdk_window_move_resize_internal. We make sure not to move the native
child window contents twice and we don't copy data that was overwritten
by the moving of the native child windows.
2009-04-02 10:15:21 +02:00
Alexander Larsson
50d9a9018a Ifdef out x11 specific code 2009-04-02 10:15:21 +02:00
Alexander Larsson
e718893611 Fix performance issue with find_native_sibling_above
It keep recursing a lot, unnecessary
2009-04-02 10:15:20 +02:00
Alexander Larsson
1084b8e6a1 Call backend move_resize with the right coords/size
We calculated and set the new position and size, just pass that.
This avoids parsing the "special values" again
2009-04-02 10:15:20 +02:00
Alexander Larsson
905d328933 Make moving subwindows correctly handle native windows
Whenever a native window is moved this causes an immediate change in
the window (the window content is copied). This change conflicts can
conflict with outstanding moves or other cached changed, so we need
to flush all outstanding moves in the related windows.

To simplify the code for window move/resize the toplevel version was
split out to its own function.

Move native windows after recomputing so that we get the right new
shape before moving (and the implied copy). This means we're not
copying too much data.

Take into account the area of a moved window that contains native
subwindows, as these affect things in two ways:

First of all we shouldn't copy the original window location, as that
is copied by the native window move.

Secondly, we can't copy things  that would end up copying from the
native window move destination, as the data that used to be there is
now destroyed by the native window move.
2009-04-02 10:15:20 +02:00
Alexander Larsson
df4f4c14c7 do_move_region_bits_on_impl needs to copy from overlapping native windows too
It can happen that another native window is re-shaped over the region to
be moved, this will not destroy the data (since we're unsetting the background
when we reshape), but it will mean we need to read from this window.

We already used INCLUDE_INFERIORS, but that only handle subwindows. We fix
this by doing the copy on the toplevel, offsetting the copy to compensate for
this.
2009-04-02 10:15:20 +02:00
Alexander Larsson
6b15e248fa move_region_on_impl - shortcut if region is empty 2009-04-02 10:15:20 +02:00
Alexander Larsson
3c5c7f4b4d Avoid extending implicit paint size due to empty regions not working well with gdk_rectangle_union on clipbox 2009-04-02 10:15:20 +02:00
Alexander Larsson
ef3d1893b6 Always set the shape when creating a native window.
This is not always done by recompute_visible_regions, as
the clip region doesn't change.
2009-04-02 10:15:19 +02:00
Alexander Larsson
c967cabc35 Avoid lots of unnecessary computation when moving toplevel windows
There is no need to do all these computations when moving toplevels
as that can't really change any visible regions. Nor will it cause
any exposes we need to handle.
2009-04-02 10:15:19 +02:00
Alexander Larsson
cdb405dfcf Restack native window after reparent put it on top 2009-04-02 10:15:19 +02:00
Alexander Larsson
c1884ce403 Fix up native window handling in gdk_window_lower too 2009-04-02 10:15:19 +02:00
Alexander Larsson
28c4518cca Fix up gdk_window_raise and native window creation to not move native window above windows outside the non-native parent 2009-04-02 10:15:19 +02:00