Commit Graph

4725 Commits

Author SHA1 Message Date
Michael Natterer
0ea1924494 quartz: add virtual modifiers already in GDK, just as X11 does it
Key event states  will now always contain GDK_META_MASK in addition
to GDK_MOD2_MASK.
(cherry picked from commit d915d17ff6)
2012-01-19 16:29:41 +01:00
Kristian Høgsberg
b9190c7fe9 wayland: Destroy shell surface as we destroy the surface 2012-01-19 09:57:43 -05:00
Kristian Høgsberg
4c79e25915 wayland: Report middle and right buttons correctly
The linux evdev button codes have right as 274 and left as 273.
2012-01-18 12:04:18 -05:00
Rob Bradford
29641ecd07 wayland: Update modifiers handling to match new semantics
Due to changes in the behaviour of the virtual modifiers around MOD1 the
implementation of the map_virtual_modifiers vfunc was mangling the modifiers
and making keybindings not work correctly.

This change updates the implementation to match the X11 implementation's
behaviour.
2012-01-18 16:32:44 +00:00
Kristian Høgsberg
b9509ec15d wayland: Handle request for selection atoms when there's no selection 2012-01-17 11:10:59 -05:00
Rob Bradford
dba9c2e5a7 wayland: Adapt move_resize vfunc implementation to match semantics
Callers of this function were passing in -1, -1 for the width and height if
they just wanted the window moving - rather than the size changing. We need to
respect that behaviour and don't try and set the width/height to those
dimensions.

Now pop-up windows (ala combo-boxes) work!
2012-01-17 15:05:03 +00:00
Alexandre Rostovtsev
e2053a582a Add Since: to gdk_x11_device_get_id(), gdk_x11_device_manager_lookup(), gdk_x11_window_set_utf8_property() docs
https://bugzilla.gnome.org/show_bug.cgi?id=667730
2012-01-16 18:08:16 -05:00
Kristian Høgsberg
7328cc73aa wayland: Set GdkWindow focused state based on keyboard focus 2012-01-16 15:36:28 -05:00
Kristian Høgsberg
5f07e937c8 wayland: Implement client side keyboard repeat 2012-01-16 15:36:27 -05:00
Rui Matos
f0a80fa308 x11: Fix the _NET_SUPPORTING_WM_CHECK window fetch to be spec compliant
"The child window MUST also have the _NET_SUPPORTING_WM_CHECK property set to
the ID of the child window. […] If the _NET_SUPPORTING_WM_CHECK window on the
client window is missing or not properly set, clients SHOULD assume that no
conforming Window Manager is present."

This commit implements that, which allows us to not have to do a
XGetWindowProperty() every N seconds when running under a compliant WM.

This is also a more correct fix for the bug handled in commit
daf29bffed.

https://bugzilla.gnome.org/show_bug.cgi?id=666921
2012-01-16 15:38:33 +00:00
Rob Bradford
08f5483fb7 wayland: Free the internal selection data when the selection is cleared 2012-01-13 16:50:47 +00:00
Rob Bradford
1e0b22c176 wayland: Fix memory handling for the selection callbacks 2012-01-13 16:50:47 +00:00
Rob Bradford
368d6c50b7 wayland: Add basic API for setting and clearing the selection on the device 2012-01-13 16:50:47 +00:00
Rob Bradford
cd795de6bf wayland: Expose basic mechanism for getting selection content by callback
This version has a couple of TODOs/FIXMEs:

* We should do something better than g_io_channel_read_to_end
* Need to check the mime type is valid
2012-01-13 16:50:47 +00:00
Rob Bradford
9d90a17a7c wayland: Add call to get types available for the selection as atoms 2012-01-13 16:50:47 +00:00
Rob Bradford
fe3f275945 wayland: Remove unused variables to silence compiler warning 2012-01-13 16:50:47 +00:00
Kristian Høgsberg
0e10fae36c wayland: Set surface type based on GdkWindow hint 2012-01-13 09:50:38 -05:00
Rob Bradford
9e29ef5f3b wayland: Update to new SHM buffer format type 2012-01-13 11:36:36 +00:00
Rob Bradford
e7e86ba5f4 wayland: Remove unused variable from grab implementation 2012-01-12 13:48:57 +00:00
Rob Bradford
0aa210866c wayland: Fix compilation warning for destroy function implementation 2012-01-12 13:48:57 +00:00
Rob Bradford
f791687d3b wayland: Fix implementation of gdk_atom_name 2012-01-12 13:48:57 +00:00
Rob Bradford
7f404a1fee wayland: Remove unused variable 2012-01-12 13:48:46 +00:00
Patrick Welche
2ceb092afc Non-XInput2 build fix
The part in gdkwindow-x11.c which uses XIEvent and friends is "protected"
by HAVE_XGENERICEVENTS, i.e., XGetEventData() has been found. (Xlib.h)

