Commit Graph

3220 Commits

Author SHA1 Message Date
Kristian Rietveld
73b55ae8f5 Register and handle a display reconfiguration callback
Using this we can update our internal monitor/screen layout state
and emit the GdkScreen::size-changed signal.  Work has not
completely finished on this yet, see bug 596238.
2009-10-26 09:52:52 +01:00
Kristian Rietveld
ce3c861c2a Setup monitor rects during screen initialization and re-use data 2009-10-26 09:52:52 +01:00
Kristian Rietveld
ca20b04b58 Move screen initialization to gdkscreen-quartz.c 2009-10-26 09:52:52 +01:00
Michael Emmel
04d7d81056 Fix for position bug
https://bugzilla.gnome.org/show_bug.cgi?id=590800
2009-10-24 17:20:50 +02:00
Kristian Rietveld
42ac226877 Bug 598881 - Unimplemented GdkWindowImplIface methods crash gimp on OSX
Add dummy for _gdk_input_window_crossing ().  Set both input_window_destroy
and input_window_crossing pointers in the Impl struct.

Reported by John Ralls.
2009-10-23 13:53:57 +02:00
Tor Lillqvist
861c34b01e Use correct type text/uri-list for the dropped files selection
Fixes bug #599321.
2009-10-23 13:40:27 +03:00
Javier Jardon
98ea183c13 Use G_STRLOC instead __FILE__ and __LINE__
Patch from bug #599225
2009-10-21 21:48:00 +03:00
Javier Jardón
d3155bb1ea Remove some unnused variables 2009-10-20 20:37:46 +02:00
Tor Lillqvist
ab13c00a38 Use correct size for root window with multiple monitors
The root window width and height have already been correctly
initialised in _gdk_root_window_size_init() to cover all monitors, so
don't incorrectly re-initialise using GetSystemMetrics(SM_C[XY]SCREEN)
which only gives the size of the primary monitor anyway. (See MSDN.)

This fixes at least gdk_screen_get_{width,height}() which indirectly
affects at least the positioning of combo box pop-up menus on multiple
monitors.
2009-10-18 14:35:17 +03:00
Tor Lillqvist
0698ddd421 Delete a couple of leftover commented-out lines 2009-10-18 14:19:55 +03:00
Tor Lillqvist
77590e9af7 Add missing newline to debugging output 2009-10-18 14:19:24 +03:00
Tor Lillqvist
be5c06d799 Delete unused leftover static function 2009-10-18 12:08:18 +03:00
Tor Lillqvist
f545bd270d More meaningful debugging output in gdk_win32_window_get_root_coords 2009-10-18 12:06:29 +03:00
Tor Lillqvist
d8de422794 Remove unused variables and static functions 2009-10-18 11:51:57 +03:00
Tor Lillqvist
b92f882ec4 Correct function names in debugging output 2009-10-18 11:45:03 +03:00
Javier Jardón
57bc513713 Use g_object_ref/unref instead deprecated gdk_*_ref/unref functions
Substitute deprecated reference counting functions for
g_object_ref/unref in documentation and in internal code

https://bugzilla.gnome.org/show_bug.cgi?id=598217
2009-10-14 03:13:52 +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
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
Sebastian Dröge
59177b1932 Bug 596959 - DirectFB backend compilation broken with changes from 2.18.0 to 2.18.1
Fix compilation of the DirectFB backend after internal API changes of GDK.
2009-10-02 07:39:34 +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
Kristian Rietveld
a4145bfeef Bug 588449 - DnD doesn't work on GDK/Quartz
Patch from Paul Davis.  This gets the basics of drag and drop properly
working on Mac OS X.
2009-09-30 15:07:37 +02:00
Kristian Rietveld
28d56cbbda Use boxed accessors for setting and retrieving cursor property 2009-09-30 13:00:28 +02:00
Thomas Jaeger
35845f1efe Interpret min_value == max_value correctly
https://bugzilla.gnome.org/show_bug.cgi?id=588649

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
2009-09-30 09:21:12 +02:00
Thomas Jaeger
70bd23537f Select for DeviceStateNotify
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-30 09:21:11 +02:00
Thomas Jaeger
0178ebf739 Keep track of axis values
https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-30 09:21:10 +02:00
Thomas Jaeger
67728ac004 Filter out events that the current window didn't select for
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-29 14:44:25 +02:00
Thomas Jaeger
51f2a99096 Always select all XInput motion events
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-29 14:44:23 +02:00
Thomas Jaeger
acdecb6aa4 Report XInput button motion events until all buttons are released.
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-29 14:44:21 +02:00
Thomas Jaeger
2635fb75c6 XInput allows up to 255 buttons
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-29 14:44:18 +02:00
Thomas Jaeger
abf7742beb Refactor _gdk_input_other_event
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-29 14:44:17 +02:00
Thomas Jaeger
bd51d930e8 Use strstr instead of g_strrstr.
Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
2009-09-29 12:58:52 +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
Thomas Jaeger
7d196b3939 Improve detection of input device source type
This detection code is not 100% reliable, but it should fare much better
than the current code, which just compares the device name to a fixed
set of strings.  Many applications depend on erasers being recognized
reliably, so we start by checking for a device name containing the
substring 'eraser'.

