Commit Graph

557 Commits

Author SHA1 Message Date
Matthias Clasen
9be22cb574 Document gdk_window_geometry_changed 2009-08-31 19:51:19 -04:00
Alexander Larsson
21efe59aa0 Don't delay showing windows until viewable in GDK_NATIVE_WINDOWS mode
If all windows are native there is no need for delaying the operations
so we just do all shows/hides directly.
2009-08-31 15:06:01 +02:00
Alexander Larsson
4d3b19fa7c Update shape handling
For toplevels, never apply clip as shape, instead apply shape.
This way we don't have to re-set it all the time as the window size
changes. Furthermore, this change fixes unsetting a shape on a
toplevel window which didn't actually unset the shape before.

Additionally we never apply clips as shape if the shape would just
be the same as the regular window size. This means we won't unnecessarily
add a useless shape to most native child windows (and additionally this
helps apps that do weird X stuff that don't expect these shaped windows).
2009-08-31 15:06:01 +02:00
Alexander Larsson
154be115ec Use temporary impl_iface variable to make lines shorter
I.e. we use:
 impl_iface = GDK_WINDOW_IMPL_GET_IFACE (private->impl);
And then use impl_iface instead of the full macro when calling vfuncs.

Also, in some places we avoid getting the iface multiple times.
2009-08-31 15:06:01 +02:00
Alexander Larsson
397951cc85 Add and use gdk_window_is_toplevel when possible
This makes a lot of code cleaner and easier to understand
2009-08-31 15:06:01 +02:00
Alexander Larsson
028610b104 Add window type an shape to window print for nicer debugging 2009-08-31 15:06:01 +02:00
Alexander Larsson
d3d7070995 Support DEBUG_WINDOW_PRINTING even with GDK_NATIVE_WINDOWS 2009-08-31 15:06:00 +02:00
Matthias Clasen
5e5ab90a57 Improve CSW docs 2009-08-31 00:55:32 -04:00
Matthias Clasen
2421e641f4 Warn when a parent is destroyed
Previously gdk_window_new would silently return NULL. Bug 590921.
2009-08-30 11:14:40 -04:00
Matthias Clasen
145fdcbb9e Make beeps work again
Yay, beeps !
2009-08-29 13:06:04 -04:00
Alexander Larsson
858e6bcd65 Allow x and y to be NULL in gdk_window_get_geometry
Fixes a crash reported in bug #593249
2009-08-27 13:34:00 +02:00
Alexander Larsson
cf73930869 Don't unnecessarily set the event mask as that can cause X errors
For instance, two clients selecting for button events can cause BadAccess.
This fixes bug 592624, where a gdk_window_reparent caused us to re-set
the event mask, breaking the workaround for the mozilla BadAccess bug.
2009-08-26 14:53:27 +02:00
Alexander Larsson
2400e1440e Propagate the "send_event" flag for emulated events
This fixes bug 593011, where we were getting a bogus time on sent events
and the gnome-panel specifically looked for this and worked around it.
2009-08-26 10:36:26 +02:00
Alexander Larsson
7cc8cf2888 Fix cairo clipping to client side windows
When updating the clip region on cairo context (due to window changes or
paints of different sizes) we reset the old clip region, but this was
erronously done inside a cairo_save/cairo_restore pair, which made the
reset not take effect.

This fixes bug #592263.
2009-08-25 15:47:09 +02:00
Alexander Larsson
c2546c859d Clean up gdk_draw_drawable() composite handling
Instead of doing some magic in gdk_draw_drawable() to avoid double
offsetting when calling gdk_draw_drawable on the impl we call
the vfunc directly on the impl. Thus removing the weird magic from
gdk_draw_drawable().

I tested this with the testgtk test "text", where if the original magic
code is disabled typing a newline in the middle of a text line causes
the double offset issue to appear.
2009-08-25 10:37:18 +02:00
Alexander Larsson
a79f929dd6 Add support for enabling only native windows
Some applications make weird assumtions on Gtk+ that do not work anymore
with the new client-side windows support. For instance SWT/Eclipse reorders
the stacking order of the X windows directly without telling gdk this,
which breaks gdk drawing as gdk now relies on knowing the stacking order
for window clipping.

This introduces a GDK_NATIVE_WINDOWS environment variable, which if set
causes Gtk+ to always use native windows. Its more compatible with
pre-csw Gtk+ behaviour if you do weird X-specific hacks, although it does
limit the size of GdkWindows to 65535x65535.
2009-08-24 15:22:29 +02:00
Alexander Larsson
428d7bd27b More reentrancy protection for process_updates
Protect against exposes destroying windows in some more places.
Hopefully this fixes bug 589367.
2009-08-20 17:09:08 +02:00
Alexander Larsson
f7185ec704 Don't crash on NULL parent
The parent window can be NULL, check for that before dereferencing.
2009-08-17 16:59:47 +02:00
Alexander Larsson
44b84fe12d Remove unused variable 2009-08-16 22:32:58 +02:00
Alexander Larsson
528546733f Fix gdk_window_get_geometry for native children with non-native parent
gdk_window_get_geometry calls the native function for all non-native
windows. This returns coords relative to the native parent. We need
to convert this to be relative to the client side parent.

This fixes DnD coordinates in firefox (bug 588437).
2009-08-16 22:27:19 +02:00
Alexander Larsson
bd0755753a Always queue antiexposes after flushing outstanding moves
If antiexposures are queued and then we do the outstanding moves
we will queue translations that will affect incomming exposes
wrongly wrt the antiexposure. So, make sure we process the outstanding
moves before doing the antiexposure.

Additionally this commit adds a bunch of comments about how the
expose handling works and fixes a small bug that made us always
flush outstanding moves a little to early than necessary.
2009-08-14 12:09:02 +02:00
Alexander Larsson
f1f7df6443 Fix type mismatch warnings
Cast g_list_foreach args to GFunc.
2009-08-14 11:20:12 +02:00
Alexander Larsson
9f82243197 Make _gdk_window_process_updates_recurse reentrancy safe
Apps may change the window hierarchy while recursing over it by
destroying windows from the expose event handler. We need to copy
the children list and ref all the children while recursing.

This fixes some crashers in gedit (bug #589367, bug #591434)
2009-08-13 17:00:00 +02:00
Alexander Larsson
7667c4d8dc Fix leaks of clip region and outstanding moves
We're never freeing these, do so when destroying.
Fixes bug 589877
2009-08-13 16:49:58 +02:00
Alexander Larsson
939e55223c Ensure that queue_translation is paired with the right X operation
The X11 queue_translation operation uses NextRequest to get the serial
of the XCopyArea operation where the translation should end. However,
if the gc passed to gdk_draw_drawable has a non-flushed clip region
(which it commonly has now for the window clipping) then the next
operation will be the GC flush, not the XCopyArea.

To handle this right we now pass in the GC to be used to
queue_translation and ensure that it is flushed before calling
NextRequest().
2009-08-13 14:46:02 +02:00
Alexander Larsson
e25ac0b5cb Clarify comment 2009-08-13 14:46:01 +02:00
Alexander Larsson
043ca236f2 Invalidate old source in gdk_window_move_region
When we copy the region we need to also re-expose the areas of
the copied region that was not also in the destination.
And, we need to do this invalidation after the move, as the
move also moves any invalid area.
2009-08-13 14:46:01 +02:00
Alexander Larsson
8a517dc0bb Modify window system exposes wrt outstanding moves
If there are outstanding moves in an area that intersects
the source of an outstanding move we need to move the invalid
area correspondingly, otherwise we will expose the wrong area
as the outstanding move copy will happen before we expose
the invalid area.
2009-08-13 14:46:01 +02:00
Alexander Larsson
f019047402 Don't un-invalidate area that will be immediately invalidated again.
When moving an area we move any invalid region in this area to the
new place, but there really is no need to remove the old invalid
area as it would just be invalidated again (being newly exposed).
2009-08-13 14:46:01 +02:00
Alexander Larsson
ff558e2ec6 Remove C++ comment 2009-08-13 14:46:01 +02:00
Matthias Clasen
bdffae7f6c Make setting the root cursor work again
This used to work, and CSW broke it. Bug 591462, 589844.
2009-08-11 14:19:35 -04:00
Alexander Larsson
fa21459066 Fix clearing of window background for some transparent notification icons
This extends the usage of the native clear region call such that its
called also for windows that have parent relative background all the
way up to a native window. That way we get true background relative
background clearing even to a foreign parent, which means that some
transparent notification icons look right again.
2009-08-11 15:41:23 +02:00
Alexander Larsson
f30cfd729a Show/Hide native window when updating viewable
This moves the native show/hide calls to the generic code
for calculating viewable rather than in its own separate code
called from gdk_window_show/hide. This simplifies the code a bit,
but most significantly it means things are correctly shown when
they become viewable for other reasons than a show/hide call.

For instance, this fixes bug 590442 (gvim embedding) where the
toplevel GtkPlug is mapped by the embedder and we didn't previously
pick up that the native children became viewable and should be shown.
2009-08-11 11:35:35 +02:00
Alexander Larsson
19c1c11322 Don't invalidate unnecessary areas on raise
We used to invalidate the whole window when raised, but this is
unnecessary much, we now just invalidate the visible area minus the
previously visible area.

This also fixes a problem where expose calling raise caused a loop (#588438)
2009-08-10 15:35:33 +02:00
Alexander Larsson
7f92684237 Don't ever invalidate the root window
This never worked before csw since the root window is never
set as IS_MAPPED, but with the new viewable check (which is
true for the root window) we could erronously queue exposes
on the root window.

This happened unexpectedly in bug 589369, where metacity
got a GraphicsExpose event on the root window due to some
graphics operation, queueing an expose which would be handled
by clearing that area. That is fixed with this commit.
2009-08-10 14:13:06 +02:00
Emmanuele Bassi
6f0f5f8dc7 Fix gdk_window_get_cursor() documentation
The 'Return value' annotation is missing from the documentation
of gdk_window_get_cursor().
2009-07-30 11:12:27 +01:00
Cody Russell
1780361b79 add gdk_window_get_cursor() 2009-07-29 22:38:36 -05:00
Alexander Larsson
a504784b4b Fix cairo rendering on large subwindows
We get the real pixmap size and use as cairo surface size rather
than doing some magic to try to get clipping on the right hand size
(and the magic looks wrong anyway).

The previous code could result in the width/height being to big for
the cairo 28.4 fix point size and thus not drawing anything.

This fixes bug #588076.
2009-07-24 21:44:57 +02:00
Alexander Larsson
e71c5d3ab5 Avoid unnecessary indirect call
Call klass->draw_pixbuf directly inside gdk_window_draw_pixbuf
instead of gdk_draw_pixbuf to avoid doing all checks twice.
2009-07-23 22:03:15 +02:00
Cody Russell
d84b575cd0 Bug 589275 – [csw] Trying to destroy NULL regions
gdk_window_input_shape_combine_mask() can accept NULL for the mask
parameter, but it wasn't checking for NULL before passing the
resulting GdkRegion to gdk_region_destroy().  Fixes #589275
2009-07-21 11:44:25 -05:00
Alexander Larsson
18048308e4 Revert all handling of clip_region being unset for non-viewable windows
This is now handled by explicitly setting it to empty for all non-viewable
windows.

This reverts these commits:
82e609c2a0
36861cf608
454160ad9e
7adf894a29
ed2c837574
2009-07-20 23:26:02 +02:00
Alexander Larsson
3c03683e09 Set clip region to empty for non-viewable windows
This lets us avoid lots of viewable checks and still not waste
time computing clip regions for non-viewable windows
2009-07-20 23:15:34 +02:00
Alexander Larsson
82e609c2a0 Make gdk_window_begin/end_paint handle non-viewable windows
These are updated to not read clip region is not viewable
2009-07-20 22:36:02 +02:00
Alexander Larsson
36861cf608 Make gdk_drawable_get_visible/clip_region handle the !viewable case
We can't access ->clip_region for these cases as its not yet calculated.
2009-07-20 22:30:48 +02:00
Alexander Larsson
bf78db5690 Calculate clip region when window goes viewable
Since we're no longer calculating clip regions for non-viewable windows
we need to calculate it when it goes viewable.
2009-07-20 22:19:35 +02:00
Matthias Clasen
8430e215a7 Remove a duplicate include.
This was pointed out in bug 588897.
2009-07-20 00:31:20 -04:00
Alexander Larsson
aa47fca68f Exit remove_child_area when region is empty
When the region is empty we can return early, because there
is no more area to remove. This happens often for children
of scrolled windows (i.e. things that are clipped out.
2009-07-19 22:38:06 +02:00
Alexander Larsson
a057c03889 Optimize remove_child_area for children outside region
If a child is totally outside the current region, bail early instead
of doing costly calculations to subtract the child region.
2009-07-19 22:38:06 +02:00
Alexander Larsson
454160ad9e Fix read of non-initialized clip_region
Foreign children are always viewable but may not have a viewable
parent, so ensure we don't read the parent for them.
2009-07-18 23:15:57 +02:00
Alexander Larsson
7adf894a29 Don't read non-initialized clip region
The clip region is only initialized (and needed) for viewable windows.
2009-07-18 23:15:57 +02:00
Alexander Larsson
b36b7000f1 Only handle viewable windows in collect_native_child_region
There is no need to handle non-viewable windows and additionally
they may not have the clip region set yet.
2009-07-18 23:15:57 +02:00
Alexander Larsson
ed2c837574 Only apply clip_region shape for viewable windows
This fixes a problem where the clip region is not yet calculated
2009-07-18 23:15:57 +02:00
Alexander Larsson
7cbb573ca9 Only calculate clipping regions for viewable windows 2009-07-18 23:15:51 +02:00
Alexander Larsson
027f411150 Check for viewable to avoid doing work instead of mapped
This is now cheap and allows us to avoid more work.
2009-07-18 23:12:02 +02:00
Alexander Larsson
aa8693f2cb Track viewable for GdkWindow 2009-07-18 23:11:54 +02:00
Alexander Larsson
db4dabf5e7 GDK_WINDOW_TYPE does a runtime typecheck, don't call it unnecessary
Looking at a profile the typecheck from GDK_WINDOW_TYPE stood out quite
a bit, which is fixed by not using it unnecessarily.
2009-07-18 15:06:27 +02:00
Alexander Larsson
d0366e5160 Don't draw to unviewable windows
The scrolling and region moving code needs to avoid drawing when the
window is mapped, which it did. However, it also needs to avoid
drawing when any of its parents are not mapped, which it didn't so
switch to using gdk_window_is_viewable().

This fixes the index rendering in evolution (#588169)
2009-07-11 00:33:52 +02:00
Alexander Larsson
9044ec9bb9 Correctly set enter/leave events as detail=nonlinear
If we get a nonlinear enter/leave notify on the toplevel we need
to set nonlinear in all the events we send, even if the in-toplevel
tree is linear.

This fixes combobox menus popping down immediately when you click
(not hold). (bug #587559)
2009-07-09 17:06:46 +02:00
Alexander Larsson
a90d43bed6 Don't emulate map/unmap events for native windows
We really need to wait for the MapNotify from the xserver to ensure
that the window has been mapped, as it may be delayed by the WM, network
or similar things.

This fixes a problem in the /ui-tests/keys-events gtk test
2009-07-08 18:47:43 +02:00
Alexander Larsson
62db28607b The shape is in window coordinate, so properly offset it when using it 2009-07-07 17:10:49 +02:00
Matthias Clasen
b3969a3d75 2.17.3 2009-07-07 01:05:29 -04:00
Matthias Clasen
93556ea899 Make distcheck pass 2009-07-06 23:06:46 -04:00
Matthias Clasen
a213b00d8b More documentation fixes 2009-07-05 20:56:45 -04:00
Matthias Clasen
8031910e21 Add doc stubs 2009-07-03 15:22:02 -04:00
Alexander Larsson
2e3866b5b2 Make GdkDrawable draw_drawable backwards compat
Turns out pygtk build broke due to the argument addition to draw_drawable.
So, we now add a new vfunc for the new draw_drawable and are thus
backwards compat.
2009-07-01 19:50:49 +02:00
Alexander Larsson
038398d493 Move new draw_drawable argument to end to make it more backwards compat 2009-07-01 16:13:31 +02:00
Alexander Larsson
10bf7ca744 Clean up embedding api
we now use gdk_offscreen_window_set_embedder() instead of a signal
to get the parent. This also replaces set_has_offscreen_changes.

Rename "parent" in all embedding related names to "embedder" to make it
more obviously different than the normal parent.

Rename gdk_window_get_offscreen_pixmap to gdk_offscreen_window_get_pixmap
to match the other offscreen calls.

Rename gdk_window_offscreen_children_changed to gdk_window_geometry_changed
as this is more descriptive.
2009-07-01 14:36:36 +02:00
Alexander Larsson
11a96ce2f6 Don't use GDK_WINDOW_SCREEN, as its an X11 specific macro 2009-07-01 10:28:05 +02:00
Alexander Larsson
0c6f64a76c Don't return value from void function
This fixes the previous commit where the return value was removed.
2009-07-01 10:27:54 +02:00
Alexander Larsson
3b6cf72f39 Move destroyed check to common code for get_origin & get_root_coords
Also remove weird return value from get_root_coords
2009-06-30 09:30:53 +02:00
Alexander Larsson
64e7c7828d Don't hide foreign children when emulating visibility
We emulate visibility by unmapping (in X) all mapped (according to
gdk) windows that are not visible (all parents mapped). This is because
there may be client side windows inbetween the native windows in the
hierarchy, so you can't know a native window is visible just because
all the parent native windows are mapped.

However, we don't want to unmap foreign windows, as that may cause all
sort of unexpected issues. This should be safe, because generally the
parent of a foreign window is a native window (e.g. a socket), so its
gdk visibility state is the same as the Xserver one.

This fixes an issue with the GDM notification area where the unmap of
the plug caused spurious UnmapNotify events that confused GtkSocket and
caused icons to become one pixel wide.
2009-06-26 20:11:57 +02:00
Alexander Larsson
c84c0e92f8 Better implementation of native clear_area
Last commit was bad, as it didn't clip against client side
children. This implements such clipping first and then
only clears the rectangles that need to be cleared.
2009-06-26 17:07:24 +02:00
Alexander Larsson
0e548579de Implement gdk_window_clear_area natively for foreign windows
This fixes a redraw issue with the notification area in xfce4.
2009-06-26 15:45:53 +02:00
Alexander Larsson
4e902cd223 Clip cairo drawing against client-side child windows
This is how cairo works with native children.
This fixes an issue where the drag target outline is visible on the
evolution folder treeview when it isn't with native windows.
2009-06-26 14:20:05 +02:00
Alexander Larsson
43bc999e6d Ensure that we always calculate clip regions for root windows
Without this we can't draw to them, which caused problems for e.g.
gnome-settings-daemon clearing the background when the desktop
background changed.

Note: We don't actually clip away child windows from the root window,
the clip is just based on the size of the root window.
2009-06-25 17:05:21 +02:00
Alexander Larsson
794f2815de Fix g_signal_emit calls
The switch to g_signal_emit was all messed up, I forgot to add signals[]
around the signal enum and did not pass in the detail quark.
2009-06-25 17:04:18 +02:00
Alexander Larsson
cf1c6bc2ed Fix typos 2009-06-24 20:59:29 +02:00
Alexander Larsson
955da9fc76 Factor out common code to sync_native_window_stack_position 2009-06-24 20:56:05 +02:00
Alexander Larsson
b093db8da9 Use g_signal_emit instead of g_signal_emit_by_name when possible 2009-06-24 20:33:13 +02:00
Alexander Larsson
8518aa2bf3 Rename accumulate_get_parent to accumulate_get_window
This function is used in several places, not just get_parent
2009-06-24 20:25:40 +02:00
Alexander Larsson
0c7a26690d Fix spelling of synthesize 2009-06-18 20:58:13 +02:00
Alexander Larsson
c08bf93fe5 Don't reset window hints when showing multiple times
gdk_window_show() should only set the initial hints on the first
run, not if the window is already mapped when gdk_window_show is
called.
2009-06-16 21:34:37 +02:00
Alexander Larsson
d44d5301a6 Remove ununsed variables 2009-06-12 12:47:20 +02:00
Alexander Larsson
bd0e95081f Always return FALSE from idle callback to avoid loop
In the destroyed window case in do_synthesize_crossing_event we didn't
return a value which can cause infinite "loops". Always return FALSE
to make sure the idle doesn't run again.
2009-06-12 12:45:31 +02:00
Alexander Larsson
56dfbd997e Handle gdk_window_beep on offscreen windows 2009-06-11 22:11:48 +02:00
Alexander Larsson
5dc6709ea0 Handle the window being destroyed in do_synthesize_crossing_event
This can happen since we ref the window and do the function in an idle.
2009-06-11 21:56:02 +02:00
Alexander Larsson
278e5bd170 Send crossing event due to geometry change in idle
Doing this directly had some issues with picking going recursive in
clutter-gtk. Furthermore, doing it in an idle means we can coalesce
multiple calls (which is common due to widget changes) in the same
toplevel to just one call.
2009-06-11 21:49:17 +02:00
Alexander Larsson
4987ca9235 Add gdk_window_offscreen_children_changed call
You can call this if you have offscreen children and the geometry of
them changed. This will cause re-picking of the active window sending
enter and leave events as needed.
2009-06-11 12:06:01 +02:00
Alexander Larsson
4d54de336b Add gdk_window_get_root_coords
We want to be able to map any window coordinate to a root coordinate, not
just the origin, because you can't rely anymore on a simple translation
from window coordinates to parent with offscreen windows. This lets
us e.g. pop up menus in the right place even if they are popped up from
a no-window widget.
2009-06-08 20:01:05 +02:00
Alexander Larsson
a8549898ab Update event emulation to handle offscreen children
We use the offscreen signals for getting parent, picking
children at a point and mapping coordinates between windows
embedding offscreens and offscreens.

This means we have two hierarchies more or less, one visible to apps via
the standard APIs and for drawing where the offscreens are their own
separate toplevels, and another one for event handling where embedded
offscreens appear as if they were children of the embedding window.
2009-06-08 19:42:34 +02:00
Alexander Larsson
904f0ccb7c Base pointer grab on get-offscreen-parent 2009-06-08 19:39:14 +02:00
Alexander Larsson
e1b52da0ab Add signals for offscreen window embedding
3 signals are for offscreen windows
get-offscreen-parent: Get the parent window an offscreen is embedded in
to-parent: Convert coordinates from offscreen to parent
from-parent: Convert coordinates from parent to offscreen

1 signal is for the window embedding offscreens:
pick-offscreen-child: This picks what (if any) offscreen is at a specific position

The last signal is only used if you call gdk_window_set_has_offscreen_children
to tell gdk that the window has embedded offscreen children.
Add get-pointer signal for offscreen window pointer getting

Apps using offscreen windows can connect to get-pointer on offscreen
windows in order to make gdk_window_get_pointer() return correct
values.

Add get-offscreen-parent signal

Add signals for from-parent and to-parent coordinate mapping

Add pick-offscreen-child signal
2009-06-08 19:39:06 +02:00
Alexander Larsson
247e1945a0 window_get_pointer should return the direct child
We returned the innermost child that has the pointer, which is not right.
Only the direct child that has the pointer in it should be reported (if any).
2009-06-05 15:18:36 +02:00
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
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