Commit Graph

603 Commits

Author SHA1 Message Date
Benjamin Otte
fc170551b6 gdk: Do final copy with OPERATOR_SOURCE in end_implicit_paint
For windows with alpha channel, the previous contents would otherwise
not be erased. Visible for example in the status icon code.

Thanks to Thomas Wood for noticing.
2010-08-13 20:48:36 +02:00
Benjamin Otte
c989d3000a API: Add gdk_window_create_similar_surface() 2010-08-12 23:43:11 +02:00
Kristian Rietveld
d819bc4814 Invalidate cairo surface if resizing is not supported for target
While X11 surfaces can be resized, this is not the case for Quartz
surfaces.  Instead of resizing we will invalidate the surface instead.
By giving _gdk_windowing_set_cairo_surface_size() a boolean return
value, we can signal back whether or not resizing was possible.  If not
possible, we invalidate the surface.
2010-08-10 21:02:31 +02:00
Benjamin Otte
c4f280651a gdk: Don't infinite loop when flushing moves
Spotted by Kristian Rietvield. Fixes testoffscreen test.
2010-08-10 21:02:30 +02:00
Matthias Clasen
075661d376 generic damage generation for offscreen windows
Generating damage from gdk drawing api doesn't help for cairo rendering
...and the gdk drawing api is gone anyway. Bug 621571
2010-08-10 21:02:30 +02:00
Benjamin Otte
1308731580 gdk: Don't require allocating window background colors anymore
X!! allocates the colors itself now.
2010-08-10 21:02:30 +02:00
Kristian Rietveld
c3a59fbfcc Fix compile warnings 2010-08-10 21:02:30 +02:00
Benjamin Otte
6a48a042c7 API: remove GdkGC
XXX: Some traces in the win32 code are left. I suppose they'd best be
replaced using Cairo.
2010-08-10 21:02:29 +02:00
Benjamin Otte
ef2d37cdaf API: remove begin/end_direct_draw functions
They're not needed without GdkGCs.

FIXME: This breaks the win32 XP theme. Someone gotta fix it.
2010-08-10 21:02:29 +02:00
Benjamin Otte
4c16995868 gdk: remove get_composite_drawable vfunc
The vfunc is not used anymore.
2010-08-10 21:02:29 +02:00
Benjamin Otte
61d4a019f8 API: remove gdk_draw_drawable() 2010-08-10 21:02:29 +02:00
Benjamin Otte
65ac54bb23 gdk: Make window moves a custom vfunc
The window move code needs special attention for multiple reasons:
- invalid areas for expose events need to be modified
- self-copy is not supported by Cairo
- in X11, copying from an overlapped Window might cause unexposed areas
  to be copied in, spo expose events for those need to be generated.

This was all special cased in various parts of the code. By making it an
explicit vfunc, we can work around it.
2010-08-10 21:02:28 +02:00
Benjamin Otte
db5fc43759 gdk: Draw redirected windows using Cairo 2010-08-10 21:02:28 +02:00
Benjamin Otte
56e7abb8a4 gdk: Refactor redirection code
This will make future patches easier
2010-08-10 21:02:28 +02:00
Benjamin Otte
755bd51757 gdk: Simplify code
Use new Cairo APIs to make the code simpler.
2010-08-10 21:02:28 +02:00
Benjamin Otte
a6fcc75774 gdk: Remove excess variables 2010-08-10 21:02:28 +02:00
Benjamin Otte
3df6726656 gdk: Do end_implicit_paint copy with Cairo 2010-08-10 21:02:28 +02:00
Benjamin Otte
f1620b5ce1 gdk: Implement gdk_window_get_source_drawable() using Cairo
Do we have a test case for this?
2010-08-10 21:02:28 +02:00
Benjamin Otte
46206f8bb8 gdk: Implement end_implicit_paint() with Cairo 2010-08-10 21:02:28 +02:00
Benjamin Otte
600fbd3e74 API: remove gdk_draw_rectangle() 2010-08-10 21:02:28 +02:00
Benjamin Otte
9ee5176492 API: remove gdk_draw_point(s) 2010-08-10 21:02:27 +02:00
Benjamin Otte
a9e99e7f5b API: remove gdk_draw_{line,lines,segments}
Those were the 3 intermixed line drawing calls.
2010-08-10 21:02:27 +02:00
Benjamin Otte
e85dfc7cc4 API: remove gdk_draw_polygon() 2010-08-10 21:02:27 +02:00
Benjamin Otte
89d28eb09d API: remove gdk_draw_glyphs() and gdk_draw_glyphs_transformed() 2010-08-10 21:02:27 +02:00
Benjamin Otte
92f4882497 API: remove gdk_draw_trapezoids() and GdkTrapezoid struct 2010-08-10 21:02:27 +02:00
Benjamin Otte
559ae63f01 API: remove gdk_draw_arc() 2010-08-10 21:02:27 +02:00
Benjamin Otte
6f5084551a API: remove gdk_drawable_copy_to_image() 2010-08-10 21:02:26 +02:00
Benjamin Otte
b926ce719b API: remove gdk_draw_image() 2010-08-10 21:02:26 +02:00
Benjamin Otte
4f8dbd4a8d API: Remove gdk_draw_pixbuf() 2010-08-10 21:02:25 +02:00
Benjamin Otte
a37ec87ed7 gdk: Flush implicit paints with Cairo 2010-07-26 16:42:49 +02:00
Benjamin Otte
cfa3a71c7b gdk: Do DEBUG_UPDATES drawing with Cairo 2010-07-26 16:42:49 +02:00
Benjamin Otte
b478081b7d gdk: Always clear backing store with Cairo
The code to use Cairo existed but wasn't used on Unix due to a bug in
XAA (that was fixed). Fwiw, we use EXA these days...
2010-07-26 16:42:49 +02:00
Paolo Borelli
0df65779bb The hash owns a ref to the cursor 2010-07-10 18:49:21 +02:00
Javier Jardón
404e7d0e00 gdk/: fully remove gdkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:21:31 +02:00
Javier Jardón
df106318f8 [gdk] Add gdk_window_has_native() function
https://bugzilla.gnome.org/show_bug.cgi?id=622677
2010-07-01 02:26:34 +02:00
Benjamin Otte
300e6b84cd s/GdkRegion/cairo_region_t/ in all of gtk
https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Benjamin Otte
3e96cfe8fc Deprecate the GdkRegion API
Includes fixing all callers to use the cairo region API instead. This is
usually just replacing the function names, the only difference is
gdk_region_get_rectangles() being replaced by
cairo_region_num_rectangles() and cairo_region_get_rectangle() which
required a bit more work.