Signed-off-by: Thomas Jaeger <ThJaeger@gmail.com>
2009-09-28 16:08: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
Alexander Larsson
739121dee0 Remove unused grab_one_pointer_release_event var
We don't use this anymore, so just remove.
2009-09-28 15:26:19 +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
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
Kristian Rietveld
f2d9f5a9e6 Remove unused variable 2009-09-27 13:44:10 +02:00
Kristian Rietveld
2f782de1b7 Bug 596012 - popup menu position is horribly off on gdk quartz with ...
Based on first patches by Christian Hergert.  Change
screen_get_monitor_geometry() so that it translates the layout of the screens
from Cocoa layout to GDK layout.  In Cocoa, the screen locations
are specified in Cocoa geometry, as well as that GDK uses a different way
to place individual monitors in the root window.  For now only monitors
that are laid out horizontally are supported (see the FIXMEs in the source),
in bug 596238 we will track future work to get things fully right.

Modify _gdk_quartz_window_get_inverted_screen_y() to take the differences
in screen layout between Cocoa and GDK into account.  Also this function
is subject to future work.
2009-09-27 13:44:10 +02:00
Christian Hergert
17130a8ec9 Bug 517394 - Native resize grip steals button release ...
Explicitly handle resizing by leaving all events in the lower right 15x15
corner to Cocoa, if the window shows a resizing indicator.  Some
applications may have widgets allocated in this area.  Generally, these
widgets are likely larger than 15x15 so they can still be hit.  Often
scroll bars are found in this area and these can also be manipulated by
other means.  Since this is the only way of resizing windows on Mac OS X,
it is too important to keep it broken.
2009-09-25 21:52:13 +02:00
Kristian Rietveld
785e55f87d Bug 596250 - Gdkcursor-quartz.c doesn't implement GDK_BLANK_CURSOR
Support GDK_BLANK_CURSOR.  Patch by John Ralls.
2009-09-25 18:51:55 +02:00
Kristian Rietveld
cdec2caaf3 Send a motion-notify when a (new) main window became active
This motion-notify even will make sure that things like highlights are
set up correctly now that the window has become active.
2009-09-25 18:51:54 +02: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
Kristian Rietveld
3043155796 Bug 550939 - GtkFileChooser listbox does not refresh selection
Make the quartz backend support the new queued translations.  We do this
by keeping our own copy of the region that has been set to need display.
Using this region we can intersect by the given area, translate this and also
set needs display for the resulting area.
2009-09-21 20:41:35 +02:00
Carlos Garnacho
bfc88240b4 Always report XInput events to the grab window if any.
The grab window should be the first option to send events to, else we may
get unpaired events, making display->ignore_core_events go crazy.

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-21 20:04:22 +02:00
Carlos Garnacho
d37268c60f Block extended events to windows that didn't select them.
Now XSelectExtensionEvent() is called on the native window, so there
may be virtual windows inside that shouldn't receive extended events.

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-21 20:04:22 +02:00
Carlos Garnacho
13c258f891 Fix x/y coordinates for extended events.
Extended events were being reported to virtual windows without taking into
account the position of the virtual window inside the native one.

