Commit Graph

482 Commits

Author SHA1 Message Date
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
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
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
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
1215f70e23 gdk: Remove GdkDrawable->create_cairo_surface vfunc
It's unused.
2010-12-02 20:21:03 +01:00
Benjamin Otte
370d272b13 gdk: Remove _gdk_window_impl_get_type() function
It was only used in the backends, and they can use the correct type
directly.
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
62622a94ae gdk: Pass Drawable as argument
We're not passing a GdKWindow here, but the implementation.
2010-12-02 20:21:02 +01:00
Benjamin Otte
e724054d19 API: Remove GDK_WINDOW_XWINDOW() macro
Use GDK_WINDOW_XID() instead.

THis was done using sed, so there might be issues resulting to that.
Feel free to fix.
2010-12-02 20:20:56 +01:00
Benjamin Otte
fe6f76a5a2 x11: Make wrapper member a GdkDrawable
This is in preparation for getting rid of GdkDrawable as a dependency of
GdkWindow.
2010-12-02 20:17:28 +01:00
Benjamin Otte
88399c041c x11: Remove GdkDrawableImplX11
It's not use anymore, the whole functionality has been moved to
GdkWindowImplX11.
2010-12-02 20:17:27 +01:00
Benjamin Otte
3e6a4af6d3 x11: _gdk_x11_drawable_update_size() => _gdk_x11_window_update_size() 2010-12-02 20:17:27 +01:00
Benjamin Otte
bb79506665 x11: Move cairo_surface and wrapper members to GdkWindowImplX11 struct 2010-12-02 20:17:27 +01:00
Benjamin Otte
1c7f58fdb6 x11: Move xid member from GdkDrawableImplX11 to GdkWindowImplX11 2010-12-02 20:17:27 +01:00
Benjamin Otte
094b0eeb98 x11: Remove screen member from GdkDrawableImplX11 2010-12-02 20:17:27 +01:00
Benjamin Otte
5f12730599 x11: Get display from window, not from impl-drawable's screen 2010-12-02 20:17:27 +01:00
Benjamin Otte
dc7d8dae67 x11: Change GDK_WINDOW_SCREEN macro
on't look at GdkDrawableImplX11->screen, but call
gdk_window_get_screen() instead.
2010-12-02 20:17:27 +01:00
Benjamin Otte
3b8aea389d x11: Use window macros instead of drawable macros
GDK_WINDOW_XID() instead of GDK_DRAWABLE_XID()
GDK_WINDOW_XDISPLAY() instead of GDK_DRAWABLE_XDISPLAY()
2010-12-02 20:17:27 +01:00
Benjamin Otte
cf51750bf4 API: x11: gdk_drawable_get_xid => gdk_window_get_xid
Also moves the function implementations to gtkwindow-x11.c.
2010-12-02 20:17:27 +01:00
Milan Bouchet-Valat
2e3935ba9d Fix missing (transfer) annotations in GDK
Mostly missing (transfer none).
2010-11-24 21:37:20 +01:00
Owen W. Taylor
a4d59f7415 Create the icon pixmap with the system visual
Since what we are doing is turning an icon with alpha into a
no-alpha icon + mask for legacy window managers, it makes more sense
to use the system visual than the window's visual, which might
be ARGB.

https://bugzilla.gnome.org/show_bug.cgi?id=634821
2010-11-19 09:29:43 -05:00
Matthias Clasen
45498417c8 Fix a crash in gnome-terminal when using a compositor
In this case, gnome-terminal sets an RGBA visual on its window,
and we need to be careful when creating the icon pixmap, to create
the pixmap with the same depth as the visual, or we risk a BadMatch
from XRenderCreatePicture deep inside cairo.
2010-11-12 19:22:49 -05:00
Benjamin Otte
22d28ef47d x11: Don't set ParentRelative if the parent's visual is different
It's like 82e6e32c, but when a pattern is given as argument.

https://bugzilla.gnome.org/show_bug.cgi?id=632218
2010-10-15 17:10:05 +02:00
Matthias Clasen
bda1f35585 Inclusion cleanups in sources
Try to do inclusions in the same sequence, more or less.
2010-10-14 22:09:36 -04:00
Kristian Rietveld
eca2af5230 Make set_cairo_surface_size a vfunc on GdkWindowImpl
Note the special implementation of this method on GdkOffscreenWindow
that makes sure its current surface is not destroyed.
2010-10-05 15:38:23 +02:00
Benjamin Otte
82e6e32c77 x11: Don't set ParentRealtive if the parent's visual is different
Causes a BadMatch otherwise, see code comments.

