Commit Graph

364 Commits

Author SHA1 Message Date
Alexander Larsson
9437138db2 Fix some warnings added by the input handling
Add casting and actually fix parenthisation of boolean expression
2009-06-03 11:24:27 +02:00
Alexander Larsson
609b03c517 Further clean up window drawing redirection/clipping
This combines the OFFSET_GC and various SETUP/RESTORE gc macros
to a single BEGIN/END_DRAW macro pair.
2009-06-01 14:48:11 +02:00
Alexander Larsson
1d739c2ff6 Fix up gdk_window_set_has_native rename issues
Seems like i forgot a bunch of things.
2009-06-01 14:47:38 +02:00
Alexander Larsson
e123931a65 Add more GdkWindow implementation docs 2009-06-01 13:38:04 +02:00
Alexander Larsson
a84cc4e9f3 Whitespace cleanup gdkwindow.c
Almost everything here changed anyway, so might as well clean it up.
2009-06-01 12:04:36 +02:00
Alexander Larsson
287b821705 Rename gdk_window_set_has_native to gdk_window_ensure_native
This also removes the (unimplemented) possibility to change a window to
non-native. This seems generally not very useful, and there are some problems
with it, for instance if two "users" need a window to be native and then
one of the "users" doesn't need it anymore it can't change it back, because
it is unaware of the other reason the window is native.
2009-06-01 11:57:59 +02:00
Alexander Larsson
7372379c24 Initial version of input support 2009-05-29 16:39:12 +02:00
Alexander Larsson
0b586a5ad7 Add support for client side graphics exposures in gdk_draw_drawable 2009-05-27 17:10:32 +02:00
Alexander Larsson
8cb385cd31 Add support for visibility notification 2009-05-26 20:53:48 +02:00
Alexander Larsson
8a689f2e15 Handle flushing implicit paint while there is a paint outstanding
If a native window or a window with a native subwindow is moved or resized
then the client window moves and implicit paints need to be flushed since
the native window move will copy/overwrite data. This may happen while there
is an outstanding paint if the move is inside an expose event (weird, but
flash embedded in webkit hit this).

Right now we're asserting here, but the right fix is to allow this but
to not flush the parts that are currently in a (non-implicit) paint. This
means we flush all results from previous not-yet-flushed exposes, but not
the ones being drawn.
2009-05-26 11:30:46 +02:00
Alexander Larsson
d64b51de4d Fix coordinates for background clearing when redirecting
Backport from svn of this fix
2009-04-02 10:16:30 +02:00
Alexander Larsson
255ec543b1 Ensure offscreen windows are not used as non-toplevels 2009-04-02 10:16:30 +02:00
Alexander Larsson
2c877d4c2d Remove offscreen hooks support
In the new world offscreen windows are not put in the hierarchy, but are
rather toplevels for themselves. Offscreen hooks don't make any sense
in this model.
2009-04-02 10:16:30 +02:00
Alexander Larsson
1208c2fa11 Fix x vs y typo 2009-04-02 10:16:29 +02:00
Cody Russell
3fdd1333b2 Misc stuff 2009-04-02 10:16:29 +02:00
Cody Russell
a93c6cd6e1 CSW Win32 work in progress - builds but does not work yet. 2009-04-02 10:16:29 +02:00
Alexander Larsson
05d3fc6bbd Try to combine consecutive window moves into one
It often happens that we move region A to B and then we move a subset
of B to C. When possible we'd like to replace this with a move from
A directly to C, and a suplimentary move from A to the areas of B not
overwritten by C.

Getting an optimal move combiner seems quite complicated, but this
simple approach gets most of the interesting cases right and isn't
all to complicated.
2009-04-02 10:16:29 +02:00
Alexander Larsson
f0fb3f450f Free region also if its empty (we're taking ownership now) 2009-04-02 10:16:29 +02:00
Alexander Larsson
c35e0e11da Move unnecessary window copies to the right place
This code got placed wrong, it should happen when processing updates
on the impl window so it affects the whole expose, not in begin_updates.
2009-04-02 10:16:28 +02:00
Alexander Larsson
51010ca066 Remove invalid source area from copy in move_region_on_impl
There is no need to copy something that is already invalid and will
be marked as invalid in the destination anyway, so we remove this
area from the region to copy.
2009-04-02 10:16:28 +02:00
Alexander Larsson
e4b26d3231 Move GdkWindowRegionMove construction/destruction to separate functions 2009-04-02 10:16:28 +02:00
Alexander Larsson
3866ea0539 Use clearer names for GdkWindowRegionMove members 2009-04-02 10:16:28 +02:00
Alexander Larsson
184dbd5782 queue expose translations after the actual pixel copy
The expose translation is useful for tracking how outstanding
invalid (exposed on server) areas are copied, and how we need to
compensate for that on the client side to redraw the right area.

So, we should queue the translation at the time we actually move
the bits on the server side, not when moving the window on the
client side.

Also, clean up some naming of parameters.
2009-04-02 10:16:28 +02:00
Alexander Larsson
fb3032af04 Fix order of outstanding moves in queue
The last added move should be done last, so we need to append moves
not prepend
2009-04-02 10:16:28 +02:00
Alexander Larsson
5742005aa1 Make outstanding window moves work with the new model
We now copy outstanding window moves directly on the window and
not to an intermediary pixmap, this means our previous code to
combine window copies was wrong (it relied on each copy not
destroying the source date).

Furthermore, we can't just remove all the update area from the
destination of the outstanding moves, as sometimes things get
copied into that area and then used as the source of another
copy.

We replace the previous window copy combining with a naive
version that just queues each move, just to get things right.
Further work to optimize copies is possible.

Also, we don't remove copy destinations that are used as source
for later copies.

We also clean up the memory management by not having
move_region_on_impl taking ownership of the passed in region.
2009-04-02 10:16:28 +02:00
Alexander Larsson
5ccc8b2ff1 Don't clear background on no exposure mask if NULL background pixmap set
This is the same as background None in X, i.e. never draw the background.
2009-04-02 10:16:28 +02:00
Alexander Larsson
96bc993786 Don't event process updates for foreign windows 2009-04-02 10:16:28 +02:00
Alexander Larsson
8690d19f03 Don't touch private->parent after its been change
The backend reparent may change private->parent, so we must use
the old saved value.
2009-04-02 10:16:27 +02:00
Alexander Larsson
7d51b4179d Clear background on expose with no EXPOSURE_MASK
Apps that set no exposure mask rely on the system clearing things
to the window background, so we need to do this ourselves.

Also, don't do this on foreign windows, as they are not controlled
by us. In fact don't do exposes on foreign windows either.
2009-04-02 10:16:27 +02:00
Alexander Larsson
16b4c3ade8 Call backend show() in gdk_window_show even if window is mapped
This is required for the GtkSocket code, as it shows the plug child
even though the current cached state is (wrongly) that its already
mapped.

This makes blink work for non-local case in testsocket.
2009-04-02 10:16:27 +02:00
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