https://bugzilla.gnome.org/show_bug.cgi?id=588649
2009-09-21 20:04:21 +02:00
Cody Russell
cb5e659ae4 revert some changes in directfb backend that broke API 2009-09-21 11:32:37 -05:00
Michael Natterer
659776ce35 Fix gdk_device_get_history() for the core pointer
When filtering out the events for "window" from the events we got for
our "impl_window", don't forget to adjust the returned number of
events because it might be smaller than what XGetMotionEvents has
returned, and free coords we allocated too much. Also if we filtered
away *all* events, return FALSE and get rid of the allocated history
entirely. Together fixes all sorts of mishehavior when painting in
GIMP, from coords going wild to plain crashes and infinite loops.
2009-09-17 11:38:14 +02:00
Kristian Rietveld
d797dcc4dd Assign the size of the screen to the root window
On startup, the root window got assigned the size of the main screen.
But, the GdkScreen has the width of all screens/monitors connected to the
machine.  Change this so that in _gdk_windowing_window_init, we assign
the width/height of all monitors to the root window width, height.
Should fix bug 594738.
2009-09-16 08:48:49 +02:00
Kristian Rietveld
cf80feb3dd Do not test the event mask of implicit grabs
The quartz backend simulates the semantics of XGrabPointer, as a part of
this it checks the event mask of the grab.  However, implicit grabs on X
do not go through XGrabPointer and thus the quartz backend should not check
the event mask for these.  This fixes various "the UI got stuck" cases.
2009-09-16 08:48:49 +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
Michael Meeks
02b102cbbc fix whitespace error 2009-09-14 15:34:43 +01:00
Michael Meeks
db88f084bc fix race between fetching owner of composit selection, and
registering as a listener for changes; bug#594913
2009-09-14 15:33:59 +01: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
Matthias Clasen
8f16541d93 Fix gdk_display_beep
Since XBell() seems broken, just call XkbBell().
2009-09-13 23:16:44 -04: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
Bastien Nocera
4ccd47f47e Avoid duplicate keysyms, ignore mispelled one
GDK_Select and GDK_Clear were duplicated, GDK_Calculater is
only useful for compulsive misspellers.
2009-09-10 10:16:44 +01:00
Bastien Nocera
11898088a1 Bug 594668 - Add new Xorg keysyms
Add support for XF86keysym.h to gdkkeysyms-update.pl and
update the generated gdkkeysyms.h file for the latest sources.
2009-09-09 18:45:28 +01:00
Matthias Clasen
aa9bb7d8e4 Deprecate gdk_event_get_graphics exposes
This function is only used in deprecated, broken widgets. Also,
fix up some of its implmentation that clang was complaining about.
2009-09-09 09:00:15 -04: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
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
Matthias Clasen
d09d810261 Fix a typo 2009-09-04 23:27:37 -04:00
Matthias Clasen
bec0d570b0 Fix the build 2009-09-04 23:00:27 -04:00
Matthias Clasen
5c14089225 Make window manager tracking work better
We were getting the new wm name with a 15 second delay, due to
some race. Reported in bug 593644.
2009-09-04 20:22:43 -04:00
Alexander Larsson
812b3c451d Deprecate GDK_WINDOW_OBJECT and GdkWindowObject 2009-09-04 17:59:18 +02:00
Alexander Larsson
d0ac27fe5f Add function accessors for x11 window/pixmap impl 2009-09-04 17:59:17 +02:00
Alexander Larsson
0c7830aa42 Make public GDK_WINDOW_TYPE and GDK_WINDOW_DESTROYED use functions calls 2009-09-04 17:59:17 +02:00
Alexander Larsson
f64ef921da Add gdk_window_is_destroyed 2009-09-04 17:59:17 +02:00
Alexander Larsson
a10e90b799 Move _gdk_window_event_parent_of to gdkinternals.h
gdkprivate.h is in installed file and this function does not
need to be exported.
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
294e222fa8 Ensure gc clip region valid in _gdk_gc_update_context
There might be an old drawable clip on it, if so remove it.
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
Matthias Clasen
2f80806359 Fix the return type of gdk_selection_property_get
It returns the length of the property, not a boolean. Reported
in bug 593788.
2009-09-02 22:50:05 -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
45956aea21 Add gdk_cairo_reset_clip
This is required to get back the original drawable clip due to
non-native windows on a cairo_t.
2009-09-01 17:06:41 +02:00
Matthias Clasen
32d59d174e Documentation fixes 2009-09-01 00:53:44 -04:00
Matthias Clasen
9be22cb574 Document gdk_window_geometry_changed 2009-08-31 19:51:19 -04:00
Alexander Larsson
3e40146c04 Fix order of cairo clip setting when drawing text
We need to set the window clip region before applying the gc clip region,
otherwise we will reset the gc clip region. Fixes bug 593595
2009-08-31 16:39:54 +02: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
b18afe9054 Don't propagate GDK_NATIVE_WINDOWS to child processes
Generally you only need to work around bugs in one specific app, so we
don't want to affect the applications that application will start.
Thus we unset GDK_NATIVE_WINDOWS after reading it.
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
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
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
f649237bf2 Minor doc fix 2009-08-31 00:55:57 -04: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
7e4e2c636e Fix a documentation error
Reported by Eduard Bagrov in bug 592862.
2009-08-29 20:23:07 -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
1932f32ef2 Correct generation of broken grabs
We send a broken grab when a *parent* gets unmapped, not when
a child gets unmapped!
2009-08-27 13:32:01 +02:00
Alexander Larsson
41054425b9 Make sure we only send one grab broken event
We were incorrectly sending grab broken events in two places which
could cause multiple events for a single grab broken.
2009-08-27 13:32:01 +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
c0084e2142 Fix clipping issue with clip masks
When the clip mask is completely inside the drawable clip region we
don't change the clip at all. However, we did set region_tag_applied,
so when the drawable clip was removed we removed the original clip mask.
This is no good, so we fix that by returning early in this case.

