Commit Graph

665 Commits

Author SHA1 Message Date
Benjamin Otte
36893a9ef8 gdk: Make GdkWindow abstract
This way backend implementors get an error if they don't set
display_class->window_type to their subclass. And that's exactly what we
want.
2010-12-21 12:07:09 -05:00
Benjamin Otte
dcb03b1085 gdk: Use G_DEFINE_TYPE for GdkWindow 2010-12-21 12:07:08 -05:00
Benjamin Otte
3036922b3d gdk: Create windows via _gdk_display_create_window()
THe use of this function will become visible in the next commits. But
wrapping g_object_new() is a generally a good idea anyway.
2010-12-21 12:07:08 -05:00
Benjamin Otte
a9637f05b6 gdk: Use g_object_(un)ref instead of gdk_cursor_(un)ref 2010-12-21 12:07:05 -05:00
Benjamin Otte
0b4913a166 gdk: Make GdkCursor a GObject
Also port the X11 implementation. Win32 and Quartz need to be ported
still.
2010-12-21 12:07:04 -05:00
Matthias Clasen
519f09f7f4 Add vfuncs for keyval and window property functions
The keyval functions should really be generic, and the window
property api should be completely revisited, but for now this
will allow us to proceed.
2010-12-21 12:07:03 -05:00
Matthias Clasen
afa0ebf36b Add vfuncs for gdk_test apis 2010-12-21 12:07:02 -05:00
Matthias Clasen
214342eac5 Clean up gdkx.h a bit
Moving the direct-access redefinitions of various macros
to gdkprivate-x11.h and use that header throughout in x11/.

Also remove a workaround for a long-fixed X server bug.
2010-12-21 12:07:01 -05:00
Matthias Clasen
126212b470 Add a vfunc for _gdk_window_impl_new 2010-12-21 12:07:01 -05:00
Matthias Clasen
2d7583c0e3 Make gdk_window_{lookup,foreign_new}_for_display backend specific
At the same time, make GDK_IS_DISPLAY_X11 available in gdkx.h, and
add some exemplaric ifdefs to GTK+ code.
2010-12-21 12:06:59 -05:00
Matthias Clasen
9adb974155 Add a vfunc for _gdk_windowing_window_get_next_serial 2010-12-21 12:06:58 -05:00
Matthias Clasen
ccb6edeb8b Add vfuncs for process_updates_recurse and the before and after hooks 2010-12-21 12:06:58 -05:00
Matthias Clasen
ea96e5e16f Explode gdkinternals.h into per-class private headers
At the same time, move some more class and instance structs
out of public headers.
2010-12-21 12:06:58 -05:00
Matthias Clasen
9a1cc81acb Add a vfunc to replace _gdk_windowing_window_destroy_foreign
All backends updated.
2010-12-21 12:06:57 -05:00
Matthias Clasen
1e694b4dd8 Add a vfunc for gdk_window_set_composited 2010-12-21 12:06:57 -05:00
Matthias Clasen
7f6ac56e3c Add a vfunc for gdk_window_set_composited 2010-12-21 12:06:57 -05:00
Matthias Clasen
a169f6e32d Make GdkDevice parallel-implementable
Use the grab and ungrab vfuncs from the frontend instead of the
_gdk_windowing wrappers, and move some things around accordingly.
Again, only the X11 backend has been updated, other backends
need to be updated to match.
2010-12-21 12:06:56 -05:00
Matthias Clasen
c53ec081ce Add vtables for DND
This commit hides GdkDragContext and GdkDragContextClass, adds
vfuncs for most drag context functionality, and turns the X11 DND
implementation into GdkDragContextX11. We also add vfuncs to
GdkDisplay for gdk_drag_get_protocol and to GdkWindow for
gdk_drag_begin, and implemenet them for X11.
Other backends need similar treatment and are broken now.
2010-12-21 12:06:56 -05:00
Matthias Clasen
de84a7b14f Move gdk_window_lookup to common code 2010-12-21 12:06:55 -05:00
Alexander Larsson
ac7d55c948 Convert all gdk_window methods to vtable calls 2010-12-21 12:06:54 -05:00
Carlos Garnacho
17e97467df Strengthen checks in functions taking a GdkDevice
Docs have also been improved, to make explicit the device
type/source accepted.
2010-12-20 23:08:10 +01:00
Colin Walters
d08ff485f2 gdkwindow: Fix event unref iteration
We were double looping previously which caused a NULL deref.
2010-12-17 15:41:15 -05:00
Colin Walters
806c04411d gdk: Fix GdkWindowFilter internal refcounting
Running gnome-shell under valgrind, I saw the attached invalid write.
Basically we can destroy a window during event processing, and the old
window_remove_filters simply called g_free() on the filter, ignoring
the refcount.  Then later in event processing we call filter->refcount--,
which is writing to free()d memory.