https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Philip Withnall
d78cee6791 Add allow-none to gdk_window_set_cursor() 2010-06-27 19:19:39 +01:00
Javier Jardón
4cf4470fcd Remove deprecated GdkDrawable functions
Remove gdk_drawable_get_data(), gdk_drawable_set_data(),
gdk_drawable_ref(), gdk_drawable_unref(),
gdk_draw_string(), gdk_draw_text(), gdk_draw_text_wc()
2010-06-19 21:39:22 +02:00
Martin Schlemmer
4696e94138 win32: Fix the xp there to correctly clip when drawing
This makes the xp theme work again, and also enables it.
2010-06-11 20:20:07 +02:00
Javier Jardón
d6bacafc52 [docs] Use the correct gtk-doc notation
Use 'Deprecated: 3.0:' intead 'Deprecated: 3.0.'
2010-05-27 15:37:19 +02:00
Christian Beier
95c824c553 gdk/gdkwindow.c: fix a typo in gdk_window_set_device_cursor().
Signed-off-by: Christian Beier <dontmind@freeshell.org>
Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-05-26 15:42:10 +02:00
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04:00
Matthias Clasen
50a72eda2d Seal gdk
Add G_SEAL annotation for struct members, and add accessors for
the (useful) fields. Patch based on work by Garrett Regier,
see bug #592580.
2010-05-25 12:01:04 -04:00
Javier Jardón
618d15e991 Remove deprecated gdk_window_get_toplevels() function 2010-05-14 18:18:10 +02:00
Javier Jardón
dc83131c9b gdkwindow: Move includes to the beginning of the file 2010-05-14 17:28:37 +02:00
Tadej Borovšak
ff61948d13 Move documentation to inline comments: GdkWindow
Use examples/gdk to store documentation code examples.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=618498

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-05-14 17:11:51 +02:00
Michael Natterer
9cac8f23d5 gdk: remove convert_coords_to_child()
and use the new public gdk_window_coords_from_parent().
2010-04-15 13:16:17 +02:00
Michael Natterer
878cde53d0 gdk: use gdk_window_is_offscreen() instead of checking manually 2010-04-15 13:08:47 +02:00
Michael Natterer
5a52d2a2f0 gdk: add API to convert coords between parent and child windows
which also works for offscreen windows and their embedder.
Also add gdk_window_get_effective_parent() and
gdk_window_get_effective_toplevel() which are offscreen aware.
2010-04-15 12:59:44 +02:00
Johan Dahlin
fe85272112 [annotations] Add allow-none
This commit was created using a script that searched for all docstrings
containing a parameter and the string 'or %NULL'.
Gdk backends and demos excluded as they are not part of a public API

https://bugzilla.gnome.org/show_bug.cgi?id=610474
2010-02-19 17:57:51 -02:00
Alexander Larsson
3d9d002bed When native window requests button presses request other button related events
We need to do this because otherwise the implicit button grab for this
(native) window will not deliver the button events not selected for
by this window. This is a problem because non-native child windows may
select using a wider event mask, and we can't emulate these events if we
don't get the native events.

Fixes bug #607508
2010-01-20 15:37:16 +01:00
Alexander Larsson
e31a6d1fea Drop outstanding cairo surfaces when window is made native
Any old cairo_surface referencing the old impl window will be wrong
when we make a window native, so drop it.

