Commit Graph

741 Commits

Author SHA1 Message Date
Carlos Garnacho
0a80c26cdf gdk: Only trigger motion hints machinery on motion events
Touch events have no need for it, plus the concept behind
gdk_event_request_motions() doesn't wrap around multiple
touches within a device.
2012-03-01 16:25:26 -05:00
Carlos Garnacho
2f2774b7a9 gdk: Have touch grabs behave like the implicit grab wrt crossing events
These are equivalent to an implicit grab (with !owner_events), so
if the touch leaves or enters the grab window, the other window
won't receive the corresponding counter-event.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
c72a77b04c gdk: handle implicit touch grabs
If the touch sequence happens on a window with GDK_TOUCH_MASK set,
a GdkTouchGrabInfo is created to back it up. Else a device grab is
only created if the sequence emulates the pointer.

If both a device and a touch grab are present on a window, the later
of them both is obeyed, Any grab on the device happening after a
touch grab generates grab-broken on all the windows an implicit
touch grab was going on.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
b5de12debd gdk: Don't change window_under_pointer for pure touch events
Only touch events that emulate the pointer do change it.
2012-03-01 16:25:25 -05:00
Carlos Garnacho
8689921b90 gdk: Generate crossing events around touch devices' press/release
Anytime a touch device interacts, the crossing events generation
will change to a touch mode where only events with mode
GDK_CROSSING_TOUCH_BEGIN/END are handled, and those are sent
around touch begin/end. Those are virtual as the master
device may still stay on the window.

Whenever there is a switch of slave device (the user starts
using another non-touch device), a crossing event with mode
GDK_CROSSING_DEVICE_SWITCH may generated if needed, and the normal
crossing event handling is resumed.
2012-03-01 16:25:21 -05:00
Carlos Garnacho
7f35708cee gdk: Add touch event types and mask
This commit introduces GDK_TOUCH_BEGIN/UPDATE/END/CANCEL
and a separate GdkEventTouch struct that they use. This
is closer to the touch event API of other platforms and
matches the xi2 events closely, too.
2012-03-01 16:25:20 -05:00
Alexander Larsson
fd0450b4e7 Fix up rendering of non-double-buffered overlays
My previous fix for this broke the progress bar in epiphany. This fix
makes it work again, and keeps the gimp bug fixed.

Basically, whenever we do a non-double-buffered rendering we have to
flush the entire window as it might be drawn outside the double
buffering machinery.
2012-03-01 14:14:33 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
ec25699f05 Clean up whitespace in _gdk_window_got_event
At the same time, fix an uninitialized warning.
2012-02-23 22:20:07 -05:00
Carlos Garnacho
c15d23ab5b gdk: Ensure that GdkPointerWindowInfo is only generated for pointers 2012-02-23 22:11:17 -05:00
Matthias Clasen
5e67d61ff4 Fix an uninitialized variable warning 2012-02-23 20:01:06 -05:00
Carlos Garnacho
5b014bfdfb gdk: Keep track of the last slave device used
This last slave device (stored per master) is used to fill
in the missing slave device in synthesized crossing events
that are not directly caused by a device event (ie due to
configure events or grabs).
2012-02-23 16:45:29 -05:00
Alexander Larsson
26ed41ece5 Remove unused functions 2012-02-19 15:10:48 +01:00
Alexander Larsson
fcb58f3c83 Don't unnecessarily clear background twice in no EXPOSE_MASK case
We already clear in begin_paint, no need to do it again. In fact, this
will get the wrong result if the background has alpha.
2012-02-19 11:55:22 +01:00
Alexander Larsson
e3da2f55ea Fix background clearing when exposing with non-double buffered widgets
We used to set a flushed boolean whenever we flushing double buffered
areas to the window due to a non-db draw. We then read back from the
window if this was set. This broke when we were doing multiple paints
of the same area after a flush as we were re-reading the window each
time, overdrawing what was previously draw.
2012-02-19 11:43:48 +01:00
Alexander Larsson
251cffb638 Fix transparency handling with non-double-buffered drawing
Sometimes we need to read back the window content into our double
buffer due to rendering a window with alpha when there is
no implicit paint or it has been flushed due to non-db drawing
before.