https://bugzilla.gnome.org/show_bug.cgi?id=630864
2010-09-29 12:18:17 +02:00
Benjamin Otte
e8e657725c x11: Get rid of gdk_drawable_get_size() usage 2010-09-26 15:11:43 +02:00
Benjamin Otte
cf4cb4f6d9 API: Remove colormap handling from GdkScreen
In particular, the following functions are gone:
- gdk_screen_get_default_colormap()
- gdk_screen_set_default_colormap()
- gdk_screen_get_system_colormap()
- gdk_screen_get_rgba_colormap()
2010-09-26 15:11:34 +02:00
Benjamin Otte
04d5c477aa API: Remove gdk_drawable_get_colormap()
And with it, remove any notion of colormaps from GdkWindow. In
particular, X11 windows will now not set attrs.colormap when calling
XCreateWindow.
2010-09-26 15:11:33 +02:00
Benjamin Otte
28b4567159 x11: Keep a default X Colormap in every visual to construct windows with
This way, we can specify a colormap when constructing windows. And ew
must do that to avoid BadMatch from XCreateWindow when we use a
different visual.
2010-09-26 15:11:33 +02:00
Benjamin Otte
47ee996198 x11: Use G_DEFINE_TYPE() to define GdkVisual
Also add a priv pointer to GdkVisual and use it for the GdkVisualPrivate
structure. Then Make GdkVisualPrivate actually private to
gdkvisual-x11.c and make other callers use proper function calls to
access it.
2010-09-26 15:11:33 +02:00
Benjamin Otte
571e749d60 x11: Set background color bypassing colormaps
Direct and TrueColor visuals don't alloc colors, so they don't need to
fiddle with colormaps. Just copy the code that computes the pixel value
from gdkcolor-x11.c and use it. For other visual types, don't set the
background color and fallback to background = None.
2010-09-26 15:11:33 +02:00
Benjamin Otte
f08254074c API: Remove colormap member from GdkWindowAttr
Also remove all code that cares about differing colormaps for child
windows.
2010-09-26 15:11:33 +02:00
Benjamin Otte
b5097de481 gdk: gdk_drawable_get_display() => gdk_window_get_display() 2010-09-26 15:11:33 +02:00
Benjamin Otte
a6e936788a gdk: gdk_drawable_get_screen/visual => gdk_window_get_screen/visual 2010-09-26 15:11:33 +02:00
Benjamin Otte
eee6c002d1 gdk: store the visual in the GdkWindowObject 2010-09-26 15:11:32 +02:00
Benjamin Otte
894d402c0f API: Remove gdk_drawable_set_colormap() 2010-09-26 15:11:32 +02:00
Benjamin Otte
55c4cdab1a x11: Make fallback cursor code not use pixmaps
The fallback code for when XCursor wasn't available was still using
GdkPixmap to create the bitmaps.
2010-09-26 15:11:30 +02:00
Benjamin Otte
6453710266 x11: Set the icon using Cairo
No more GdkPixmap to store the icon and its mask, but instead use cairo
surfaces. Also render the icon into the surfaces using Cairo instead of
gdk_pixbuf_render_threshold_alpha().
2010-09-26 15:11:29 +02:00
Benjamin Otte
2c1633699f gdk: Rewrite background handling
Now the window background is a cairo_pattern_t. The backends will try to
set this as good as they can on the windowing system, but no guarantees
are made on wether the windowing system supports the pattern.