XIEvent and friends are defined in <X11/extension/XInput2.h> which is
included by gdkdisplay-x11.h if XINPUT_2 is defined.

The patch makes sure XIEvent is only used if XINPUT_2 is defined.

https://bugzilla.gnome.org/show_bug.cgi?id=667534
2012-01-10 13:54:22 +00:00
Rob Bradford
1f023cd2b1 wayland: Constrain the window configure requests to the window's geometry
When we receive a configure event from Wayland telling us to resize our
surface we check against the geometry constraints for the window to ensure we
do not resize below the minimum and maximum limits.
2012-01-09 17:19:34 +00:00
Rob Bradford
4107ef0b93 wayland: Implement set_geometry_hints vfunc
Our trivial implementation simply saves the passed in parameters into the
Wayland private data structure.
2012-01-09 17:19:34 +00:00
Rob Bradford
eedd1ec92f wayland: Make the resize and move functions use gdk_device_ungrab
Now that grab and ungrab vfuncs are implemented on GdkDevice then we can use
gdk_device_ungrab to break the implicit grab created by the button press that
triggered the resize and move.
2012-01-09 16:00:14 +00:00
Kristian Høgsberg
e5283122fd wayland: Add implementations for the device_grab / device_ungrab vfuncs
This allows the correct implementation of breaking the grab in pointer driven
resize and move.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-01-09 15:59:02 +00:00
Matthias Clasen
ef1bc2923e Add more tests for GdkRGBA parsing
These examples are taken from bug 667485.
2012-01-09 00:31:20 -05:00
Matthias Clasen
e5e6d25a50 Tighten up GdkRGBA parsing
gdk_rgba_parse was accepting too much nonsense, as pointed out
in bug 667485.
2012-01-09 00:31:20 -05:00
Matthias Clasen
b3f2b41567 Rename rgba test file
Not testing GdkColor here, anymore.
2012-01-07 19:02:48 -05:00
Matthias Clasen
1e867a94a2 Use g_slice_dup
This saves some manual copying.
Pointed out in bug 667473.
2012-01-07 19:00:47 -05:00
Matthias Clasen
2b16ec9f14 Add a test for gdk_rgba_copy 2012-01-07 19:00:32 -05:00
Rob Bradford
47146dacff wayland: Break an implicit grab when asking to be resized
An implicit grab is created inside GTK+ when the button is pressed down on a
window. The semantics of wl_shell_surface_resize means that you don't get a
corresponding release event that would ordinarily break the implicit grab. So
we must do it as part of the resize request.
2012-01-06 16:58:06 +00:00
Rob Bradford
675b2fddcb wayland: Make the event source use _gdk_display_get_next_serial 2012-01-06 16:58:05 +00:00
Rob Bradford
e13cca00cc wayland: Implement the get_next_serial vfunc on GdkDisplay 2012-01-06 16:58:05 +00:00
Kristian Høgsberg
e2dd95aced wayland: The shared cursors are now installed in the weston directory
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2012-01-06 15:12:14 +00:00
Rob Bradford
ff016a7857 wayland: Set a default cursor when the window cursor is set to NULL
This change follows on from a change in semantics in Wayland where calling
wl_input_device_attach with nil would make the compositor set the pointer
sprite to it's default cursor sprite.
2012-01-05 17:39:14 +00:00
Javier Jardón
24360a8076 gdk/*: Use g_list_free_full convenience function 2012-01-05 04:22:42 +01:00
Matthias Clasen
266866e82c Fix problems with DND on some X servers
When the X server does not support the shape extension (as some
vnc implementations seem to), our DND code was always seeing
an empty input shape, so drops always missed their target.

http://bugzilla.gnome.org/show_bug.cgi?id=620240
2012-01-03 10:57:53 -05:00
Emmanuele Bassi
c62a1fd522 Add symbolic constants for event emission control
Similar to https://bugzilla.gnome.org/show_bug.cgi?id=631413 in GLib,
GTK+ should have symbolic constants for controlling the event handling
instead of a mere boolean value.

The GDK_EVENT_PROPAGATE and GDK_EVENT_STOP constants map to FALSE and
TRUE respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=631414
2012-01-03 12:58:43 +00:00
Chun-wei Fan
bdb98fdfcc Update gdk/gdkconfig.h.win32
Apparently the deprecation warning macros are placed into gdkconfig.h
during the configure stage, so put these in the pre-configured
gdkconfig.h.win32 as well, as their definitions are needed for all builds.
2011-12-30 16:21:38 +08:00
Matthias Clasen
01320e5773 Fix problems with sticky handling
Reading a card32 property into a long may lead to undefined high
bits, so mask them off. Also, make the conditions for setting and
unsetting the stick flag opposites, to avoid unintended changes.
Patch by John Lindgren, bug 666842
2011-12-28 11:20:47 -05:00
Matthias Clasen
19b47b931e Update various EWMH interactions
The current EWMH has added 'source indication' fields to a number
of client messages. Set these to 1 to indicate a regular client.
Also fill the button field of _NET_WM_MOVERESIZE.
2011-12-28 11:16:54 -05:00
Benjamin Otte
a61ba41167 x11: Don't handle focus events for NULL windows
The check was accidentally removed in the refactoring of
2ea328dfbc.
2011-12-23 00:15:59 +01:00
Matthias Clasen
18406b7b04 Revert "x11: Avoid spurious focus events on grabs"
This reverts commit db4a6040af.

This is causing bad focus confusion e.g. in gnome-terminal.
2011-12-22 16:03:56 +00: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
Ryan Lortie
ecfdb834c9 GtkSettings: add shell-shows-menubar property
Unity will set this to tell us that it is going to handle displaying the
menubar.
2011-12-19 12:51:09 -05:00
Colin Walters
a003eef9d4 gdk: Fix prototype for gdk_x11_window_set_utf8_property 2011-12-19 12:51:08 -05:00
Ryan Lortie
f826dd5481 GtkSettings: add shell-shows-app-menu property
This is a boolean property that will be set to TRUE if the current
desktop environment is capable of displaying the application menu as
part of the desktop shell.

If it is FALSE then the application will need to display the menu for
itself.
2011-12-19 12:51:08 -05:00
Colin Walters
ff38dda9a8 x11: Add gdk_x11_window_set_utf8_property
A convenience function to manipulate UTF-8 X11 properties; no point
in wrapping each one in individual setters.
2011-12-19 12:51:07 -05:00
Benjamin Otte
db4a6040af x11: Avoid spurious focus events on grabs
We want to avoid handling focus events for the private focus window,
otherwise the keyboard grab taken by for example buttons will cause a
spurious FOCUS_OUT/FOCUS_IN on the toplevel.

The code that did this seems to have been lost in the XI2 transition for
GTK3.

https://bugzilla.gnome.org/show_bug.cgi?id=657578
2011-12-19 16:17:14 +01:00
Benjamin Otte
2ea328dfbc x11: Unify focus handling code
This code was essentially copy-pasted in two locations, so unify them in
the same place.

https://bugzilla.gnome.org/show_bug.cgi?id=657578
2011-12-19 16:17:13 +01:00
Matthias Clasen
910e50994c Fix parameter name mismatch 2011-12-18 16:04:51 -05:00
Matthias Clasen
c6df2828b7 Add gdk_screen_get_monitor_workarea
The function returns the part of a monitors area that should be
used for positioning popups, menus, etc. The only non-trivial
implementation atm is in the X backend, all the other backends
just return the full monitor area. The X implementation is
currently suboptimal, since it requires roundtrips to collect
the necessary information. It should be changed to monitor
the properties for changes, when XFixes allows to monitor
individual properties.
https://bugzilla.gnome.org/show_bug.cgi?id=641999
2011-12-18 14:29:16 -05:00
Carlos Garnacho
358ecad501 gdk,xi2: Make more resilient about not yet known devices
Dealing with disabled devices may turn into hierarchy/device
changed events on device IDs with no backing GdkDevice yet,
so protect against that. The device attachment will be handled
correctly when the device is enabled later.
2011-12-18 18:57:57 +01:00
Matthias Clasen
89c8c1f8a8 Doc format fixes 2011-12-15 23:09:10 -05:00
Matthias Clasen
9cdeaaab30 Remove some accidental additions
These functions were never actually implemented
2011-12-15 23:03:12 -05:00
Matthias Clasen
8b60bc9d24 Cosmetic change 2011-12-15 23:03:12 -05:00
Matthias Clasen
14f1811158 Add new symbols 2011-12-15 22:40:01 -05:00
Florian Müllner
4f8f8fe828 window: Add hide-titlebar-when-maximized property
For maximized windows, titlebars cannot be used to reposition or
scale the window, so if an application does not use it to convey
useful information (other than the application name), the screen
space occupied by titlebars could be put to better use.
Add a new window property which requests from the window manager
to hide titlebars when windows are maximized to account for this.

https://bugzilla.gnome.org/show_bug.cgi?id=665616
2011-12-15 16:31:56 +01:00
Rob Bradford
8c1f8c0668 wayland: Add dummy implementation of the wl_data_device functionality
Setup listener functions for the drag and drop events as well as the selection
events. Then create and save a data structure representing the data offer from
the other client.
2011-12-14 14:47:27 +00:00
Rob Bradford
55b2286c3e wayland: Add an implementation for GdkAtom
This implementation is based on a hash table. The hard coded GtkSelection
atoms are preloaded into the hash table at the correct values. User generated
atoms start after the last preloaded atom.
2011-12-14 14:45:44 +00:00
Rob Bradford
b165c1bac8 wayland: Get the data device during input device setup
The data device is a associated with the input device - fetch the data device
from the data manager for the current input device.
2011-12-14 14:44:44 +00:00
Rob Bradford
aea95c8efc wayland: Retrieve the data device manager object
The data device manager is a global object that provides the support
infrastructure around data devices. These data device objects are the basis
for handling drag and drop as well as selections in Wayland.
2011-12-14 14:43:35 +00:00
Rob Bradford
32c9251b1e wayland: Don't use deprecated function: gdk_window_get_pointer
Replace it with gdk_window_get_device_position.
2011-12-14 14:43:29 +00:00
Matthias Clasen
ffb56ecc15 Fix nicks for the window class enum
As pointed out in bug 665999, these were just not right.
Before this commit, the nicks were 'output' and 'only'.
After this commit, they are 'input-output' and 'input-only'.
2011-12-13 21:15:14 -05:00
Matthias Clasen
89c90ed193 Fix move-resize emulation with XI2
https://bugzilla.gnome.org/show_bug.cgi?id=650943
2011-12-09 21:28:12 -05:00
Rob Bradford
83054baa16 wayland: Load cursors from wayland directory under XDG_DATA_DIRS
This means we don't have to have hardcoded "/usr/share/wayland" to find the
cursors.

This change also fixes up the warning messages for when loading fails.
2011-12-09 18:22:01 +00: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
Rob Bradford
b917c2f027 wayland: Port from wl_shell to wl_surface_shell
Previously all the commands that acted on the shell took the surface that was
to be acted on as parameter. Now we retrieve an object from the shell that
represents its state for the surface. With that wl_shell_surface object we can
then call methods on that.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2011-12-05 16:20:39 +00:00
Alexander Larsson
c47ef89aca Merge branch 'transparent-windows' 2011-12-05 14:24:28 +01: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
Kristian Høgsberg
0dd1f7edbc wayland: Update to recent API changes 2011-12-02 05:41:43 -05: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
9613e6ae19 testwindows: Test transparent backgrounds 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
Matthias Clasen
9b967ab8af XI2: Push error traps around XIQueryDevice calls
This may help against the crashes at resume time that some
people have been hitting when input devices mysteriously
disappear.
2011-11-30 00:16:43 -05:00
Alexander Larsson
62b505174f win32: Make all GDK_WINDOW_TEMP always on top
This makes menus, popups and tooltips show above the windows
task bar.
2011-11-25 11:22:59 +01:00
Matthias Clasen
2b6f639bfa Fix a typo 2011-11-22 14:55:46 -05:00
Matthias Clasen
251ee41d8d Revert "Clean up includes"
This reverts commit c5e4af761c.
2011-11-22 13:41:59 -05:00
Matthias Clasen
c5e4af761c Clean up includes
There's no sign of Pango in this header, so no need to include
pangocairo.h
2011-11-22 08:25:24 -05:00
Alexander Larsson
9275b87b6a win32: Don't double free stuff when finalizing drag context
We were freeing stuff that was already freed in the parent class
finalizer.
2011-11-21 15:03:53 +01:00
Alexander Larsson
0d94b974b3 win32: Don't dereference keyboard_grab if it is NULL
This fixes a crash in e.g. testdnd
2011-11-21 14:37:57 +01:00
Alexander Larsson
4760b3e2bd win32: Make gdk_drag_context_new static 2011-11-21 14:34:06 +01:00
Dieter Verfaillie
2fb8b97b65 win32: get rid of GdkDragContextPrivateWin32 and related machinery.
This turns GdkWin32DragContext into a proper GdkDragContext subclass.
Because we now correctly initialize GdkWin32DragContext in
gdk_drag_context_new, we no longer crash immediatly when a DnD
operation is initialized (the find_window, drag_status, ... vfuncs
where all pointing to 0x0 instead of their proper win32 implementations).

We now try to consistently refer to GdkDragContext as "context",
GdkWin32DragContext as "win32_context" and the ole2 related
target_drag_context and source_drag_context as "ctx".

Members of GdkWin32DragContext only used by the ole2 DnD codepaths
are now explicitly marked with a ole2_dnd_ prefix.
2011-11-21 14:34:06 +01:00
Michel Dänzer
ab34c79896 Fix gdk_cairo_region_create_from_surface on big endian
gdk_cairo_region_create_from_surface doesn't work correctly on PPC.
This is most prominently seen with the GTK window resize grip, the
shape of which is mirrored every eight pixels horizontally.

At the same time, use an A1 surface for the resize grip shape to
eliminates an A8->A1 surface conversion.
2011-11-19 12:23:27 -05:00
Michael Natterer
6bb495f6bd gdk: remove the GET_EFFECTIVE_KEYMAP() stuff from gdkkeys-x11.c
We don't support passing a NULL keymap any longer. Also pull some
precondition checks into the parent class.
2011-11-18 16:43:41 +01:00
Michael Natterer
90e73dd1c4 gdk_x11_keymap_get_modifier_mask(): always return a value 2011-11-18 15:26:09 +01:00
Michael Natterer
9c79f9f868 Turn the private #define for the group-shifting modifier into API
Add GDK_MODIFIER_INTENT_SHIFT_GROUP to enum GdkModifierIntent
and handle it in gdk_keymap_get_modifier_mask(). Add an X11
impl of the method and return keymap_x11->group_switch_mask.
Return 0 from the default impl because we don't know.
2011-11-18 15:14:31 +01:00
Michael Natterer
1c8481a6ea Bug 663856 - Make option-foo accelerators use the right symbol
If the keyboard group shifting modifier is *also* a normal
accelerator modifier, we need to special case it when calling
gdk_keymap_translate_keyboard_state(), so we get the right
key symbol for accelerators (for example we want Option-O,
not Option-Ø displayed in menu items). This patch should only
affect quartz where the Alt key both shifts the group and can
be used as accel modifier, and not X11 or Win32 where AltGr
is not used for accelerators.

- fix quartz' gdk_keymap_translate_keyboard_state() to return
  the right consumed_modifiers
- add _gtk_translate_keyboard_accel_state() which does the
  special casing
- use it everywhere instead of gdk_keymap_translate_keyboard_state()
2011-11-18 13:06:27 +01:00
Alexander Larsson
361fcabbde win32: make fixup_event correctly ref all GdkWindow members
This fixes some crashes related to owner changes and selections.
2011-11-17 12:25:56 +01:00
Alexander Larsson
6690e6dc58 ref, don't unref, requestor member when copying GdkEvents
This seems like a typo, we should obviously ref the member when
copying. Apparently nobody copied GDK_SELECTION_* events...
2011-11-17 11:59:27 +01:00
C. Scott Ananian
981efc90b4 Fix uninitialized digest_len field, causing WebSocket handshake to g_assert.
g_checksum_get_digest checks to ensure that the passed digest_len is long
enough to hold the digest, before setting it to the actual length of the
digest returned.  Digest_len is uninitialized in the code, so if you're
lucky it will be larger than 20 and everything will work fine.  If you're
unlucky, g_checksum_get_digest will return either -1 or some number less
than 20, and the g_assert(digest_len==20) will fail.
2011-11-14 09:55:19 +01:00
Michael Natterer
e19cbd7a04 quartz: fix a race condition when waking up the CGRunLoop
Wake up the run loop unconditionally (don't check if it is waiting) because
it might go into waiting state right after we checked for it. Fixes GIMP
startup (which has a lot of GIOChannel I/O but zero NSEvents) from several
minutes to a few seconds.
(cherry picked from commit 0729cdc9a1)
2011-11-11 23:58:43 +01:00
Alexander Larsson
a2b879fe53 win32: Make grab cursors work again 2011-11-10 21:32:50 +01:00
Alexander Larsson
2f14732b1d win32: Fix gdk_win32_window_translate
We now do proper handling of existing invalid regions, and
we use ScrollDC which allows us to specify the right clip
region rather than just the bounding rect.
2011-11-10 17:41:13 +01:00
Dieter Verfaillie
68d28aad97 win32: fix pasting screenshots taken with PrintScreen or Alt+PrintScreen
These are found on the clipboard in the biCompression == BI_BITFIELDS &&
biBitCount >= 16 format. In this case the BITMAPINFOHEADER is followed
by three DWORD specifying the masks of the red green and blue components,
but bfOffBits was not being adjusted accordingly.

Based on Massimo's comment on bug 631384 and verified on
http://msdn.microsoft.com/en-us/library/dd183386%28v=VS.85%29.aspx

https://bugzilla.gnome.org/show_bug.cgi?id=631384
2011-11-10 17:41:12 +01:00
Dieter Verfaillie
4e10d9604b win32: fix some typos 2011-11-10 17:41:12 +01:00
Alexander Larsson
52be8cb9e9 win32: Fix some warnings 2011-11-10 17:41:11 +01:00
Alexander Larsson
65002208b9 win32: Ensure newly mapped toplevels are inside the workarea
This is what e.g. metacity does, and its needed to e.g. get the inital
position of the gimp dock window right.
2011-11-10 17:41:10 +01:00
Alexander Larsson
c563765574 win32: Fix placement at initial position
Positioning windows at 0,0 post creation failed, because it
was mapped with CW_USEDFAULT, but private->x/y still said 0,
so moving it to 0,0 did nothing. We now always position the
window at the right place, even when not mapped, but we
create it at CW_USEDEFAULT initially and store that position
before moving it to the right place.

This fixes the window sizing test in testgtk and the inital
position for the gimp toolbar.
2011-11-10 17:41:10 +01:00
Alexander Larsson
d441044569 win32: Fix synaptics trackpad issues
The synaptics trackpad driver has some weird behaviour on scroll.
It pops up a window over the mouse pointer (looking like a scrollbar).
This has two problems:
* We get extra enter/leave events for the trackpad window
* We get back the trackpad window when we look for the window
  under the mouse to deliver the mousewheel message.

So, we add some trackpad specific hacks to avoid this (sigh) based
on the trackpad window window class.

This fixes bug #542777 and was partially based on a patch there
from Peter Clifton.
2011-11-10 17:41:09 +01:00
Alexander Larsson
487ace0aca win32: Add gdk_win32_window_get_impl_hwnd
This is needed to fix the ms-windows theme not to create
native windows for all child windows.
2011-11-10 17:41:08 +01:00
Alexander Larsson
1737ffeeb9 win32: Fix modal_hint handling
Modal hints are not really a stack. All windows that are modal
are allowed to get input, not just the top one.

This fixes bug #604156
2011-11-10 17:41:07 +01:00
Alexander Larsson
2788efeb5e win32: Don't use API_CALL for SetWindowLong
This can return 0 without it being an error.
Should fix the last issue with bug #142874
2011-11-10 17:41:07 +01:00
Alexander Larsson
a1828e8b60 win32: Make flush/sync work like in X
gdk_flush() should gdk_display_sync() on all open displays.

Both for display_flush and display_sync it seems useful to call
GdiFlush, but we don't have anything extra to do for display_sync,
as there is no inherent roundtrip on win32.

This should close bug #84314
2011-11-10 17:41:06 +01:00
Alexander Larsson
d27b402a85 win32: Add custom placements for some window types
Windows with transients: center on parent
Splash screens: center on monitor
Also properly ignores initial moves of unmapped
windows that are not override redirect or HINT_POS

Fixes bugs #324254 and #612359
2011-11-10 17:41:06 +01:00
Alexander Larsson
2662fe37df win32: More robust way to ensure we get a configure event after move/resize
There were still cases where we didn't get a WINDOWPOSCHANGED after
a SetWindowPos() call, like e.g. with a larger minimum size than
the set size (bug #574935)

So, we revert the previous fix and now just always manually emit
a configure notify after the move_resize call. Also, we inhibit
the WINDOWPOSCHANGED configure event during the move_resize operation
to avoid multiple Configures.
2011-11-10 17:41:05 +01:00
Alexander Larsson
2dbc05f756 win32: Ensure we always send a configure event when changing size/pos
There are some cases where we don't get a WINDOWPOSCHANGE such that
we generate a configure event, even if we called gdk_window_move_resize()
or similar. For instance:
* The window is fullscreen
* The window is maximized
* The specified pos/size is the same as the current one

However, as per X11 ConfigureNotify semantics we *always* want one, or
we could run into issue like e.g. bug #537296 where we're waiting for
the CONFIGURE to call gdk_window_thaw_toplevel_updates_libgtk_only().
2011-11-10 17:41:04 +01:00
Alexander Larsson
4c061a5270 win32: By default, allow windows larger than the screen 2011-11-10 17:41:04 +01:00
Alexander Larsson
6be876cdea win32: Fix size or style changes during fullscreen
When we're fullscreen we should update the cached hints, and we
should not apply the normal hints to the style.

This fixes bug #516822
2011-11-10 17:41:03 +01:00
Alexander Larsson
820721500b win32: Use WM_NCDESTROY instead of WM_DESTROY
WM_NCDESTROY gets called after children are destroyed, which is
the semantics DestroyNotify has in X11.
2011-11-10 17:41:03 +01:00
Alexander Larsson
4690aa28d0 win32: Don't remove the window from the handle table on destroy
We always get the WM_DESTROY message anyway, and we remove it there.
Bug #336416 even claims this could be a leak if the WM_DESTROY
message was not seen before the DestroyWindow call returned, as
the WM_DESTROY message could not be handled later without the
window in the handle table. I'm not sure this can happen, but we
might as well remove it.
2011-11-10 17:41:02 +01:00
Alexander Larsson
725379192d win32: Make set_keep_above work also for non-mapped windows
This fixes bug #171456
2011-11-10 17:41:01 +01:00
Alexander Larsson
ab615105b6 win32: Send window-state-changes before configure events
This is requires to that the state of the window is right when
you get the configure event (and to match what X does).

Fixes bug #169811
2011-11-10 17:41:01 +01:00
Alexander Larsson
8f50944904 win32: Send initial configure
We need to send a configure event when a window is shown.
2011-11-10 17:41:00 +01:00
Alexander Larsson
36a28d616f win32: Ignore client requested window move/size during SIZEMOVE
This will just be fighting the user like in e.g.
https://bugzilla.gnome.org/show_bug.cgi?id=64428
2011-11-10 17:41:00 +01:00
Alexander Larsson
538ab4fca7 win32: Remove most special casing of WINPOSCHANGED during modal ops
There is no particular reason to special case this, we want to handle all
sort of normal events. The only special thing we keep is that
as an optimization we pump the message loop extra during a WINPOSCHANGED
in a modal operation as that will cause us to repaint faster.

Also, bump the arbitrary number of mainloop iterations for the timer.
I don't see why we need it at all, but at least doing more than one
iteration if needed should be nice.
2011-11-10 17:40:59 +01:00
Alexander Larsson
429bd4e5d5 win32: Fix missed resize exit message
When you start a window resize or move via the window menu and
don't actually change anything we're not getting an exitsizemove.
In order to work around this we also look for WM_CAPTURECHANGED.
2011-11-10 17:40:59 +01:00
Alexander Larsson
ad374a595c win32: Handle all window changes in WINDOWPOSCHANGED
This moves all the code from WM_SIZE, WM_MOVE, and WM_SHOWWINDOW into
one place, cleans up the code and makes sure we only send a single
configure event even if both size and position changes.
2011-11-10 17:40:58 +01:00
Alexander Larsson
66f7e5d163 win32: Fix up window_show
We don't pass in raise anymore, but already_mapped.
Also, already_mapped must be used rather than MAPPED, as we already
synthesize the MAPPED in the generic code (and thus we don't have
to synthesize it again).
2011-11-10 17:40:57 +01:00
Dieter Verfaillie
1df95b4c0a win32: Call GetQueueStatus instead of PeekMessage PM_NOREMOVE
Calling PeekMessage can cause reentrant calls into the window procedure
for sent (as opposed to posted) messages, so its not safe to call
when we're not expecting reentrancy. Instead we call GetQueueStatus
when we're just looking for availible messages.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=552041
2011-11-10 17:40:55 +01:00
Alexander Larsson
d66ad8c39d win32: Better crossing events and grab destination reporting
We new report to the right window during !owner_event grabs, and
we send proper enter and leave events.
2011-11-10 17:40:55 +01:00
Alexander Larsson
73c527aef0 win32: Record the native event mask in use 2011-11-10 17:40:54 +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
Alexander Larsson
321acc3286 win32: in window_at_pointer, ensure that we handle non-client areas correctly
We should not return a window if the pointer is in the non-client area,
like the titlebar.
2011-11-10 17:40:53 +01:00
Alexander Larsson
f0f7c07f4d win32: Handle implicit grabs 2011-11-10 17:40:53 +01:00
Alexander Larsson
6668ba6914 win32: Update input device code to use the new property names in constructor 2011-11-10 17:40:52 +01:00
Alexander Larsson
ade6d093e2 win32: Fix up initialization order of input subsystem
We were getting warnings due to windows being created before input
subsystems were fully initialized.
2011-11-10 17:40:51 +01:00
Dieter Verfaillie
5406955f7c win32: Fix DnD when drag icon is below the pointer
By reverting gdk_drag_find_window_for_screen logic to what it was
before eb21a7df29.
The old logic knew how to ignore drag_window when searching
for dest_window, but that code was removed (I guess by accident).

https://bugzilla.gnome.org/show_bug.cgi?id=616544
2011-11-10 17:40:51 +01:00
Dieter Verfaillie
86b8a1ddc8 win32: dnd should not be registerd for offscreen windows
https://bugzilla.gnome.org/show_bug.cgi?id=616544
2011-11-10 17:40:50 +01:00
Peter Clifton
05e982a11a Win32: Fix _gdk_windowing_window_at_pointer to correctly return a toplevel
Commit 5ebb32d1ff didn't add the correct
code to find the toplevel window. The WindowFromPoint() function does
not return the toplevel window in the hierarchy, it returns the deepest
non-disabled, non-invisible child. As we don't use invisible or disabled
windows, we don't actually need to use the ChildWindowFromPoint walk for
the non get_toplevel case, so we can remove that code path.

To find a toplevel, we need to start from the desktop and work up, using
ChildWindowFromPointEx (to ignore invisible and disabled windows). If we
don't ignore invisible and disabled windows (as is the case with the
ChildWindowFromPoint call, we are liable to get returns of hidden or
disabled children of the desktop which don't belong to us, but notionally
occupy the same area under the pointer.

An alternative might be to start our walk with one of the children of the
desktop owned by our process and thread - which we can enumerate using,
the EnumThreadWindows call, or (presumably) determine internally. This
would not work when we are inside a GtkSocket though, as the children of
the desktop would belong to the process owning the GtkPlug - we would
have to rely on our own list of windows.

For correctness, this commit adds tests to ensure that we don't try to
return either x or y window coordinates if that corresponding pointer is
NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=658842
2011-11-10 17:40:50 +01:00
Peter Clifton
f9d8f9758b Win32: Ensure native back-end for windows where the user requests their handle
https://bugzilla.gnome.org/show_bug.cgi?id=658841
2011-11-10 17:40:49 +01:00
Chun-wei Fan
b18718ac7e Add G_ENABLE_DEBUG #ifdef check in gdkdisplay-win32.c
Commit 88707e6912 used
_gdk_win32_cf_to_string, which is only defined when G_ENABLE_DEBUG
is defined, so add G_ENABLE_DEBUG #ifdef around that part.
2011-11-10 17:40:49 +01:00
Marc-André Lureau
1afc29d869 win32: resurect Windows clipboard selection notification
This is a rewrite of e6fa7394ba, with
misc fixes that should help with some bugs Tim was talking about.

https://bugzilla.gnome.org/show_bug.cgi?id=652239
2011-11-10 17:40:48 +01:00
Hans Breuer
db19fbd45c win32: Resurrect some enter/leave notify events for native windows
The button highlighting in testgtk works again, even with
GDK_NATIVE_WINDOWS. Unfortunately testgtk:menus still does
not work for the forced-native-window-case.
2011-11-10 17:40:47 +01:00
Neil Roberts
7445a59a9a win32: Never pass SWP_NOSIZE or SWP_NOMOVE to SetWindowPos
In _gdk_window_move_resize_child it tries to decide whether to pass
SWP_NOSIZE and SWP_NOMOVE based on whether the new size and position
is different from the window's existing position. However it seems
that GDK now ends up updating the window's position before calling
_gdk_window_move_resize_child so this would mean it would think the
window never changes size or position so SWP_NOSIZE|SWP_NOMOVE would
always be set. This causes child windows to never be resized.

This patch changes it so that it never passes either flag to
SetWindowPos. I don't know whether this will cause any side effects
but you'd think it shouldn't do any harm to reassert the current size.

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

Signed-off-by: Hans Breuer <hans@breuer.org>
2011-11-10 17:40:47 +01:00