This fixes bug #599511
2010-01-19 16:40:59 +01:00
Alexander Larsson
46d25437a1 Move common gdkwindow.c code into function gdk_window_drop_cairo_surface
This code is duplicated in several places, and more to come, so put
it all in one place.
2010-01-19 16:40:55 +01:00
Alexander Larsson
841fa47715 Track direct window cairo access and avoid tricks when used
When a cairo surface is requested for direct window access (i.e. not
when double-buffering) we can't really track when the actual drawing happens
as cairo drawing is not virtualized. This means we can't properly flush
any outstanding window moves or implicit paints.

This actually causes problems with e.g. abiword (bug #606009) where they
draw without double-buffering. If you press down it scrolls the window
and then draws the caret, but the caret drawing does not flush the
outstanding move from the scroll, so the caret gets drawn on the wrong
screen.

We fix this by never allowing either implicit paints or outstanding window
moves on impl-windows where any windows related to it has an outstanding
direct cairo surface. Luckily this is not very common so in practice this
doesn't matter much.
2010-01-19 15:01:03 +01:00
Alexander Larsson
f96e51db46 Avoid drawing implicit paints to destroyed windows
It may happen that a window gets destroyed during painting, if so
we should not draw the implicit paint double-buffered pixmap to it
as that will cause a BadDrawable X error.

This fixes bug 600865
2010-01-15 16:08:18 +01:00
Javier Jardón
bef70bc5bf [docs] Add documentation for GdkWindow 'cursor' property
Reported by Rafal Luzynski here:
https://bugzilla.gnome.org/show_bug.cgi?id=604821
2010-01-03 21:14:06 +01:00
Matthias Clasen
d2ce67734a Fix a think in the CSW input extension handling
This was causing stack overflow due to an obvious infinite recursion.
See e.g. RH #548849.
2009-12-21 15:27:46 -05:00
Alexander Larsson
7e9d89b555 Actually send exposes from gdk_window_clear_area_e 2009-12-18 15:35:04 +01:00
Javier Jardón
674dd557e8 Add 'Since: 2.18' tag
Add missing 'Since:' tag in gdk_window_get_root_coords() and
gdk_window_is_destroyed()

Reported by Rafal Luzynski in
https://bugzilla.gnome.org/show_bug.cgi?id=604821
2009-12-18 10:53:01 +01:00
Colin Walters
18dc96caf8 Merge in Gdk-custom.c introspection annotations
The Gdk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GDK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.

https://bugzilla.gnome.org/show_bug.cgi?id=592279
2009-12-16 17:22:01 -02:00
Matthias Clasen
0748cf563d Never do implicit paints for foreign windows
They don't need double buffer combination since they have no
client-side children, and creating pixmaps for them is risky
since they could disappear at any time.

May fix bug 598476 and 603652.
2009-12-08 10:09:04 -05:00
Alexander Larsson
22d1d0d507 Fix up last commit 2009-12-08 12:28:44 +01:00
Alexander Larsson
159214173d Handle input extension events when making a window native
It may happen when turning a client side window into a native window
that the window, or some of its children with the same native parent
have extension events enabled, and thus have an input window enabled
for the native parent which needs to change as the window is made
native.

We fix this by temporarily disabling extension events on all the affected
windows while we create the native window, and then reenable them afterwards.

This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=544624
2009-12-08 12:22:59 +01:00
Alexander Larsson
b509f28559 Don't filter out BUTTON_MOTION event masks
We don't really need to filter these out, it was just a leftover
safety check to not override the GDK_POINTER_MOTION_MASK.

Furthermore when we changed behaviour to not always select for native
pointer motion it is actually wrong. We'll still get normal motion
events for the toplevel which we will emulate as button motion on the
child, but the button motion mask will not be inherited by implicit
grabs which makes us not get any motion events during grabs.

This fixes bug 601473
2009-12-02 11:19:21 +01:00
Alexander Larsson
9e51c10edc Don't unnecessarily clear windows with no exposure mask set
When we just invalidate some area from the app we don't need to clear
windows with no exposure mask, because that wouldn't have happened pre-csw
anyway. Additionally we can avoid such clearing for native windows in cases
where the xserver already did the clearing like on exposes or when resizing
toplevels.

This means we don't fully redraw a GtkSocket when it resizes, thus
avoiding flicker in gnome-mplayer as reported in this bug:
https://bugzilla.gnome.org/show_bug.cgi?id=598050
2009-11-05 12:52:12 +01:00
Alexander Larsson
9ae0d9a44f Document clears_as_native and make the name more descriptive 2009-11-05 12:52:12 +01:00
Alexander Larsson
4cd5c98942 Don't unnecessarily expose areas copied by native windowing system
When moving or scrolling a window with native children, there is no
need to expose the areas that are copied by the windowing system
as part of moving/resizing the native windows anyway.
2009-11-05 12:52:12 +01:00
Alexander Larsson
a299797883 Only send exposes on unmap if window really was unmapped
Exposing when you hide a hidden window is just a waste of time.
2009-11-05 12:52:12 +01:00
Alexander Larsson
8c1ea38d84 Flush outstanding stuff when clearing directly on a window
Clearing will directly modify the contents of the window, so we need
to flush any outstanding moves or double-buffering.
2009-11-05 12:52:11 +01:00
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