Commit Graph

483 Commits

Author SHA1 Message Date
Javier Jardón
d3155bb1ea Remove some unnused variables 2009-10-20 20:37:46 +02:00
Matthias Clasen
4581432387 Plug a memory leak
Valgrind reported a leak of regions from gdk_window_process_updates_internal.
2009-10-04 22:35:12 -04:00
Kristian Rietveld
28d56cbbda Use boxed accessors for setting and retrieving cursor property 2009-09-30 13:00:28 +02:00
Alexander Larsson
6fef640deb Only select for button and pointer event on toplevels
These event types propagate up the hierarchy anyway, so this means
we avoid setting it unnecessarily. This is especially important
for button press event, since only one client can select for this
on each window, causing X errors if two clients do it.
2009-09-29 12:58:42 +02:00
Alexander Larsson
e81501ebea Sent button events don't cause passive grabs
Don't track sent button events as causing or removing
passive grabs.
2009-09-28 15:29:37 +02:00
Cody Russell
fe188a18f3 Bug 596494 - New property "cursor" in 2.18's GdkWindow with wrong type?
Use a boxed paramspec with GDK_TYPE_CURSOR instead of a pointer paramspec.
2009-09-27 14:37:19 -05:00
Alexander Larsson
3bcf8b39fb On pointer grab request native events needed for event emulation
When we grab the pointer we need to request more events than what is
specified, otherwise our event emulation stop working and you won't
e.g. get crossing event unless you specified motion event mask.
2009-09-25 11:28:26 +02:00
Alexander Larsson
afc19eb4a7 Send expose events on foreign windows
F-Spot needs this as it draws on a foreign (screensaver) window, which
used to work.

I believe this is safe, because in all typical cases the expose
mask will not be set, so we won't do anything, and its what we used to
do.
2009-09-24 16:48:04 +02:00
Alexander Larsson
0ecd87fb78 Respect grab event mask for crossing events
In the case of a non-owner_events grab, use grab->event_mask rather
than the window even mask to decide whether to deliver the event
or not.
2009-09-15 14:40:35 +02:00
Alexander Larsson
cfeba9c389 Make gdk_window_flush public
We need to call this from Gtk+, and its concievable that some other
app doing weird stuff could have a use for it.
2009-09-14 16:07:25 +02:00
Alexander Larsson
f473242e19 Better handling of window hierarchy changes from inside expose handler
If we move, resize or otherwise change a window from inside a (double
buffered)  expose handler we can run into issues with double buffered
paints that have already been ended but have not yet been commited
to the window from the implicit paint pixmap.

For instance, any copies of source regions due to a window scroll need
to take these into account, and any operation that causes some drawing at
a destination covered by the implicit paint region would be overdrawn
when the implicit paint is ended.

So, before we do any window-hierarchy changing operation while an implicit
paint is in effect we flush all moves and already commited paints.
2009-09-14 13:52:40 +02:00
Alexander Larsson
6d84fcab76 Handle expose events moving or resizing windows
When a window is moved or resized from a double-buffered expose handler
we can't really just copy the window region around, as the window
will be overdrawn with the double buffered region when the expose returns.

Instead we remove all regions with outstanding implicit paints from the
region to be copied and just mark this area as invalid to be redrawn
later.

This fixes bug 594880.
2009-09-14 13:52:40 +02:00
Alexander Larsson
2d2dc2c7e9 Factor out impl_window_add_update_area() to a function 2009-09-14 13:52:40 +02:00
Alexander Larsson
130a7743e3 Don't reenter gdk_window_process_updates_internal
Its not correct for recurse gdk_window_process_updates_internal, as
the outer instance will overdraw the inner. So, protect against
gdk_window_process_updates() being called while in an expose
handler.

This shouldn't be a repaint problem, as eventually the idle handler
will cause the updates to be processed.
2009-09-14 13:52:40 +02:00
Alexander Larsson
6716d46393 Bail out of window move/resize early if no change
This is not all that uncommon in size_allocate, so we want
to optimize this case.
2009-09-14 13:52:40 +02:00
Alexander Larsson
e1554d8466 Don't support the old handling of zero height/width in gdk_window_clear_area
We used to handle zero height/width specially in the non-double buffered
case due to the weird behaviour of XClearArea in this case. However
this is undocumented, incompatible with what happens on double-buffered
drawing, and just not a good API. So, we drop this behaviour, having
fixed gtkclist.c which used this.
2009-09-11 15:21:43 +02:00
Matthias Clasen
be22a62160 Cleanups
This commit removes dead code, mostly pointed out by clang.
2009-09-10 13:53:28 -04:00
Alexander Larsson
7124f5927a Don't send grab broken for implicit grabs on button release
This is how it used to work, you only get grab broken if someone
else gets a grab, or if the grabbed window gets destroyed or unmapped.
2009-09-10 19:27:45 +02:00
Alexander Larsson
c4d2c38238 Ensure recursing gdk_window_process_all_updates works
There are two issues here. First of all an ignored update didn't
use to unset update_idle which could cause all further idle repaints
to be ignored. (Bug #591583)

Secondly, if we ignore the process_all_updates we may end up not updating
the windows in update_windows unless something else triggers an update.
So, we handle this by checking for recursions and scheduling a new update
at the end of the outermost process_all_updates.
2009-09-10 13:56:54 +02:00
Alexander Larsson
113d21801b Fix handling of window cursor wrt grabs
Even for grabs we need to recurse up to look for what cursor to use.
2009-09-08 11:48:20 +02:00
Alexander Larsson
f64ef921da Add gdk_window_is_destroyed 2009-09-04 17:59:17 +02:00
Alexander Larsson
4adcb39f86 Ensure clip region valid before using it for emulating graphics exposures
If there is a drawable clip on it we don't want to use that.
2009-09-04 16:06:51 +02:00
Alexander Larsson
223bcd23f7 Correct the antiexposure vs implicit paint flush race
The check for a possible implicit paint flush before queueing an
antiexposure was wrong. An implicit flush doesn't actually NULL
the implicit paint, se we have add a flag to explicitly track if
it is flushed.
2009-09-04 13:14:25 +02:00
Alexander Larsson
753f159aad Don't access region when it might be freed
Passing region into _gdk_gc_set_clip_region_internal takes ownership,
so don't use it after that. We can just as well just move the usage
above the call.
2009-09-04 13:10:35 +02:00
Alexander Larsson
587bc97d9c Fix warnings in gdk_window_restack 2009-09-04 11:08:46 +02:00
Alexander Larsson
d67a7eda16 Add gdk_window_restack
This lets you restack a window above or below a specified sibling.
At least eclipse wants this functionallity.
2009-09-02 23:38:55 +02:00
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