However, in this case we can't use gdk_cairo_set_source_window as
it might trigger an implicit paint flush as we detect what we
think is a direct non-double buffered window draw operation, which
will flush the implicit paint operation that we're just setting up.

To fix this we use the raw gdk_window_ref_impl_surface operation
to get the source surface.
2012-02-09 21:14:07 +01:00
Alexander Larsson
5d9736fe13 Fix non-double-buffered drawing
There was a sign issue in a coordinate transform that made us
flush the wrong region when flushing an implicit paint.
The non-double buffered drawing would then be drawn over the
right area, but then at the end of the implicit paint this
would be overdrawn with the area we didn't properly remove
from the implicit paint.

Also, the translation from window coords to impl window
coords is now done before removing any active double
buffered paints, as these are also in impl window coords.
2012-02-09 21:14:07 +01:00
Alexander Larsson
fed1cfb122 Make the default background for GdkWindows transparent
With the changes in default CSS to make the default background transparent
we ran into issues where intermediate GdkWindow (for instance the
view_window in GtkViewport) where we didn't set an explicit background
(because before they were always covered). So instead of showing throught
the transparent windows were showing the default backgroind of the intermediate
window (i.e. black).

With this change we also needed to fix GtkViewport, as it was previously
relying on the bin and view windows to cover widget->window so that the
border was not visible if shadow_type was NONE.
2012-02-09 16:39:23 +01:00
Alexander Larsson
7ec927a386 Fix visibility notification event reporting
We were checking the event mask for GDK_VISIBILITY_NOTIFY,
not GDK_VISIBILITY_NOTIFY_MASK, which was clearly a typo.
2012-01-20 11:01:49 +01:00
Javier Jardón
24360a8076 gdk/*: Use g_list_free_full convenience function 2012-01-05 04:22:42 +01:00
Javier Jardón
a3abc18858 Deprecate all the public API that is using GdkColor struct 2011-12-22 02:59:39 +00:00
Xan Lopez
2d70d8fa36 gdkwindow: plug memory leak
==23282== 64 bytes in 2 blocks are definitely lost in loss record 8,069 of 13,389
==23282==    at 0x4A074CD: malloc (vg_replace_malloc.c:236)
==23282==    by 0x39A1C3E2EA: cairo_region_create (cairo-region.c:196)
==23282==    by 0x6D9AF3D: recompute_visible_regions_internal (gdkwindow.c:964)
==23282==    by 0x6D9B4B8: recompute_visible_regions (gdkwindow.c:1126)
==23282==    by 0x6DA3450: gdk_window_hide (gdkwindow.c:5689)
==23282==    by 0x6D9CED9: _gdk_window_destroy_hierarchy (gdkwindow.c:2042)
==23282==    by 0x6D9D040: gdk_window_destroy (gdkwindow.c:2109)
==23282==    by 0x655B5E4: gtk_entry_unrealize (gtkentry.c:3012)
==23282==    by 0x7068BF3: g_cclosure_marshal_VOID__VOID (gmarshal.c:85)
==23282==    by 0x706710B: g_type_class_meta_marshal (gclosure.c:885)
==23282==    by 0x7066DF9: g_closure_invoke (gclosure.c:774)
==23282==    by 0x7080585: signal_emit_unlocked_R (gsignal.c:3340)
==23282==    by 0x707F619: g_signal_emit_valist (gsignal.c:3033)
==23282==    by 0x707FB71: g_signal_emit (gsignal.c:3090)
==23282==    by 0x679E243: gtk_widget_unrealize (gtkwidget.c:4458)
==23282==    by 0x64E83C7: gtk_bin_forall (gtkbin.c:172)
==23282==    by 0x6548BBD: gtk_container_forall (gtkcontainer.c:2014)
==23282==    by 0x67A966D: gtk_widget_real_unrealize (gtkwidget.c:10253)
==23282==    by 0x672D002: gtk_tool_item_unrealize (gtktoolitem.c:474)
==23282==    by 0x7068BF3: g_cclosure_marshal_VOID__VOID (gmarshal.c:85)

https://bugzilla.gnome.org/show_bug.cgi?id=666552
2011-12-19 15:06:22 -05:00
Cosimo Cecchi
8f4f7faa11 window: copy back window surface data when the implicit paint is flushed
When an implicit paint is flushed during expose, e.g. because a
non-double buffered widget is painting, make sure to copy the existing
data from the window surface we rendered before flushing back to the
paint surface, instead of using an empty base.
Code was already handling that (and said so in the comment), but only
when no implicit paint was used at all, and not in the case when it's
flushed mid-expose.
2011-12-07 08:54:09 +01:00
Cosimo Cecchi
2fad8eb0c3 window: trivial cleanup 2011-12-06 18:27:59 -05:00
Cosimo Cecchi
e3744bbd70 window: remove unused arguments and variables
Trivial cleanup, no functional change.
2011-12-06 17:49:35 -05:00
Alexander Larsson
4597f1ea6a gdk: gdk_window_get_update_area don't remove alpha covered areas
gdk_window_get_update_area is supposed to get the area where things
need painting, and remove them from the update areas. However, if
some area is covered by other windows with an alpha background we
can't just expect whatever the app choses to render in the update
area as correct, so we don't actually remove these areas, meaning
they will get correctly rendered when we get to the expose handlers.
2011-12-05 12:18:22 +01:00
Alexander Larsson
65ef15812b gdk: gdk_window_move_region
gdk_window_move_region doesn't move children, so we can't copy
transparent child window regions with copyarea, so we remove these
from the copy region.
2011-12-05 12:16:55 +01:00
Alexander Larsson
76ea768316 gdk: Fix alpha window background paintings on non-implicit paints 2011-12-05 11:40:30 +01:00
Alexander Larsson
68843a3e93 gdk: Remove unused _gdk_window_calculate_full_clip_region 2011-12-05 10:59:07 +01:00
Alexander Larsson
f00cfe1fac Handle has_alpha_background for parent-relative backgrounds 2011-12-05 10:55:55 +01:00
Alexander Larsson
7a263c68a0 gdk: Fix repaint of layered region during move_region 2011-12-01 22:08:00 +01:00
Alexander Larsson
8e28f53a1d gdk: Fix repaint of layered region during scroll 2011-12-01 22:08:00 +01:00
Alexander Larsson
f0c8c4a94b gdk: Fix repaint of layered region during raise 2011-12-01 22:07:59 +01:00
Alexander Larsson
0f6784a919 gdk: Make sure we don't copy to/from layered regions when moving a window 2011-12-01 22:07:59 +01:00
Alexander Larsson
46d5b89830 gdk: Track the layered area
We track the areas that have alpha coverage so that we can
avoid using these as sources when copying window contents.
We also don't remove such areas from the clipping regions so
that they are painted both by parent and child.
2011-12-01 22:06:44 +01:00
Alexander Larsson
f51482e283 gdk: Track wether windows have alpha in the background
This will let us handle such windows differently in the
drawing machinery
2011-12-01 22:03:51 +01:00
Alexander Larsson
7fd225c766 gdk: Expose bottommost windows first
This cleans up the expose handling a bit by using the existing
clip regions, and it allows us later to use painters algorithm
to do transparent windows.
2011-12-01 13:42:09 +01:00
Alexander Larsson
45df163e9d gdk: Remove now unused region tags completely 2011-12-01 13:38:04 +01:00
Alexander Larsson
915e9d57f9 win32: Use right native_window for implicit grabs
The native grab really is on the window that got the button press event.
2011-11-10 17:40:54 +01:00
Rui Matos
43f1b5abbc gdk: Add GDK_WINDOW_STATE_FOCUSED to GdkWindowState
This state means that the toplevel window is presented as focused to the user,
i.e with active decorations under an X11 window manager.

If the GDK backend doesn't implement this flag, it will just remain set after
mapping the window.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:25:51 +00:00
Matthias Clasen
250d4331b2 Add device-taking variants of begin_resize/move_drag
This was one of the last places where display->core_pointer was
used in non-deprecated code paths.
2011-11-05 01:10:16 -04:00
Benjamin Otte
b120cb04a5 gdk: Move a bunch of deprecated code to a new file
The new file defines GDK_DISABLE_DEPRECATION_WARNINGS so it can happily
use deprecated APIs.

This commit moves those functions there that use deprecated functions
and currently cause warnings.

With this commit, GDK compiles without deprecation warnings.
2011-11-02 02:32:53 +01:00
Rui Matos
34357481b3 docs: Delete duplicate line in gdkwindow.c 2011-10-01 01:24:36 +01:00
Cosimo Cecchi
036c193fb2 GdkWindow: fix conditional jump depends on uninitialized value error
Those if() blocks don't have any reason being there, as x and y are not
pointers. If the window is destroyed, just set the out values to zero
and return.

As seen in valgrind:

==3306== Conditional jump or move depends on uninitialised value(s)
==3306==    at 0x624C74F: gdk_window_get_root_coords (gdkwindow.c:6933)
==3306==    by 0x5E193C3: gtk_tooltip_show_tooltip (gtktooltip.c:1160)
==3306==    by 0x5E19C05: tooltip_popup_timeout (gtktooltip.c:1282)
==3306==    by 0x623B102: gdk_threads_dispatch (gdk.c:754)
==3306==    by 0x8592F3A: g_timeout_dispatch (gmain.c:3907)
==3306==    by 0x859174C: g_main_context_dispatch (gmain.c:2441)
==3306==    by 0x8591F47: g_main_context_iterate (gmain.c:3089)
==3306==    by 0x8592494: g_main_loop_run (gmain.c:3297)
==3306==    by 0x5D2E501: gtk_main (gtkmain.c:1362)
==3306==    by 0x5C5652F: gtk_application_run_mainloop
(gtkapplication.c:115)
==3306==    by 0x7C47C9D: g_application_run (gapplication.c:1323)
==3306==    by 0x447B5F: main (nautilus-main.c:102)
==3306==  Uninitialised value was created by a stack allocation
==3306==    at 0x624D48A: gdk_window_get_device_position
(gdkwindow.c:4952)
2011-09-28 20:20:19 -04:00
John (J5) Palmieri
c3e0a0035e [gi] annotate gdk_container_set_user_data to take a GObject
* this allows bindings to correctly marshal the parameter
2011-08-14 08:07:10 -04:00
Matthias Clasen
25a4e8e7de Don't return a value from a void function
Reported in bug 654720, patch by Brian Cameron.
2011-07-17 18:05:17 -04:00
Joachim Breitner
317d7a1f54 docs: Remove mention of client messages 2011-07-05 16:08:04 -04:00
Benjamin Otte
e45230ad39 gdk: Make background changes queue a repaint
For client-side windows, we need to queue a repaint when the background
changes. For native windows, the windowing system does take care of it,
but client-side windows are our own, so we gotta do it manually.

https://bugzilla.gnome.org/show_bug.cgi?id=652102
2011-06-09 05:51:53 +02:00
Benjamin Otte
2a4c361831 gdk: Don't set backgrounds on input-only windows
It doesn't make sense to allow a background on input-only windows, so
instead of setting it and then never using it, we just don't ever set
it.
2011-06-09 05:51:53 +02:00
Carlos Garnacho
1b53741e4c gdk: Document gdk_window_add_filter()+XGenericEvents behavior 2011-05-18 22:34:33 +02:00