Fix this by centralizing list mutation and refcount handling inside
a new shared _gdk_window_filter_unref() function, and using that
everywhere.

==13876== Invalid write of size 4
==13876==    at 0x446B181: gdk_event_apply_filters (gdkeventsource.c:86)
==13876==    by 0x446B411: _gdk_events_queue (gdkeventsource.c:188)
==13876==    by 0x44437EF: gdk_display_get_event (gdkdisplay.c:410)
==13876==    by 0x446B009: gdk_event_source_dispatch (gdkeventsource.c:317)
==13876==    by 0x4AB7159: g_main_context_dispatch (gmain.c:2436)
==13876==    by 0x4AB7957: g_main_context_iterate.clone.5 (gmain.c:3087)
==13876==    by 0x4AB806A: g_main_loop_run (gmain.c:3295)
==13876==    by 0x8084D6B: main (main.c:722)
==13876==  Address 0x1658bcac is 12 bytes inside a block of size 16 free'd
==13876==    at 0x4005EAD: free (vg_replace_malloc.c:366)
==13876==    by 0x4ABE515: g_free (gmem.c:263)
==13876==    by 0x444BCC9: window_remove_filters (gdkwindow.c:1873)
==13876==    by 0x4454BA3: _gdk_window_destroy_hierarchy (gdkwindow.c:2043)
==13876==    by 0x447BF6E: gdk_window_destroy_notify (gdkwindow-x11.c:1115)
==13876==    by 0x43588E2: _gtk_socket_windowing_filter_func (gtksocket-x11.c:518)
==13876==    by 0x446B170: gdk_event_apply_filters (gdkeventsource.c:79)
==13876==    by 0x446B411: _gdk_events_queue (gdkeventsource.c:188)
==13876==    by 0x44437EF: gdk_display_get_event (gdkdisplay.c:410)
==13876==    by 0x446B009: gdk_event_source_dispatch (gdkeventsource.c:317)
==13876==    by 0x4AB7159: g_main_context_dispatch (gmain.c:2436)
==13876==    by 0x4AB7957: g_main_context_iterate.clone.5 (gmain.c:3087)

https://bugzilla.gnome.org/show_bug.cgi?id=637464
2010-12-17 12:07:37 -05:00
Carlos Garnacho
2c8c1c6df4 Remove *_set_extension_events() and old API to query devices.
The old functions to get core pointer and devices list are gone as
well. This slice is entirely replaced internally by multidevice
handling and may just go.
2010-12-17 16:25:14 +01:00
Matthias Clasen
208d717fef Optimize gdk_window_set_shape_combine_region
When setting no shape on an unshaped window, nothing changes,
so return early instead of recomputing lots of visibility
information.