Fixes issue reported in bug #592752.
2009-08-25 10:37:18 +02:00
Alexander Larsson
0ad0646daf Fix clipping of drawn pixbufs in the no-render case
The fallback pixbuf rendering case ends up calling gdk_draw_image() on the
destination drawable wrapper, which resets the previously set clip region.
So, we need to manually get the impl and draw on that directly.

This fixes bug 592752 where we don't clip pixbuf rendering on non-render
Xservers.
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
Matthias Clasen
e0a1e78a5a Silence the conversion from xatom to atom too 2009-08-20 18:06:35 -04:00
Shixin Zeng
277d840616 Deprecate also GdkFontPrivateWin32 2009-08-20 23:57:41 +03:00
Shixin Zeng
bbe16ec60f Use g_object_ref/unref instead of deprecated specializations 2009-08-20 23:55:51 +03: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
Matthias Clasen
be83e8789c Tiny docs improvement
Mention that gdk_xid_table_lookup may return  NULL. Bug 591432.
2009-08-17 13:46:30 -04: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
Tor Lillqvist
341b8a4752 Initialize missing methods on Windows
Set the input_window_destroy and input_window_crossing methods of the
GdkWindowImplIface on Windows. Add implementation of
_gdk_input_crossing_event that is mostly dummy, though.
2009-08-13 22:49:35 +03: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
Alexander Larsson
939e55223c Ensure that queue_translation is paired with the right X operation
The X11 queue_translation operation uses NextRequest to get the serial
of the XCopyArea operation where the translation should end. However,
if the gc passed to gdk_draw_drawable has a non-flushed clip region
(which it commonly has now for the window clipping) then the next
operation will be the GC flush, not the XCopyArea.