Also gets rid of GDK_NO_BG as undefined behavior is not a good idea to
support, and GDK_NO_BG effectively made the window's contents undefined.
It wasn't effectively used in GTK anyway.
2010-09-26 15:03:00 +02:00
Benjamin Otte
c250b3fe1d gdk: Remove supports_native_bg on WindowImplIface
This will not be TRUE for anything anymore, once we fix background
handling.
2010-09-26 15:03:00 +02:00
Benjamin Otte
547e2cc837 gdk: Remove GdkWindowImpl->clear_region
It was only used on the X11 backend and is easier to implement locally,
in particular when we want to allow backgrounds that X can't handle.
2010-09-26 15:03:00 +02:00
Benjamin Otte
bfa6ad6e7c gdk: Remove _gdk_windowing_get_shape_for_mask()
It's unused. And there's a replacement available with
gdk_cairo_region_create_from_surface()
2010-09-26 15:02:59 +02:00
Benjamin Otte
6ef27387e0 API: remove gdk_window_set_icon()
gdk_window_set_icon_list() now does everything gdk_window_set_icon()
used to do.
2010-09-26 15:02:59 +02:00
Benjamin Otte
241f38992b x11: remove icon_window property, it's not used anymore 2010-09-26 15:02:59 +02:00
Benjamin Otte
c65bb2b3b4 x11: Set icon based on icon list
Basically copies the code for setting the WM icon hint from GtkWindow to
GdkWindow. This achieves the following:
- Putting this X11 specific code into the X11 backend
- Enables removal of gdk_window_set_icon()
- Gets rid of Pixmap/Bitmap usage outside of GDK.
2010-09-26 15:02:59 +02:00
Johan Dahlin
6ba904486c Add a couple of missing transfer annotations 2010-09-20 23:45:01 -03:00
Matthias Clasen
2ddfaeddad More error trap cleanups
Remove syncs in front of gdk_error_trap_pop() calls, and convert
gdk_error_trap_pop() calls to gdk_error_trap_pop_ignored() in gdk.
2010-09-20 16:40:14 -04:00
Matthias Clasen
6aa8941b84 Add annotations
The goi scanner warns about these nowadays.
2010-09-17 00:18:20 -04:00
Javier Jardón
bd277fad50 Remove deprecated gdk_window_get_deskrelative_origin() and its implementations 2010-09-09 00:50:46 +02:00
Benjamin Otte
3fdb4f6069 x11: Unused variable 2010-09-03 13:39:24 +02:00
Matthias Clasen
eb10e6b128 Remove the long deprecated GDK_WINDOW_DIALOG type.
This has been deprecated forever, and was just left in for
compatibility reasons.
2010-08-28 20:10:02 -04: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
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
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
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
Benjamin Otte
52200eee01 Remove _gdk_region_new_from_yxbanded_rects()
It was an internal function and we can use
cairo_region_create_rectangles() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +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
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04: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
Javier Jardón
2b64a7fd54 Remove some deprecated stuff from GdkWindow
Also, substitute the deprecated functions with the correct ones
2010-05-12 04:29:55 +02:00
Claudio Saavedra
51a1af7aa4 Use the proper screen in _gdk_windowing_get_shape_for_mask()
Bug 615853 - BadMatch when pressing keyboard volume keys while pointer in
             secondary X screen

_gdk_windowing_get_shape_for_mask() is using the default screen, not taking
into account that its GdkBitmap could have been created for a different one,
causing BadMatch errors.
2010-04-19 18:51:27 +03:00
Matthias Clasen
0efb24f589 Yet another fix for shape handling
This should fix problems with awn and notify-osd.
2010-04-06 20:33:19 -04:00
Matthias Clasen
996541d096 Don't crash in DND when the X server doesn't support SHAPE
Reported in bug 612768
2010-03-16 12:35:13 -04:00
Matthias Clasen
f73f9d802c Fix gdk_window_set_icon_name
A typo kept this from working on toplevel windows.
Reported in bug 612346.
2010-03-12 15:59:59 -05:00
Matthias Clasen
69aa7a6392 Make DND work better with shaped windows
If mouse clicks go through, drag-and-drop should too...
Fixes bug 608615.
2010-02-04 19:18:22 -05:00
Alexander Larsson
48fc0f36c2 Fix mouse pointer handling on multiple screens
The fix in 786b589d95 for the
"Cannot click buttons more than once without moving the mouse cursor"
did not correctly handle setups with multiple screens in one display.

We need to handle the case where the first XQueryPointer returns
a different root window than the default one.

This fixes bug 597386 (agaion)
2009-12-07 10:49:57 +01:00
Matthias Clasen
5bfab2b9d4 Short-circuit get_frame_extents for override-redirect windows
There's no reason to do our expensive round-trips for an override-redirect
window; just use local information. See bug 581145. Patch by Owen Taylor.
2009-11-27 18:19:20 -05:00
Alexander Larsson
39993f147f Add supports_native_bg to GdkWindowImpl
Backends that support native window background setting (and that clears
new window areas to this color/pixmap) should set this to true.