Pointed out by Owen Taylor in bug 637156.
2010-12-14 22:21:39 -05:00
Carlos Garnacho
44a7ef7bec Add gdk_window_[gs]et_source_events()
This function will enable events for all devices of a given
GdkInputSource, either these available at the time of the call,
or these that are connected in the future.
2010-12-15 03:17:59 +01:00
Carlos Garnacho
f5a20ab65a Add gdk_event_[gs]et_source_device().
This function may be used to know the hardware device that triggered
an event, it could resort to the master device in the few cases there's
not a direct hardware device to relate to the event (i.e.: crossing events
due to grabs)
2010-12-15 03:17:58 +01:00
Benjamin Otte
d55073fde6 gdk: Remove depth argument from GdkWindowImpl->get_geometry() 2010-12-06 01:02:52 +01:00
Benjamin Otte
645d0ac403 API: gdk: Remove depth argument from gdk_window_get_geometry()
We don't want to expose depth anymore. If you need it, query the visual.
2010-12-06 01:02:52 +01:00
Matthias Clasen
5fdc140dd8 Fix a segfault in gdk_window_beep
Not a good idea to cast an instance to a class...
2010-12-04 17:25:40 -05:00
Paolo Borelli
cd76b057e9 Annotate gdk_window_get_geometry, get_position and get_origin 2010-12-04 15:47:50 +01:00
Benjamin Otte
350fb1d55c API: gdk: Rename GdkWindowObjectClass to GdkWindowClass
Be consistent in the naming of objects.
2010-12-03 19:11:13 +01:00
Matthias Clasen
17e2c5391c Fix up parameter mismatches in the docs
And other minor gdk doc fixes.
2010-12-03 09:07:06 -05:00
Benjamin Otte
fdb242ac6a gdk: Clean up Cairo code
Remove a bunch of code that is not required.
2010-12-02 20:21:05 +01:00
Benjamin Otte
f9a9567731 gdk: Replace direct calls of _gdk_event_func with _gdk_event_emit()
For now that function just calls the event func.
2010-12-02 20:21:05 +01:00
Benjamin Otte
4d1604c77d gdk: Move window beeps into GdkWindowImpl
One less magic function. Also refactored it to make it easier to
implement. It now returns TRUE if it beeped and FALSE if it failed to do
so. A default implementation exists that just returns FALSE for all the
backends that can't beep windows (read: everything but X11 with XKB -
and why on earth do keyboard libs implement beeping?)
2010-12-02 20:21:05 +01:00
Benjamin Otte
1269f8424f gdk: Make get_shape and get_input_shape vfuncs
Trying to get rid of all the _gdk_windowing_something() functions that
we expect backends to magically know about and instead put them in a
proper interface (mostly GdkWindowImplClass).
2010-12-02 20:21:04 +01:00
Benjamin Otte
b9fc6a0c03 gdk: Remove remaining includes of gdkdrawable.h 2010-12-02 20:21:04 +01:00
Benjamin Otte
3494f87a10 API: Remove GdkNoExposeEvent
It's not used by anyone and not supported by any backend but X11.
2010-12-02 20:21:04 +01:00
Benjamin Otte
98838df2db gdk: Make GdkWindow->impl a GdkWindowImpl 2010-12-02 20:21:04 +01:00
Benjamin Otte
17a0a467a1 gdk: Pass the GdkWindow to resize_cairo_surface vfunc
So it's in sync with all the other vfuncs.
2010-12-02 20:21:04 +01:00
Benjamin Otte
e4c27b0a59 API: GdkWindow no longer is a GdkDrawable
Also, name the get_type function properly.
2010-12-02 20:21:03 +01:00
Benjamin Otte
d1700d6e3c gdk: Move ref_cairo_surface from GdkDrawable to GdkWindowImpl
Also make it take the actual GdkWindow, not the implementation, like all
the other vfuncs do.
2010-12-02 20:21:03 +01:00
Benjamin Otte
62d004cf8f gdk: Remove _gdk_drawable_ref_cairo_surface()
Instead, call the vfunc directly from gdkWindow.c
2010-12-02 20:21:03 +01:00
Benjamin Otte
1bb6f48bb3 gdk: Rename GdkWindowObject to GdkWindow
... and remove most of the casting that used to be necessary.
2010-12-02 20:21:03 +01:00
Benjamin Otte
7acb64f983 gdk: Make GdkWindowImpl a class, not an interface
It's a subclass of GdkDrawable and the baseclass for GdkWindowImplX11
etc now.
2010-12-02 20:21:02 +01:00
Benjamin Otte
81605623e2 gdk: Use GdkDrawable for impl pointers
... instead of GdkWindow
2010-12-02 20:21:02 +01:00
Benjamin Otte
072498ae87 gdk: Make _gdk_window_ref_cairo_surface() protected and use it
... instead of _gdk_drawable_ref_cairo_surface() where appropriate.
Also, don't implement the drawable->create_cairo_surface vfunc anymore.

This is in preparation for the split of GdkWindow from GdkDrawable.
2010-12-02 20:21:02 +01:00
Benjamin Otte
18a6976e5a API: gdk: Don't track outstanding surfaces
You are not allowed to track surfaces from GDK or draw outside of expose
events. So we can remove ugly hacks needed previously. See
https://bugzilla.gnome.org/show_bug.cgi?id=606009 for the introduction
of this workaround.
2010-12-02 20:17:28 +01:00
Benjamin Otte
becaf660fc API: gdk_drawable_get_visible_region => gdk_window_get_visible_region
Also get rid of the GdkDrawable vfunc.
2010-12-02 20:17:28 +01:00