To handle this right we now pass in the GC to be used to
queue_translation and ensure that it is flushed before calling
NextRequest().
2009-08-13 14:46:02 +02:00
Alexander Larsson
e25ac0b5cb Clarify comment 2009-08-13 14:46:01 +02:00
Alexander Larsson
043ca236f2 Invalidate old source in gdk_window_move_region
When we copy the region we need to also re-expose the areas of
the copied region that was not also in the destination.
And, we need to do this invalidation after the move, as the
move also moves any invalid area.
2009-08-13 14:46:01 +02:00
Alexander Larsson
8a517dc0bb Modify window system exposes wrt outstanding moves
If there are outstanding moves in an area that intersects
the source of an outstanding move we need to move the invalid
area correspondingly, otherwise we will expose the wrong area
as the outstanding move copy will happen before we expose
the invalid area.
2009-08-13 14:46:01 +02:00
Alexander Larsson
a3ee8271a9 Check for GraphicsExpose too in expose_serial_predicate
GraphicsExpose cause invalidation too, so we need to look for such
events in addition to normal Expose events.
2009-08-13 14:46:01 +02:00
Alexander Larsson
f019047402 Don't un-invalidate area that will be immediately invalidated again.
When moving an area we move any invalid region in this area to the
new place, but there really is no need to remove the old invalid
area as it would just be invalidated again (being newly exposed).
2009-08-13 14:46:01 +02:00
Alexander Larsson
ff558e2ec6 Remove C++ comment 2009-08-13 14:46:01 +02:00
Matthias Clasen
bdffae7f6c Make setting the root cursor work again
This used to work, and CSW broke it. Bug 591462, 589844.
2009-08-11 14:19:35 -04:00
Alexander Larsson
fa21459066 Fix clearing of window background for some transparent notification icons
This extends the usage of the native clear region call such that its
called also for windows that have parent relative background all the
way up to a native window. That way we get true background relative
background clearing even to a foreign parent, which means that some
transparent notification icons look right again.
2009-08-11 15:41:23 +02:00
Alexander Larsson
60fa0da96d Implement fallback for old draw_drawable vfunc
GdkDrawable->draw_drawback was replaced with a new vfunc
draw_drawback_with_src that is now called from gdk_draw_drawable.
However, some code seems to call the vfunc directly (see bug #591288),
so make it chain to the new call.

Note that such direct vfunc calls are a bad idea and won't work for all
cases.
2009-08-11 12:58:48 +02:00
Alexander Larsson
f30cfd729a Show/Hide native window when updating viewable
This moves the native show/hide calls to the generic code
for calculating viewable rather than in its own separate code
called from gdk_window_show/hide. This simplifies the code a bit,
but most significantly it means things are correctly shown when
they become viewable for other reasons than a show/hide call.

For instance, this fixes bug 590442 (gvim embedding) where the
toplevel GtkPlug is mapped by the embedder and we didn't previously
pick up that the native children became viewable and should be shown.
2009-08-11 11:35:35 +02:00
Alexander Larsson
19c1c11322 Don't invalidate unnecessary areas on raise
We used to invalidate the whole window when raised, but this is
unnecessary much, we now just invalidate the visible area minus the
previously visible area.

This also fixes a problem where expose calling raise caused a loop (#588438)
2009-08-10 15:35:33 +02:00
Alexander Larsson
0fc8c475a8 Remove old comment about guffaw scrolling
We no longer use guffaw scrolling since the client side windows
branch was merged.
2009-08-10 14:27:53 +02:00
Alexander Larsson
7f92684237 Don't ever invalidate the root window
This never worked before csw since the root window is never
set as IS_MAPPED, but with the new viewable check (which is
true for the root window) we could erronously queue exposes
on the root window.

This happened unexpectedly in bug 589369, where metacity
got a GraphicsExpose event on the root window due to some
graphics operation, queueing an expose which would be handled
by clearing that area. That is fixed with this commit.
2009-08-10 14:13:06 +02:00
Javier Jardón
ec7c24d227 Remove some unused variables (GnomeBug:591218) 2009-08-10 11:06:54 +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
Matthias Clasen
b514c6ac22 Fix a logic error in gdk_window_set_title on OS X
Also fix a similar error in gdk_window_set_transient_for.
This fixes bug 589738
2009-08-07 00:13:44 -04:00
Matthias Clasen
5002976fab Fix a logic error in gdk_window_set_title on OS X
This fixes bug 589738
2009-08-07 00:10:43 -04:00
Kristian Rietveld
8c8e1daefa Add stubs for missing GDK windowing functions to Quartz backend
This seems to more or less fix the build.  On Tiger there are still issues
with libresolv missing on the link line, I will figure out what's up with
that soonish.
2009-07-31 21:22:54 +02:00
Emmanuele Bassi
6f0f5f8dc7 Fix gdk_window_get_cursor() documentation
The 'Return value' annotation is missing from the documentation
of gdk_window_get_cursor().
2009-07-30 11:12:27 +01:00
Emmanuele Bassi
1811ecfb58 Add missing gdk_window_get_cursor to the GDK symbols 2009-07-30 11:12:26 +01:00
Cody Russell
1780361b79 add gdk_window_get_cursor() 2009-07-29 22:38:36 -05:00
Cody Russell
313b6f39a6 _gdk_window_impl_new() on directfb 2009-07-27 15:39:28 -05:00
Hans Breuer
a7394dc887 Implement GdkDrawableImplWin32::draw_pixbuf 2009-07-26 19:14:08 +02:00
Hans Breuer
45344cdf7c Use G_DEFINE_TYPE (GdkDrawableImplWin32, ...) 2009-07-26 19:14:07 +02:00
Hans Breuer
c5c87a918f Some cursor work for csw(win32), more left to do 2009-07-26 19:14:06 +02:00
Hans Breuer
4d2c165b75 Formatting and removing commented/obsolete code 2009-07-26 19:14:04 +02:00
Alexander Larsson
a504784b4b Fix cairo rendering on large subwindows
We get the real pixmap size and use as cairo surface size rather
than doing some magic to try to get clipping on the right hand size
(and the magic looks wrong anyway).

The previous code could result in the width/height being to big for
the cairo 28.4 fix point size and thus not drawing anything.

This fixes bug #588076.
2009-07-24 21:44:57 +02:00
Alexander Larsson
9d69355e6f Fix clipping of pixbuf drawing to windows
When the fallback for gdk_draw_pixbuf (gdk_drawable_real_draw_pixbuf)
is called with a window destination we have already applied any clip
regions and offsets for the window, but the window we get is a wrapper
and not an impl. We have to ensure we really draw to the impl, as
otherwise the pixbuf drawing will be clipped by client side subwindows.

This fixes bug 588553.
2009-07-23 22:03:15 +02:00
Alexander Larsson
e71c5d3ab5 Avoid unnecessary indirect call
Call klass->draw_pixbuf directly inside gdk_window_draw_pixbuf
instead of gdk_draw_pixbuf to avoid doing all checks twice.
2009-07-23 22:03:15 +02:00
Cody Russell
d84b575cd0 Bug 589275 – [csw] Trying to destroy NULL regions
gdk_window_input_shape_combine_mask() can accept NULL for the mask
parameter, but it wasn't checking for NULL before passing the
resulting GdkRegion to gdk_region_destroy().  Fixes #589275
2009-07-21 11:44:25 -05:00
Alexander Larsson
18048308e4 Revert all handling of clip_region being unset for non-viewable windows
This is now handled by explicitly setting it to empty for all non-viewable
windows.

This reverts these commits:
82e609c2a0
36861cf608
454160ad9e
7adf894a29
ed2c837574
2009-07-20 23:26:02 +02:00
Alexander Larsson
3c03683e09 Set clip region to empty for non-viewable windows
This lets us avoid lots of viewable checks and still not waste
time computing clip regions for non-viewable windows
2009-07-20 23:15:34 +02:00
Alexander Larsson
82e609c2a0 Make gdk_window_begin/end_paint handle non-viewable windows
These are updated to not read clip region is not viewable
2009-07-20 22:36:02 +02:00
Alexander Larsson
36861cf608 Make gdk_drawable_get_visible/clip_region handle the !viewable case
We can't access ->clip_region for these cases as its not yet calculated.
2009-07-20 22:30:48 +02:00
Alexander Larsson
bf78db5690 Calculate clip region when window goes viewable
Since we're no longer calculating clip regions for non-viewable windows
we need to calculate it when it goes viewable.
2009-07-20 22:19:35 +02:00
Matthias Clasen
8430e215a7 Remove a duplicate include.
This was pointed out in bug 588897.
2009-07-20 00:31:20 -04:00
Alexander Larsson
aa47fca68f Exit remove_child_area when region is empty
When the region is empty we can return early, because there
is no more area to remove. This happens often for children
of scrolled windows (i.e. things that are clipped out.
2009-07-19 22:38:06 +02:00
Alexander Larsson
a057c03889 Optimize remove_child_area for children outside region
If a child is totally outside the current region, bail early instead
of doing costly calculations to subtract the child region.
2009-07-19 22:38:06 +02:00
Alexander Larsson
454160ad9e Fix read of non-initialized clip_region
Foreign children are always viewable but may not have a viewable
parent, so ensure we don't read the parent for them.
2009-07-18 23:15:57 +02:00
Alexander Larsson
7adf894a29 Don't read non-initialized clip region
The clip region is only initialized (and needed) for viewable windows.
2009-07-18 23:15:57 +02:00
Alexander Larsson
b36b7000f1 Only handle viewable windows in collect_native_child_region
There is no need to handle non-viewable windows and additionally
they may not have the clip region set yet.
2009-07-18 23:15:57 +02:00
Alexander Larsson
ed2c837574 Only apply clip_region shape for viewable windows
This fixes a problem where the clip region is not yet calculated
2009-07-18 23:15:57 +02:00
Alexander Larsson
7cbb573ca9 Only calculate clipping regions for viewable windows 2009-07-18 23:15:51 +02:00
Alexander Larsson
027f411150 Check for viewable to avoid doing work instead of mapped
This is now cheap and allows us to avoid more work.
2009-07-18 23:12:02 +02:00
Alexander Larsson
aa8693f2cb Track viewable for GdkWindow 2009-07-18 23:11:54 +02:00
Alexander Larsson
db4dabf5e7 GDK_WINDOW_TYPE does a runtime typecheck, don't call it unnecessary
Looking at a profile the typecheck from GDK_WINDOW_TYPE stood out quite
a bit, which is fixed by not using it unnecessarily.
2009-07-18 15:06:27 +02:00
Hans Breuer
f3668e96e7 Bug #588398 - Leak with testgtk::preview_(color|gray) and more
Revert to gdk_win32_ref_cairo_surface() implementation from gtk-2-16
and make _gdk_windowing_create_cairo_surface() simply delegate to it.
2009-07-18 13:13:13 +02:00
Hans Breuer
d0cf137ed9 More efficient version of _gdk_win32_window_queue_translation()
Don't create create an extraneous expose event for any scroll operation
that gtk+ does. Thanks to Alex for the hint.
2009-07-17 17:26:48 +02:00
Cody Russell
ecd961fcf7 more directfb updates 2009-07-13 08:36:40 -05:00
Hans Breuer
e7737dbd19 Implement _gdk_win32_window_destroy() and more cleanup
Implement _gdk_win32_window_destroy() by just renaming
_gdk_windowing_window_destroy(), removed superfuous stub.

Also cleaned up implementations of  gdk_win32_window_set_background()
and gdk_win32_window_set_back_pixmap() - removed stuff now done at the
respective gdk_window_*() function.
2009-07-13 09:45:07 +02:00
Hans Breuer
e96c161643 Implement _gdk_win32_window_queue_translation() 2009-07-13 09:45:06 +02:00
Hans Breuer
b72960f12d Bug #588388 - shape rendering is back
Just mapping exisiting implementations to new GdkWindow API.

http://bugzilla.gnome.org/show_bug.cgi?id=588388
2009-07-13 09:45:05 +02:00
Hans Breuer
4c2c45740d Make more use of defines in $(TOP)/build/win32/make.msc 2009-07-13 09:45:04 +02:00
Hans Breuer
c99b4e775b Bug #588379 - testgtk::panes does not change the cursor on mouse over
That one was easy, just removing Alex's #ifdef TODO_CSW ;)

http://bugzilla.gnome.org/show_bug.cgi?id=588379
2009-07-13 09:45:03 +02:00
Hans Breuer
e2000ac366 Bug #588373 - Menus broken by client-side-windows
Resurrcetion and adaption of find_window_for_mouse_event(). The window
receiving the WM_MOUSEMOVE, WM_?BUTTONDOWN is not necessarily the one
interested in GDK_(ENTER|MOTION|LEAVE)_NOTIFY

http://bugzilla.gnome.org/show_bug.cgi?id=588373

Also added some more more TODO_CSW and disabled print_event(): it can not
cope with the new _gdk_windowing_got_event() eating/morphing events.
2009-07-13 09:45:02 +02:00
Hans Breuer
b97ccecd5d Update msvc build 2009-07-13 09:45:00 +02:00
Alexander Larsson
d0366e5160 Don't draw to unviewable windows
The scrolling and region moving code needs to avoid drawing when the
window is mapped, which it did. However, it also needs to avoid
drawing when any of its parents are not mapped, which it didn't so
switch to using gdk_window_is_viewable().

This fixes the index rendering in evolution (#588169)
2009-07-11 00:33:52 +02:00
Alexander Larsson
9063e5b3bf Ensure that windows used for selections are native
This fixes cut and paste in gvim (#588115)
2009-07-10 19:36:38 +02:00
Alexander Larsson
ccb09d1c6f Manually update toplevel_under_pointer when a grab changes to owner_events
When we ungrab the pointer we don't get enter events for the window the
pointer is in at the time of the ungrab, so we manually query for the
window the pointer is in. The same thing actually happens on re-grab if
the previous grab was !owner_events (meaning we don't get crossing events
for windows other than the grab) but the new grab is owner_events (and
thus non-grab windows need to get crossing events).

This factors out some common code and enables it also for the re-grab
to owner_events case.
2009-07-10 17:38:05 +02:00
Cody Russell
6ca5430a74 Merge branch 'directfb-csw' 2009-07-10 03:21:28 +01:00
Cody Russell
e6605b091c get directfb building with csw 2009-07-09 23:53:26 +01:00
Michael Natterer
3d1f55b68d Add xevent->xcrossing.mode to GDK_NOTE() for enter and leave notify events 2009-07-09 17:59:41 +02:00
Alexander Larsson
9044ec9bb9 Correctly set enter/leave events as detail=nonlinear
If we get a nonlinear enter/leave notify on the toplevel we need
to set nonlinear in all the events we send, even if the in-toplevel
tree is linear.

This fixes combobox menus popping down immediately when you click
(not hold). (bug #587559)
2009-07-09 17:06:46 +02:00
Alexander Larsson
9ef87ea11e Handle non-native windows in the gdk test utils
We need to add the non-native offset to the root coords when
sending events.
2009-07-08 18:47:43 +02:00
Alexander Larsson
a90d43bed6 Don't emulate map/unmap events for native windows
We really need to wait for the MapNotify from the xserver to ensure
that the window has been mapped, as it may be delayed by the WM, network
or similar things.

This fixes a problem in the /ui-tests/keys-events gtk test
2009-07-08 18:47:43 +02:00
Matthias Clasen
872152d56b Make gdk build with GDK_DISABLE_DEPRECATED
Turns out gdk_window_get_deskrelative_origin is now called in
gdk as well.
2009-07-08 09:54:39 -04:00
Kjartan Maraas
b6b9004885 Use g_object_unref instead of deprecated gdk_pixmap_unref 2009-07-08 15:48:51 +02:00
Alexander Larsson
62db28607b The shape is in window coordinate, so properly offset it when using it 2009-07-07 17:10:49 +02:00
Alexander Larsson
52e3d2cf0e Optimize clip-to-window with clipmask case when fully visible or obscured
This avoids creating alot of bitmaps in common trivial cases.
2009-07-07 17:10:49 +02:00
Alexander Larsson
2678a454e5 Make clipmasks work for pixbuf rendering
This is more important in the client side windows world, as clip masks
may be used for clipping to non-native subwindows. This fixes a bug
in aisleriot where it uses masked pixbuf drawing and it ends up drawing
over the moving card subwindow.
2009-07-07 17:10:49 +02:00
Alexander Larsson
5f12fe2b3b Add _gdk_gc_get_clip_mask
Internal function to get the clip mask of a gc (if set)
2009-07-07 17:10:49 +02:00
Matthias Clasen
b3969a3d75 2.17.3 2009-07-07 01:05:29 -04:00
Matthias Clasen
93556ea899 Make distcheck pass 2009-07-06 23:06:46 -04:00