Currently only X11 supports this.
2009-11-05 12:52:12 +01:00
Javier Jardón
d3155bb1ea Remove some unnused variables 2009-10-20 20:37:46 +02:00
Alexander Larsson
786b589d95 Fix up _gdk_windowing_window_at_pointer coordinate reporting
We need to do a final XQueryWindow to get the coordinates inside the
windows rather than in the parent window.

This fixes bug #597386, "Cannot click buttons more than once...", which
failed due to the grab tracking stuff getting the wrong coordinates as
per the above.
2009-10-05 11:41:50 +02:00
Pascal Terjan
f3013bf6ed Call XReconfigureWMWindow with proper screen
Thanks gcc :

gdkwindow-x11.c:1731: warning: passing argument 3 of
'XReconfigureWMWindow' makes integer from pointer without a cast
/usr/include/X11/Xlib.h:1871: note: expected 'int' but argument is of
type 'struct GdkScreen *'

Signed-off-by: Pascal Terjan <pterjan@mandriva.com>
2009-10-01 18:36:43 +02:00
Alexander Larsson
5ebb32d1ff Extend _gdk_windowing_window_at_pointer to be able to get toplevels only
This has two advantages:
1) In many backends, this is faster as we can terminate the window
hierarchy traversal earlier
2) When used in gdkdisplay.c::get_current_toplevel() to get the
current toplevel that has the pointer we now correctly return
a toplevel with the pointer in it where the pointer is inside
some foreign subwindow of a toplevel window.

The second advantage fixes some bugs in client side event generation
when the pointer is inside such a foreign child window.
2009-09-28 15:21:54 +02:00
Matthias Clasen
be22a62160 Cleanups
This commit removes dead code, mostly pointed out by clang.
2009-09-10 13:53:28 -04:00
Matthias Clasen
da00e171e7 Correct the initial event mask of the root window
This fixes bug 588455 where the panel stopped responding to Alt-F2 when
setting a transparent background.
2009-09-06 02:44:24 -04: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
Alexander Larsson
cc5b22cc81 Don't update window->shaped from backends
This is properly updated from the main code these days and
should not be touched by the backend code.
2009-08-31 15:06:01 +02:00
Matthias Clasen
69fc109c22 Avoid some gratitious behaviour changes
Go back to allowing a lot of the WM-level functions on foreign windows,
since we used to allow that before csw. Fixes bug 589732.
2009-08-08 22:00:07 -04:00
Alexander Larsson
aa8693f2cb Track viewable for GdkWindow 2009-07-18 23:11: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
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
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
7303f3c9fd Merge branch 'master' into client-side-windows
This updates client-side-windows to the the latest soname
change for easier testing.

Conflicts:
	gdk/x11/gdkwindow-x11.c
	tests/Makefile.am
2009-06-17 12:56:05 +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
56dfbd997e Handle gdk_window_beep on offscreen windows 2009-06-11 22:11:48 +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
Matthias Clasen
c7a0a513f5 Remove nonworking conditionals
Don't pretend that we care about XShape-less builds anymore.
See bug 584637.
2009-06-05 23:06:12 -04:00
Alexander Larsson
4720bbc15e Make window_get_pointer a window impl virtual 2009-06-05 15:18:36 +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
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
7698daf97a Merge branch 'master' into client-side-windows
Conflicts:
	gdk/x11/gdkwindow-x11.c
2009-05-25 14:30:01 +02:00
Matthias Clasen
141ddd99f3 Avoid unintended side-effect in gdk_window_get_events
Calling gdk_window_get_events() had the side-effect of letting
property change notification through to the application, which
was not intended. Now we keep StructureNotify and PropertyNotify
filtered out when they were before. Reported in bug 582003.
2009-05-10 02:08:41 -04:00
Matthias Clasen
4fc49fd8db Don't enforce property change events on the root window
The code in gdk_x11_window_set_events is only meant to enforce
property change events on child windows. Pointed out in bug 531490.
2009-05-10 01:54:43 -04:00
Christian Persch
0e99a5849e Allow unsetting the icon title set with gdk_window_set_icon_name
Change gdk_window_set_icon_name to allow using NULL to unset a
previously set icon title, so that the icon title tracks the normal
title again. Bug #535557.
2009-04-20 14:53:51 +02:00