Compare commits

..

1091 Commits

Author SHA1 Message Date
Siegfried-Angel Gevatter Pujals
fe47a3d86e Use const enum ...' instead of const gchar' for the type parameter. 2011-12-29 16:56:47 +01:00
Siegfried-Angel Gevatter Pujals
66ff8f8785 Start working on GtkRecentManagerAndZeitgeist. 2011-12-27 20:54:23 +01:00
Javier Jardón
465301c64f tests/testgtk: Do not use GdkColor-based api 2011-12-26 17:12:20 +01:00
Daniel Mustieles
deeac44abb Updated Spanish translation 2011-12-26 11:10:17 +01:00
Ignacio Casal Quinteiro
1abf7618c0 gtktextlayout: use g_slice for GtkTextLineDisplay 2011-12-25 18:13:51 +01:00
Ignacio Casal Quinteiro
359d8c9856 gtktextbtree: use g_slice 2011-12-25 17:49:03 +01:00
Benjamin Otte
ab1699510e themingbackground: Avoid erroring cairo context 2011-12-23 22:30:45 +01:00
Benjamin Otte
396ae8f1de tests: Make widget-factory close when window is closed 2011-12-23 22:30:45 +01:00
Benjamin Otte
58d553c604 cssprovider: Fix leak
Thanks to the heroic valgrinding efforts of Olivier Sessnik, another
leak could be plugged.
2011-12-23 22:30:45 +01:00
Matthias Clasen
fbc3db8ba9 Fix scroll_offset handling
scroll_offset can be negative here, so replace a > 0 test
by != 0.
2011-12-23 00:36:20 -05:00
Matthias Clasen
f1bfdda3fd Only push the menu in if the position function said so 2011-12-23 00:36:20 -05:00
Matthias Clasen
a553cb50ab Use gtk_widget_get_allocated_width/height where it makes sense 2011-12-23 00:36:20 -05:00
Matthias Clasen
53ce519b1f Remove an unneeded variable 2011-12-23 00:36:20 -05:00
Matthias Clasen
547baf0e5f Remove an unused struct 2011-12-23 00:36:19 -05:00
Benjamin Otte
9707d964f7 combobox: Don't allow an individual cell to cheat
Make sure we only set sensitive when the cell is sensitive and visible.
Also avoid invalid memory accesses if no cells existed.
2011-12-23 00:15:59 +01:00
Benjamin Otte
8a83f0c2d1 widget: Print a g_warning() when a cairo_t is invalid
Only print the warning on internal code, so we aren't too verbose.
2011-12-23 00:15:59 +01:00
Benjamin Otte
d1c92c38df styleproperties: Move private struct declaration into public header 2011-12-23 00:15:59 +01: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
Javier Jardón
115d92aa11 gtkappchooserwidget: Use g_object_clear() 2011-12-22 02:57:35 +00:00
Ryan Lortie
182fbba2bf GtkModelMenu: drop extra & added by mistake 2011-12-21 17:15:16 -05:00
Cosimo Cecchi
157d9271fa application: don't unconditionally unref the GMenuModel in getters
Both the app-menu and menubar models can be NULL, so we shouldn't
blindly unref them, since g_object_unref() doesn't cope with NULL
pointers.
2011-12-21 12:20:15 +01:00
Cosimo Cecchi
72c04c064a application: mark menu/menubar getters as (transfer none)
Since they do not return a reference to the underlying GMenuModel.
2011-12-21 12:19:31 +01:00
Cosimo Cecchi
9ae0ffb9cb application: use the same variable names in definitions and declarations
gobject-introspection will be confused and mark the methods as not
introspectable otherwise.
2011-12-21 11:29:39 +01:00
Colin Walters
06307dd774 GtkAction: Hold a reference to proxy widgets
Previously we expect that a proxy widget holds a reference to the
action via gtk_activatable_do_set_related_action().  However, it
is possible for the widget to still be in a floating state when
it adds itself to the the action.

This is a problem when gtk_action_get_proxies() gets called, because
we return floating objects back to the user.  And language bindings
aren't going to be expecting that.

Fix this by calling ref_sink() and unref().

https://bugzilla.gnome.org/show_bug.cgi?id=657367
2011-12-20 15:36:48 -05:00
Matthias Clasen
b5577781d1 GtkApplicationWindow: fix a typo
And add a link to the screenshots.
2011-12-20 14:10:39 -05:00
Javier Jardón
325142fba7 tests/testcombo.c: Use GdkRGBA instead GdkColor 2011-12-20 18:32:15 +00:00
Javier Jardón
f84c124e53 gtk/gtkcellview.c: Use new GdkRGBA api instead GdkColor one 2011-12-20 18:32:15 +00:00
Javier Jardón
e24634537e gtk/gtktrayicon-x11.c: Use new GdkRGBA api instead GDKColor one 2011-12-20 18:32:15 +00:00
Cosimo Cecchi
2827cd4518 button: deprecate the inner-border style property
Since we allocate the standard CSS border to the button now, and center
the child accordingly, there's no need for an additional inner-border
style property. Deprecate it and ignore its values.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi
0021ef19fa button: add CSS borders to the size request
And allocate the button children according to it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi
fe59c5f954 button: add a border param to gtk_button_get_props()
We'll use it later to compute the child offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Javier Jardón
9635759548 tests/testgtk.c: Remove death code 2011-12-20 17:51:59 +00:00
Ryan Lortie
bac58abec3 gtkmodelmenuitem: don't crash on missing action 2011-12-20 10:51:58 -05:00
Daniel Mustieles
8f5e8b2d0b Updated Spanish translation 2011-12-20 14:45:14 +01:00
Cosimo Cecchi
13f5706488 treeview: fix an uninitialised variable warning 2011-12-20 11:41:46 +01:00
Matthias Clasen
e65a8d0d40 Bump version 2011-12-19 18:41:10 -05:00
Matthias Clasen
be689e8307 3.3.6 2011-12-19 18:37:44 -05:00
Matthias Clasen
d7652d2c06 Fix dist 2011-12-19 18:37:28 -05:00
Matthias Clasen
23ca2a953c Fix symbol lists 2011-12-19 18:07:42 -05:00
Matthias Clasen
e09b2107b6 Updates 2011-12-19 17:47:13 -05:00
Rui Matos
f4c698ef93 Revert "progressbar: Set state flags on draw"
This reverts commit 6ed5918718 which is no
longer needed as the style context now has the state flags updated when going
into draw.
2011-12-19 20:59:06 +00:00
Matthias Clasen
5d8641dd92 Add another bloatpad screenshot 2011-12-19 15:16:11 -05: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
Matthias Clasen
8eb58a6567 Updates
https://bugzilla.gnome.org/show_bug.cgi?id=666552
2011-12-19 15:06:22 -05:00
Rui Matos
8b444d1c03 notebook: Use the widget state flags as a base for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
9a4edf7a5a menuitem: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
6b624a5a18 menubar: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
5b4cc2f0b6 label: Use the widget state flags as a base for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
02dd7df653 label: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
e3d38708ab image: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
f4b9562f46 iconview: Use the widget state flags as a base for drawing items 2011-12-19 19:21:16 +00:00
Rui Matos
ffd5126a42 iconview: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
e9a8938b21 hsv: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
1facea2a8d expander: Use the widget state flags as a base for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
3e0b2f7262 eventbox: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
754eabeb19 entry: Use the widget state flags as a base for drawing icons and text 2011-12-19 19:21:16 +00:00
Rui Matos
a0fd344217 entry: Stop setting state flags on the style context for drawing 2011-12-19 19:21:16 +00:00
Rui Matos
721920e9e9 combobox: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00:00
Rui Matos
ee669a1b51 cellview: Stop checking for sensitivity on draw
This is needless since GtkCellRenderer does it consistently before rendering.
2011-12-19 19:21:15 +00:00
Rui Matos
70970146ca cellrenderertoggle: Use the cell renderer's state flags as a base for rendering
This allows us to pick the underlying widget's state flags that we don't
explicitly set here.
2011-12-19 19:21:15 +00:00
Rui Matos
42d2a1984c cellrenderer: Use the widget state flags as a base for cell renderers' state 2011-12-19 19:21:15 +00:00
Rui Matos
8baf65b595 checkmenuitem: Clean up state flags handling on drawing 2011-12-19 19:21:15 +00:00
Rui Matos
c9bbfb5e9b checkbutton: Use the widget state flags as a base for drawing the indicator
Instead of building a set of state flags specifically for drawing the
indicator, base it on the underlying widget state flags.
2011-12-19 19:21:15 +00:00
Rui Matos
dae2675441 checkbutton: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00:00
Rui Matos
5f5d4db034 calendar: Use the widget state flags as a base for drawing arrows
This allows drawing calendar arrows in all possible states the main widget may
be in.

The arrow_state array is converted into a bit field since it only really needs
to store boolean information about prelight for each arrow.
2011-12-19 19:21:15 +00:00
Rui Matos
d84021a870 calendar: Use the widget state flags as a base for drawing days
Instead of building a set of state flags specifically for drawing days, base
it on the underlying widget state flags.
2011-12-19 19:21:15 +00:00
Rui Matos
e868b8d6ea button: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00:00
Rui Matos
cf469eeb61 arrow: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00:00
Rui Matos
221442aa2a accellabel: Stop setting state flags on the style context for drawing 2011-12-19 19:21:15 +00:00
Rui Matos
cc8012eb32 widget: Set style flags on the style context when the flags are set
This will allow us to simplify most draw methods by not having to explicitly
set the style flags on the context.
2011-12-19 19:21:15 +00:00
Rui Matos
eecbdb6f57 widget: Always propagate state flags to all children
https://bugzilla.gnome.org/show_bug.cgi?id=666126
2011-12-19 19:21:15 +00:00
Piotr Drąg
951af792e6 Updated POTFILES.in 2011-12-19 20:20:28 +01:00
Ryan Lortie
aeaed2ab15 bump glib depend to 2.31.6 2011-12-19 14:03:32 -05:00
Ryan Lortie
8578fefaa5 GtkApplication: add menu API
We add the app-menu and menubar public APIs to GtkApplication while
leaving the implementation in GApplication.

The actual implementation will be moved soon.
2011-12-19 12:51:12 -05:00
Ryan Lortie
4e5e47931d missing file 2011-12-19 12:51:12 -05:00
Ryan Lortie
06c8921975 GtkApplication: document relationship to gdkthreads 2011-12-19 12:51:12 -05:00
Ryan Lortie
6a246a85f2 GtkApplicationWindow: deal with remote actions
Deal with remote action invocations correctly by implementing
GRemoteActionGroup in the same way that GApplication does and pushing
remote activations through the before/after_emit functions of the
GApplication associated with the window.

This is the last part of getting the threading situation right.

https://bugzilla.gnome.org/show_bug.cgi?id=665737
2011-12-19 12:51:12 -05:00
Ryan Lortie
363c2d684c GtkApplication: lock gdk on incoming messages
When we have incoming activations or action invocations we should
acquire the GDK lock, just in case the program in question is using gdk
threads.

https://bugzilla.gnome.org/show_bug.cgi?id=665737
2011-12-19 12:51:12 -05:00
Ryan Lortie
76d671d6a2 Move X property handling to GtkApplicationWindow
Don't try to deal with this using a qdata and signal connections in
GtkApplication.
2011-12-19 12:51:12 -05:00
Matthias Clasen
cff5ba1bc2 Document that gtk_init is called without argv
This answers a question in bug 661823.
2011-12-19 12:51:12 -05:00
Matthias Clasen
316e0ea542 Fix a typo 2011-12-19 12:51:12 -05:00
Matthias Clasen
5562d0a57a Forgotten file 2011-12-19 12:51:12 -05:00
Matthias Clasen
080007d7cb Show off some menus 2011-12-19 12:51:12 -05:00
Matthias Clasen
06a75b7e1f Some more menu-related docs 2011-12-19 12:51:12 -05:00
Matthias Clasen
aeb550ffd7 Plugman: Find the plugins menu in a better way
Now that GtkBuilder finds named submenus, there's no need for
the clumsy menumodel navigation anymore.
2011-12-19 12:51:12 -05:00
Matthias Clasen
a991bb9927 GtkBuilder: pick up named submenus
When parsing GMenu xml, use the facility for pick up named submenus.
Note that <section id='foo'>...</section> is _not_ a named submenu.
It is a named item with an unnamed submenu :-(
2011-12-19 12:51:12 -05:00
William Hua
c1f9ccce5b Handle menu changes. 2011-12-19 12:51:12 -05:00
William Hua
4846f3619a Add accelerators to bloatpad. 2011-12-19 12:51:12 -05:00
William Hua
1a02fc036d Refactor GMenuModel rendering for Mac OS. 2011-12-19 12:51:12 -05:00
William Hua
ec72f8fd81 gtkquartz-menu: fix some leaks 2011-12-19 12:51:12 -05:00
William Hua
460ac291b2 begin adding menu accelerators
Show accelerators in menus.
2011-12-19 12:51:12 -05:00
Matthias Clasen
3103ae2685 Two small fixes
Don't leak a session bus reference, and don't assume a display
is X11 just because we've built the X11 backend.
2011-12-19 12:51:12 -05:00
Matthias Clasen
d91c9f9859 Fix up includes 2011-12-19 12:51:12 -05:00
Ryan Lortie
9e3c4c6b03 bloatpad: add 'New Window' menu item 2011-12-19 12:51:11 -05:00
William Hua
8bc7513a7b begin GtkApplication menu support for Mac OS 2011-12-19 12:51:11 -05:00
Matthias Clasen
8a21201e2c Another plugin, for good measure 2011-12-19 12:51:11 -05:00
Matthias Clasen
c30e2b88c3 Something for the eye 2011-12-19 12:51:11 -05:00
Matthias Clasen
744f87fc12 Add an action too 2011-12-19 12:51:11 -05:00
Matthias Clasen
cc14811ec0 wip example for plugin/gmenu interaction 2011-12-19 12:51:11 -05:00
Matthias Clasen
4877799145 Update testgmenu to latest api changes 2011-12-19 12:51:11 -05:00
Ryan Lortie
21f4562d10 GtkApplicationWindow: share one GActionMuxer
Use the same GActionMuxer for menubars and accels instead of recreating
a new one each time.
2011-12-19 12:51:11 -05:00
Matthias Clasen
f485dd3f08 Documentation additions 2011-12-19 12:51:11 -05:00
Matthias Clasen
0baa663182 GtkApplicationWindow: Always install accelerators
We want accelerators to work, even if the menus are not shown
locally, so we can't rely on the GtkMenu code to set them up
for us. Currently, this code only installs accelerators when the
window is realized.
2011-12-19 12:51:11 -05:00
Matthias Clasen
073a924481 Bloatpad: Add an accelerator in the menu 2011-12-19 12:51:11 -05:00
Matthias Clasen
f7244431a9 GtkApplication: Extract accelerators from menus
This allows to specify accelerators in a convenient way, by
adding accel="..." attributes to the menu items in the
XML for the menu.

Currently, the accelerators are extracted only once, when the
menu property is changed on the application.
2011-12-19 12:51:11 -05:00
Matthias Clasen
2398d7e900 Introduce gtkaccelmapprivate.h
Move internal accel map API there and update all users.
Also, add an internal function to create an accel path for
an action and parameter, and use it in gtkapplication.c and
gtkmodelmenuitem.c instead of duplicating that code.
2011-12-19 12:51:11 -05:00
Matthias Clasen
f05cfd55f0 Bloatpad: Add an accelerator 2011-12-19 12:51:11 -05:00
Matthias Clasen
153cc818db GtkApplication: Add API to install accelerators for actions 2011-12-19 12:51:11 -05:00
Matthias Clasen
1c6d0c3e27 GtkApplicationWindow: Set the accel group on constructed windows
This will make the menuitems pick up matching accel map entries
automatically. Currently, nothing creates such accel map entries,
though.
2011-12-19 12:51:11 -05:00
Matthias Clasen
9d62d24d65 GtkApplicationWindow: Add a GtkAccelGroup
This will be used in the following patches.
2011-12-19 12:51:11 -05:00
Matthias Clasen
d5d896f812 Fix a gtk-doc warning 2011-12-19 12:51:11 -05:00
Ryan Lortie
90fcf994d5 GtkApplication: export windows on the bus
And advertise their location on the bus using X11 properties.
2011-12-19 12:51:11 -05:00
Ryan Lortie
03db3e1ca1 (trivially) implement 'shutdown' in GtkApplication 2011-12-19 12:51:11 -05:00
Matthias Clasen
aa1faa7c70 Add an example 2011-12-19 12:51:10 -05:00
Matthias Clasen
898bc98d3b Update GtkApplicationWindow docs 2011-12-19 12:51:10 -05:00
Matthias Clasen
3205a40b84 Whitespace fix 2011-12-19 12:51:10 -05:00
Matthias Clasen
f119c834c1 Make accelmap initialization more forgiving 2011-12-19 12:51:10 -05:00
Matthias Clasen
7ef340fb87 Clean up includes 2011-12-19 12:51:10 -05:00
Ryan Lortie
43bf430f21 bloatpad: add proper sections to the menus 2011-12-19 12:51:10 -05:00
Ryan Lortie
cd7ce867a7 Split off GMenuModel -> GtkMenuBar code
Put this in a separate file and substantially refactor it.

Move handling of submenu creation into gtkmodelmenuitem where it
belongs.

Improve our handling of when to show separators or not.
2011-12-19 12:51:10 -05:00
Ryan Lortie
afb0c098cb Watch "shell shows menu" settings for changes
Correctly monitor the GtkSettings for changes to the
"gtk-shell-shows-app-menu" and "gtk-shell-shows-menubar" properties.
2011-12-19 12:51:10 -05:00
Ryan Lortie
88f16b13f3 GtkSettings: quartz: shell always shows menus 2011-12-19 12:51:10 -05:00
Matthias Clasen
f7ce4d7740 Whitespace fixes 2011-12-19 12:51:10 -05:00
Matthias Clasen
b7de477611 Never add separators to menubars 2011-12-19 12:51:10 -05:00
Ryan Lortie
2f78238872 gmenu testcase: update to glib API changes 2011-12-19 12:51:10 -05:00
Ryan Lortie
2ce6a27fa3 bloatpad: move action/menu setup to ::startup
No need to waste time doing this in init() if we are not going to become
the primary instance.
2011-12-19 12:51:10 -05:00
Ryan Lortie
59092e1c00 bloatpad: port to GActionMap for application
g_application_set_action_group() is now deprecated.
2011-12-19 12:51:10 -05:00
Ryan Lortie
2e64177e3f GtkModelMenuItem: don't leak a GVariant 2011-12-19 12:51:10 -05:00
Ryan Lortie
9cc98f9d9b bloatpad: use GtkBuilder for constructing menus
This is closer to what a real application would want to do.
2011-12-19 12:51:10 -05:00
Ryan Lortie
f83530ae3a GtkModelMenuItem: omit indicator if not required
GtkModelMenuItem, being based on GtkCheckMenuItem, was always reserving
space for a check/radio indicator.  This ends up looking pretty strange
in a GtkMenuBar.

Don't reserve space for the indicator unless it's appropriate.
2011-12-19 12:51:10 -05:00
Ryan Lortie
de53b5226d GtkApplicationWindow: nuke some g_print spew 2011-12-19 12:51:10 -05:00
Ryan Lortie
f0c2ff39fc GtkApplcationWindow: plug two obvious leaks 2011-12-19 12:51:10 -05:00
Colin Walters
c7e7237559 GtkApplicationWindow: Consistently unparent menubar
We create it floating, and don't hold an extra ref, so we should
just unparent it.
2011-12-19 12:51:10 -05:00
Ryan Lortie
c299963428 GtkApplicationWindow: clean up menubar logic 2011-12-19 12:51:10 -05:00
Matthias Clasen
e7b6fa4449 Only add a separator when a section ends 2011-12-19 12:51:10 -05:00
Ryan Lortie
612e24dfc6 introduce GtkModelMenuItem
This GtkMenuItem subclass (and GActionObserver implementation) contains
all the knowledge necessary for converting a GMenuModel item description
into a GtkMenuItem.

Remove much of the code that used to do this from
gtkapplicationwindow.c.
2011-12-19 12:51:09 -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
Matthias Clasen
45e9d09eab Only add separators when a section actually ends 2011-12-19 12:51:09 -05:00
Matthias Clasen
064999cb2a Bloatpad: Add a View menu for fullscreen 2011-12-19 12:51:09 -05:00
Matthias Clasen
396876969a Bloatpad: Don't leak a menu model 2011-12-19 12:51:09 -05:00
Colin Walters
7ad83b6827 bloatpad: Be 640x480 by default
Because otherwise we're just a few pixels, and this is the least lame
solution I know of in GTK+.
2011-12-19 12:51:09 -05:00
Colin Walters
2c6b7eff17 GtkApplicationWindow: Further sanitize handling of merging app menu and menubar
The _set_show_app_menu should really be _set_show_menubar().

Also, correctly display just the window menu in the window when run
under GNOME 3.
2011-12-19 12:51:09 -05:00
Colin Walters
b041d33465 bloatpad: Fix Edit to be a submenu 2011-12-19 12:51:09 -05:00
Colin Walters
65a2962733 GtkApplication: Merge app menu and menubar
Change bloatpad to have both an app menu and a menubar.
2011-12-19 12:51:09 -05:00
Matthias Clasen
aae52d4580 GtkApplicationWindow: Make mnemonics work for stateful actions 2011-12-19 12:51:09 -05:00
Matthias Clasen
dd360d725c Bloatpad: Add mnemonics to the menu 2011-12-19 12:51:09 -05:00
Colin Walters
3a088d9ac2 GtkApplicationWindow: Don't unref a NULL object 2011-12-19 12:51:09 -05:00
Ryan Lortie
b42308f8e3 Adapt to changes in GLib API
g_application_get_menu() -> get_app_menu().
2011-12-19 12:51:09 -05:00
Matthias Clasen
33aaf26dd5 Drop GtkApplicationMenuButton for now
This feels premature; we do have the fallback situation covered
adaequately with the menubar, and people can do their own creative
solutions with gtk_application_window_get_menu(), so we don't have
to offer a widget for this right now.
2011-12-19 12:51:09 -05:00
Matthias Clasen
acbda82199 Remove a redundant test 2011-12-19 12:51:09 -05:00
Matthias Clasen
b893247eeb GtkApplicationMenuButton: add docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
bd30a1c556 Undoccommentify action muxer files 2011-12-19 12:51:09 -05:00
Matthias Clasen
0683f086bb Whitespace fixes 2011-12-19 12:51:09 -05:00
Matthias Clasen
cedc3cb6e1 Hook up docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
6d0475df4f Remove no-longer existing function 2011-12-19 12:51:09 -05:00
Matthias Clasen
f10f3bc7e4 GtkApplicationWindow: more docs 2011-12-19 12:51:09 -05:00
Matthias Clasen
762616dd75 Include gtkapplicationmenubutton.h in gtk.h 2011-12-19 12:51:08 -05:00
Matthias Clasen
65f5a65336 GtkApplicationWindow: mark a string for translation 2011-12-19 12:51:08 -05:00
Matthias Clasen
792c719478 Some coding style fixes 2011-12-19 12:51:08 -05:00
Matthias Clasen
d9c3714fcb GtkApplication: doc improvement 2011-12-19 12:51:08 -05:00
Matthias Clasen
a6794133aa Some initial docs 2011-12-19 12:51:08 -05:00
Matthias Clasen
32508ee825 Drop an unused variable 2011-12-19 12:51:08 -05:00
Matthias Clasen
8ae7921708 Don't call g_object_unref on a variant
Tsk, tsk...
2011-12-19 12:51:08 -05:00
Colin Walters
1eee7fb103 GtkApplicationWindow: Use dispose for GObjects
This ensures we break cyclic references.
2011-12-19 12:51:08 -05:00
Colin Walters
9e9e1a9fbf gtkapplicationwindow: Pick up gtk-shell-shows-app-menu XSetting
Calling gtk_application_window_set_show_app_menu() is now an override
for that setting.  If you don't call it, we pick up the default.
2011-12-19 12:51:08 -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
618bca1333 bloatpad: use GtkApplicationMenuButton 2011-12-19 12:51:08 -05:00
Ryan Lortie
ddfbe19b23 add GtkApplicationMenuButton 2011-12-19 12:51:08 -05:00
Ryan Lortie
3076ba9c62 bloatpad: add 'win.fullscreen' action 2011-12-19 12:51:08 -05:00
Ryan Lortie
906475860f bloatpad: make "about" a window action
By making "about" a per-window action, we can pop the about dialog up on
top of the correct window instead of trying to guess from the
application list of windows.
2011-12-19 12:51:08 -05:00
Ryan Lortie
1a97f4b9ef GtkApplicationWindow: wire up action activations
Wire the 'activate_action' and 'change_action_state' vfuncs through to
the GSimpleActionGroup.
2011-12-19 12:51:08 -05:00
Ryan Lortie
af0c1e66ab gtk.symbols fixes 2011-12-19 12:51:08 -05:00
Ryan Lortie
7e34342899 GtkApplicationWindow: implement GActionMap 2011-12-19 12:51:08 -05:00
Ryan Lortie
ebd7450f02 port bloatpad to the new APIs 2011-12-19 12:51:08 -05:00
Ryan Lortie
a93b9dd1cb add GtkApplicationWindow
This is a GtkWindow subclass that "application windows" will use.  Each
is associated with a GtkApplication, has the ability to show menus and
will have its own associated set of actions.
2011-12-19 12:51:08 -05:00
Ryan Lortie
e7ad2f97c8 add GActionMuxer and observer interfaces
These were destined for GLib, but they don't really make sense as a
public API.  Instead, we'll copy/paste them around between the various
codebases that need to render menus.
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
Matthias Clasen
7ee18bd74a Make it build against the current wip/menus-rebase3 branch 2011-12-19 12:51:07 -05:00
Colin Walters
0455a9596f testgmenu: #ifdef out non-compiling code for now 2011-12-19 12:51:07 -05:00
Matthias Clasen
6b7be4a3a2 Add a very bad fallback check
...maybe committing this inspires some better solution.
2011-12-19 12:51:07 -05:00
Colin Walters
9c52a73c21 window: Set a _DBUS_APPLICATION_ID X11 window property
This will allow gnome-shell to reference it.
2011-12-19 12:51:07 -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
Matthias Clasen
5705a330c2 GtkApplication: Insert separators after sections
The previous code was only inserting a separator when a new
section was starting right away, which may not always be the
case.
2011-12-19 12:45:51 -05:00
Matthias Clasen
9131849eec testgmenu: Insert separators after sections
The previous code was only inserting a separator when a new
section was starting right away.
2011-12-19 12:45:51 -05:00
Matthias Clasen
5aee67793f GtkApplication: Initial attempt at section headings
This should be redone to show the label together with the
separator line, somehow. For now, just put the label below
the separator, as a separate item.
2011-12-19 12:45:51 -05:00
Matthias Clasen
7de8660187 testgmenu: Initial attempt at section headings
This should be redone to show the label together with the
separator line, somehow. For now, just put the label below
the separator, as a separate item.
2011-12-19 12:45:51 -05:00
Matthias Clasen
92af3d04b8 GtkApplication: use activate for actions here, too 2011-12-19 12:45:51 -05:00
Matthias Clasen
bf03adcdeb testgmenu: Use activate with parameter for radio actions
This is how stateful actions are supposed to be activated, using
change_state for this was not right at all.
2011-12-19 12:45:51 -05:00
Matthias Clasen
15afbf846d testgmenu: Use activate for toggle actions
This is how stateful actions are supposed to be activated, using
change_state for this was not right at all.
2011-12-19 12:45:51 -05:00
Colin Walters
e0c235255b testgmenu: Quit on delete-event 2011-12-19 12:45:51 -05:00
Matthias Clasen
95d9a5e368 Adapt to api changes in GMenuModel 2011-12-19 12:45:51 -05:00
Matthias Clasen
5d0020cbd3 Adapt to object path conventions
Seems common to expect 'path == bus name with slashes'.
2011-12-19 12:45:51 -05:00
Matthias Clasen
8ee68a7bf1 bloatpad: Add an example app menu
The bloatpad example shows simple GtkApplication usage,
so it makes sense to test app menu api here as well.
2011-12-19 12:45:51 -05:00
Matthias Clasen
cc24dbe9c7 GtkApplication: add a way to get the appmenu
This function either returns a GtkMenu or NULL.
Still to do: detect if the app menu is externally handled.
2011-12-19 12:45:51 -05:00
Matthias Clasen
601b3fca60 Drop an unused variable 2011-12-19 12:45:51 -05:00
Matthias Clasen
3b2f77e2c6 Remove an unneeded include 2011-12-19 12:45:51 -05:00
Matthias Clasen
1996a5edff testgmenu: Demonstrate how translatable labels work 2011-12-19 12:45:51 -05:00
Matthias Clasen
f13083bf0d Pass domain to the menu parser
This is necessary to make translations in markup work.
2011-12-19 12:45:51 -05:00
Matthias Clasen
b36198dbc2 More dynamic changes 2011-12-19 12:45:51 -05:00
Matthias Clasen
1aec8e22b6 Cleanups
Separate the menu generation code and all callbacks in a
MenuHolder struct.
2011-12-19 12:45:50 -05:00
Matthias Clasen
1ddaf01aed Quick-and-dirty GtkBuilder integration
This makes GtkBuilder accept a GMenuMarkup tree at the toplevel
(ie with <menu id='foo'> being a child of <interface>) and the resulting
GMenu object can be obtained via gtk_builder_get_object (builder, "foo").
2011-12-19 12:45:50 -05:00
Matthias Clasen
fd9df1864b Brute-force dynamic change propagation
We need to make sure that we connect to ::items-changed on every
single model, as they appear and disappear. Ugly business.
2011-12-19 12:45:50 -05:00
Matthias Clasen
519c75a606 First attempt at handling dynamic changes
We need to connect to items-changed on _every_ menu
model, which is somewhat icky. For some reason, this
works fine with a local model, but not with D-Bus in
between. Debugging needed.
2011-12-19 12:45:50 -05:00
Matthias Clasen
c62ed7e3a3 Add code for dynamic changes
Add and remove items and actions - we don't update
the menus properly yet.
2011-12-19 12:45:50 -05:00
Matthias Clasen
bfa53a9df5 Add some todos 2011-12-19 12:45:50 -05:00
Matthias Clasen
8841c04e22 Some GMenu test code
This is some test code for constructing GtkMenus from GMenus.
2011-12-19 12:45:50 -05:00
Daniel Mustieles
0192955bd8 Updated Spanish translation 2011-12-19 17:14:35 +01:00
Benjamin Otte
902c5c6979 a11y: emit entry signals immediately
We want to emit signals when stuff happens, not sometime later. That way
we can also catch the correct text that was deleted.

https://bugzilla.gnome.org/show_bug.cgi?id=659445
2011-12-19 16:17:14 +01: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
Benjamin Otte
3d4a8dabb2 a11y: implement widget_(un)set in ContainerCell 2011-12-19 16:17:13 +01:00
Benjamin Otte
d2a58446ea a11y: Make GtkCellAccessible a GtkAccessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
e937d0613d tests: Avoid deprecation warning 2011-12-19 16:17:13 +01:00
Benjamin Otte
073b4d8bea accessible: Deprecate gtk_accessible_connect_widget_destroyed()
That was an abomination. Also, if people called it twice, you got even
mor signal handlers!
2011-12-19 16:17:13 +01:00
Benjamin Otte
0c1f2f2fc1 widget: Set widget in accessible's constructor
No need to add t manually later.
2011-12-19 16:17:13 +01:00
Benjamin Otte
d801b28365 a11y: Don't connect_destroyed anymore
It's not used now that set_widget() does the right thing.
2011-12-19 16:17:13 +01:00
Benjamin Otte
1961be9ee9 iconview: Simplify adjustment monitoring for accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
4652d4c399 a11y: Remove widget_destroyed call
GtkAccessible does all of that for us now.
2011-12-19 16:17:13 +01:00
Benjamin Otte
80a0413d40 a11y: Use widget_unset vfunc in treeview 2011-12-19 16:17:13 +01:00
Benjamin Otte
dbc1581376 accessible: Ensure we unset the widget when finalizing 2011-12-19 16:17:13 +01:00
Benjamin Otte
03a63def24 widget: Unref accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
7b5b678e2e a11y: Fix crash in notebook
When the accessible was disposed before the notebook it referenced, the
weak ref could still trigger. This works around it.
2011-12-19 16:17:13 +01:00
Benjamin Otte
e042462674 widget: Unset self from accessible 2011-12-19 16:17:13 +01:00
Benjamin Otte
23b5f9c066 widget: Unset widget on accessibles 2011-12-19 16:17:13 +01:00
Benjamin Otte
075cc5dd36 accesible: Manage the DEFUNCT state
A GtkAccessible with a NULL widget is defunct, there's no way around it.
2011-12-19 16:17:12 +01:00
Benjamin Otte
1305815bde iconview: Split out iconview accessible 2011-12-19 16:17:12 +01:00
Benjamin Otte
eb27c61878 accessible: Use set_widget() in destroy notify
We don't want to bypass the unset_widget call.
2011-12-19 16:17:12 +01:00
Benjamin Otte
bac73e48db API: accessible: Add widget_set and widget_unset vfuncs
I expect them to be used a lot, so this approach seems better than
requiring signals that connect to "notify::widget". Also, we can't use
regular functions (like dispose or constructed), becaiuse those assume
that (un)setting of the widget only happens once and with the current
design (a puble set_widget() function) we can't really guarantee that.

Also, I split them into two separate functions as one function is part
of construction and the other part of destruction of the object. And it
doesn't sound like a good idea to have that both be part of one
function.
2011-12-19 16:17:12 +01:00
Benjamin Otte
50431be274 accessible: At an important note to the docs
I wanted to use weak refs to ensure this instead, but it's a performance
problem when used in the treeview and each and every cell adds a weak
ref to the treeview.
2011-12-19 16:17:12 +01:00
Benjamin Otte
5789fd983b accessible: Check the widgeyt actually changed when setting 2011-12-19 16:17:12 +01:00
Benjamin Otte
1998a63917 accessible: Make widget a property 2011-12-19 16:17:12 +01:00
Benjamin Otte
eed9cc94e1 treeview: Only set focus column in setter function
Single point of entry. It's actually going to become more complicated
with a11y now.
2011-12-19 16:17:12 +01:00
Benjamin Otte
e4f6a7124b a11y: Simplify code
Use peek_cell() instead of a custom find_cell() function that duplicates
loads of functionality.
2011-12-19 16:17:12 +01:00
Matthias Clasen
19c5b5c9d6 Tell gtk-doc about G_GNUC_WARN_UNUSED_RESULT 2011-12-19 07:32:32 -05:00
Matthias Clasen
5913e88feb Reduce gtk-doc warnings 2011-12-19 07:32:15 -05:00
Matthias Clasen
910e50994c Fix parameter name mismatch 2011-12-18 16:04:51 -05:00
Matthias Clasen
020c1846b7 Use the workarea when placing popups
This uses the new workarea API to avoid placing popups underneath
panels, docks, etc.
2011-12-18 14:29:16 -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
Daniel Mustieles
74cff292d5 Updated Spanish translation 2011-12-18 20:11:34 +01: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
Ignacio Casal Quinteiro
69fba5d3ed textlayout: cleanup
Use g_clear_object, move unrefs to dispose and reorganize code
2011-12-18 18:46:36 +01:00
Paolo Borelli
397cbbef32 Use gtk_text_layout_get_iter_at_line
We already have a gtk_text_layout_get_iter_at_line wrapper that takes
care of getting the btree from the layout, we may as well use it.
2011-12-18 17:44:23 +01:00
Paolo Borelli
7f301cf822 Remove useless get_iter_at_line calls.
No need to call _gtk_text_btree_get_iter_at_line right before calling
totally_invisible_line, since it is the first thing it does itself.
2011-12-18 17:35:08 +01:00
Baurzhan Muftakhidinov
bbf96b9ea7 [l10n] Updated Kazakh translation 2011-12-17 21:11:15 +01:00
Piotr Drąg
9b02b6c7c0 Updated POTFILES.in 2011-12-17 19:50:27 +01:00
Rui Matos
4a113394da tests: Add a test for latest commit
https://bugzilla.gnome.org/show_bug.cgi?id=666392
2011-12-17 11:59:08 +00:00
Rui Matos
9d6da33ff5 widget: Flip the sensitive flag even if the state doesn't change
Even if we can't change our sensitivity because the parent is insensitive we
should still flip the sensitive flag. Otherwise, with and insensitive parent,

child.set_sensitive(True)
...
parent.set_sensitive(True)

would result in child still being insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=666392
2011-12-17 11:48:01 +00:00
Benjamin Otte
b9fad15ee6 filechooserentry: Catch tab key earlier
Instead of in the key_press handler, use a signal handler. The signal
handler runs before the default handler, and before other signal
handlers. In particular it runs before the signal handler installed via
gtk_entry_set_completion() which pops down the entry completion, and we
don't want that to happen.

The code does not change the code of the handler in any significant way,
it just refacotrs it to not call the parent anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
640754e98b filechooserentry: Do inline completion only when opening files
When saving files, using <tab> is required. We don't want the UI
randomly changing filenames from below us.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
351dd206bc filechooserentry: Remove unused enum 2011-12-16 20:09:14 +01:00
Benjamin Otte
4fb6961c6a filechooserentry: Allow NULL as base folder again
This was removed previously, but is necessary to support the case where
no base folder is in use, which should cause an error. This can be
experienced in save mode in the recent files list.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
523a45d927 filechooserentry: Don't show files when selecting directory
We don't want to complete on files when they're not supposed to be
selectable.
2011-12-16 20:09:14 +01:00
Benjamin Otte
57766f1948 filechooserentry: Remove beep function
There's only 2 places left where we potentially beep. We can call
gtk_widget_error_bell() directly there.
2011-12-16 20:09:14 +01:00
Benjamin Otte
0d10583695 filechooserentry: Simplify load completion
Most importantly, consistently trigger a beep when we abort a pending
completion.
2011-12-16 20:09:14 +01:00
Benjamin Otte
c4a331f934 filechooserentry: Use a GtkFileFilter for filtering
That way, we can use the regular filtering features of the
filesystemmodel instead of having our own filtering function that
duplicates much of the matching code.

This also removes the broken-on-windows feature where files strting with
a dot were not autocompleted.
2011-12-16 20:09:14 +01:00
Benjamin Otte
98fb16e307 filesystemmodel: Add a toggle for whether directories are filtered 2011-12-16 20:09:14 +01:00
Benjamin Otte
b47b6d307e filechooserentry: Remove the file column
It is not needed anymore.
2011-12-16 20:09:14 +01:00
Benjamin Otte
5607cd9170 filechooserentry: Simplify code
Use all the clever functions we invented in recent refactorings to
compute the file and dir part and the current folder.

This also fixes the bug where "./" was not taken as the current
directory but interpreted as a file named "./".
2011-12-16 20:09:13 +01:00
Benjamin Otte
d27d73f885 filechooserentry: Refactor function
Name the function set_completion_folder() and make it accept NULL, so it
behaves like a regular setter function.
2011-12-16 20:09:13 +01:00
Benjamin Otte
ea8f5f15c1 filechooserentry: Set minimum key length to 0
We want the empty chooser to show possible completions, too.
2011-12-16 20:09:13 +01:00
Benjamin Otte
af9e385616 filechooserentry: Simplify refresh_current_folder_and_file_part()
The function can get the text it's refreshing from itself, as there is
only one possible value. And it doesn't need to return a value anymore.
2011-12-16 20:09:13 +01:00
Benjamin Otte
357ae09b54 filechooserentry: Get rid of unused member variable
in_change isn't set anymore.
2011-12-16 20:09:13 +01:00
Benjamin Otte
6ab681c094 filechooserentry: Remove _gtk_file_chooser_entry_set_file_part()
gtk_entry_set_text() is fine.
2011-12-16 20:09:13 +01:00
Benjamin Otte
c9b220275a filechooserentry: Use completion for completion
Reduce the amount of code even more by using the entry completion to
query the prefix.
2011-12-16 20:09:13 +01:00
Benjamin Otte
d3fd759f77 filechooserentry: Add gtk_file_chooser_entry_get_completion_text()
This returns the text that should be completed on. As this is somewhat
tricky to compute (and in fact one place did it wrong), let's make it a
function.
2011-12-16 20:09:13 +01:00
Benjamin Otte
f6f2a78d3e filechooserentry: Don't update the folder when completing
The folder is always up to date, there's no need to update it. (If the
folder is not up to date, that is a bug and needs to be fixed
elsewhere.)
2011-12-16 20:09:13 +01:00
Benjamin Otte
ad1672c194 filechooserentry: Don't override activate
The code is no longer necessary, because the relevant parts for inline
completion are now handled by GtkEntry.
2011-12-16 20:09:13 +01:00
Benjamin Otte
6e7b2de21e filechooserentry: Simplify append_common_prefix()
Now that we don't need to know anymore why insertion failed, we can
simplify the append function quite a lot.

A simple rule now: If we did not insert anything, beep.
2011-12-16 20:09:13 +01:00
Benjamin Otte
f7e5a773ff filechooserentry: Remove completion feedback
Too much special code for no gain.

I did a totally unscientific questionnaire on GNOME IRC (assuming
autocompletion is for advanced users) and nobody even knew what this is.
So I suspect it's useless. Also, it's positioned completely wrong anyway
and nobody noticed so far. Last but not least, I'm trying to imitate
bash here and bash doesn't show feedback.
2011-12-16 20:09:13 +01:00
Benjamin Otte
93263dcd33 filechooserentry: Redo completion popup trigger
Use dispatch_properties_changed() instead of GtkEditable to watch for
changes to the to-be-completed text. This is necessary because various
functions in GtkEntry don't use the interface vfuncs and one only
becomes aware of them via notifications. I'm not sure this is intended
behavior, but it's how it works today.
Also, use the same code for triggering in all situations.

What the code does is this: It looks at the part of the text in front of
the cursor (or selection) and completes for it. Once the directory has
been enumerated, inline completion is activated. Note that popping up of
the completion popup is completely handled by GtkEntry.
2011-12-16 20:09:13 +01:00
Benjamin Otte
132c42ccbd filechooserentry: Get rid of RefreshMode
Instead, pass the text to use to refresh_current_folder_and_file_part().
This also gets rid of the problem introduced earlier that the position
is not properly updated in do_insert_text() and therefor the completion
is wrong.
2011-12-16 20:09:13 +01:00
Benjamin Otte
45d54fcba6 filechooserentry: Use inline completion
... from GtkEntryCompletion instead of implementing a poor copy
ourselves. This also makes the file chooser entry behave a lot closer to
normal entries.
2011-12-16 20:09:13 +01:00
Benjamin Otte
cdd236ddd4 filechooserentry: Merge function 2011-12-16 20:09:13 +01:00
Benjamin Otte
c585471baf filechooserentry: Set the text column of the entry completion
I want to use it in the next commits, but am doing this in a separate
commit so we can find side effects causing bugs easier when bisecting.
2011-12-16 20:09:12 +01:00
Benjamin Otte
e3ef8a568e filechooserentry: Simplify match_selected function 2011-12-16 20:09:12 +01:00
Benjamin Otte
cde8ae7b1e filechooserentry: Keep an extra column for the full path
This is identical to the display name when not having a path that
changes the folder. Otherwise it will have the full path that was
entered in the entry. Say when from your home dir, you type
"../../usr/li", the full path for "lib" and "lib64" will be
"../../usr/lib" and "../../usr/lib64" respectively. This value isn't
used yet, but will be soon.
2011-12-16 20:09:12 +01:00
Benjamin Otte
fc775dfa5b entrycompletion: Export gtk_entry_completion_compute_prefix()
I want to use it in the file chooser entry autocomplete code.
2011-12-16 20:09:12 +01:00
Benjamin Otte
1ac6ace87d filechooserentry: Redo _gtk_file_chooser_entry_get_file_part()
The new version does not need to update any text, it just strips the
last part of the existing entry.
2011-12-16 20:09:12 +01:00
Benjamin Otte
e2105c2bef filechooserentry: Modify _gtk_file_chooser_entry_get_current_folder()
The new version does not need to muck with the entry, it just extracts
the required information. It returns a reference to the folder though,
as we extract the information now instead of returning something stored.
2011-12-16 20:09:12 +01:00
Benjamin Otte
5c42972735 filechooserentry: Split out function
I want to use that function elsewhere, so split it out.
2011-12-16 20:09:12 +01:00
Benjamin Otte
2186c28263 filechooserentry: Simplify code
Now that the base folder is always != NULL, we can remove the parts of
the code that check for NULL.
2011-12-16 20:09:12 +01:00
Benjamin Otte
35198e142d filechooserentry: Ensure the base folder is always valid
If the base folder is set to NULL, then we just assume the home dir.
FIXME: Should we disallow a NULL folder?
2011-12-16 20:09:12 +01:00
Benjamin Otte
e0859004f6 filechooserentry: Don't complain about incomplete hostnames
First of all, those hostnames may very well be complete, second of all,
smb:// is a valid uri to enter.
2011-12-16 20:09:12 +01:00
Benjamin Otte
242afcfeff filechooserentry: Start autocomplete immediately
Don't do idle handlers for this.
2011-12-16 20:09:12 +01:00
Benjamin Otte
9ee577d5ee filechooserentry: Remove file_system argument
It's not needed anymore.
2011-12-16 20:09:12 +01:00
Benjamin Otte
c3da748cb2 filechooserentry: Simplify code
Now that we've imported the function in the last commit, rename it and
omit useless arguments by instead passing in the entry directly.
2011-12-16 20:09:12 +01:00
Benjamin Otte
9d09028970 filechooserentry: Move _gtk_file_system_parse()
It's very specific to the file chooser entry, so it's better kept there.
It's also not used anywhere else in the code.
2011-12-16 20:09:12 +01:00
Benjamin Otte
036195e7a8 gtkfolder: Remove
It's not used anymore. And new code should of course use gio.
2011-12-16 20:09:12 +01:00
Benjamin Otte
a1e0c1e042 filechooserentry: Use a GtkFileSystemModel
Replace the usage of a list store and a GtkFolder with a
GtkFileSystemModel. This improves performance and reduces code size.
2011-12-16 20:09:11 +01:00
Benjamin Otte
06a64daefc filechooserentry: Store the liststore as a treemodel
Just changes the type of the member variable. This way we can avoid a
lot of casts.
2011-12-16 20:09:11 +01:00
Benjamin Otte
5ebc69066a filechooserentry: Make appending / to directories simpler 2011-12-16 20:09:11 +01:00
Benjamin Otte
2b9ecd9706 filechooserentry: Only append / to directory names once
Since 069d78ed31 the / is appended to
directories upon constructing the display name, so there is no need to
do it later.
2011-12-16 20:09:11 +01:00
Benjamin Otte
8389922de9 filechooserentry: Don't trim away the slash after directories
It's not necessary as the code appending the slashes checks for a slash
these days.
2011-12-16 20:09:11 +01:00
Benjamin Otte
2ead847f7d filechooserentry: Fold in start_loading_current_folder()
The function just did one thing, we can just fold it into the only
caller.
2011-12-16 20:09:11 +01:00
Benjamin Otte
a04b70e51f filechooserentry: The file system cannot be NULL
Remove code that checked this.
2011-12-16 20:09:11 +01:00
Benjamin Otte
05398b8f1a filechooserentry: Make the filesystem a construct-only argument
This allows simplifications in the code.
2011-12-16 20:09:11 +01:00
Benjamin Otte
5aeac0bccb filechooserentry: Keep finished_loading variable ourselves
This will be useful in the next commits when the GtkFolder code
previously keeping that variable gets repalced.
2011-12-16 20:09:11 +01:00
Benjamin Otte
b6f6e33801 filechooserentry: force_reload is never TRUE
.. so remove it.
2011-12-16 20:09:11 +01:00
Benjamin Otte
f0cf1117e1 filechooserentry: Fold function into other
There's no need to discard the current folder's file without also
discarding the folder object.
2011-12-16 20:09:11 +01:00
Benjamin Otte
d5e5ca3e2a filechooserentry: Reorganize function
Setter functions the way I code it look like this (in order):
1) Figure out if the value changed. If not, exit early.
2) Clear the old value (ie unref stuff, disconnect signals
3) Copy the new value
4) Set up things about the new value

This reorganization does that.

And by doing that, it even reduces the amount of code and the amount of
branches (and with it, nesting) needed.
2011-12-16 20:09:11 +01:00
Benjamin Otte
7b51ca9a47 filechooserentry: Use the actual discarding function to discard a folder 2011-12-16 20:09:11 +01:00
Benjamin Otte
edddb666a7 filechooserentry: Don't use a magic number
... when we have a proper enum value for a column.
2011-12-16 20:09:11 +01:00
Benjamin Otte
92a72ce3e5 entry: Move freeze/thaw into begin/end_change 2011-12-16 20:09:11 +01:00
Benjamin Otte
cf8f3c07f2 entry: Don't try to handle Tab in entry completions
Instead, fall through to the default handler after closing the
completion. This has the advantage of letting the file chooser entry
capture the tab key properly, so one can't accidentally move out of the
entry by pressing tab while the completion is popped up.

I also suspect it fixes bugs with weird tab keys and shift/ctrl
oddities. But who knows...
2011-12-16 20:09:11 +01:00
Daniel Mustieles
88da2e81ab Updated Spanish translation 2011-12-16 14:22:49 +01:00
Benjamin Otte
e104219ab1 tests: Relax a refcount comparison check
We now test for real_refcount >= expected_refcount, because various
parts of the code (a11y, selection, cursor, ...) can and do add
references.
2011-12-16 13:39:43 +01:00
Benjamin Otte
113aff673f a11y: Don't emit children-changed when nothing changed
When we have 0 columns, no children ever get added or removed.
2011-12-16 13:39:43 +01:00
Benjamin Otte
d78971b31d treeview: Run unref helper for all rows
Don't do shortcuts. Because all rows need to be unreffed.
Introduced in 92929b968b.
2011-12-16 13:39:43 +01:00
Matthias Clasen
afa945f480 Updates 2011-12-15 23:59:36 -05:00
Matthias Clasen
7f5a665b95 Fix more linking fallout
We are using xinput and gmodule API in a few places in libgtk.
https://bugzilla.gnome.org/show_bug.cgi?id=665326
2011-12-15 23:35:06 -05:00
Matthias Clasen
cea35016db Add missing symbols to the docs 2011-12-15 23:09:23 -05: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
2f25ab2b22 Doc typo fix 2011-12-15 23:03:12 -05:00
Matthias Clasen
a26afb6aab Add new symbols 2011-12-15 23:03:12 -05:00
Matthias Clasen
55f1799b96 Doc typo fix 2011-12-15 23:03:12 -05:00
Matthias Clasen
ba59b9c4f9 Cosmetic changes 2011-12-15 23:03:12 -05:00
Benjamin Otte
f8426cd706 gtk-demo: Fix warnings in changedisplay
Use the brute force fix. I'm not really interested in fixing this
properly.
2011-12-16 04:53:17 +01:00
Benjamin Otte
c0fdcbf513 a11y: Remove unused gtk_cell_accessible_set_cell_data() 2011-12-16 04:53:17 +01:00
Benjamin Otte
b8b8ba8ed9 a11y: Make boolean cell render report its states the new way 2011-12-16 04:53:17 +01:00
Benjamin Otte
64aa203773 a11y: Refactor treeview code even more
- Split out set_cell_data()
- Use it
- Get rid of update_cell_value() function, it's now just 2 calls
2011-12-16 04:53:16 +01:00
Benjamin Otte
eb6465167e a11y: Redo function signature
With the recent changes to gtk_cell_accessible_update_cache(), the
update_cell_value() function now needs less code, too.
2011-12-16 04:53:16 +01:00
Benjamin Otte
4ac501736e a11y: Implement GtkContainerCellAccessible.update_cache 2011-12-16 04:53:16 +01:00
Benjamin Otte
118bc610f6 a11y: Move update_cache to GtkCellAccesible
This way, we can call it for container renderers, too.
2011-12-16 04:53:16 +01:00
Benjamin Otte
2e7fcc24ac a11y: Redo cell update function
1) always emit signals
   Previously, newly constructed cells would be told to not emit events.
   However, we can ensure that nothing is connected to the signals, so
   they will not actually emit anything.
2) don't return anything
   The return value is unused anyway.
2011-12-16 04:53:16 +01:00
Benjamin Otte
5cca6b2dc2 a11y: Remove unused function 2011-12-16 04:53:16 +01:00
Benjamin Otte
d2a9220006 a11y: remove now unused property lists 2011-12-16 04:53:16 +01:00
Benjamin Otte
a3f60349ed a11y: Don't copy data between renderers
Now that we don't use custom renderers anymore, we don't need to copy
data between them anymore.
2011-12-16 04:53:16 +01:00
Benjamin Otte
8ac579602c a11y: Use cell renderer creation funcs unconditionally
Also delete the previous "new" functions and actually set the real cell
renderer here.
2011-12-16 04:53:16 +01:00
Benjamin Otte
c5433e852b gtk: Add accessible types for cell renderers 2011-12-16 04:53:16 +01:00
Benjamin Otte
e5d5863a3f a11y: Use the accessible type 2011-12-16 04:53:16 +01:00
Benjamin Otte
0470b91add cellrenderer: Add API to keep the accessible type
It's private for now, because we require a GType that isn't exported in
the API yet.
2011-12-16 04:53:16 +01:00
Benjamin Otte
acb73f99bb API: cellrenderer: Add a private struct 2011-12-16 04:53:15 +01:00
Benjamin Otte
c28f641921 a11y: Add GtkRendererCellAcessible::renderer 2011-12-16 04:53:15 +01:00
Benjamin Otte
dfb82333a3 a11y: Remove unused variable 2011-12-16 04:53:15 +01:00
Benjamin Otte
ccabccc42f treeview: Send changed signal directly to a11y code
No more signal handler is needed, therefore the code can also get rid of
tracking the treemodel. And we use a faster approach for iterating the
changed cellrenderers: We just iterate all columns instead of over all
cell accessibles, as that number is likely quite a bit smaller.
2011-12-16 04:53:15 +01:00
Benjamin Otte
070124b0a5 tests: Add test resetting the model
We first set a NULL model and then reset the old model, just to get the
effect of clearing and then resetting.

We reset the cursor and selection afterwards, so the reset doesn't
destroy all the work we did.
2011-12-16 04:53:15 +01:00
Benjamin Otte
f5621a3a8e treeview: Emit cursor-changed signal when new model is set 2011-12-16 04:53:15 +01:00
Benjamin Otte
c9c7e91db9 a11y: Improve treeview's add/remove_selection() 2011-12-16 04:53:15 +01:00
Benjamin Otte
dc8f5effd4 a11y: Improve get_selected_rows() 2011-12-16 04:53:15 +01:00
Benjamin Otte
20b56689c5 a11y: Improve table_is_row_selected() 2011-12-16 04:53:15 +01:00
Benjamin Otte
3112679a5e treeview: Signal selection changes to the accessible
And another signal gone.
2011-12-16 04:53:15 +01:00
Benjamin Otte
1a3226e2f7 a11y: Emit children-changed properly for treeviews
Fixes the patch reverted in b7e74ef95f1d9cd851fb81a124beca0ca11dad00
properly.

https://bugzilla.gnome.org/show_bug.cgi?id=548782
2011-12-16 04:53:15 +01:00
Benjamin Otte
0005d820c7 treeview: Remove unnecessary accessible_expanded()
Instead, just call remove_state().
2011-12-16 04:53:15 +01:00
Benjamin Otte
c7b82c2cea treeview: Add add() function to accessible
... and use that to emit the insertion signals.
2011-12-16 04:53:14 +01:00
Benjamin Otte
82a9f6faa0 treeview: Set expandable flag from treeview
... instead of trying to update it manually.
2011-12-16 04:53:14 +01:00
Benjamin Otte
9e9533fc88 a11y: Redo cell accessible action handling
Multiple changes:
- actions are now available unconditionally, but only work in the right
  state. This mirrors other actions.
- instead of adding actions manually, they invoke the action on the
  GtkCellAccessibleParent interface.

Tests have been updated to reflect the changes
2011-12-16 04:53:14 +01:00
Benjamin Otte
f840efae96 a11y: Remove "toggle" action from cell renderers
This is identical to "edit" (even though that name is kinda confusing).
2011-12-16 04:53:14 +01:00
Benjamin Otte
adf183b71f treeview: Set EXPANDED state directly on a11y elements 2011-12-16 04:53:14 +01:00
Benjamin Otte
6fa72300be treeview: Deprecate gtk_tree_view_set_destroy_count_func()
The accessibility code doesn't need it anymore.
2011-12-16 04:53:14 +01:00
Benjamin Otte
ab9c2c2de2 a11y: Remove destroy_count_func usage
It's not needed anymore.
2011-12-16 04:53:14 +01:00
Benjamin Otte
8ca5192d6d a11y: Emit row-deleted signal when rows get deleted
Instead of in the old callbacks.
2011-12-16 04:53:14 +01:00
Benjamin Otte
25445837ca a11y: Revert 22a47c3dbd
The fix is wrong on multiple levels. I'll add a proper fix soon.

https://bugzilla.gnome.org/show_bug.cgi?id=548782
2011-12-16 04:53:14 +01:00
Benjamin Otte
95dc248790 treeview: Don't use signals in a11y row expansion
Instead, add a function and call it directly.
2011-12-16 04:53:14 +01:00
Benjamin Otte
d9b71702dc a11y: Add _gtk_tree_view_accessible_add_state()
... and _gtk_tree_view_accessible_remove_state(). They should be called
by gtktreeview.c to notify about changes of state for a row.
2011-12-16 04:53:13 +01:00
Benjamin Otte
3badf48d2e a11y: Split out function
I want to use that function when sending notifications. See next
commits.
2011-12-16 04:53:13 +01:00
Benjamin Otte
ff80ae16d9 a11y: Readd FOCUSABLE state
The state was lost in commit 08d86fabc4.

Also order the states that are always set alphabetically.
2011-12-16 04:53:13 +01:00
Benjamin Otte
0ef6771bcc a11y: Remove old notify about showing/visible
As cells are always visible and showing, there is no need to do complex
notification mechanisms anymore.
2011-12-16 04:53:13 +01:00
Benjamin Otte
7f42a9465a a11y: Add _gtk_cell_accessible_state_changed()
It's supposed to replace the old state_set calls.
2011-12-16 04:53:13 +01:00
Benjamin Otte
90f04b56a7 a11y: Split out renderer<->atk state matching
We now keep a state map. This makes adding new states easier, and
doesn't introduce bugs with state change emissions.
2011-12-16 04:53:13 +01:00
Benjamin Otte
acfb3b3d88 a11y: Don't duplicate information anymore
We do provide the expandable and expanded information via
GtkCellRendererState now so there is no need to use extra flags.
2011-12-16 04:53:13 +01:00
Benjamin Otte
bb029420fd a11y: Set new treeview flags 2011-12-16 04:53:13 +01:00
Benjamin Otte
175043bd8d treeview: Set the new flags when rendering the cell 2011-12-16 04:53:13 +01:00
Benjamin Otte
b6aa011c43 cellrenderer: Add EXPANDED and EXPANDABLE states
These make more sense as flags than they do as properties of the cell
renderer.
2011-12-16 04:53:13 +01:00
Benjamin Otte
953b4aedf1 tests: Add a test for latest commit 2011-12-16 04:53:05 +01:00
Benjamin Otte
94f00eb04d widget: Don't change sensitive state with insensitve parent
This way child.set_sensitive(True) with an insensitive parent doesn't
cause child to become sensitive.
2011-12-16 04:50:11 +01:00
Benjamin Otte
1377ff08c0 fontchooserwidget: Handle dpi < 0
Just use 96.0
2011-12-16 04:50:11 +01:00
Matthias Clasen
14f1811158 Add new symbols 2011-12-15 22:40:01 -05:00
Cosimo Cecchi
f0714338b3 iconhelper: treat the empty string as a NULL icon name
Treat the empty string as if it was a NULL icon name instead of
rendering GTK_STOCK_MISSING_IMAGE.
This used to be the previous behavior of GtkCellRendererPixbuf and
applications might still rely on it.
2011-12-15 20:01:35 +01:00
Cosimo Cecchi
798413151f cellrendererpix: save the icon size locally instead of in the helper
We need to save the icon size locally for GtkCellRendererPixbuf, since
its properties are set again every time it's drawn (resetting the icon
size on the helper by means of _gtk_icon_helper_clear() each time).
2011-12-15 19:59:24 +01:00
Cosimo Cecchi
69a5b3af94 menuitem: cleanup arrow-spacing fetch code
Refactor get_arrow_size() to return the spacing as well, since basically
we always need both.
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
05e62e0251 menuitem: share code between HFW and non-HFW height requests
The code is very similar; having two slightly different code paths is
bad and can lead to bugs. Refactor the code to use the same height
request function.
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
4d76b10ce5 menuitem: properly respect padding when drawing the separators
Use the padding when calculating the draw coordinates of the separator.

https://bugzilla.gnome.org/show_bug.cgi?id=666242
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
713df0c72b menuitem: force odd height if we're not using wide separators
So that the 1px line can receive the same amount of space above and
below.

https://bugzilla.gnome.org/show_bug.cgi?id=666242
2011-12-15 18:52:30 +01:00
Cosimo Cecchi
20e94c1275 menuitem: don't request twice the padding for separator menu items
Padding was requested twice for separator menu items.

https://bugzilla.gnome.org/show_bug.cgi?id=666242
2011-12-15 18:52:30 +01:00
Florian Müllner
3b0a9c59cc demo: Add test for hide-titlebar-when-maximized
Add an additional option to the appwindow demo to test the new
gtk-hide-titlebar-when-maximized setting.

https://bugzilla.gnome.org/show_bug.cgi?id=665616
2011-12-15 16:31:57 +01: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
Cosimo Cecchi
cfa0339559 scale: remove unused variable 2011-12-15 12:16:09 +01:00
Rui Matos
1235dc320b widget: Synthesize crossing only if sensitivity changed while propagating state 2011-12-14 17:03:44 +00:00
Andrea Cimitan
40423df234 Add has-origin property for GtkScale
If the scale has an origin (it will have one by default), GtkRange will
render the two sides before/after the current value with different style
classes, making it possible for themes to use different colors and
properties for the two areas.
This was possible in GTK 2 with style details, but got lost during the
road to 3.0.

https://bugzilla.gnome.org/show_bug.cgi?id=665140
2011-12-14 17:16:09 +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
Pavol Šimo
c66fd84523 Updated Slovak translation 2011-12-14 14:19:06 +01:00
Jan Rękorajski
f807f7834f print dialog: Fix authentication logic
Reset state of CUPS requests correctly during authentization and
check CUPS requests for errors.
Don't initialize variables holding password and username with empty
string (#664640).
2011-12-14 14:09:48 +01: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
Alexander Larsson
10b5ec20f2 Fix set_focus_child handling during focus changes
In many cases we used to set focus_child to NULL all the way up
to the top and then to the right value, even if there was
a common ancestor, meaning these see a temporary NULL value for
focus_child. Only when the new focus widgets direct parent was
in the previous ancestor list did we stop early.

This fixes that by always stopping propagation when reaching
the common ancestor.
2011-12-14 00:26:40 +01:00
Claudio Saavedra
064204da9b GtkFrame: Fix a casting in the compute_child_allocation() method
The casting used to calculate the child allocation is confusing MAX().
As a result, width and height end up with negative values, which makes no sense.

https://bugzilla.gnome.org/show_bug.cgi?id=666109
2011-12-13 20:26:30 +02:00
Cosimo Cecchi
a7f3a9ff74 themingengine: split a GtkThemingBackground object
Allows easier modification and general sanity of the CSS background
rendering code.
2011-12-12 12:46:52 +01:00
Cosimo Cecchi
1e23a74a95 image: take misc padding into account when calculating x/y draw coords
This fixes the misc-alignment.ui reftest.
2011-12-12 12:30:27 +01:00
Cosimo Cecchi
b215aeacc8 image: add gtk_image_get_preferred_size()
Add a function to query the preferred size of the GtkImage, and use it
in the get_preferred_width/height implementations.
2011-12-12 12:29:21 +01:00
Benjamin Otte
92929b968b treeview: Ensure selection's changed signal
There was a corner case where the changed signal was not emitted.
If rows were built like this:
  1    (not selected)
  + 2  (selected)
  + 3  (not selected)
And row 1 was removed, no signal would be emitted.

I like it when writing tests actually finds bugs that have been around
since 2003 - introduced by 4a03ea2334
actually. :)
2011-12-10 08:00:26 +01:00
Benjamin Otte
d4d2cc14d2 treeview: Don't try to optimize away selection_changed signal
We get certain cases, in particular with SELECTION_MULTIPLE, where we
cannot figure out in advance of real_set_cursor() if the selection will
actually change.
2011-12-10 08:00:26 +01:00
Benjamin Otte
ef4c4b7836 tests: Add select/unselect calls 2011-12-10 08:00:26 +01:00
Benjamin Otte
559c3c7da1 treeview: Add a CURSOR_INVALID flag to set_cursor_row()
This is necessary so the code doesn't attempt to do things with the
previous cursor, which currently cause crashes.
2011-12-10 08:00:26 +01:00
Benjamin Otte
d3bccfbb6d treeview: Replace lots of boolean args with flags
I want to add more and 3 boolean args is essentially unreadable code.
2011-12-10 08:00:26 +01:00
Benjamin Otte
bf47d8d499 tests: Add sanity checks for selection
We want to know that the selection emits "changed" when it changes.
2011-12-10 08:00:26 +01:00
Benjamin Otte
4dbedb7481 docs: Update code demo for newer glib 2011-12-10 08:00:26 +01:00
Benjamin Otte
4d3986e709 tests: Dump the operation that is performed to stderr 2011-12-10 08:00:26 +01:00
Benjamin Otte
6e099a11ae tests: Make treechanging test run as fast as possible 2011-12-10 08:00:26 +01:00
Benjamin Otte
1a2932ba29 treeview: Handle the case where the cursor row gets deleted
Previously, the cursor would just become invalid, which used to
reselect the first row in the treeview later on (without a
cursor-changed signal). This leads to a crash now with the recent
refactorings.

The patch is longer than I'd like it to be, but the situation is kinda
complicated, because we want to make sure to move the cursor to a good
row. It works like this:
1) From the deleted row, search forward for the first row that is not
   going to be deleted and is not a separator.
2) If no such row exists, search backwards for a row that is not a
   separator.
3) If no such node exists, clear the cursor.
2011-12-10 08:00:26 +01:00
Benjamin Otte
e01af5c5c9 treeview: Replace cursor handling by keeping the node
Previously the code used a GtkTreeRowReference, which was (a) less
performant and more importantly (b) hiding errors.
The errors being hidden were the referenced row becoming invalid or
collapsed, because such rows would not be valid cursor rows and it would
be necesary to select a new row and emit a "cursor-changed" signal.

So if a crash bisects down to this commit, it is very likely that the
cursor has not correctly been updated and the cursor row is invalid.
2011-12-10 08:00:26 +01:00
Benjamin Otte
2a59265df1 tests: Put random number into local variable
This way, we can see what function had previously been called when the
checks fail.
2011-12-10 08:00:25 +01:00
Benjamin Otte
78aad2d35c treeview: Use _gtk_rbtree_contains() in a11y code 2011-12-10 08:00:25 +01:00
Benjamin Otte
710a8435cc rbtree: Add _gtk_rbtree_contains()
It's useful in a bunch of places, so split it out
2011-12-10 08:00:25 +01: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
Denis Arnaud
fba5ca3330 Updated Breton translation 2011-12-09 04:31:33 +01:00
Denis Arnaud
517be09cda Updated Breton translation 2011-12-09 04:20:51 +01:00
Matthias Clasen
9bf17a95e5 Revert 3fd7dbc940
Calling gdk_keymap_add_virtual_modifiers causes _all_ virtual
modifiers to be added, which causes problem when they are co-located
on the same real modifier (as Super and Hyper often are). Effectively,
this made it impossible to enter key combinations involving Super,
since they all turn into Super+Hyper.
2011-12-08 12:44:19 -05:00
Matthias Clasen
e43080a0c2 Test some virtual modifiers
This adds some accelerators involving Super and Hyper to testmerge.
This helps in testing our accel matching for those.
2011-12-08 08:02:18 -05:00
Timothy Arceri
36effbb307 print to file: fixed lost filename in gui
Stop widget creating an event before updating both directory and
filename values.

https://bugzilla.gnome.org/show_bug.cgi?id=603823
2011-12-07 20:04:38 -05:00
Benjamin Otte
6454c718dd overlay: Properly allocate the child upon addition
This ensures that after addition the child gets assigned the proper
allocation and the child window is properly shown/hidden.
2011-12-08 00:24:28 +01:00
Benjamin Otte
003d80dbea overlay: Move code
Move code for child allocation into the child allocation function. Don't
keep it in the overlay allocation code.

See the next commit for why this is useful.
2011-12-08 00:24:28 +01:00
Benjamin Otte
f34d0d6f7b overlay: Create child window before setting parent
Otherwise, the window will not be used when set_parent() maps the child.
2011-12-08 00:24:28 +01:00
Rui Matos
6ed5918718 progressbar: Set state flags on draw
We were missing setting state flags on the style context before drawing.
2011-12-07 22:42:56 +00:00
Rui Matos
7a6babfd02 widget: Unset window-unfocused in gtk_widget_unparent()
Widgets without a parent aren't inside a toplevel window so we must remove
window-unfocused as it doesn't make sense outside a toplevel.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-12-07 22:41:58 +00:00
Benjamin Otte
807a449f29 treeview: Fix crash when scrolling to end
This broke in a4630d0e7b

https://bugzilla.gnome.org/show_bug.cgi?id=665741
2011-12-07 20:12:12 +01: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
Benjamin Otte
c24742e789 modifierstyle: Fix compile errors
Introduced in 7bd2446801
2011-12-06 18:01:57 +01:00
Alexander Larsson
288b1539d1 Fix demo to use a "normal" transparent value now that it works.
The last commit fixed this, so lets have a sane value in the demo code.
2011-12-06 14:12:24 +01:00
Alexander Larsson
7bd2446801 Remove broken optimization in style modifier overrides
We used to only set the override color or font if it was different
than the existing value. However, that means you can't change it to
an override that is the same as the default value for the property.

With this fixed you can e.g. override with a color of 0,0,0,0 which
you couldn't before.
2011-12-06 14:12:23 +01:00
Matthias Clasen
b558885221 Try to fix linking
We need to link against gdk against pangoft2 on X11.
Also add Requires.private to gdk-3.0.pc, and try to clean
things up some.

https://bugzilla.gnome.org/show_bug.cgi?id=665326
2011-12-05 20:58:21 -05:00
Alexander Larsson
4962167864 gtk-demo: Add test of transparent GdkWindows
This shows a semi-transparent shadow from a GtkOverlay window
2011-12-06 00:23:58 +01:00
Matthias Clasen
d978ed85ae Remove an unused variable 2011-12-05 18:07:41 -05:00
Carlos Garnacho
029a884d9e gtk,notebook: Invalidate the gap side when reordering tabs
This narrow area is invalidated so the gap follows the tab
being reordered.
2011-12-05 21:23:23 +01:00
Alexander Larsson
fd06890354 notebook: Make the tab reordering dnd window transparent 2011-12-05 21:15:06 +01:00
Cosimo Cecchi
392cdff697 statusicon: fix the build on !X11
Uninevitable fallout from my last patch to GtkStatusIcon. Thanks to Rob
Bradford for testing this.
2011-12-05 13:22:20 -05:00
Benjamin Otte
4259a27cf5 widget: Update Pango context on state change
The layout depends on the state flags, so it must be updated when they
change.
2011-12-05 18:27:05 +01:00
Benjamin Otte
c3cccf586c label: Clear layout on state change
Selected or active text might be rendered differently.
2011-12-05 18:27:05 +01:00
Benjamin Otte
5ac6950dd6 label: Move callback to new stuff
We want to react to state flags changing, not to the (deprecated) state
type changing.
2011-12-05 18:27:05 +01: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
Cosimo Cecchi
d80ff7b5f1 stylecontext: always add the ARROW style class when rendering an arrow
When gtk_render_arrow() is called, always add an ARROW style class to
the GtkStyleContext before rendering, so themes can specify a different
color for it.

https://bugzilla.gnome.org/show_bug.cgi?id=665420
2011-12-05 09:37:21 -05:00
Cosimo Cecchi
c538fb8f64 stylecontext: add GTK_STYLE_CLASS_ARROW
For e.g. submenu items arrow in GtkMenuItems.

https://bugzilla.gnome.org/show_bug.cgi?id=665420
2011-12-05 09:30:57 -05:00
Cosimo Cecchi
2e01dc1b7a statusicon: port to GtkIconHelper
Just always render the pixbuf ourselves and set it on the GtkImage in
the X11 case.
Code for other backends was already rendering the pixbuf manually before
translating it into a native type, so this greatly simplifies the code.

https://bugzilla.gnome.org/show_bug.cgi?id=665409
2011-12-05 09:09:43 -05:00
Alexander Larsson
c47ef89aca Merge branch 'transparent-windows' 2011-12-05 14:24:28 +01:00
Alexander Larsson
93c086ec80 Make window handle transparent
Instead of painting the window background on the grip_window we now
only paint it on the GtkWindow->window, and we make the grip_window
have a transparent background.

We can't really make transparent window handle background optional
via css atm, because the handle color is actually based on the
background color, so if that is set to transparent we won't draw
anything.
2011-12-05 12:51:55 +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
Cosimo Cecchi
2bf765ab49 entry: avoid a mismatched cairo_save/restore
Leftover from GtkIconHelper migration.
2011-12-04 19:58:28 -05:00
Paolo Borelli
5a471fefdb Remove unused alignment from GtkTooltip. 2011-12-04 19:20:23 +01:00
Paolo Borelli
7c779a0bee Plug tiny leak in the css parser 2011-12-03 17:52:24 +01:00
Kristian Høgsberg
0dd1f7edbc wayland: Update to recent API changes 2011-12-02 05:41:43 -05:00
Claudio Saavedra
f9c24e8f03 GtkIconView: fix a memory corruption in the drag-n-drop code
You shall free with g_slice_free() what you allocate with
g_slice_new().

https://bugzilla.gnome.org/show_bug.cgi?id=665338
2011-12-01 22:56:43 +01:00
Alexander Larsson
7a263c68a0 gdk: Fix repaint of layered region during move_region 2011-12-01 22:08:00 +01:00
Alexander Larsson
8e28f53a1d gdk: Fix repaint of layered region during scroll 2011-12-01 22:08:00 +01:00
Alexander Larsson
f0c8c4a94b gdk: Fix repaint of layered region during raise 2011-12-01 22:07:59 +01:00
Alexander Larsson
0f6784a919 gdk: Make sure we don't copy to/from layered regions when moving a window 2011-12-01 22:07:59 +01:00
Alexander Larsson
46d5b89830 gdk: Track the layered area
We track the areas that have alpha coverage so that we can
avoid using these as sources when copying window contents.
We also don't remove such areas from the clipping regions so
that they are painted both by parent and child.
2011-12-01 22:06:44 +01:00
Alexander Larsson
f51482e283 gdk: Track wether windows have alpha in the background
This will let us handle such windows differently in the
drawing machinery
2011-12-01 22:03:51 +01:00
Alexander Larsson
30ad4e676f testwindows: Add a button to cause a repaint
This makes it easy to find various kinds of repaint bugs
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
Cosimo Cecchi
58b1f24d6d image: use the default icon size if no icon size is provided
If no icon size is provided (e.g. when setting icon-name or stock-id
using the GObject property directly), use the default icon size. This
matches the previous GtkImage behavior.
2011-11-30 19:47:52 -05:00
Cosimo Cecchi
0c68227270 image: minor cleanup 2011-11-30 19:47:52 -05:00
Paolo Borelli
2ef5844bac Introduce gtk_render_insertion_cursor
The new function provides an API that takes the PangoLayout and index
as input params, this way it handles strong and weak cursors internally
factoring out all code duplicated in the widgets that need to render
cursors.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
3c6842222a Use the split-cursor setting for textview cursors
Explicitely check the split-cursor setting when drawing the textview
insertion cursor instead of relying on the cursor_direction set in the
textlayout. This makes the cursor drawin code more uniform with other
widgets in preparation to refactoring the cursor drawing code in a
shared function.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
0bff1af7a2 Rework GtkTextView cursor code.
Move the handling of primary/secondary cursors to gtktextdisplay, which
makes code simpler and more consistent to how GtkLabel and GtkEntry
draw cursors, which is useful in preparation to further refactoring.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Paolo Borelli
b3f850e6b9 Tiny cleanup.
https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:38 +01:00
Paolo Borelli
f18bbdff53 Remove draw_insertion_cursor in label and entry
Remove the the draw_insertion_cursor wrapper which just converts from
GtkTextDir to PangoDirection

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:38 +01:00
Cosimo Cecchi
772459979f image: simplify code
We can unconditionally call into the icon helper methods now that we
removed the g_return_val_if_fail() checks.
2011-11-30 19:06:38 -05:00
Cosimo Cecchi
d47e82ffdd entry: simplify code
We can unconditionally call into the icon helper methods now that we
removed the g_return_val_if_fail() checks.
2011-11-30 19:05:34 -05:00
Cosimo Cecchi
864c5610f8 icon-helper: remove useless checks
When we change storage type, we always clear the rest of the object, so
these checks do not add any safety.
2011-11-30 19:04:17 -05:00
Cosimo Cecchi
d300ddc5e4 icon-helper: don't warn out when the icon size is GTK_ICON_SIZE_INVALID
We can call ensure_icon_size() for an empty image; don't warn out in
that case, but just return a zero width.
2011-11-30 18:32:01 -05:00
Cosimo Cecchi
e37c55aa3e icon-helper: don't reset pixel_size when clearing the helper
Don't reset the pixel size when clearing the helper; pixel-size is e.g a
property of GtkImage, which is stable unless explicitly set.
2011-11-30 18:15:05 -05:00
Cosimo Cecchi
5224302a30 entry: always prepare the style context when using it for entry icons
Make sure to always prepare the entry's style context for the entry icon
style when passing it to GtkIconHelper.
2011-11-30 16:39:59 -05:00
Cosimo Cecchi
126651f889 cellrendererpix: make sure to select the default helper as a fallback
If we don't have expander pixbufs, select the default helper to render
the icon, even if the cell is an expander. This mimics what the old code
did.
2011-11-30 16:39:59 -05:00
Cosimo Cecchi
0304cc04d3 cellrendererpix: port to GtkIconHelper 2011-11-30 16:39:59 -05:00
Cosimo Cecchi
a4d6505cb3 entry: port to GtkIconHelper 2011-11-30 16:39:59 -05:00
Cosimo Cecchi
adbfbb7278 dnd: port to GtkIconHelper 2011-11-30 16:39:59 -05:00
Cosimo Cecchi
f085dde830 image: port to GtkIconHelper
Use newly introduced GtkIconHelper to render pixbufs in GtkImage.
2011-11-30 16:39:59 -05:00
Cosimo Cecchi
b5d8d2c4a8 icon-helper: add GtkIconHelper private object
GtkIconHelper is a helper object to easily obtain a pixbuf from
different icon sources (e.g. a GIcon, an icon name, a stock id, ...).

Code is ported from GtkImage, which will be adapted in the next commit.
2011-11-30 16:39:59 -05:00
Stef Walter
d462f86aad GtkCssProvider: don't segfault when CSS file is not found
* Fix null dereference in gtk_css_provider_take_error()
 * And another in gtk_css_provider_emit_error()

https://bugzilla.gnome.org/show_bug.cgi?id=664537
2011-11-30 00:23:07 -05: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
Federico Mena Quintero
830bc4304c [GtkFileChooserDefault] Don't destroy and re-create the filename entry
This is a leftover from the big rework to remove the expanded/collapsed mode
in Save mode.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-11-29 15:11:56 -06:00
Federico Mena Quintero
463c98a9d7 [GtkPathBar] Remove unused error argument
It used to be that _gtk_path_bar_set_file() would return an error if
it wasn't able to switch to the specified file, but that hasn't been
the case for a long while now, since the file chooser became async.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-11-29 15:11:54 -06:00
Paolo Borelli
58d247d7ae Avoid shadowing a variable
Move bg_color variable to an inner scope.
2011-11-29 21:28:30 +01:00
Federico Mena Quintero
7fb00c919e [path-bar] Add some comments to explain the async recursion on an I/O callback
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-11-29 14:17:04 -06:00
Federico Mena Quintero
6ce48345ce [path-bar] Only reset the children's styles if the children actually changed
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-11-29 14:17:02 -06:00
Federico Mena Quintero
07eb8d6952 Remove unused argument
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-11-29 14:17:00 -06:00
Benjamin Otte
5317cb1263 filechooserdefault: Don't unref value twice
Double unref was introduced in eb02dacb37

https://bugzilla.gnome.org/show_bug.cgi?id=646461
https://bugzilla.gnome.org/show_bug.cgi?id=664137
2011-11-29 20:44:57 +01:00
Benjamin Otte
7d3109a855 treeview: Properly change cursor when row is collapsed
Previously, when the cursor was a descendant of the collapsed row,
the cursor path was set to the collapsed row, but this was not
communicated via cursor-changed events.
2011-11-29 20:44:57 +01:00
Benjamin Otte
bbf00265fc treeview: Reorder code a bit
This is mainly in preparation for the next commit, but also to reorder
the code to
1) prepare modification of tree
2) modify tree
3) emit signals
2011-11-29 20:44:57 +01:00
Mike Gorse
160e1c085c tests: Add new test that is currently failing 2011-11-29 20:44:57 +01:00
Benjamin Otte
c070e7acf5 treeview: Simplify code
Since the changes in commit 2b3de3dd this simplification is possible.
2011-11-29 20:44:57 +01:00
Benjamin Otte
806dca0677 treeview: Rename function
_gtk_tree_view_find_path() was not a name that not really described what
the function does. And I kept forgetting it. Also, it took the tree view
as an argument and that was completely unnecessary.
2011-11-29 20:44:57 +01:00
Benjamin Otte
b843aa14c4 tests: Add automatic expanding/collapsing
Makes the test test even more stuff.
2011-11-29 20:44:57 +01:00
Benjamin Otte
caa9ca94cc tests: Fix the iter stepping code
The old code actually was wrong and could cause assertions and crashes,
in particular when stepping out of a deep tree back onto the highest
layer.
2011-11-29 20:44:57 +01:00
Benjamin Otte
64ff56e718 tests: Check that the cursor keeps up to date
This actually demonstrates a bug where the treeview doesn't emit a
cursor-changed signal when the cursor row is deleted.
2011-11-29 20:44:57 +01:00
Benjamin Otte
763e4b9f45 reftests: Fix test for border-image addition 2011-11-29 20:44:57 +01:00
Cosimo Cecchi
924efd40e8 widget-factory: make one of the two spinbuttons active 2011-11-29 10:52:03 -05:00
Cosimo Cecchi
ae60f00ba4 themingengine: fix a typo 2011-11-29 10:52:03 -05:00
Cosimo Cecchi
41b56d87e7 themingengine: move code to make switch-case more clear
Code is more readable with the default case as the last one in the
switch block.
2011-11-29 10:52:02 -05:00
Yuri Myasoedov
03217c2019 Updated Russian translation 2011-11-29 00:08:56 +04:00
Cosimo Cecchi
f7d95b5fe3 pathbar: add the linked style class to GtkPathBar 2011-11-28 14:41:48 -05:00
Cosimo Cecchi
6740121fab stylecontext: add GTK_STYLE_CLASS_LINKED
"linked" is a style class for linked areas, such as a box containing
buttons belonging to the same control.
2011-11-28 14:41:48 -05:00
Javier Jardón
f920d968f6 gtk/gtkeditable: Some docs fixes 2011-11-28 15:23:00 +00:00
Cosimo Cecchi
10cfa90817 spinbutton: redesign to use an horizontal layout
Rewrite GtkSpinButton to use a touchscreen friendly horizontal layout.
Other features include:
- support for theming buttons with nth-child
- full support for RTL
- use + and - symbolic icons instead of arrows
- general streamlining and cleanup of a lot of related code

https://bugzilla.gnome.org/show_bug.cgi?id=663359
2011-11-28 09:40:23 -05:00
Alexander Larsson
03b7bb6e29 win32-theme: Make tabs look better 2011-11-28 10:06:38 +01:00
Alexander Larsson
eb44036346 Support border-image in theme_engine_render_frame_gap
This is similar to the normal frame rendering, but has a clip
region applied for the gap.
2011-11-28 10:05:29 +01:00
Alexander Larsson
267b51ec98 win32-theme: Add some margins on GtkScale trought to look like win32 2011-11-28 09:14:13 +01:00
Alexander Larsson
21c7e8cf47 win32-theme: Support custom margins in win32 theme parts 2011-11-28 09:13:54 +01:00
Alexander Larsson
7756f49995 Fix up makefile rules for parallel builds
The gtkwin32css.h generation code used a temporary filename that was also
used by some other files, which is racy. Use a unique one.
2011-11-28 09:12:28 +01:00
Alexander Larsson
7c092be0ce win32-theme: Make syntax for mixing theme parts more regular
This lets us extend the argument list better
2011-11-28 08:58:41 +01:00
Alexander Larsson
6898ba4f76 win32-theme: Make notebook tabs slightly better 2011-11-25 16:43:51 +01:00
Alexander Larsson
3f206dcd83 win32-theme: Fix background colors for new bg drawing 2011-11-25 16:40:25 +01:00
Alexander Larsson
db5e3872f5 Fix up background-origin now that we correctly handle the background color 2011-11-25 16:14:20 +01:00
Alexander Larsson
75642d3af2 css: Always draw the bg color under the bg image 2011-11-25 16:14:20 +01:00
Alexander Larsson
9fd4e954b5 Reftest background-origin with various background-clip values 2011-11-25 16:14:20 +01:00
Alexander Larsson
d8d7c7c171 Update background-area reftest for background-clip 2011-11-25 16:14:20 +01:00
Alexander Larsson
8411f1a279 Implement background-clip and background-origin 2011-11-25 16:14:19 +01:00
Alexander Larsson
330fd3b614 Add GtkCssArea enum
This will be used for background-clip and background-origin css properties.
2011-11-25 16:14:19 +01:00
Alexander Larsson
34e15566e3 Add reftest to test border-style: none
From the css docs at http://www.w3.org/TR/CSS2/box.html:

8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width',
'border-left-width', and 'border-width'

Computed value:  	absolute length; '0' if the border style is 'none' or 'hidden'

So, if i specify border-style none and a border-width > 0 that should give the
same result as border-width 0.
2011-11-25 16:14:10 +01:00
Alexander Larsson
c276f53796 Make computed value of border-width 0 if border-style none
From the css docs at http://www.w3.org/TR/CSS2/box.html:

    8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width',
    'border-left-width', and 'border-width'

    Computed value:  	absolute length; '0' if the border style is 'none' or 'hidden'
2011-11-25 15:36:08 +01:00
Alexander Larsson
91dcf4000b css: Convert border style parsing to use enums 2011-11-25 15:36:08 +01:00
Alexander Larsson
d85aabe1e3 Rename GTK_CSS_REPEAT_STYLE_NONE to GTK_CSS_REPEAT_STYLE_STRETCH
This is a private type, and the CSS default value is "stretch", which
is how we were parsing and printing NONE anyway.

With this fix we can use the enum stuff for printing/parsing
2011-11-25 15:36:08 +01:00
Alexander Larsson
2a42fad145 css: Use enum parsing for background repeat style 2011-11-25 15:36:08 +01:00
Alexander Larsson
8fb4b13730 css: Break out enum parse/print helper
We need this to parse non-GValue enums
2011-11-25 15:36:08 +01:00
Alexander Larsson
3e24029415 css: Parse enums with new case-insensitive helper 2011-11-25 15:36:08 +01:00
Alexander Larsson
1a68afffaf css: Add _gtk_css_parser_try_enum
This helps parsing GType enums in CSS, properly handling
CSS being case insensitive.
2011-11-25 15:36:08 +01:00
Alexander Larsson
c9a3332ede Add generation of private g-types for private headers
This starts with just the gtkcsstypesprivate.h header
2011-11-25 15:36:08 +01:00
Benjamin Otte
f412293a2d reftests: Make sure border-image-gradient keeps working
.. even with more advanced themes.
2011-11-25 15:12:45 +01:00
Benjamin Otte
9da7cc776c tests: Add testtreechanging
It's just a treestore going crazy while the treeview has to keep up.
2011-11-25 15:12:45 +01: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
Benjamin Otte
a63b6cc7f1 tests: Add prop editors to testtreeview
It tests treeviews, so we'd better be able to edit them :)
2011-11-24 18:29:45 +01:00
Benjamin Otte
9011bf9e3b reftests: Mark windows as popups
Improves performance, gets rid of resize grip.
2011-11-24 18:29:45 +01:00
Benjamin Otte
08d86fabc4 a11y: Implement ref_state_set using the new APIs
Various tiny semantic changes in here.

The big fix is that we consider every cell as visible and as showing if
the treeview is mapped.
This was also fixed in the tree dump test.
2011-11-24 18:29:45 +01:00
Benjamin Otte
178686ba11 a11y: Add get_renderer_state() to cell accessibles
Accessibles can use this function to query the state that their row
would be rendered with.
2011-11-24 18:29:45 +01:00
Benjamin Otte
bcafd9ba3c a11y: Add _gtk_cell_accessible_set_cell_data()
See the function documentation for details.

Also included is the implementation for the treeview, but no users yet.
2011-11-24 18:29:45 +01:00
Benjamin Otte
416b3ed204 treeview: Notify a11y about reordered rows
That way, no more signal handler is needed in the a11y code. Plus, we
avoid needless signal emissions for rows we don't care about.
2011-11-24 18:29:44 +01:00
Benjamin Otte
fbfbaa3d50 a11y: Don't create fake cell renderers 2011-11-24 18:29:44 +01:00
Florian Müllner
b72b4e79cf build: Add gmodule-2.0 dependency for gtk-query-immodules-3.0 2011-11-24 16:33:02 +01:00
Alexander Larsson
35ffd4cfea win32-theme: Fix up radio and menus in various states
This makes all states in widget-factory look ok
2011-11-24 11:50:02 +01:00
Alexander Larsson
c066136c3a win32-theme: Theme column headers 2011-11-24 11:50:01 +01:00
Christian Persch
af0537bce1 prop-editor: Implement property editing for GdkRGBA properties
Bug #664467.
2011-11-23 18:25:29 -05:00
Christian Persch
2831151405 Revert "tests: use GdkRGBA instead GdkColor"
This reverts commit 85747da972.

Conflicts:

	tests/prop-editor.c

Bug #664467.
2011-11-23 18:25:27 -05:00
Christian Persch
3abc31a2d1 color-button: Notify "color" and "alpha" properties when changing the rgba
Bug #664469.
2011-11-23 18:19:48 -05:00
Matthias Clasen
b84d37af4d GtkIconView: Fix a segfault
Keynav on an empty iconview was causing segfaults. This
was reported in https://bugzilla.gnome.org/show_bug.cgi?id=664456
2011-11-23 17:51:58 -05:00
Federico Mena Quintero
e8be9ec01f bgo#662814 - Don't print a g_warning() when GtkRecentManager can't find a file
Also, *do* add the file to the recently-used list, even if the file does not
exist yet.  This is used from the Save dialog, so even shitty apps which don't
add the file to GtkRecentManager, will get the file added from the Save dialog.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2011-11-23 09:44:26 -06:00
Cosimo Cecchi
92e6444163 widgetpath: correctly print the siblings index
In gtk_widget_path_to_string() we were counting siblings from zero
instead of one, resulting in confusing output.
2011-11-23 11:22:30 -05:00
Cosimo Cecchi
0d71f62388 frame: don't access padding before it's initialized
Move padding initialization before its first access.
2011-11-23 11:21:29 -05:00
Benjamin Otte
6a6af8464b gtk-demo: Fix segfault in editable cells demo
The strings can be freed when edting the description column. This does
not work with constant strings.
2011-11-22 23:29:04 +01:00
Benjamin Otte
6d0499a500 rbtree: Rewrite to not lose node order
_gtk_rbtree_reorder() was moving the node's data while reordering. As we
use the node pointer in the a11y code as a hash key, this didn't work.

So this rewrite changes that. As a bonus, it is less code and faster.
Woohoo!
2011-11-22 23:29:04 +01:00
Benjamin Otte
3166457802 tests: Add test for _gtk_rbtree_reorder() 2011-11-22 23:29:04 +01:00
Benjamin Otte
c1124df1f2 tests: Speed up rbtree test
We don't need so many tree consistency checks while creating when the
test is about something else.
2011-11-22 23:29:04 +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
abc787a5ac Move pangoft2 to Requires.private
We have pango in Requires anyway, and this is just so we
can call pangofc api ourselves.
2011-11-22 09:42:31 -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
Benjamin Otte
d8b6414567 rbtree: Remove needless tests
if the checks are run on the nil node, they will get the second test the
  way we expect it anyway, so it's unnecessary.
2011-11-22 03:42:31 +01:00
Benjamin Otte
ae99a9e04a rbtree: Simplify rotation functions
- Make sure the rotated nodes aren't nil
- Use existing functions for complex computations
- Don't use NULL checks for variables guaranteed to not be NULL/nil
2011-11-22 03:32:56 +01:00
Benjamin Otte
37786804e1 rbtree: Remove the nil member 2011-11-22 03:32:56 +01:00
Benjamin Otte
a4630d0e7b rbtree: Introduce _gtk_rbtree_is_nil()
Makes for more readable code than "== tree->nil" and allows removing the
nil member later.
2011-11-22 03:32:56 +01:00
Benjamin Otte
c3056951db rbtree: Introduce _gtk_rbtree_first()
... and use it.
2011-11-22 03:32:56 +01:00
Benjamin Otte
73a834336f rbtree: Replace nil node allocation with a preallocated nil
This has one major caveat: The new value is const, so read-only memory.
Any attempt to write to it will cause a crash. Note that we are not ever
supposed to write to it, but bugs happen...
2011-11-22 03:32:56 +01:00
Matthias Clasen
fa89423346 Bump version 2011-11-21 18:34:11 -05:00
Matthias Clasen
84c0ccad47 3.3.4 2011-11-21 18:14:13 -05:00
Matthias Clasen
7c6bbf59d7 More updates 2011-11-21 17:12:27 -05:00
Benjamin Otte
e2f2289d72 tests: Add a test for the rbtree code. 2011-11-21 22:33:46 +01:00
Benjamin Otte
647c441e26 rbtree: Don't write to nil node
The code used to set nil->parent, which could cause segfaults. Don't do
that. We also need to pass the parent explicitly to the fixup code,
because the node during fixup may be the nil node.
2011-11-21 22:33:46 +01:00
Benjamin Otte
f4fe921a17 rbtree: Add a local variable
This will be needed in the next patch, and I wanted to split that patch
up.
2011-11-21 22:33:46 +01:00
Benjamin Otte
02671f9ec9 rbtree: Move to an approach where we don't move contents
So instead of copying the children and height to the new node, we keep
the old node and copy all the old stuff to it.

This is necessary so the accessibility code can use the node as a key in
the hash table or store the node as a reference to the row instead of
GtkTreeRowReference. And because it already does that (oops), this fixes
a bunch of segfaults with a11y enabled.
2011-11-21 22:33:45 +01:00
Benjamin Otte
1dd9dd45c1 rbtree: Use gtk_rbnode_adjust() even more
Use it for the modified node in gtk_rbnode_remove(). Cleans up the code
quite a lot.
2011-11-21 22:33:45 +01:00
Benjamin Otte
769186dbff rbtree: Use gtk_rbnode_adjust()
Make gtk_rbnode_remove() use it when unlinking the node.
2011-11-21 22:33:45 +01:00
Benjamin Otte
ba7a0a0188 rbtree: Use gtk_rbnode_adjust() more.
Make _gtk_rbtree_node_set_height() use it.
2011-11-21 22:33:45 +01:00
Benjamin Otte
7b2d414222 rbtree: Use gtk_rbnode_adjust() more
Make _gtk_rbtree_insert_before() use it.
2011-11-21 22:33:45 +01:00
Benjamin Otte
01a44e2a16 rbtree: Use gtk_rbnode_adjust()
Make _gtk_rbtree_insert_after() use it.
2011-11-21 22:33:45 +01:00
Benjamin Otte
22a4c15b4f rbtree: Split out a common function
gtk_rbtree_adjust() will adjust the summed values of a node and all its
parents in the tree. Currently only implemented by splitting out the
function from gtk_rbtree_free().
2011-11-21 22:33:45 +01:00
Benjamin Otte
54f3fbfe26 rbtree: Don't set variable twice 2011-11-21 22:33:45 +01:00
Benjamin Otte
6168a64713 rbtree: Add assertions to clarify usage 2011-11-21 22:33:45 +01:00
Benjamin Otte
69a516018f rbtree: Mark all debug sections as debug 2011-11-21 22:33:45 +01:00
Benjamin Otte
af2ebe638c rbtree: Make debug functions private
They're not used elsewhere
2011-11-21 22:33:45 +01:00
Cosimo Cecchi
79bbce5577 notebook: use the current page allocation when computing the redraw area
Instead of taking the first page and trying to adjust the rect with
random padding values, take the current page, as it's always guaranteed
to be at least as tall as inactive tabs.
This fixes some annoying 1px drawing artifacts while switching tabs when
the theme disables notebook padding.

https://bugzilla.gnome.org/show_bug.cgi?id=664494
2011-11-21 14:19:36 -05:00
Cosimo Cecchi
f01162c727 notebook: properly subtract the initial_gap width from the tab space
Instead of modifying the allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=664494
2011-11-21 14:19:36 -05:00
Matthias Clasen
7814718152 Drop uses of @returns syntax 2011-11-21 13:12:58 -05:00
Matthias Clasen
7e8b7a72ac Prevent local filesystem influence in the a11y tests
By using the 'unix' gio volume monitor, we avoid variation
in the file chooser that otherwise breaks the 'pickers' test.
2011-11-21 13:05:47 -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
Alexander Larsson
c533482f80 Convert gtk-win32.css to unix line endings 2011-11-21 14:31:17 +01:00
Alexander Larsson
c6dab00595 Add gtk_symbolic_color_new_win32 to gtk.symbols 2011-11-21 13:53:31 +01:00
Alexander Larsson
07e284a1f0 win32-theme: Fix up docs for gtk_symbolic_color_new_win32 2011-11-21 13:52:39 +01:00
Alexander Larsson
4bfa35417b Merge branch 'win32-theme2' 2011-11-21 13:49:44 +01:00
John Ralls
1e737bb61b [icons] text-x-generic isn't a generated icon
Calling it one causes maintainer-clean to delete it.
2011-11-20 16:38:34 -08:00
Javier Jardón
5c6656e485 gtk/gtkapplication.c: Fix typo 2011-11-20 23:05:47 +00:00
Cosimo Cecchi
4626edb889 frame: make sure to allocate the CSS border width
Similar to GtkNotebook, GtkFrame was only allocating space for the
padding width, and not the border.

This could be seen by just running tests/testframe. With a theme that
renders frame borders, setting xthickness = 0 in the test draws the
button border over the frame border, which is wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=664342
2011-11-20 16:03:31 -05:00
Cosimo Cecchi
b9b01f99b6 frame: add GTK_STYLE_CLASS_FRAME in _init()
Instead of adding it every time we use the GtkStyleContext, just add it
in _init().

https://bugzilla.gnome.org/show_bug.cgi?id=664342
2011-11-20 16:03:31 -05:00
Cosimo Cecchi
009224a80e notebook: make sure to allocate the CSS border width
Instead of taking only the CSS padding into account when allocating the
notebook children, also allocate the border width.

https://bugzilla.gnome.org/show_bug.cgi?id=664342
2011-11-20 16:03:31 -05:00
Rui Matos
e60fa49fa7 Bug 653676 - Expand/Collapse doesn't respond after one click
Ignore leave-notify-event when mode is GDK_CROSSING_GTK_[UN]GRAB.
Just [un]grabbing shouldn't cause us to [un]prelight the current arrow
and node.
2011-11-20 21:00:08 +01:00
Kristian Rietveld
44a064fe30 Don't call scroll to cell if the tree view is empty
Account for the case when gtk_drag_finish() didn't actually add a row
(can happen when dragging from an empty tree view to itself ...).
2011-11-20 20:15:48 +01:00
Kristian Rietveld
a069ec662f Bug 660554 - gtk_tree_view_drag_begin: assertion `path != NULL' failed
Turned assertion into silent return.

This assertion is only hit when dragging from an empty tree view.  In
this case, gtk_tree_view_begin_drag() is triggered from gtkdnd.c and not
from gtk_tree_view_maybe_begin_dragging_row().  We actually want to
cancel the drag at this point, but that is not possible with the GTK+
API as far as I can see.

The alternative is to not allowing the drag to start.  This could be
done by simply unsetting the tree view as drag source when it is empty
and setting it as drag source again when rows are added.  I didn't
choose to go with this for now, since this will likely break third party
code.
2011-11-20 20:15:39 +01:00
Kristian Rietveld
64a38bdb82 quartz: fix coding style in quartz-version of gtk_drag_begin_internal 2011-11-20 20:15:32 +01:00
Kristian Rietveld
477b7f27e0 quartz: do not call gdk_drag_begin() twice
This makes drag and drop work again on Quartz.
2011-11-20 20:15:27 +01:00
John Ralls
eafff409c9 [Bug 664238] GTK apps crash when dragging something
Corrects a bad condition in a test in 085b98f4
2011-11-20 10:35:40 -08:00
Jorge González
aa17b2c578 Updated Spanish translation 2011-11-20 10:40:15 +01:00
Matthias Clasen
cd2af02c48 Adapt iconview a11y test output 2011-11-19 19:53:43 -05:00
Matthias Clasen
c3d96ff2c0 Improve AtkText implementations
There was some regressions from the recent display line fix;
while fixing it improve the test coverage and make GtkEntry
and GtkTextView return identical results.
2011-11-19 19:28:48 -05:00
Matthias Clasen
bcc98cf14c Remove leftover debug spew 2011-11-19 18:13:42 -05:00
Matthias Clasen
f2569ba92b Add a missing static 2011-11-19 18:08:18 -05:00
Matthias Clasen
5e11bf18d5 Fix the build 2011-11-19 17:57:26 -05:00
Matthias Clasen
e49fb9f2ac Updates 2011-11-19 16:15:46 -05:00
Matthias Clasen
b63724b08e Drop the Beagle search engine
It is not actively maintained.
2011-11-19 15:32:12 -05: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
Alexander Larsson
88d059ff09 win32: Default to gtk-win32 theme 2011-11-18 16:54:05 +01:00
Alexander Larsson
f59836a4d0 Build in default win32 css as gtk-win32 2011-11-18 16:54:04 +01:00
Alexander Larsson
a38c48be92 Build gtkwin32css.h from gtk-win32.css 2011-11-18 16:54:04 +01:00
Alexander Larsson
e9ac60830d win32-theme: Add gtk-win32.css 2011-11-18 16:53:55 +01: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
Murray Cumming
43dd705308 Fix tiny docs typo. 2011-11-18 11:30:07 +01:00
Alexander Larsson
5f782d2449 win32-theme: Support mixing parts
We need this to do something about the non-existing inconsistent
radio button state in win32.
2011-11-18 11:06:32 +01:00
Alexander Larsson
3309639c1c Add support for win32 theme colors as symbolic colors 2011-11-18 10:16:38 +01:00
Alexander Larsson
ca829b484c Add pulse style class and use in progress bar and entry
This is used for indeterminate progress reporting.
2011-11-18 10:15:04 +01:00
Alexander Larsson
68c74e1427 Set top/bottom style classes on spinbutton buttons 2011-11-17 19:43:13 +01:00
Alexander Larsson
a038c589db Add top/left/bottom/right style classes to steppers
This is needed for e.g. win32 theming, but is also generally
useful.
2011-11-17 17:34:05 +01:00
Alexander Larsson
fdbf029df3 win32-theme: Support multiple parts being combined
This is needed for e.g. scrollbar sliders
2011-11-17 14:34:39 +01:00
Alexander Larsson
5e04549548 Render background image if set for checks and options
The default theme engine draws a fallback check/radio image, but
doesn't let you replace this. We now check if a background image
is set and if so render that instead of the default fallbacks.
2011-11-17 12:30:09 +01:00
Alexander Larsson
bc38cf1ff8 win32-theme: Support -gtk-win32-size CSS value 2011-11-17 12:30:08 +01:00
Alexander Larsson
abe6598a13 Add initial cut at win32 theme support for CSS
We now support -gtk-win32-theme-part(class,part,state) in background
and border-image CSS properties. This renders the corresponding
theme part using DrawThemeBackground() and acts as a base for a
CSS based windows theme.

Note that we build the parsing code even on non-win32 so that
all themese will parse the same on all arches. We draw pink instead
of the actual theme parts on non-win32 though.
2011-11-17 12:29:03 +01:00
Alexander Larsson
8b644b40b1 make _gtk_style_property_resolve copy the result to an output value
This is preparation for allowing it to return a newly created
value, rather than just copying one.
2011-11-17 12:27:23 +01:00
Alexander Larsson
2cf3ff956a Actually pass in a StylePropertyContext when getting images
This is in preparation for getting size-dependent results back
with the win32 themes.
2011-11-17 12:27:23 +01:00
Alexander Larsson
7104b4b575 Remove _gtk_style_properties_peek_property
We want to move to a world where getting style properties can
allocate a new value, depending on the style property context.
In this world we can't expose "peeking" a property, as we neet
to return a ref to the property that is newly created.

So, we move the peek code into get_property and use get_property
from get_valist.
2011-11-17 12:27:22 +01:00
Alexander Larsson
c09148ca09 Add GtkStylePropertyContext and use it in when getting style properties
At the toplevel we have _gtk_theming_engine_get, which lets us pass
in a property context with (atm) the size to get the property for.
Then there is a lot of plumbing to push this down into the lower
layers of the style property code until finally hitting
the property resolvers.

I need this because I will be adding a property resolver for win32
theme parts, and they render differently depending on the size
(i.e. they don't scale linearly). The idea is that the code
to get the background properties will pass in the final size
and we will resolve the theme part specification to that particular
size.

If the old non-context calls are used we just hardcode a size
of 100x100.
2011-11-17 12:27:22 +01:00
Alexander Larsson
e953465e33 Save a generic boxes source in GtkImageBorder
We used to special handle gradient, but we want to be able to store
other sources (that will eventually resolve to cairo patterns).
For instance, this is needed to handle win32 theme part sources.
2011-11-17 12:27:21 +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
Michael Natterer
0308352417 notebook: don't leak the action widgets
The notebook owns them, so it must destroy them in destroy().
(cherry picked from commit 87ebfb19fd)
2011-11-17 01:07:37 +01:00
Benjamin Otte
73e54ab727 viewport: Get rid of deprecation warnings 2011-11-17 00:46:15 +01:00
Benjamin Otte
65ceff35f9 viewport: Don't use deprecated functions 2011-11-17 00:46:15 +01:00
Benjamin Otte
5bacd8e019 viewport: adjustments are never NULL
So there's no need to check for that in the getters.
2011-11-17 00:46:15 +01:00
Benjamin Otte
2939eae20f viewport: Initialize the adjustment in the init function 2011-11-17 00:46:15 +01:00
Benjamin Otte
0ef224766a viewport: Don't unset the adjustment on finalize
We unset it on destroy already. This makes it consistent with all other
scrollables.
2011-11-17 00:46:15 +01:00
Xan Lopez
2c065d716b treeview: fix the build 2011-11-16 22:41:57 +01:00
Cosimo Cecchi
9986b26c0b treeview: use gtk_tree_view_ensure_background() consistently
In gtk_tree_view_state_flags_changed() we were setting the background on
the bin_window without the necessary "view" style class, making the
treeview render with the wrong color in some circumstances (such as when
adding an empty treeview in a window, as spotted by Brian Smith).
2011-11-16 16:09:00 -05:00
Cosimo Cecchi
8d97d8ca3c treeview: factor out gtk_tree_view_ensure_background()
We'll use it shortly.
2011-11-16 15:59:47 -05:00
Kjell Ahlstedt
e8bb2e4545 Maintain map/unmap invariants in GtkRecentChooserDialog
We used to explicitly map and unmap the child GtkRecentChooserWidget when
mapping and unmapping the dialog, respectively. Now that GtkContainer actually
unmaps child widgets (instead of avoiding that), we can assume that the
child GtkRecentChooserWidget will be unmapped when we want it to be.

This fixes a warning from gtk_widget_verify_invariants(), as we were mapping
our child widget before calling our parent class' ::map() handler. Bug #659257.
2011-11-16 19:56:11 +01:00
Bastien Nocera
ab27fa9bba tests: Add tests for keypad keys parsing
See https://bugzilla.gnome.org/show_bug.cgi?id=606727
2011-11-16 18:49:54 +00:00
Bastien Nocera
de47b90fd1 gtk: Parse keypad numbers correctly
Try to find keycodes for keysyms at level-0 in the keymap, but don't
fail to parse if we can find those in level-1. This fixes the
parsing of numerical keys on the keypad, which require a shift level
through Num-Lock.

https://bugzilla.gnome.org/show_bug.cgi?id=606727
2011-11-16 18:47:39 +00:00
Bastien Nocera
ef5476f16a tests: Check "without keycode" code path too
And see whether the output of gtk_accelerator_parse()
matches that of gtk_accelerator_parse_with_keycode()
2011-11-16 18:05:41 +00:00
Bastien Nocera
c1bdbe610a Revert "tests: Disable accel test until fixed"
The test now works correctly.

This reverts commit ba397a3431.
2011-11-16 15:02:06 +00:00
Matthias Clasen
43705c7360 Update comment to new realities 2011-11-16 00:27:14 -05:00
Benjamin Otte
acbf37bae7 a11y: Merge function into only caller
Also cleann up comments that are misleading now.
2011-11-16 04:39:26 +01:00
Benjamin Otte
a4b88c47cd treeview: Call a11y functions for culmn changes directly
This way, the a11y code knows if a column was reordered, added or
removed and can do the right things instead of trying to guess and
getting it wrong.

Also, this patch finalizes the changes so that only visible columns
exist to the accessibility interface.
2011-11-16 04:39:25 +01:00
Benjamin Otte
5041286166 a11y: Unify column-by-index getting
We are only ever interested in visible columns. Invisible columns do not
exist for all a11y cares.
2011-11-16 04:39:25 +01:00
Benjamin Otte
857fa84796 tests: Add an invisible column to the tree test
This one should be invisible if everything works as it should.
2011-11-16 04:39:25 +01:00
Benjamin Otte
2e48bb2ccd tests: Add checks for row/column index to accessibility-dump 2011-11-16 04:39:25 +01:00
Benjamin Otte
74e8ac1208 tests: Don't dump stuff twice for tables
Captions and headers are printed as part of the children, so we can
avoid the duplication by just printing the name.
2011-11-16 04:39:25 +01:00
Benjamin Otte
bbf59c75d7 a11y: Use gtk_tree_view_get_n_columns()
In fact, invent our own function get_n_columns() which actually only
counts the visible functions, because that's the only ones we care
about.

The places where it's not used yet will be changed in the coming
patches.
2011-11-16 04:39:25 +01:00
Benjamin Otte
18181f5417 API: treeview: Add gtk_tree_view_get_n_columns() 2011-11-16 04:39:25 +01:00
Benjamin Otte
f7df354c5a a11y: Fix get_column_index() 2011-11-16 04:39:25 +01:00
Benjamin Otte
f7fed686fd a11y: remove argument from get_column_number()
The argument was always FALSE.
2011-11-16 04:39:25 +01:00
Benjamin Otte
aa1cab1ec2 treeview: Simplify a check
Use the same method as elsewhere.
2011-11-16 04:39:25 +01:00
Benjamin Otte
81f9082d2a treeview: Minor beautification 2011-11-16 04:39:24 +01:00
Benjamin Otte
0c99022956 tests: Up the ante
Put 10000 rows into the tree-performance test, so the tests don't finish
in <1s. That's too little for profiling.
2011-11-16 04:39:24 +01:00
Benjamin Otte
b1fe9b6b8b a11y: remove useless argument
The argument is unused these days, so don't confuse people with it.
2011-11-16 04:39:24 +01:00
Benjamin Otte
5af4ce6a66 a11y: Remove clean_rows function
It doesn't do anything anymore.
2011-11-16 04:39:24 +01:00
Benjamin Otte
c2410d0d04 a11y: Don't crete cell infos for non-children
When we use a container inbetween, this ensures that the cell infos
don't replace each other in the hash table.
2011-11-16 04:39:24 +01:00
Benjamin Otte
0b26a15b62 a11y: Make find by index lookup use the hash table again
This should give back the performance that was lost with the commit
"a11y: Make the cache lookup function inefficient".
2011-11-16 04:39:24 +01:00
Benjamin Otte
85fee33092 a11y: Add a hash function for cell infos
Note that comparing the tree is not necessary as the nodes are already
unique per row.
2011-11-16 04:39:24 +01:00
Benjamin Otte
104ddf8a6d a11y: Compute the cell index quicker
We have the node available, so we can compute it from there.
2011-11-16 04:39:24 +01:00
Benjamin Otte
a890a61253 treeview: Add _gtk_rbtree_node_get_index()
.. as a replacement for _gtk_rbtree_node_find_parity(). Instead of 1 or
0, the function now returns the index of node in the complete tree
(counting from the root). And this is of course identical to the row
number.
2011-11-16 04:39:24 +01:00
Benjamin Otte
b8dec90f3a a11y: Compute index the easy way
index is row_index * n_columns + column_index

We use it everywhere, why not here?
2011-11-16 04:39:24 +01:00
Benjamin Otte
acc5627e39 a11y: Redo indexing
We now index rows by actual expanded row number and don't count them
ourselves no more.
2011-11-16 04:39:24 +01:00
Benjamin Otte
92a2284bb2 tests: Ensure the treeview is expanded
Otherwise the test code might ignore collapsed rows, which makes it go
rather fast.
2011-11-16 04:39:23 +01:00
Benjamin Otte
e927a5b2c7 treeview: Redo row tracking
Track the RBNode/RBTree instead of keeping a TreeRowReference. This is a
whole lot faster and less error-prone.

Also, notify the accessible of removal of rows before actually removing
them, so we have a chance to clean up.
2011-11-16 04:39:23 +01:00
Benjamin Otte
0b716e77ea widget: Add _gtk_widget_peek_accessible()
This function returns the accessible if it already exists. This way we
can call functions on the accessible from the widget itself instead of
having to rely on signals.
2011-11-16 04:39:23 +01:00
Benjamin Otte
24e4a03af2 a11y: Remove needless checks
The cell_row_ref and cell_col_ref variables are always non-NULL, so
there's no need to check it.
2011-11-16 04:39:23 +01:00
Benjamin Otte
918a9d0e3a a11y: Add a cell_info_get_path() function
Reads better and we only need to change it in one place.
2011-11-16 04:39:23 +01:00
Benjamin Otte
5096df14c3 treeview: Remove unnecessary variable
tmptree has the same value as tree everywhere, so just use tree instead.
2011-11-16 04:39:23 +01:00
Benjamin Otte
9f91405d6c a11y: Mark object as defunct in destroy notify
Instead of requiring a special functio to be called before just removing
from the hash table. This simplifies code a lot that used to remove from
the hash table.
2011-11-16 04:39:23 +01:00
Benjamin Otte
bd1bc88ed2 a11y: Remove in_use member
After the latest changes, it is now always TRUE, so adjust the code
accordingly.
2011-11-16 04:39:23 +01:00
Benjamin Otte
40b7e3044e a11y: Don't garbage collect anymore
Instead, remove cell infos immediately from the hash table.
2011-11-16 04:39:23 +01:00
Benjamin Otte
64b825b87b a11y: Improve cell_infos table
- Name it properly
- Make it just a set of cell_infos

Currently it's using direct hash, but as long as we don't actually
lookup stuff from it, who cares...
2011-11-16 04:39:23 +01:00
Benjamin Otte
71011f3e1e a11y: Implement find_cell_info() using qdata lookup
That should be orders of magnitude faster then iterating over a hash
table.
2011-11-16 04:39:23 +01:00
Benjamin Otte
331a4c92b0 a11y: Store the cellinfo in the cell's qdata 2011-11-16 04:39:22 +01:00
Benjamin Otte
d265636526 a11y: Remove index from cellaccessible
That way we also get rid of the refresh_index function.
2011-11-16 04:39:22 +01:00
Benjamin Otte
f05d3f66b1 a11y: Don't use the cell's index anymore
We implement get_cell_index() now, so it's no longer necessary.
As a side effect, we need a different index for our hash table (which
now has a wrong name, but that will soon change).
2011-11-16 04:39:22 +01:00
Benjamin Otte
35b667a409 a11y: Implement get_child_index in treeview 2011-11-16 04:39:22 +01:00
Benjamin Otte
d5b52ae3b1 a11y: Implement get_child_index in treeviewaccessible 2011-11-16 04:39:22 +01:00
Benjamin Otte
b526375e8f gtk: Fix compiler warnings from include fixes 2011-11-16 04:31:06 +01:00
Benjamin Otte
a9dd3e559a a11y: Make the cache lookup function inefficient
Ahem.

This is in preparation for future changes and is not meant to stay this
way. But I want to change the hash table's keys and this is way easier
when nobody is using them.
2011-11-16 04:31:06 +01:00
Benjamin Otte
ac29108586 a11y: Change function declaration
Returning an int seems way easier than having an int out argument to a
void function. Also, it doesn't lead to uninitialized memory, what a
concept!
2011-11-16 04:31:06 +01:00
Benjamin Otte
533ee181de a11y: Add a special-case for cell index querying
I could have tried to make GtkContainerCellAccessible implement
GtkCellAccessibleParent, but the current implementation of that
interface doesn't make sense for it.
2011-11-16 04:31:06 +01:00
Benjamin Otte
02fd1e5a62 a11y: Add _gtk_cell_accessible_parent_get_child_index()
This will soon replace the shenanigans we do to keep the index of cells
current.
2011-11-16 04:31:06 +01:00
Benjamin Otte
2bd69cbf8c a11y: Remove idle handler for focus notifications 2011-11-16 04:31:06 +01:00
Benjamin Otte
0c2f454b41 a11y: Re-implement gtk_tree_view_accessible_get_n_rows()
... using the new _gtk_rbtree_find_index().
2011-11-16 04:31:06 +01:00
Benjamin Otte
635e53433d treeview: Add _gtk_rbtree_find_index()
Uses the parity to do an O(log N) search for the nth element in the
tree in display order of the treeview.
2011-11-16 04:31:06 +01:00
Benjamin Otte
59097ecef4 treeview: Rename "parity" to "total_count"
Now that we use it to actually count the rows instead of just even/odd,
it's better to reflect that in the variable name.
2011-11-16 04:31:06 +01:00
Benjamin Otte
320df163a2 treeview: Make the parity actually store the row number
Instead of just storing the least significant bit of the row number,
store the full row number. This will soon be useful for accessibility.
But CSS could like it, too.
2011-11-16 04:31:06 +01:00
Benjamin Otte
c8e2cd27e9 treeview: Remove special cases when computing parity
The parity of the nil npode is always 0, so no need to check for the nil
node first.
2011-11-16 04:31:06 +01:00
Benjamin Otte
1a241f2348 treeview: Only compute parity once when rendering
This shouldn't affect performance too much, but it I just found it so I
fixed it.
2011-11-16 04:31:05 +01:00
Stef Walter
5b6f0b9893 GtkSpinButton: Clarify clamping behavior in gtk_spin_button_set_range doc
* If the current value is outside the range, it will be adjusted
   to fit within the range, otherwise it will remain unchanged.

https://bugzilla.gnome.org/show_bug.cgi?id=664021
2011-11-15 07:47:35 +01:00
Matthias Clasen
9ad67a3186 Avoid double inclusion of a migration chapter 2011-11-15 00:47:16 -05:00
Matthias Clasen
4904a2f45b GtkTextViewAccessible: Respect display lines
This special tweak was lost when porting from GailTextUtil.

https://bugzilla.gnome.org/show_bug.cgi?id=663994
2011-11-15 00:25:18 -05:00
Martin Pitt
76cd14410c Fix GDK linking for Gtk typelib and example builds
Add missing GDK linking to GIR build and examples:

  GISCAN Gtk-3.0.gir
  CCLD   gtk-query-immodules-3.0
./.libs/libgtk-3.so: undefined reference to `gdk_keymap_get_modifier_mask'
./.libs/libgtk-3.so: undefined reference to `gdk_modifier_intent_get_type'
./.libs/libgtk-3.so: undefined reference to `gdk_window_begin_resize_drag_for_device'
./.libs/libgtk-3.so: undefined reference to `gdk_event_triggers_context_menu'
collect2: ld returned 1 exit status

  CCLD   grid-packing
../gtk/.libs/libgtk-3.so: undefined reference to `gdk_keymap_get_modifier_mask'
[...]

https://bugzilla.gnome.org/show_bug.cgi?id=664027
2011-11-15 06:18:18 +01:00
Yuri Kozlov
90e171e6f9 Fixed Russian translation 2011-11-14 23:50:52 +04:00
Matthias Clasen
005451e3f3 GtkComboBoxAccessible: Make keybindings work
https://bugzilla.gnome.org/show_bug.cgi?id=659151
2011-11-14 09:26:15 -05:00
Matthias Clasen
2777078e21 Add combobox a11y tests 2011-11-14 09:26:15 -05:00
Matthias Clasen
a6cb6c6d39 Add some keybindings to the a11y entries test 2011-11-14 09:26:15 -05:00
Martin Pitt
1c222372d9 Fix gtk_tree_view_get_tooltip_context() transfer annotation
The default (out) transfer mode is "full", but the passed "model" pointer gets
set to gtk_tree_view_get_model() which is "transfer none". This caused Python
programs to free the model after calling this, causing crashes.
2011-11-14 14:33:51 +01:00
Matthias Clasen
6ae78c3cf1 Add a link to the Windows port wiki page 2011-11-14 08:01:23 -05: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
Matthias Clasen
242b1f12f8 GtkProgressbar: respect the range of 'fraction'
The setter should not set the property to values outside the allowed
range.

https://bugzilla.gnome.org/show_bug.cgi?id=663825
2011-11-11 10:36:09 -05:00
Rico Tzschichholz
4a43c062ac Fix some implicit declaration warnings
There were some includes of gtkmain.h missing
2011-11-11 13:06:56 +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
11e9c6f95f win32: Hack to make statusbar menus show up visible: 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
Morten Welinder
fefe8e7c8c win32: Actually check for IPrintDialogCallback in configure 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
af00c68dd0 win32: correctly handle difference between tab_pos and gap_side when drawing an extension (notebook tab) 2011-11-10 17:40:57 +01:00
Dieter Verfaillie
2d83850864 win32: add TODO mentioning GtkButton::child-displacement-x & y should be 0 when XP theme is active 2011-11-10 17:40:56 +01:00
Arnaud Charlet
6ed89c514b win32: fix typo in msw_style.c
https://bugzilla.gnome.org/show_bug.cgi?id=647460
2011-11-10 17:40:56 +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
Alexander Larsson
06a20d207a Fix build by adding include
build failed with a GTK_IS_VIEWPORT link error
2011-11-10 17:40:46 +01:00
Alexander Larsson
96bae6ad08 Add include to fix the build 2011-11-10 17:25:02 +01:00
Benjamin Otte
24b9599af7 a11y: Get rid of gtk.h includes in headers
This way, we can include them without accidentally including deprecated
code. Which means we can still use the recently added turning-off tricks
for deprecation warnings.
2011-11-10 17:10:04 +01:00
Benjamin Otte
2d3c36a021 a11y: Fix gcc warning 2011-11-10 17:10:04 +01:00
Benjamin Otte
1c96b0b838 a11y: It's not a bug if there's no row at some point
In that case, there's just nothing there.
2011-11-10 17:10:04 +01:00
Bastien Nocera
c30d313afc gtk: Fix parsing of accelerators with keycodes
GDK_KEY_VoidSymbol is not the same as keycode 0. This fixes
keycodes such as "0xb3" being parsed as "VoidSymbol" keysyms.

https://bugzilla.gnome.org/show_bug.cgi?id=663761
2011-11-10 14:33:28 +00:00
Bastien Nocera
d69c7f4776 gtk: Fix GtkCellRenderer ignoring keycodes
We should use the new helper code rather than invent our own
functions again.

https://bugzilla.gnome.org/show_bug.cgi?id=663761
2011-11-10 14:33:28 +00:00
Guillaume Desmottes
fb97c28bca gtktreeviewaccessible: use a value_destroy_func with the cell_info_by_index hash
This ensures that we don't leak any GtkTreeViewAccessibleCellInfo when
re-inserting a new one with the same key.

https://bugzilla.gnome.org/show_bug.cgi?id=663694
2011-11-10 14:49:30 +01:00
Guillaume Desmottes
22807d8469 gtktreeviewaccessible: factor out cell_info_free()
https://bugzilla.gnome.org/show_bug.cgi?id=663694
2011-11-10 14:49:30 +01:00
Michael Meeks
14a17873de broadway: Initial support fro V7+ websockets
Allows more modern browsers eg. firefox 5+ to use gtk/broadway
Auto-detects protocol version, and can switch between them at
as you connect a different browser.

This works to some extent, but seems to hang sometimes, for
instance the "button box" test in testgtk never shows up.
2011-11-10 10:12:28 +01:00
Matthias Clasen
f711da3d1b uimanager: Work around deprecations 2011-11-09 23:45:58 -05:00
Matthias Clasen
a7958f06e3 treeview: Work around deprecations 2011-11-09 23:42:11 -05:00
Matthias Clasen
6ae6284d1a Remove some redundant verbosity 2011-11-09 22:18:39 -05:00
Matthias Clasen
82d6a4e918 Don't use G_ERRORCHECK_MUTEXES anymore
It's gone from GLib.
2011-11-09 22:11:04 -05:00
Matthias Clasen
2298c51d93 Update documentation around deprecations. 2011-11-09 22:08:43 -05:00
Matthias Clasen
5594ec8dd0 Don't add -DGSEAL_ENABLE to CFLAGS anymore
That define is no longer used anywhere in gtk.
2011-11-09 22:05:11 -05:00
Matthias Clasen
190c271986 Add a missing include 2011-11-09 22:03:10 -05:00
Matthias Clasen
a78ab0cfa1 Drop use of GDK_DISABLE_DEPRECATED guards in gtk
We now use function attributes for deprecation so the build-breaking
guards are no longer needed.
2011-11-09 22:02:42 -05:00
Matthias Clasen
b3e13bd0a8 Drop use of GDK_DISABLE_DEPRECATED guards in gdk
We now use function attributes for deprecation so the build-breaking
guards are no longer needed.
2011-11-09 22:01:00 -05:00
Matthias Clasen
b6ae763e25 Drop references to g_thread_init()
We are already requiring GLib 2.31, so g_thread_init() is never
needed anymore.
2011-11-09 18:36:35 -05:00
Kristian Rietveld
91ae19768e Bug 661997 - Gtk crashes when changing the TreeView model while ...
Simply stopping rubber banding in gtk_tree_view_set_model() eliminates
the crash.  Reported by Thomas Perl.
2011-11-09 08:45:34 +01:00
Ryan Lortie
7e22a5350c Don't implement GApplication mainloop
Let the default GApplication implementation take care of it.

https://bugzilla.gnome.org/show_bug.cgi?id=658805
2011-11-09 00:22:52 -05:00
Benjamin Otte
d1d2d71159 demos: Remove non-working code
It causes warnings, so it has to go.
The cursor doesn't change anyway, no matter if it's there or not.
2011-11-09 03:46:23 +01:00
Benjamin Otte
0333ed97fe tools: Work with deprecated APIs
We want to screenshot deprecated widgets, so we'd better not fail when
using them.
2011-11-09 03:23:43 +01:00
Benjamin Otte
8e4a45eb12 exanmples: Don't use deprecated API 2011-11-09 03:23:43 +01:00
Benjamin Otte
198a35fde5 testgtk: Remove deprecations from shapes test 2011-11-09 03:23:43 +01:00
Benjamin Otte
f41262320c testgtk: Don't use deprecated functions in properties example 2011-11-09 03:23:43 +01:00
Benjamin Otte
2783158f8d treeview: Do a simple replace for gdk_window_get_pointer()
Replace it with the equivalent gdk_window_get_device_position() with the
core pointer.
2011-11-09 03:23:43 +01:00
Benjamin Otte
c9c9099f83 gtk-demo: Remove excessive pointer querying 2011-11-09 03:23:43 +01:00
Benjamin Otte
439b9a3b1d queryimmodules: Actually fix deprecation warnings
The previous patch still caused warnings. Ooops. That's what you get for
not compiling with -Werror.
2011-11-09 03:23:43 +01:00
Michael Natterer
5ca2f06893 quartz: include all buttons' state in GdkEventMotion.state
(cherry picked from commit 3b5c5710da)
2011-11-09 00:36:21 +01:00
Michael Natterer
5f6c70f211 quartz: include all buttons' states in GdkEventButton.state
(cherry picked from commit a381e8ea62)
2011-11-09 00:26:30 +01:00
Michael Natterer
264241eb11 Bug 663605 - Fix event->state of many event types on quartz
Don't try to remember the current keyboard modifier and mouse button
states from the last event, because that isn't always right, and don't
set event.state = 0 for generated events. Instead, add private functions
to get the current states, and implement them with API that retrieves
these states independently from an event.
2011-11-08 21:52:49 +01:00
Benjamin Otte
28d3d6e039 treeview: Remove unused crack code
No, querying the pointer position in a draw callback is not a good idea.
No, setting FOCUSSED based on that position is not a good idea either.
2011-11-08 21:14:06 +01:00
Benjamin Otte
fd93e08a7c widget: Don't use deprecated symbols
Not even in deprecated functions!
2011-11-08 21:14:06 +01:00
Benjamin Otte
d41732b729 widget: Deprecate gtk_widget_get_pointer () 2011-11-08 21:14:06 +01:00
Benjamin Otte
a1fb2c863b treeview: Remove call to gtk_widget_get_pointer() 2011-11-08 21:14:06 +01:00
Benjamin Otte
28d0403f17 paned: Pass x/y position to update_drag()
This way we get the coordinates from the right device instead of using
any random device.
2011-11-08 21:14:06 +01:00
Benjamin Otte
80a23a2f2b paned: Remove MOTION_HINT_MASK
It's not needed anymore. GDK does culling of events for us.
2011-11-08 21:14:06 +01:00
Benjamin Otte
68bc011507 menuitem: WOrk around deprecation warnings 2011-11-08 21:14:06 +01:00
Benjamin Otte
a12e12a56d queryimmodules: Disable deprecaion warnings for deprecated header 2011-11-08 21:14:06 +01:00
Benjamin Otte
40db65a85b settings: Disable deprecaion warnings for deprecated header 2011-11-08 21:14:06 +01:00
Benjamin Otte
c9b1e00c30 layout: Work around deprecation warnings 2011-11-08 21:14:05 +01:00
Benjamin Otte
f9c664c69b immodule: Disable deprecations before including deprecated header 2011-11-08 21:14:05 +01:00
Benjamin Otte
e1f4bd6495 gtk: Empty gtkimmodule.h
Move the remaining struct definition into gtkimcontextinfo.h and include
that header in gtk.h. gtkimmodule.h is now an empty header. We should
probably deprecate it somehow.

This is also necessary so headers used in gtk .c files don't include
gtk.h which in turn includes all the deprecated headers which we want to
avoid so we can include them with deprecation warnings turned off.
2011-11-08 21:14:05 +01:00
Benjamin Otte
ba05093fe7 build: Don't append to an accidentally existing file 2011-11-08 21:14:05 +01:00
Benjamin Otte
c2da143aa6 immodule: Move private functions to a private header 2011-11-08 21:14:05 +01:00
Benjamin Otte
bd97127e6c immodule: Fix includes
Make includes not rely on gtkimmodule.h including gtk.h. This will be
important once we remove gtkimmodule from the include files.

That way, we can achieve not pulling deprecated headers automatically.
2011-11-08 21:14:05 +01:00
Benjamin Otte
1c22053baf window: Fix cast warnings 2011-11-08 21:14:05 +01:00
Benjamin Otte
1425ecbc52 treeview: Fix warnings from fixing warnings
Warnings introdcued by fixing deprecation warnings in
2ead4c6038
2011-11-08 21:14:05 +01:00
Benjamin Otte
adcd136f1e icontheme: Get rid of deprecation warnings
Before including deprecated headers, disable deprecation warnings.
2011-11-08 21:14:05 +01:00
Benjamin Otte
7cfe9051cc cellrendererspinner: Ignore deprecation warnings
The cell renderer relies on deprecated functionality, so we need to
disable deprecations for included deprecated headers.
2011-11-08 21:14:05 +01:00
Benjamin Otte
8f8269ad30 cellrendererspinner: Include correct header 2011-11-08 21:14:05 +01:00
Benjamin Otte
9aa7e9f050 button: Don't call deprecated functions 2011-11-08 21:14:05 +01:00
Benjamin Otte
a9134de5d3 assistant: Work around deprecation warnings 2011-11-08 21:14:05 +01:00
Rui Matos
70f87b8bd5 gtk: Add a GTK_STATE_FLAG_WINDOW_UNFOCUSED widget state flag
This allows themes to style widgets differently according to whether the
toplevel window they are in is presented as focused.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:33:22 +00:00
Rui Matos
95648fd194 x11: Implement GDK_WINDOW_STATE_FOCUSED on top of _NET_WM_STATE_FOCUSED
_NET_WM_STATE_FOCUSED is a new _NET_WM_STATE hint which allows us to
implement a meaningful GDK_WINDOW_STATE_FOCUSED under X11. If the window
manager doesn't support this hint we keep GDK_WINDOW_STATE_FOCUSED set since
that is what gtk+ implicitly assumed historically.

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:33:22 +00:00
Rui Matos
43f1b5abbc gdk: Add GDK_WINDOW_STATE_FOCUSED to GdkWindowState
This state means that the toplevel window is presented as focused to the user,
i.e with active decorations under an X11 window manager.

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

https://bugzilla.gnome.org/show_bug.cgi?id=661428
2011-11-08 19:25:51 +00:00
Marc-André Lureau
c1e8e7ba22 reftests: Add a reftest for background-repeat css property
https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 12:41:35 -05:00
Cosimo Cecchi
f9d16f3923 themingengine: set the cairo extend to PAD when we're stretching bg
This avoids artifacts around the borders due to bilinear filtering cairo
applies to the surface pattern when stretching it.

https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 12:41:28 -05:00
Marc-André Lureau
3b436eec6d css: start background-repeat
By default, a background image is stretched. Instead, it is worth to
have a tiled background.

This patch allows background surfaces to be repeated or not, and should
be compatible with future extensions and CSS.

https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 11:10:44 -05:00
Marc-André Lureau
ee7ac4fa44 Rename s/GtkCssRepeatStyle/GtkCssBorderRepeatStyle/g
https://bugzilla.gnome.org/show_bug.cgi?id=663522
2011-11-08 11:10:41 -05:00
John Ralls
085b98f470 [Quartz Bug 663182] NSImage throws an exception from _gtk_quartz_create_image_from_pixbuf()"
If a zero-sized NSImage calls lockfocus it throws an exception. Make sure that the image isn't zero-sized before calling lockfocus, and log a warning and return NULL if it is zero-sized.

Have the quartz version of gtk_drag_begin_idle return FALSE if the returned image is NULL.
2011-11-07 14:25:08 -08:00
John Ralls
42656dde57 Revert "[Quartz Bug 663182] NSImage throws an exception from _gtk_quartz_create_image_from_pixbuf()". Utterly screwed up. Sorry.
This reverts commit 8216324e4b.
and          commit 3243e6955c.
2011-11-07 13:57:10 -08:00
John Ralls
3243e6955c Fix accidental paste error in 8216324 2011-11-07 13:18:14 -08:00
John Ralls
8216324e4b [Quartz Bug 663182] NSImage throws an exception from _gtk_quartz_create_image_from_pixbuf()
If _gtk_quartz_create_image_from_pixbuf is given a pixbuf with size 0, 0
or which produces an NSImage with size 0.0, 0.0, it throws an exception
which Gtk doesn't handle.

your changes. Lines starting
2011-11-07 13:11:18 -08:00
Michael Natterer
ac943bf69a gdk: exclude MOD1 from the virtual modifier mapping
which effectively nails down the MOD1 == ALT assumption that is valid
in all other parts of GTK+. After the modifier abstraction fixes for
OSX, the virtual mapping is now (correctly) used in more places, and
caused problems with the common default PC keyboard layout on X11 that
colocates ALT and META on the same key.
2011-11-07 20:09:00 +01:00
Morten Welinder
d80953666e Print preview: make cancel work
This makes cancels of a print preview work in the same way it
works for non-previews, i.e., the operation stops at the next
page boundary.

https://bugzilla.gnome.org/show_bug.cgi?id=662160
2011-11-07 13:10:24 -05:00
Michael Natterer
d1c6bcb85c quartz: handle recursive CFRunLoops
Fixes e.g. crashs when dropping from finder.

Turn the "getting_events" boolean into a counter to handle poll_func()
being called recursively, and track the loop depth correctly by
changing its counter before bailing out in run_loop_observer_callback().
This way we reallocate our autorelease pool at the right time, and
don't kill memory that is still in use by outer run loops.

Also drain, not release the pool, just for some defensive forward
compatibility.
(cherry picked from commit ef9a92d225)
2011-11-06 23:38:50 +01:00
Torsten Schönfeld
4ef61e2311 gtk: add annotations for some GtkRadio* constructors
Since constructors like gtk_radio_button_new_from_widget take an
instance of their type as the first argument, the gi scanner interprets
them as methods.

https://bugzilla.gnome.org/show_bug.cgi?id=661858
2011-11-06 16:50:57 +01:00
Kristian Rietveld
88329aeff4 quartz: use get_toplevel_from_ns_event in one more place
Fixup needed due to refactoring in GTK+-3.0.
2011-11-06 10:36:00 +01:00
Kristian Rietveld
b78658c310 quartz: make gdk_quartz_osx_version conform to coding style 2011-11-06 10:17:46 +01:00
Kristian Rietveld
e5ccae5782 quartz: make test_resize () conform to coding style 2011-11-06 10:16:27 +01:00
Kristian Rietveld
9f45c37be7 quartz: Process motion events within windows bounds without window set
When an NSEvent does not have the window field set, we already assumed
the event was not for us and discarded it.  But for NSMouseMoved events
we now make an exception, because such events generated after
using/clicking the main menu bar have the window field set to NULL while
the application window still has focus.

We used to experience a loss of motion events after using the menu bar,
this could be seen in buttons that stopped prelighting and first
clicks often being ignored unless you clicked somewhere else first.
These issues are fixed by this patch.
2011-11-06 10:15:16 +01:00
Kristian Rietveld
7269cdf315 quartz: Factor out toplevel from NSEvent code into function 2011-11-06 10:12:24 +01:00
Kristian Rietveld
6a7280ce1a quartz: Separate out screen_point conversion in function
Reduces code duplication and confusion.
2011-11-06 10:10:12 +01:00
Kristian Rietveld
4d9d8ba96d quartz: remove unused variable 2011-11-06 10:04:39 +01:00
Florian Müllner
79803d0edc menuitem: Always treat submenus as popup
Submenus are not actually attached to a menubar, but styling them
as if they were imposes some problems (at least with Adwaita).
Just using GDK_WINDOW_TYPE_HINT_POPUP_MENU for submenus instead
fixes the issue.

https://bugzilla.gnome.org/show_bug.cgi?id=662691
2011-11-05 01:49:50 -04:00
Akira TAGOH
4d7e47ddd0 Allow fallback for input method modules
Accept a :-separated list of module names in GTK_IM_MODULE and
the corresponding setting, to deal a bit better with broken
situations.

https://bugzilla.gnome.org/show_bug.cgi?id=603559
2011-11-05 01:48:59 -04:00
Torsten Schönfeld
a72a3160a8 gtk: add annotations for some GtkSymbolicColor constructors
https://bugzilla.gnome.org/show_bug.cgi?id=661859
2011-11-05 01:38:40 -04:00
Rui Matos
8067f6b886 x11: Fix window manager change detection
Since the wmspec_check_window doesn't have a corresponding GdkWindow we can't
rely on the get_event_window() return value to get the XID from. Just use the
XID from the XEvent directly.

https://bugzilla.gnome.org/show_bug.cgi?id=662953
2011-11-05 01:37:37 -04:00
Benjamin Moody
8318515cd8 Mark gtk_dialog_new_with_buttons as NULL-terminated
https://bugzilla.gnome.org/show_bug.cgi?id=663073
2011-11-05 01:27:25 -04:00
Matthias Clasen
41d4229155 Pop up context menus at the right device
When multiple pointers are in play, we need to be careful
not to loose track of the device between receiving a button
press and popping up a menu.

https://bugzilla.gnome.org/show_bug.cgi?id=663396
2011-11-05 01:24:17 -04:00
Matthias Clasen
7644ef1e3a GtkWindow: Use new begin_resize_drag api
We have an event, so the correct thing to do is to pass
the device into the function that we are calling. GDK
just grew a variant that takes a device, for this purpose.

https://bugzilla.gnome.org/show_bug.cgi?id=663444
2011-11-05 01:14:30 -04:00
Matthias Clasen
3b152df48a Wayland: Adapt to GdkWindowImpl api change 2011-11-05 01:12:26 -04:00
Matthias Clasen
810ef68679 Broadway: Adapt to GdkWindowImpl API change 2011-11-05 01:12:07 -04:00
Matthias Clasen
6f48f20c67 Quartz: Adapt to GdkWindowImpl api change 2011-11-05 01:11:50 -04:00
Matthias Clasen
32884e9c16 win32: Adapt to GdkWindowImpl api change 2011-11-05 01:11:18 -04:00
Matthias Clasen
250d4331b2 Add device-taking variants of begin_resize/move_drag
This was one of the last places where display->core_pointer was
used in non-deprecated code paths.
2011-11-05 01:10:16 -04:00
Matthias Clasen
3bd0059850 GdkDeviceManager: some reshuffling of docs 2011-11-04 23:38:11 -04:00
Bastien Nocera
ba397a3431 tests: Disable accel test until fixed 2011-11-04 16:40:23 +00:00
Bastien Nocera
780a92b559 gtk: Add test program for keycode parsing
https://bugzilla.gnome.org/show_bug.cgi?id=662755
2011-11-04 16:40:22 +00:00
Bastien Nocera
06b55b2149 gtk: Add accel with keycode parsing functions
Which handle accelerators with keycodes as well as keyvals,
so we can use it in applications that use GtkCellRendererAccel's
"Other" mode of operations (namely gnome-control-center and
gnome-settings-daemon).

https://bugzilla.gnome.org/show_bug.cgi?id=662755
2011-11-04 16:40:22 +00:00
Matthias Clasen
0f167e8b43 Fix make check 2011-11-03 23:58:46 -04:00
Colin Walters
6cf1385e8f introspection: Include deprecated headers for scanner too
https://bugzilla.gnome.org/show_bug.cgi?id=663345
2011-11-03 15:27:56 -04:00
Piotr Drąg
8853a3e5ff Updated POTFILES.in 2011-11-02 22:12:53 +01:00
Alexander Larsson
c002c83ec5 Make sure we only show icons in the file selector bookmarks toolbar
This looked really bad in non-gnome settings where default is to
show text too.
2011-11-02 14:46:53 +01:00
Matthias Clasen
20008c33cb Revert a change to the plug/socket headers
I was trying to avoid including gtk.h here, but this breaks
some of our tests, and there's a good chance that 3rd party
code also relies on this include.
2011-11-02 08:28:34 -04:00
Matthias Clasen
2ead4c6038 Remove some more uses of gdk_window_get_pointer 2011-11-02 08:10:42 -04:00
Matthias Clasen
cafef131d6 Remove one instance of gdk_window_get_pointer 2011-11-02 08:10:42 -04:00
Matthias Clasen
adc731fad9 Remove various internal uses of deprecated api 2011-11-02 08:10:42 -04:00
Matthias Clasen
8ad3fd28b8 Don't warn about deprecations in deprecated/ 2011-11-02 08:10:42 -04:00
Matthias Clasen
2de4405c32 Move deprecated gtkwidget style api to gtkstyle 2011-11-02 08:10:42 -04:00
Matthias Clasen
1f827d6214 Don't warn about deprecations in deprecated/
We know we are deprecated here, no need to warn.
2011-11-02 01:21:49 -04:00
Matthias Clasen
feece3c0bb Move gtkstyle and gtkrc to deprecated/
This required a somewhat more substantial include reshuffling.
Some typedefs have been moved to gtkiconfactory.h and to
gtksettings.h.
2011-11-02 01:15:21 -04:00
Matthias Clasen
068e1f0390 Move wholly deprecated files to a subdirectory
Also install their headers to a subdirectory.
2011-11-01 23:51:18 -04:00
Matthias Clasen
98db3dd5dd Move gtk_draw_insertion_cursor out of gtkstyle.[hc]
This function does not use GtkStyle at all and is not deprecated.
2011-11-01 23:51:18 -04:00
Matthias Clasen
484a45c4b6 Drop DISABLE_DEPRECATED guards here, too 2011-11-01 23:22:06 -04:00
Matthias Clasen
8370052180 Don't use *DISABLE_DEPRECATED guards
Instead define GDK_DISABLE_DEPRECATION_WARNINGS where appropriate.
2011-11-01 22:35:57 -04:00
Matthias Clasen
416e1a1468 Don't use *_SINGLE_INCLUDES defines
GLib now outlaws single includes always, anyway.
2011-11-01 22:35:05 -04:00
Matthias Clasen
9b0011be92 Don't use *_DISABLE_DEPRECATED
Instead of undefining the DISABLE_DEPRECATED guards,
define the GDK_DISABLE_DEPRECATION_WARNING macro where needed.
Also replace INCLUDES by AM_CPPFLAGS to shut up automake.
2011-11-01 22:14:45 -04:00
Matthias Clasen
2a9932cf02 Don't use deprecated GValue api 2011-11-01 22:05:29 -04:00
Benjamin Otte
9788bfac89 gtk-demo: Don't use deprecated code 2011-11-02 02:32:54 +01:00
Benjamin Otte
86af3ea4e9 tests: Disable fontselection deprecation warnings
This test tests deprecated code...
2011-11-02 02:32:54 +01:00
Benjamin Otte
98d215635e tooltip: Don't use deprecated API 2011-11-02 02:32:54 +01:00
Benjamin Otte
5ada0fc382 tooltip: Remove unused variables 2011-11-02 02:32:54 +01:00
Benjamin Otte
54d6ef115b iconview: Keep the device for dnd autoscroll
This is necessary to query the device's coordinates when doing the
scrolling.
2011-11-02 02:32:54 +01:00
Benjamin Otte
e739757bab table: Define GDK_DISABLE_DEPRECATION_WARNINGS 2011-11-02 02:32:54 +01:00
Benjamin Otte
6132f52fa3 handlebox: Define GDK_DISABLE_DEPRECATION_WARNINGS 2011-11-02 02:32:53 +01:00
Benjamin Otte
c10cbf1715 fontsel: Define GDK_DISABLE_DEPRECATION_WARNINGS 2011-11-02 02:32:53 +01:00
Benjamin Otte
b120cb04a5 gdk: Move a bunch of deprecated code to a new file
The new file defines GDK_DISABLE_DEPRECATION_WARNINGS so it can happily
use deprecated APIs.

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

With this commit, GDK compiles without deprecation warnings.
2011-11-02 02:32:53 +01:00
Benjamin Otte
c9a648395e display: Don't use deprecated functions
When synthesizing crossing events, actually query the position of the
device we care about instead of using the core pointer every time.
2011-11-02 02:32:53 +01:00
Benjamin Otte
eddacfcc71 x11: Do fallback resize without deprecated functions
After consulting with Carlos, we agreed that it should be enough to grab
the core pointer instead of doing a full grab. If it turns out that's
wrong, we need to adapt the internal API for resizes to take the device
doing the resize.
2011-11-02 02:32:45 +01:00
Benjamin Otte
14d35d5c09 x11: Don't use deprecated function
Use the replacement instead.
2011-11-02 02:32:25 +01:00
Benjamin Otte
e7e3413e2e tests: Remove unused variables 2011-11-02 02:31:54 +01:00
Benjamin Otte
4f9fc252da box: Fix includes so hbox/vbox compile warning-free
And make sure most of the code is included before undeffing deprecated
code.
2011-11-02 02:31:54 +01:00
Matthias Clasen
8669eb49f5 Don't use deprecated Pango api 2011-11-01 21:22:14 -04:00
Matthias Clasen
4460cac3ed Don't use g_value_set_char 2011-11-01 21:18:27 -04:00
Matthias Clasen
d7c264653a Don't use deprecated Pango api 2011-11-01 21:13:35 -04:00
Matthias Clasen
c3d2df4eab GDK: Adapt to GLib thread api changes 2011-11-01 21:11:04 -04:00
Matthias Clasen
4ac4a1bee3 GtkSearchEngineSimple: adapt the GLib thread api changes 2011-11-01 21:06:09 -04:00
Cosimo Cecchi
d808daccc1 iconview: layout items immediately when setting a GtkTreeModel
As the draw handler expects the items to be laid out already, we cannot
queue a layout here to avoid a race condition with the resize that is
queued immediately after, which in turn would lead to a segfault later
in the paint_item() implementation.

https://bugzilla.gnome.org/show_bug.cgi?id=663138
2011-11-01 11:15:50 -04:00
Emmanuele Bassi
a77162ebaf radiotoolbutton: Fix the introspection annotations
Everything that deals with a group has to be fixed.

Plus, we have NULL checks without allowing NULL arguments; since NULL
arguments are perfectly fine, we can relax the argument checks.

https://bugzilla.gnome.org/show_bug.cgi?id=662870
2011-10-28 17:10:46 +01:00
Emmanuele Bassi
931a40844b radiotoolbutton: Fix the annotation for get_group()
Use the same annotation used by gtk_radio_button_get_group().

https://bugzilla.gnome.org/show_bug.cgi?id=662870
2011-10-28 17:10:46 +01:00
Bastien Nocera
0888e6f485 gtk: Fix XIGrabKeycode usage
A modifier of "0" is still a modifier and must be submitted normally.
A num_modifiers of 0 is essentially a noop in the server.

As mentioned by Peter Hutterer <peter.hutterer@who-t.net>

https://bugzilla.gnome.org/show_bug.cgi?id=662839
2011-10-28 12:03:22 +01:00
Matthias Clasen
701c00e8cf Print dialog: small keynav improvement
Mark the page range entry and the copies spin button as
activates-default.

https://bugzilla.gnome.org/show_bug.cgi?id=662670
2011-10-26 22:11:17 -04:00
Bastien Nocera
aa3ddb2a34 tests: Store keycode in tree for testaccel
Useful for testing keys without a keysym.
2011-10-26 12:47:07 +01:00
Bastien Nocera
1cffe6c2e4 gdk: Translate keyboard brightness keys
https://bugzilla.gnome.org/show_bug.cgi?id=662628
2011-10-26 10:36:43 +01:00
Bastien Nocera
aceccd5819 gdk: Make gen-keyname-table.pl work again
keyname-table.h was modified by hand, and gen-keyname-table.pl
couldn't be used to generate that file again.

https://bugzilla.gnome.org/show_bug.cgi?id=662628
2011-10-26 10:36:43 +01:00
Matthias Clasen
0f17a846a0 Update grid tests to match
The previous fix changed some test results here.
2011-10-25 23:21:13 -04:00
Matthias Clasen
362ff7bedf Fix gtk_grid_attach_next_to
The function did not behave as intended when @sibling is NULL.
Also add an example to the docs to clarify the intended behaviour.
2011-10-25 23:21:13 -04:00
Michael Natterer
7f80ee3a38 gtkrc.key.mac: add Command-cursor text navigation
and some emacs-ish Control bindings that work in native widgets.
Patch from Michael Hutchinson.
(cherry picked from commit ccf12f7b40)
2011-10-25 22:26:26 +02:00
Michael Natterer
f6d78bf879 gtkrc.key.mac: remove half the file, it was an accidential double paste
(cherry picked from commit 79a92f99a9)
2011-10-25 17:04:37 +02:00
Matthias Clasen
4f1c7e255d Post-release version bump
Halfway to 666 !
2011-10-25 10:22:15 -04:00
Matthias Clasen
6ea285cbbc Bump version to 3.3.2 2011-10-25 09:15:50 -04:00
Matthias Clasen
a0ea626904 Updates 2011-10-25 07:38:36 -04:00
Matthias Clasen
df1e2cd128 Fix more test breakage 2011-10-25 07:38:36 -04:00
Benjamin Otte
b195c7dbb2 a11y: Hack around infinite loops in parent setting
This is kind of a hack to get rid of infinite loops that occur when
child accessibles try to set their parent upon creation but the parent
accessible creates its children in the initialize vfunc. Because in that
case, the parent will not have an accessible set when the child tries to
access it, because it is still initializing itself. Which will cause a
new accessible to be created.

https://bugzilla.gnome.org/show_bug.cgi?id=660687
2011-10-25 07:38:36 -04:00
Matthias Clasen
7d165b67f9 Fix make check
Somebody committed a behaviour change that broke his own
tests...tsk, tsk.
2011-10-25 07:38:36 -04:00
Matthias Clasen
9a13943d8c Add a css parser test for transparent 2011-10-25 07:38:36 -04:00
Cosimo Cecchi
99266c4ceb printunixdialog: fix a GtkTable->GtkGrid typo
Code was treating the GtkScrolledWindow as a grid, not the grid itself.
2011-10-24 16:33:00 -04:00
Matthias Clasen
cd91ab9761 Fix handling of GtkCellRendererProgress::inverted
We were setting the wrong field.
https://bugzilla.redhat.com/show_bug.cgi?id=747761
2011-10-24 13:50:00 -04:00
Cosimo Cecchi
ccdc3c1802 notebook: update tab area allocation when switching page
When the active page is switched, it's important
gtk_notebook_pages_allocate() is called after the bulk of
gtk_notebook_real_switch_page() is run, as the former allocates a
different space according to the currently active tab, which is set by
the latter.
gtk_notebook_pages_allocate() already calls gtk_notebook_redraw_tabs()
when the allocation changes, so just move its call down to
gtk_notebook_real_switch_page() to fix the bug.

https://bugzilla.gnome.org/show_bug.cgi?id=662629
2011-10-24 13:19:39 -04:00
Dieter Verfaillie
16343bc9a9 win32: fix unterminated #ifdef error
By removing all ifdefs as gtk/gtkwin32.c is only built
on win32 anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=662481
2011-10-23 21:46:19 +02:00
Rui Matos
d56484f6ed tooltip: only update shape if the window is realized
If we get a composited-changed signal before the tooltip is ever realized we
have nothing to do.

This actually prevents a segfault in maybe_update_shape() because calling
gtk_widget_get_window() on a non-realized widget returns NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=662467
2011-10-23 16:26:18 +01:00
Michael Natterer
5c4f2ef0c1 gtk: move _gtk_modules_has_mixed_deps() to gtkmodlesprivate.h
and remove gtkmainprivate.h completely.
2011-10-23 13:57:07 +02:00
Michael Natterer
2688ccdbc4 gtk: clean up the private horror
- add gtkmodulesprivate.h and move stuff there from gtkprivate.h
- add gtkprivate.c and move stuff there from gtkmain.c
- add gtkwin32.c and move stuff there from gtkmain.c
- don't redefine GTK_DATADIR and friends in gtkprivate.h
- have _gtk_get_datadir() and friends on all platforms
- remove the horrid hacks where gtkprivate.h can't be included,
  or must be included later due to redefinition of the compile-time
  directories
2011-10-22 23:53:55 +02:00
Michael Natterer
88ad614c73 gtkquartz: don't free the string returned by get_bundle_path()
It's statically allocated.
(cherry picked from commit c040b03c2e)
2011-10-22 23:24:41 +02:00
Michael Natterer
077b366879 quartz: don't return FALSE from GdkDevice::query_state()
Not finding a child window to return is not a failure.
2011-10-22 23:21:02 +02:00
Hendrik Knackstedt
65d01e3763 Updated German translation 2011-10-22 00:38:28 +02:00
Cosimo Cecchi
18a638a7d3 GtkRange: use the right widget for coordinate translation
GtkRange needs to check if its allocation intersects with the resize
grip allocation (trimming its own allocation if it does).
In order to do that, it needs to translate its allocation into window
coordinates, and before that, find the window to whose the allocation
is relative; code goes all the way finding the right parent widget, but
then doesn't actually use it when translating the coordinates, leading
to using the wrong rectangles for the intersection check.

https://bugzilla.gnome.org/show_bug.cgi?id=662308
2011-10-21 16:30:34 -04:00
Sjoerd Simons
958fc69494 Fix document generation in out of tree builds
https://bugzilla.gnome.org/show_bug.cgi?id=661032
2011-10-21 16:27:13 -04:00
Matthias Clasen
bb1d9aba86 Fix natural/min widht calculations for empty grids
https://bugzilla.gnome.org/show_bug.cgi?id=660139
2011-10-21 16:24:55 -04:00
Matthias Clasen
6b510f4855 Add GtkSwitch to widget-factory 2011-10-20 22:15:41 -04:00
Matthias Clasen
85a6bc8be1 Distribute tests/css/parser/selector.errors
https://bugzilla.gnome.org/show_bug.cgi?id=662024
2011-10-20 21:52:25 -04:00
Matthias Clasen
34d6caab5e Don't refer to --sync anymore
That commandline option got replaced with an environment variable,
so mention that in the warning text.

https://bugzilla.gnome.org/show_bug.cgi?id=662132
2011-10-20 21:50:01 -04:00
Matthias Clasen
633918158b DND: Work better with XI2
It turns out that simply using XIGrabKeycode instead of XGrabKey
makes the DND keyboard support mostly work (there seem to be some
minor issues with modifiers). This means we no longer grab the
keyboard actively during DND, which in turn makes Alt-Tab and
other window manager shortcuts work again during DND.

At the same time, bring the DND key handling code into the
multi-backend work, by checking for X11 and XI2 at runtime,
in addition to compile time.
2011-10-20 20:59:50 -04:00
Cosimo Cecchi
0c135cbf2c treemodel: document gtk_tree_path_free() as allow-none
https://bugzilla.gnome.org/show_bug.cgi?id=662230
2011-10-20 09:27:17 -04:00
Stef Walter
385b7a3031 gtk: GtkToolbar returns invalid paths when adding tool items
* Calculate siblings_path on demand, so that it's always correct
   and doesn't get out of sync with the toolbar state.

https://bugzilla.gnome.org/show_bug.cgi?id=662177
2011-10-20 14:11:28 +02:00
Cosimo Cecchi
febc29852b tooltip: add support for opacity and rounded corners for tooltips
Rounded corners now will always work, using XShape in case we're not
running a composite manager.
Also, setting an RGBA visual (if available) on the tooltip toplevel
enables them to be transparent if the theme specifies so.

https://bugzilla.gnome.org/show_bug.cgi?id=599617
2011-10-19 15:15:00 -04:00
Antoine Jacoutot
d987a01d80 GMountOperation on OpenBSD: remove the need for kvm(3)
kvm(3) is considered a deprecated interface, so make
GMountOperation::show-processes use the recommended sysctl(3) interface
instead. This also removes the need to link with libkvm.

https://bugzilla.gnome.org/show_bug.cgi?id=661835
2011-10-17 19:06:41 +02:00
André Gondim
b7562090b3 Fixed some strings in Brazilian Portuguese translation 2011-10-17 10:03:01 -02:00
Chun-wei Fan
c301101e65 Update VS property sheets
Bid farewell to G_DISABLE_DEPRECATED and the build errors it causes as
warnings are now used to deter people from using deprecated GLib items
in a more subtle manner
2011-10-17 15:34:59 +08:00
Jiro Matsuzawa
c4cf754509 Updated Japanese translation 2011-10-17 01:27:46 +09:00
Bruce Cowan
568198b9b0 Updated British English translation 2011-10-16 14:45:15 +01:00
John Ralls
1db5b34b97 Bug 658772: Directory paths for resource directories are hard coded.
Corrected formatting to match coding standards; introduced local statics
to prevent leaking returned strings.
2011-10-15 12:41:53 -07:00
Torsten Schönfeld
a95c4c1bb4 gtk: fix syntax of an annotation 2011-10-15 19:37:43 +02:00
Javier Jardón
0853ce3077 Use G_VALUE_INIT
Instead of an explicit { 0, } when declaring the variable.
2011-10-15 16:45:16 +01:00
Michael Natterer
616afadd78 gdk: s/gdk_cursor_unref/g_object_unref/ 2011-10-15 14:35:28 +02:00
Sebastian Pölsterl
133a7a4f58 Fixed referenced images for GTK_STOCK_INDENT
https://bugzilla.gnome.org/show_bug.cgi?id=661780
2011-10-15 00:30:46 +02:00
Matthias Clasen
7cfb3eda1b Add deprecation annotations for GtkHandleBox and GtkTable 2011-10-14 00:54:01 -04:00
Colin Walters
520881ac11 build: Strip out -DG_DISABLE_DEPRECATED
It's unnecessary pain now that they're warnings.
2011-10-12 11:54:56 -04:00
Chun-wei Fan
5a13e08fa7 Bug 660730: Win32: Only use _fstat32 if available
_fstat32 is only introduced with msvcrt80.dll (i.e. Visual C++ 2005), in
which using this function will break compilation with MinGW, which links
against msvcrt.dll.  The msvcrt.lib in the Windows DDK which links to
a later incarnation of the msvcrt.dll in later Windows systems may have
this symbol defined, but that needs to be checked upon to be sure.

Thanks to Dieter Verfaillie for pointing out this problem.
2011-10-12 11:39:06 +08:00
Matthias Clasen
9e0efc5022 Add deprecation annotations for deprecated functions
We define our own GDK_DEPRECATED[_FOR] macros for this
and allow it to be turned off by defining the
GDK_DISABLE_DEPRECATION_WARNINGS macro.
2011-10-11 15:03:46 -04:00
Matthias Clasen
8f078992fd Include gdk.h in gail.c
This is needed so that we pick up deprecation macros here in the
future.
2011-10-11 15:01:41 -04:00
Matthias Clasen
1ecd9fb3bd Add a new symbol
gtk_widget_get_modifier_mask was added recently.
2011-10-11 13:49:22 -04:00
Brian Cameron
0940974f5a Fix void function n gtkfontbutton.c so it does not try to return a value.
Fixes bug #661089.
2011-10-10 14:13:35 -05:00
John Ralls
6906ab88bc Bug 658767 - Drag and Drop NSEvent capture is racy
Create a synthetic NSMouseLeftDown to store in the GtkQuartzDragSourceInfo
rather than relying on the NSWindow's latest event being the right one (or the
right kind).
2011-10-09 11:24:41 -07:00
Kristian Rietveld
8ad3d2b296 Bug 657770 - Write to released memory in gtkdnd-quartz.c
Clear the Drag paste board just before the info->context is released.
This way the GtkDragSourceOwner is released just before the drag context
is and thus can pasteboard:provideDataForType: not accidentally access
an already released drag context
2011-10-09 10:37:21 -07:00
Alex Corrado
defdfde999 Quartz, Bug 655057: Eliminate Compiler Warning
When compiled with older SDKs, the original change for this bug caused a
compiler warning about NSWindow not being able to handle a setStyleMask
message. This tricks the compiler into thinking that it can.
2011-10-09 10:18:40 -07:00
Matthias Clasen
a35d8764da Add G_GNUC_DEPRECATED annotations in GDK 2011-10-09 09:55:08 -04:00
John Ralls
6dc34c1f5e Bug 658772: Directory paths for resource directories are hard coded.
Provide dynamic path discovery functions as are provided for win32.
2011-10-08 15:02:38 -07:00
Kristian Rietveld
d172f1ce22 quartz: also update window position on windowDidResize
When a window goes fullscreen, the resize also changes its size.
2011-10-08 11:47:11 +02:00
Wouter Bolsterlee
1feb672f8c Updated Dutch translation by Wouter Bolsterlee 2011-10-08 00:40:12 +02:00
Rachid
0926f11f30 Updated Dutch translation by Rachid 2011-10-08 00:39:18 +02:00
Michael Natterer
5327034c31 gtk: remove the private GTK_DEFAULT_ACCEL_MOD_MASK define
and finish the port to using the new modifier abstraction API.
This commit has some evilness, it uses the default display for
the lack of a widget context, and the change to gtkstock.c
is very ugly, but I can't think of anything better given
GtkStockItem needs an accel mask instead of a proper accel
string.
2011-10-07 20:58:58 +02:00
Michael Natterer
5b74ee38e8 gdk: fix gdk_keyval_to_lower/upper() for Quartz, Win32 and Broadway
In 2.x, the !HAVE_XCONVERTCASE fallback of keyval_convert_case() was
implicitly used as implementation for all !X11 backends.

In 3.x, when this function was virtualized in GdkDisplayManager,
this fallback was moved to the X11 backend and the other backends
"equipped" with /* FIXME implement */ implementations of
keyval_convert_case() which don't convert anything.

Move the fallback code back to gdk/ as default implementation
of GdkDisplayManager::keyval_convert_case() and remove its
implementations is all backends but X11. Also remove the
implementation in Wayland which was a plain copy of what
is now the default implementation.
(cherry picked from commit f46c1b76d8)
2011-10-07 16:19:41 +02:00
Michael Natterer
87cc0dc79f gtk: use the new modifier API instead of GTK_DEFAULT_ACCEL_MOD_MASK
in gtkimcontextsimple and gtktreeview, which are the easy places,
but also true bugfixes, because on OSX we can't use the virtual META
here, we needs MOD2 as delivered in key events.
2011-10-07 09:33:07 +02:00
Fran Dieguez
78d8d6b900 Updated Galician translations 2011-10-07 01:31:49 +02:00
Tristan Van Berkom
2677a7d5b9 GtkComboBox: Add the format-entry-text signal.
This provides more control over how the selected item is shown in
the entry.
Bug #631167
2011-10-06 11:14:38 +02:00
Kjell Ahlstedt
f920ded541 GtkTreeViewColumn: dispose: Remove from the treeview
This handles the case (with gtkmm) that the GtkTreeViewColumn is
destroyed before the GtkTreeView is destroyed.
Bug #659672
2011-10-06 11:02:02 +02:00
John Ralls
37f71d71cd Bug 628936: Minimal change to pass introspection.
gobject_introspection's G-ir-scanner doesn't like the -xobjective-c
option needed to compile ObjectiveC features in quartz implementations
of certain gtk functions. This rearranges the compiler flag environment
variables in Makefile so that G-ir-scanner doesn't see them.
2011-10-04 16:45:54 -07:00
Tristan Van Berkom
00d79fdb61 Fixed gtk_cell_area_stop_editing() to properly notify when editing is not canceled
This fixes bug 653289, in gtk+-2 gtk_tree_view_stop_editing() was previously
responsible for notifying with gtk_cell_editable_editing_done(), this detail
was missed when porting the cell renderer management to GtkCellArea.
2011-10-04 14:15:21 -04:00
Cosimo Cecchi
b928664471 reftests: add a reftest for the CSS :only-child selector
https://bugzilla.gnome.org/show_bug.cgi?id=660833
2011-10-04 11:48:20 -04:00
Cosimo Cecchi
1f2cfb5619 all: add an 'only-child' pseudo-class selector
Add an :only-child pseudo-class selector, which selects single children
of a parent container.

https://bugzilla.gnome.org/show_bug.cgi?id=660833
2011-10-04 11:47:47 -04:00
Cosimo Cecchi
3a6996ea83 appchooser: make the "Find applications online" follow search state
Set the button as insensitive while searching, so that it can't be
accidentally clicked twice.

https://bugzilla.gnome.org/show_bug.cgi?id=651818
2011-10-04 11:34:10 -04:00
Cosimo Cecchi
569b5ffd5b appchooser: add a GCancellable to the search operation
So that we can cancel it when the dialog is destroyed.

https://bugzilla.gnome.org/show_bug.cgi?id=651818
2011-10-04 11:34:10 -04:00
Jorge González
06dbbad5a7 Updated Spanish translation 2011-10-03 23:21:40 +02:00
Kristian Rietveld
0e3a4b73ca Fix commit 61d6c73f18
Where the commit suggested "somebody should review it [the test]",
it would have been useful to test this particular commit instead...
2011-10-03 22:59:40 +02:00
Kristian Rietveld
bbc1e883a8 Bug 659022 - gtk_tree_model_filter_clear_cache_helper: assertion failed
This bug is resolved by fixing two things in
gtk_tree_model_filter_row_deleted():

  (1) It is possible for an elt to have elt->visible_siter == NULL, when
  it is deleted.  Only call g_sequence_remove() if this pointer is
  non-NULL.

  (2) For the case len (level->seq) > 1, free the elt->children level
  if non-NULL.  Failing to do this means the level will stick around.
  If this child level was not referenced, it will still have a zero
  ref count on its parent which cannot be removed!

For both bugs unit tests have been added in the preceding commit.
2011-10-03 22:59:40 +02:00
Kristian Rietveld
e8323e2abc Add two more unit tests for bug 659022
Both pointing out problems in gtk_tree_model_filter_row_deleted().
2011-10-03 22:59:40 +02:00
Kristian Rietveld
f646ed6f76 Fix first part of bug 659022
Push creation of path into if clause, the path cannot be created anyway
(and would be meaningless otherwise) if the parent is not visible.
2011-10-03 22:59:40 +02:00
Kristian Rietveld
6fdf882eb4 Add unit test for part 1 of bug 659022
This tests a case where gtk_tree_model_filter_row_changed() is run
for a node with visible_siter != NULL, however its parent has
visible_iter == NULL. For this case, no valid paths can be generated
as the node cannot be accessed (because the parent is invisible).
2011-10-03 22:59:40 +02:00
Cosimo Cecchi
e1f79e8275 box: add some missing includes 2011-10-03 16:54:09 -04:00
Benjamin Otte
78ddecab0c iconcache: Fix gcc warning 2011-10-03 18:29:53 +02:00
Benjamin Otte
e97b05acbd filesystemmodel: Add a missing check
Paths with depth > 1 should return FALSE instead of pretending the depth
is 1.
2011-10-03 18:29:21 +02:00
Chun-wei Fan
eb8c2dfae2 Bug 660730: Use GStatBuf for portability
Thanks to Kean Johnston for pointing this out.

There are a few places in GTK that use "struct stat",
and then g_stat(), rather than using GStatBuf.This breaks things on
Windows. Since the size of struct stat can vary depending on other
flags specified, this has the potential to cause overwrites and is
trivial to fix.

Based on patch submitted by Kean Johnston
2011-10-03 23:25:33 +08:00
Adel Gadllah
25e65dc1b5 gdk: Plug leak in gdk_display_pointer_is_grabbed
gdk_x11_device_manager_core_list_devices returns a new allocated
list, which has to be freed.

valgrind output:

==18686== 160,176 (80,088 direct, 80,088 indirect) bytes in 3,337 blocks are definitely lost in loss record 25,347 of 25,378
==18686==    at 0x4C256DD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==18686==    by 0x6CD7752: g_malloc (in /lib64/libglib-2.0.so.0.3000.0)
==18686==    by 0x6CEE2B6: g_slice_alloc (in /lib64/libglib-2.0.so.0.3000.0)
==18686==    by 0x6CCB37D: g_list_prepend (in /lib64/libglib-2.0.so.0.3000.0)
==18686==    by 0x654CADA: gdk_x11_device_manager_core_list_devices (gdkdevicemanager-core-x11.c:836)
==18686==    by 0x6531489: gdk_display_pointer_is_grabbed (gdkdisplay.c:1270)
==18686==    by 0x5162E1E: filter_func (ui.c:140)
==18686==    by 0x6558B50: gdk_event_apply_filters (gdkeventsource.c:83)
==18686==    by 0x6558CB3: _gdk_x11_display_queue_events (gdkeventsource.c:197)
==18686==    by 0x6530680: gdk_display_get_event (gdkdisplay.c:311)
==18686==    by 0x65589F1: gdk_event_source_dispatch (gdkeventsource.c:356)
==18686==    by 0x6CD0A0E: g_main_context_dispatch (in /lib64/libglib-2.0.so.0.3000.0)

https://bugzilla.gnome.org/show_bug.cgi?id=660676
2011-10-03 14:11:43 +02:00
Tiffany Antopolski
2790a3d81a Updated Esperanto translation 2011-10-03 12:48:57 +02:00
Antoine Jacoutot
f44b8465f1 __SIZEOF_INT__ and __SIZEOF_POINTER__ may not be defined.
Protect __SIZEOF_INT__ and __SIZEOF_POINTER__ with an ifdef to prevent
warnings about them not being defined when including gtktextattributes.h.

https://bugzilla.gnome.org/show_bug.cgi?id=660619
2011-10-03 09:11:50 +02:00
Javier Jardón
8985ce3b72 gtkbox: Move private functions to private header 2011-10-02 21:30:42 +01:00
Matthias Clasen
c5c392ddf9 Add 'Since 3.4' indices to the docs 2011-10-02 10:22:13 -04:00
Matthias Clasen
c8eb4e5abe Add new api to gdk.symbols
This keeps 'make check' happy.
And if 'make check' is happy, so am I.
2011-10-02 10:22:13 -04:00
Javier Jardón
522c305c12 gdkcreen-x11: Use GdkRGBA instead GdkColor 2011-10-01 20:45:27 +01:00
Nguyễn Thái Ngọc Duy
36b2362ac9 Updated Vietnamese translation 2011-10-01 20:10:12 +10:00
Nguyễn Thái Ngọc Duy
dc67221027 po/vi: import from Damned Lies 2011-10-01 19:55:34 +10:00
Benjamin Otte
fcd4d8a208 uimanager: Deprecate add-tearoffs property
Don't use it. Please.
2011-10-01 05:59:04 +02:00
Benjamin Otte
b13544171a menu: Deprecate GtkTearoffMenuItem 2011-10-01 05:59:04 +02:00
Benjamin Otte
165fc24104 testgtk: Remove tearoff menus from tests 2011-10-01 05:59:04 +02:00
Benjamin Otte
f74421f524 gtk-demo: Don't use tearoff menus
Demoing bad things, sheesh.
2011-10-01 05:59:04 +02:00
Rui Matos
2720574ab9 gtkwindow: Clean up gtk_window_map()
Remove unneeded variable and delete trailing whitespace.
2011-10-01 01:28:30 +01:00
Rui Matos
34357481b3 docs: Delete duplicate line in gdkwindow.c 2011-10-01 01:24:36 +01:00
Benjamin Otte
85b79fbd26 handlebox: Deprecate 2011-09-30 23:23:36 +02:00
Benjamin Otte
e967c7406a testgtk: Remove handlebox example
Rather than keeping it and enabling deprecated code in testgtk I decided
to delete the example. The warnings from testgtk about deprecated code
are too useful IMO.
Should we need it again, we can make it into its own test, or add a
testgtkdeprecated.
2011-09-30 23:23:36 +02:00
Benjamin Otte
5ae01f82c0 tests: Remove handleboxes from testmerge example 2011-09-30 23:23:36 +02:00
Benjamin Otte
a36b05fed7 a11y: Don't include gtkx when not needed 2011-09-30 23:23:36 +02:00
Benjamin Otte
4a43034761 a11y: Remove useless check 2011-09-30 23:23:36 +02:00
Yaron Shahrabani
e0625f1370 Updated Hebrew translation. 2011-09-30 13:27:54 +03:00
Benjamin Otte
61d6c73f18 tests: Fix a bunch of set-but-unused warnings in the filtermodel test
The whole test doesn't seem to unref any memoery, somebody should review
it.
2011-09-30 00:26:22 +02:00
Benjamin Otte
58d9c7e53e docs: Fix typo in treeview docs 2011-09-30 00:26:22 +02:00
Javier Jardón
28bffa4f27 gtktable: Fix gtk-doc notation 2011-09-29 12:42:38 +01:00
Javier Jardón
b0a7db76fb Replace some references to the GtkTable, use GtkGrid instead 2011-09-29 12:38:49 +01:00
Cosimo Cecchi
bdfa05bc81 notebook: don't forget to prepare the tab style context before drawing
The previous commit a9affcdd3f
accidentally removed the call to notebook_tab_prepare_style_context()
2011-09-29 01:49:55 -04:00
Benjamin Otte
a9affcdd3f notebook: Remove unused variables 2011-09-29 04:24:02 +02:00
Benjamin Otte
11e17601b3 combobox: Remove unused define 2011-09-29 04:24:02 +02:00
Cosimo Cecchi
fb488d49b2 GtkTreeViewColumn: initialize a variable
Shut up valgrind complaining about uninitialized values

==5330== Conditional jump or move depends on uninitialised value(s)
==5330==    at 0x624FF4C: gdk_window_move_resize_internal
(gdkwindow.c:6037)
==5330==    by 0x62502C3: gdk_window_move_resize (gdkwindow.c:6274)
==5330==    by 0x5E4FBB5: _gtk_tree_view_column_allocate
(gtktreeviewcolumn.c:2169)
==5330==    by 0x5E3846B: gtk_tree_view_size_allocate_columns
(gtktreeview.c:2631)
==5330==    by 0x5E43D76: gtk_tree_view_size_allocate
(gtktreeview.c:2686)
==5330==    by 0x7F03959: g_closure_invoke (gclosure.c:774)
==5330==    by 0x7F16446: signal_emit_unlocked_R (gsignal.c:3202)
==5330==    by 0x7F20256: g_signal_emit_valist (gsignal.c:3003)
==5330==    by 0x7F20421: g_signal_emit (gsignal.c:3060)
==5330==    by 0x5E6DFBE: gtk_widget_size_allocate (gtkwidget.c:4886)
==5330==    by 0x5D94ADD: gtk_scrolled_window_allocate_child
(gtkscrolledwindow.c:1506)
==5330==    by 0x5D95299: gtk_scrolled_window_size_allocate
(gtkscrolledwindow.c:1704)
==5330==    by 0x7F03959: g_closure_invoke (gclosure.c:774)
==5330==    by 0x7F16446: signal_emit_unlocked_R (gsignal.c:3202)
==5330==    by 0x7F20256: g_signal_emit_valist (gsignal.c:3003)
==5330==    by 0x7F20421: g_signal_emit (gsignal.c:3060)
==5330==    by 0x5E6DFBE: gtk_widget_size_allocate (gtkwidget.c:4886)
==5330==    by 0x5C62708: gtk_box_size_allocate (gtkbox.c:658)
==5330==    by 0x7F03959: g_closure_invoke (gclosure.c:774)
==5330==    by 0x7F16446: signal_emit_unlocked_R (gsignal.c:3202)
==5330==  Uninitialised value was created by a stack allocation
==5330==    at 0x5E4FA8D: _gtk_tree_view_column_allocate
(gtktreeviewcolumn.c:2139)
2011-09-28 20:20:20 -04:00
Cosimo Cecchi
036c193fb2 GdkWindow: fix conditional jump depends on uninitialized value error
Those if() blocks don't have any reason being there, as x and y are not
pointers. If the window is destroyed, just set the out values to zero
and return.

As seen in valgrind:

==3306== Conditional jump or move depends on uninitialised value(s)
==3306==    at 0x624C74F: gdk_window_get_root_coords (gdkwindow.c:6933)
==3306==    by 0x5E193C3: gtk_tooltip_show_tooltip (gtktooltip.c:1160)
==3306==    by 0x5E19C05: tooltip_popup_timeout (gtktooltip.c:1282)
==3306==    by 0x623B102: gdk_threads_dispatch (gdk.c:754)
==3306==    by 0x8592F3A: g_timeout_dispatch (gmain.c:3907)
==3306==    by 0x859174C: g_main_context_dispatch (gmain.c:2441)
==3306==    by 0x8591F47: g_main_context_iterate (gmain.c:3089)
==3306==    by 0x8592494: g_main_loop_run (gmain.c:3297)
==3306==    by 0x5D2E501: gtk_main (gtkmain.c:1362)
==3306==    by 0x5C5652F: gtk_application_run_mainloop
(gtkapplication.c:115)
==3306==    by 0x7C47C9D: g_application_run (gapplication.c:1323)
==3306==    by 0x447B5F: main (nautilus-main.c:102)
==3306==  Uninitialised value was created by a stack allocation
==3306==    at 0x624D48A: gdk_window_get_device_position
(gdkwindow.c:4952)
2011-09-28 20:20:19 -04:00
Benjamin Otte
08d578dfcb table: Deprecate GtkTable for GtkGrid 2011-09-29 01:51:46 +02:00
Benjamin Otte
80462c7cfd docs: Make infobar code example use GtkGrid instead of GtkTable 2011-09-29 01:51:46 +02:00
Benjamin Otte
638cb9e11a testtoolbar: Fix test to use GtkGrid
The conversion in commit 7724f14dfa was
incomplete. Redo it.
2011-09-29 01:51:46 +02:00
Benjamin Otte
9aed1514b7 testgtk: Convert panes example from GtkTable to GtkGrid 2011-09-29 01:51:46 +02:00
Benjamin Otte
4fbda7abfb testgtk: Convert size groups example from GtkTable to GtkGrid 2011-09-29 01:51:46 +02:00
Benjamin Otte
db746f39d8 testgtk: Switch progress bar example from GtkTable to GtkGrid 2011-09-29 01:51:46 +02:00
Benjamin Otte
d4c520e0c7 testgtk: Clean up code
Remove unused hboxes.
2011-09-29 01:51:46 +02:00
Michael Natterer
0a13deae88 quartz: don't filter away directly encoded 24-bit UCS characters
gdk_unicode_to_keyval(uc) returning (uc | 0x01000000) is not an
error return value but simply the way to encode 24-bit unicode
characters directly as keyvals.
2011-09-28 13:48:52 +02:00
Benjamin Otte
32bb9eebaa testgtk: Move paned example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
6e8b4c851a testgtk: Move display example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
35f5dd53a2 testgtk: Remove invalid property 2011-09-28 05:29:50 +02:00
Benjamin Otte
94f77029f7 testgtk: Convert focus example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
9972a1813e testgtk: Simplify code
Use a for loop for iterating.
2011-09-28 05:29:50 +02:00
Benjamin Otte
114541359f testgtk: Switch scrolled windows example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
26974640f8 testgtk: Convert radio/check button examples from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
88a7942198 print: Convert custom paper dialog from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
2d885120bc testgtk: Convert buttons example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
e214aec3cf testgtk: Beautify buttons example 2011-09-28 05:29:50 +02:00
Benjamin Otte
c25f2c4728 testgtk: Convert big windows example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
06440b40e2 testgtk: Upgrade alpha windows test from GtkTable to GtkGrid
Also fix some extra code.
2011-09-28 05:29:50 +02:00
Benjamin Otte
41e17d92c6 tests: Convert testframe from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
c4bc16e023 tests: Convert testgeometry from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
d4d4f7f7e7 tests: Convert testexpand from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
4866b04dce tests: Convert testentryicons example from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
32c21ea1b1 tests: Convert testdnd from GtkTable to GtkGrid 2011-09-28 05:29:50 +02:00
Benjamin Otte
1678fff136 tests: Convert testadjustsize example from GtkTable to box and grid 2011-09-28 05:29:50 +02:00
Benjamin Otte
3111ac0b1a tests: Make prop-editor use a grid instead of a table 2011-09-28 05:29:50 +02:00
Benjamin Otte
60eede3db3 tests: Convert print-editor from GtkTable to GtkBox 2011-09-28 05:29:49 +02:00
Benjamin Otte
afc56461de tests: Convert testimage example from GtkTable to GtkGrid 2011-09-28 05:29:49 +02:00
Benjamin Otte
2071cbf291 tests: Convert testmerge from GtkTable to GtkGrid 2011-09-28 05:29:49 +02:00
Cosimo Cecchi
5cf0450c69 toolbutton: don't force the icon widget to be a GtkMisc
There's really no reason the icon widget must be a GtkMisc. You might
want to use e.g. a GtkSpinner.
2011-09-27 17:31:11 -04:00
Cosimo Cecchi
63124e81b6 notebook: vborder/hborder deprecations are Since: 3.4, not 3.2 2011-09-27 13:46:01 -04:00
Cosimo Cecchi
c2f5d3d8b0 notebook: add top/bottom/left/right style classes to the tab region
When we use the style context to get information for the tab region,
also add a style class to indicate its position, so that the relevant
information is pulled off from the theme.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
8d3f7e3a4a stylecontext: add style classes for top/bottom/right/left areas
This is useful to e.g. theme notebook tabs differently according to
their position directly from the CSS sheet.

GtkNotebook support in a separate commit.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
d6a58e5bd3 notebook: unconditionally apply padding to the tab content
Not only when on left or top, otherwise the other position look
off-centered.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
34ee6d08bb notebook: really deprecate tab_vborder and tab_hborder
The setter for this was deprecated in 2.x and removed in 3.0.
I don't see any reason why we should hardcode 2px for this value;
instead, deprecated the getter and make it always return zero, and stop
using the variables internally.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
2500a95fad notebook: allow using different padding values for the active tab state
The code before was basically adding and removing the same padding value
in two different places during the allocation cycle.
Instead, what we want to do is to offset the inactive tab allocation by
the difference with the active tab padding, to ensure the tab content is
always drawn centered and in the right position.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Cosimo Cecchi
d4f83cdfb6 notebook: use the current state to get the padding values
We want to enable the use of different padding values between active and
inactive tabs, so that the two are completely separated (but limited by
the active tab size).
This way themes can decide how bigger the active tab is drawn compared
to the normal one just specifying a different padding value from the
CSS, like this:

.notebook tab {
  padding: 2;
}

.notebook tab:active {
  padding: 4;
}

As a first step, fetch the padding values with the right state flags
from GtkStyleContext.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
YunQiang Su
4991da8dd5 update zh_CN translation 2011-09-28 01:34:46 +08:00
Cosimo Cecchi
82710adc24 mountoperation: fix the build
2d3db3421f has a typo which broke the
build on master.
2011-09-27 12:51:54 -04:00
Piotr Drąg
b58a82dbb3 Updated POTFILES.skip 2011-09-27 16:04:53 +02:00
Michael Natterer
2d3db3421f Bug 659406 - Abstract what triggers a context menu
Add gdk_event_triggers_context_menu(), using the new modifier
abstraction API. Remove _gtk_button_event_triggers_context_menu()
and port all callers.
2011-09-27 15:45:18 +02:00
Michael Natterer
27cbbc4a7d GtkSettings: fix compile warnings on != X11 2011-09-27 14:21:09 +02:00
Michael Natterer
11f8c1ba6f gtk: remove the private GTK_EXTEND/MODIFY_SELECTION_MOD_MASK
and use the new public modifier abstraction API instead.
2011-09-27 12:06:10 +02:00
Michael Natterer
0abe8ce27b gtk: remove the private GTK_NO_TEXT_INPUT_MOD_MASK
and use the new public modifier abstraction API.
2011-09-27 11:34:19 +02:00
Michael Natterer
4a7a67339a Bug 659602 - Provide an abstraction for the platform's use of modifier keys
Add enum GdkModifierIntent which identifies use cases for modifier masks
and GdkKeyMap::get_modifier_mask(). Add a default implementation which returns
what is currently hardcoded all over GTK+, and an implementation in the
quartz backend. Also add gtk_widget_get_modifier_mask() which simplifies
things by doing widget->display->keymap->get_modifier_mask().
2011-09-27 09:56:25 +02:00
Benjamin Otte
04009aa332 tests: Use a grid in testnotebookdnd instead of a table 2011-09-27 05:37:14 +02:00
Benjamin Otte
fa656acb63 tests: Use a grid in testorientable instead of a table 2011-09-27 05:37:14 +02:00
Benjamin Otte
814b6c27aa tests: Use a box instead of a table in testselection 2011-09-27 05:37:14 +02:00
Benjamin Otte
aebd859ef9 toolbar: Fix widget path creation code
- Ensure arrow button is always included
- Invalidate list when direction changes
2011-09-27 05:37:14 +02:00
Benjamin Otte
276a9d7567 container: Warn if an invalid widget path is created
This makes it quite a bit easier to debug things.
2011-09-27 05:37:14 +02:00
Benjamin Otte
7724f14dfa tests: Convert testtoolbar to use a box instead of a table 2011-09-27 05:37:14 +02:00
Benjamin Otte
b48c2d3aea tests: Convert testtreeview from GtkTable to GtkBox 2011-09-27 05:37:14 +02:00
Benjamin Otte
dbd49744e3 tests: Make testwindows use GtkGrid 2011-09-27 05:37:14 +02:00
Benjamin Otte
3658e7a459 tests: Make testwindows dialog even more beautiful 2011-09-27 05:37:14 +02:00
Benjamin Otte
5e08c315b2 tests: Make editing window look more beautiful 2011-09-27 05:37:14 +02:00
Мирослав Николић
7b732ffb73 Updated Serbian translation 2011-09-27 02:24:51 +02:00
Matthias Clasen
a095a24ab4 Put master on the 3.3 track 2011-09-26 18:03:37 -04:00
Benjamin Otte
89d16a5123 reftests: Add a reftest checking background-color: transparent 2011-09-26 22:34:20 +02:00
Rodolfo Ribeiro Gomes
c7f2c88b18 Fixed some strings in Brazilian Portuguese translation 2011-09-26 15:46:00 -03:00
Michael Natterer
b663f3a00b Bug 659406 - Abstract what triggers a context menu
Add _gtk_button_event_triggers_context_menu() and use it instead
of checking for event->button == 3, so context menus are invoked
correctly on the Mac.
2011-09-26 16:01:50 +02:00
Michael Natterer
0955a59563 app: abstract which modifiers are used for extending and modifying selections
which are SHIFT and MOD2 on the Mac, and SHIFT and CONTROL otherwise.
Use the new define all over the place and rename variables and
members to not say "shift" or "control".
2011-09-26 16:01:50 +02:00
Michael Natterer
286fff4e5f gtk: use GTK_NO_TEXT_INPUT_MOD_MASK also in gtkfilechooserdefault.c
(cherry picked from commit b057a311e7)
2011-09-26 16:01:50 +02:00
Michael Natterer
24a42839ba gtk: allow to specify accelerators in a platform-independent way
Introduce <Primary> in accelerator strings, which resolves to
GDK_CONTROL_MASK on X11/Win23, and to GDK_META_MASK on quartz.
Also serialize CONTROL/META as <Primary> depending on the platform.
2011-09-26 16:01:50 +02:00
Michael Natterer
2a8be23d17 gtk: fix entering of Option-foo symbols on the Mac
define GTK_NO_TEXT_INPUT_MOD_MASK in gtkprivate.h
and use it in the IM contexts, so Option-foo is no longer
filtered away.
2011-09-26 16:01:50 +02:00
Michael Natterer
d3df4678ca gtk: use GTK_DEFAULT_ACCEL_MOD_MASK instead of GDK_CONTROL_MASK in gtkstock.c 2011-09-26 16:01:50 +02:00
Michael Natterer
a99d14f61c quartz: resolve the modifier confusion on the Mac
- map Alt/Option to MOD1
- map Command to MOD2
- map MOD2 to the virtual Meta
- improve/fix (?) group handling in gdkkeys-quartz.c
2011-09-26 16:01:50 +02:00
Michael Natterer
c50063397f gtk: disable mnemonics in gtkrc.key.mac, they don't exist on the Mac
(cherry picked from commit d83c86d42e)
2011-09-26 16:01:50 +02:00
Michael Natterer
3fd7dbc940 gtk: enable setting virtual modifiers in GtkCellRendererAccel
Call gdk_keymap_add_virtual_modifiers() on event->state,
so virtual modifiers get added at all.
(cherry picked from commit be1eea612c)
2011-09-26 16:01:50 +02:00
Benjamin Otte
b01e20f1d1 cssprovider: Remove unused enums 2011-09-26 16:00:26 +02:00
Benjamin Otte
1e36e40e29 styleproperty: Allow 'transparent' keyword for background-color 2011-09-26 16:00:26 +02:00
Benjamin Otte
205d0eb4da styleproperty: Default to transparent background-color 2011-09-26 16:00:26 +02:00
Benjamin Otte
61525f0662 styleproperty: Use the long form to register background-color
We want to set a default value.
2011-09-26 16:00:25 +02:00
Carles Ferrando
6476f6a265 [l10n]Updated Catalan (Valencian) translation 2011-09-26 14:22:19 +02:00
Carles Ferrando
d026fd4a04 [l10n]Updated Catalan (Valencian) translation 2011-09-26 14:22:01 +02:00
Petr Kovar
33c43c9264 Update Czech translation 2011-09-26 12:20:49 +02:00
Matthias Clasen
70b13d734d Bump version 2011-09-25 22:01:13 -04:00
552 changed files with 44388 additions and 33199 deletions

240
NEWS
View File

@@ -1,3 +1,243 @@
Overview of Changes in GTK+ 3.3.6
=================================
* GtkApplication has grown support for exporting application
menus and menubars on the bus, as a GMenuModel. The
new GtkApplicationWindow toplevel automatically
displays these menu models when needed.
* GtkSpinButtons have received a long-overdue face-lift
to make them easier to use with both mouse and touch.
* GtkScale has gained a has-origin property to request
filled-in drawing of the trough.
* GtkWindow can now request that the window manager hide
the titlebar when the window is maximized.
* The GtkTreeView accessibility support and the core
treeview code have been extensively refactored;
performance should be much improved. But watch out
for regressions.
* The GtkFileChooser entry completion code has been
extensively refactored; it now uses GtkEntryCompletion
* Excessive dependencies have been culled from Requires:
lines in pc files. Dependent modules may have to declare
dependencies that they were getting 'for free' in the past.
* Theming improvements:
- The background-clip and background-origin CSS properties
have been implemented
* Win32 improvements:
- Theming of column headers, radio buttons and menuitems,
notebook tabs, etc has been fixed
- Menus, tooltips, and other popups show above the task bar
* Wayland:
- The Wayland backend has been updated to the current Wayland API
* Bugs fixed:
603823 Print to File suggests ".ps" as filename...
640317 gtk_draw_insertion_cursor should be moved to gtk_render
646461 Leak in gtkfilechooserbutton.c: model_free_row_data
650943 Clicking resize grip causes strange mouse grabbing beh...
661428 Allow themes to know when a toplevel window appears un...
662814 Request for way to tell gtk_recent_manager_add_item_qu...
664137 Crash in Audacious audio player when browsing the add ...
664456 segfault on arrow keypress in empty GtkIconView
664467 prop-editor is broken for GdkColor properties
664469 color button doesn't notify "color" and "alpha" when c...
664537 GtkCssProvider: don't segfault when CSS file is not found
664640 CUPS authentication does not work
665140 Draw the scale split
665326 FTBFS: missing Xi/Pango/Fc for gtk-query-immodules-3.0
665616 Add hide-titlebar-when-maximized setting
665741 Crashes in treeview when pressing End key.
665999 Introspection wrong for GDK_INPUT_ONLY vs GDK_INPUT_OUTPUT
666242 Separators in menuitem are not vertically aligned
641999 Consider adding a workarea API
657578 Toggling the state of a GtkCheckButton causes accessible...
659445 Accessible event.any_data is incorrect for text-removed...
663573 Rework GtkFileChooserEntry
666392 widget: Flip the sensitive flag even if the state doesn't...
666552 Layered region is leaked in GdkWindow
* Updated translations
Breton
Kazakh
Russian
Slovak
Spanish
Overview of Changes in GTK+ 3.3.4
=================================
* The beagle search backend has been dropped
* Stop using GDK/GTK_DISABLE_DEPRECATED guards for deprecated
functions; instead use function attributes
* Make GtkCellRendererAccel support naked keyvals, so it can
be used in gnome-control-center
* GDK changes
- Make the Mod1 == Alt assumption official
- The Broadway backend has initial support for V7+ websockets
* GtkApplication no longer uses gtk_main internally
* GtkNotebook now destroys its action widgets, instead of leaking them
* Theming improvements:
- Background images can now be tiled instead of stretched,
using the background-repeat CSS property
- Unfocused windows can be themed differently, using
the 'window-unfocused' state flag
* Accessibility improvements:
- Much better treeview performance
- Completely ignore invisible columns in treeviews
- Many a11y/treeview-related crashes fixed
- Combo box keybindings are reported again
- Textview respects display lines again
* OS X improvements:
- Improved handling of motion events and event state
- Handle recursive CFRunLoops
- More fixes to accel handling
* Win32 improvements:
- Many fixes, making this the first version of GTK+ 3 that
works well on Windows
* Bugs fixed:
84314 gdk_display_sync() and gdk_flush()
142874 use of SetWindowLong in gdkwindow-win32.c causes incorrect...
169811 configure_event and window-state-event are not emitted con...
171456 "Keep Above" option in Gimp broken on Win32
324254 Realizing a top-level window widget early positions it at 0,0
516822 gtk_window_fullscreen does not resize correctly if removing...
542777 Scroll-Wheel doesn't scroll (Win)
552041 Windows' System Menu from taskbar is buggy
603559 gtk should handle missing immodules better
604156 gtk_window_set_modal() freezes application completely
606727 Can't bind keys on numerical keypad with numlock on
612359 Dialog positioning hints fail on Windows 7
616544 win32 drag and drop (DnD) broken for GTK+ 3
628049 Native windows don't work very well
631384 Images pasted from clipboard are shifted/wrapped
647460 typo in msw_style.c?
652239 win32: resurect Windows clipboard selection notification
658841 Ensure native window in gdk_win32_drawable_get_handle()...
658842 Fix win32 _gdk_windowing_window_at_pointer - port to gtk3
659151 Cannot obtain accessible keybinding for comboboxes
659257 Gtk-WARNING **: GtkRecentChooserWidget 0x80da890 is mapped...
661858 Add annotations for some GtkRadio* constructors
661859 Add annotations for some GtkSymbolicColor constructors
661997 Gtk crashes when changing the TreeView model while rubber...
662160 gtk_print_operation_cancel fails
662628 Add keyboard brightness to keyname-table.h
662670 Pressing "Enter" in print dialog box will not cause printing
662691 menuitem: Always treat submenus as popup
662755 Keycode support in GtkCellRendererAccel broken
662839 Fix XIGrabKeycode usage
662870 Fix introspection annotations for GtkRadioToolButton
662953 x11: Fix window manager change detection
663073 gtk_dialog_new_with_buttons should be G_GNUC_NULL_TERMINATED
663138 iconview: layout items immediately when setting a GtkTreeModel
663182 Dragging any item on OS X crashes Banshee
663345 'from gi.repository import Gtk' fails in jhbuild
663396 With multiple master devices, right clicking may show popup...
663522 css: start background-repeat
663605 Fix event->state of many event types on quartz
663694 GtkTreeViewAccessibleCellInfo are leaked
663761 gtk: Fix GtkCellRenderer ignoring keycodes
663825 calling gtk_progress_bar_set_fraction with a fraction > 1.0...
663856 Make option-foo accelerators use the right symbol
663994 GtkTextView no longer reports the correct line text to ATs...
664021 GtkSpinButton: Clarify clamping behavior in gtk_spin_button...
664027 Build fails with undefined reference to `gdk_keymap_get_mod...
664132 gdk_cairo_region_create_from_surface broken on PPC...
Overview of Changes in GTK+ 3.3.2
=================================
* GtkCellRendererAccel can show virtual modifiers
* Theming improvements:
- CSS: 'transparent' can be used a color
- Improved notebook tab rendering
- Support opacity and rounded corners for tooltips
* OS X improvements:
- Disable mnemonics
- Make Option work as a modifier
- Cleanup of modifiers: Alt/Option is MOD1, Command is MOD2
- Fix keyval <> Unicode and lowercase/uppercase mapping
* Improvements of cross-platform key and button event handling:
- Support '<Primary>' in accelerator strings
- Use approprivate modifiers for extending and modifying
selections, depending on the platform
- Use the appropriate button for triggering context menus,
depending on the platform
* Bugs fixed:
628936 gtk build fails because of objective-c elements
653289 GtkCellRendererText "edited" signal not emitted...
655057 rendering issues with map plugin
657770 Write to released memory in gtkdnd-quartz.c
658767 Drag and Drop NSEvent capture is racy
658772 Directory paths for resource directories are hard-coded
659022 gtk_tree_model_filter_clear_cache_helper: assertion failed
659655 3 errors in Spanish translation of gtk+
660687 roxterm X crashes with accessibility enabled
660730 Use of "struct stat" breaks Windows
659602 Provide an abstraction for the platform's use...
659406 Abstract what triggers a context menu
660619 __SIZEOF_INT__ and __SIZEOF_POINTER__ may not be defined
599617 a modern tooltip look
628936 gtk build fails because of objective-c elements
631167 GtkComboBox with has-entry=true should not require...
651818 Crash in gtk_app_chooser_refresh()
659672 gtk_tree_view_column_dispose() does not remove from tree...
660139 GtkGrid gives Gtk-Warnings about negative sizes...
660833 all: add an 'only-child' pseudo-class selector
661032 out-of-tree builds result in broken gtk-doc documentation
661089 gtkfontbutton.c will not compile on Solaris
661780 GTK_STOCK_INDENT references wrong images
661835 GMountOperation on OpenBSD: remove the need for kvm(3)
662024 tests/css/parser/selector.errors missing from EXTRA_DIST
662132 --sync
662177 Toolbar returns invalid paths for toolbar items
662230 treemodel: document gtk_tree_path_free() as allow-none
662308 Scrollbars seem to unconditionally reserve a space...
662467 tooltip: only update shape if the window is realized
662481 Clean up the gtkprivate directory redefinition mess
662629 notebook: update tab area allocation when switching page
* Translation updates
Brazilian Portuguese
British English
Catalan (Valencian)
Czech
Dutch
Esperanto
Japanese
Galician
Latvian
Serbian
Spanish
Simplified Chinese
Traditional Chinese
Vietnamese
Overview of Changes in GTK+ 3.2
===============================

View File

@@ -588,7 +588,7 @@ $(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
</ClCompile>
<Link>

View File

@@ -9,7 +9,7 @@
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0"
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES"
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES"
ForcedIncludeFiles="msvc_recommended_pragmas.h"
/>
<Tool

View File

@@ -9,8 +9,8 @@
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [2])
m4_define([gtk_micro_version], [0])
m4_define([gtk_minor_version], [3])
m4_define([gtk_micro_version], [7])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@@ -39,7 +39,7 @@ AC_CONFIG_AUX_DIR([build-aux])
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.29.14])
m4_define([glib_required_version], [2.31.6])
m4_define([pango_required_version], [1.29.0])
m4_define([atk_required_version], [2.1.5])
m4_define([cairo_required_version], [1.10.0])
@@ -165,9 +165,6 @@ case $host in
*-*-linux*)
os_linux=yes
;;
*-*-openbsd*)
os_openbsd=yes
;;
esac
dnl
@@ -266,27 +263,27 @@ AC_ARG_ENABLE(xkb,
[enable_xkb="maybe"])
AC_ARG_ENABLE(xinerama,
[AS_HELP_STRING([--enable-xinerama],
[support Xinerama extension if available [default=maybe]])],,
[support Xinerama extension [default=maybe]])],,
[enable_xinerama="maybe"])
AC_ARG_ENABLE(xinput,
[AS_HELP_STRING([--enable-xinput],
[support XInput extension if available [default=yes]])],,
[support XInput extension [default=yes]])],,
[enable_xinput="maybe"])
AC_ARG_ENABLE(xrandr,
[AS_HELP_STRING([--enable-xrandr],
[support XRandR extension if available [default=maybe]])],,
[support XRandR extension [default=maybe]])],,
[enable_xrandr="maybe"])
AC_ARG_ENABLE(xfixes,
[AS_HELP_STRING([--enable-xfixes],
[support XFixes extension if available [default=maybe]])],,
[support XFixes extension [default=maybe]])],,
[enable_xfixes="maybe"])
AC_ARG_ENABLE(xcomposite,
[AS_HELP_STRING([--enable-xcomposite],
[support X Composite extension if available [default=maybe]])],,
[support X Composite extension [default=maybe]])],,
[enable_xcomposite="maybe"])
AC_ARG_ENABLE(xdamage,
[AS_HELP_STRING([--enable-xdamage],
[support X Damage extension if available [default=maybe]])],,
[support X Damage extension [default=maybe]])],,
[enable_xdamage="maybe"])
AC_ARG_ENABLE(x11-backend,
@@ -318,6 +315,11 @@ if test -z "$backend_set"; then
fi
fi
AC_ARG_ENABLE(quartz-relocation,
[AS_HELP_STRING([--enable-quartz-relocation],
[enable bundle-based relocation functions])],
[quartz_relocation=yes])
cairo_backends=
backend_immodules=
GDK_BACKENDS=
@@ -360,6 +362,10 @@ if test "x$enable_quartz_backend" = xyes; then
#define GDK_WINDOWING_QUARTZ"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
AM_CONDITIONAL(USE_QUARTZ, true)
if test "x$quartz_relocation" = xyes; then
AC_DEFINE([QUARTZ_RELOCATION], [1], [Use NSBundle functions to determine load paths for libraries, translations, etc.])
fi
else
AM_CONDITIONAL(USE_QUARTZ, false)
fi
@@ -400,7 +406,7 @@ fi
if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES"
GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
else
if test "x$enable_debug" = "xno"; then
GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
@@ -438,8 +444,6 @@ if test "x$GCC" = "xyes"; then
fi
changequote([,])dnl
CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES"
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc.
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
@@ -491,6 +495,8 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
if test "$os_win32" != yes; then
# libtool option to control which symbols are exported
# right now, symbols starting with _ are not exported
@@ -681,23 +687,11 @@ esac
# Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
#
GLIB_PACKAGES="gobject-2.0 gio-2.0 gmodule-no-export-2.0"
AM_PATH_GLIB_2_0(glib_required_version, :,
AC_MSG_ERROR([
*** GLIB glib_required_version or better is required. The latest version of
*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
gobject gmodule-no-export gthread)
# See if it's safe to turn G_DISABLE_DEPRECATED on.
GLIB_VERSION_MAJOR_MINOR=`$PKG_CONFIG --modversion glib-2.0 | sed "s/\.@<:@^.@:>@*\$//"`
GLIB_REQUIRED_VERSION_MAJOR_MINOR=`echo glib_required_version | sed "s/\.@<:@^.@:>@*\$//"`
if test "x$GLIB_VERSION_MAJOR_MINOR" = "x$GLIB_REQUIRED_VERSION_MAJOR_MINOR"; then
CFLAGS="-DG_DISABLE_DEPRECATED $CFLAGS"
fi
CFLAGS="-DGDK_PIXBUF_DISABLE_DEPRECATED $CFLAGS"
gobject gmodule-no-export)
dnl
dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
@@ -1124,6 +1118,7 @@ if test "x$enable_x11_backend" = xyes; then
[Define to 1 if XFree XInput should be used])
X_PACKAGES="$X_PACKAGES xi"
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xi"
AC_CHECK_HEADER(X11/extensions/XInput2.h,
have_xinput2=yes
@@ -1261,20 +1256,24 @@ fi
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject"
GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 cairo cairo-gobject"
GDK_PRIVATE_PACKAGES="$GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends"
if test "x$enable_x11_backend" = xyes; then
GDK_PRIVATE_PACKAGES="$GDK_PRIVATE_PACKAGES pangoft2"
fi
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES` $MATH_LIB"
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS"
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES $GDK_PRIVATE_PACKAGES` $MATH_LIB"
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PACKAGES $GDK_PRIVATE_PACKAGES` $GDK_EXTRA_CFLAGS"
#
# If we aren't writing explicit dependencies, then don't put the extra libraries we need
# into the pkg-config files
#
if test $enable_explicit_deps != yes ; then
GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 cairo-gobject"
GDK_EXTRA_LIBS=
fi
AC_SUBST(GDK_PACKAGES)
AC_SUBST(GDK_PRIVATE_PACKAGES)
AC_SUBST(GDK_EXTRA_LIBS)
AC_SUBST(GDK_EXTRA_CFLAGS)
AC_SUBST(GDK_DEP_LIBS)
@@ -1311,17 +1310,15 @@ else
fi
GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0"
GTK_PRIVATE_PACKAGES=""
if test "x$enable_x11_backend" = xyes; then
GTK_PACKAGES="$GTK_PACKAGES pangoft2"
GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
fi
GTK_EXTRA_LIBS=
if test x"$os_openbsd" = xyes; then
GTK_EXTRA_LIBS="$GTK_EXTRA_LIBS -lkvm"
fi
GTK_EXTRA_CFLAGS=
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $MATH_LIB"
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES $GTK_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES $GTK_PRIVATE_PACKAGES` $GTK_EXTRA_LIBS $MATH_LIB"
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PACKAGES $GTK_PACKAGES $GTK_PRIVATE_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
if test x"$os_win32" = xyes; then
GTK_EXTRA_CFLAGS="$msnative_struct"
@@ -1333,6 +1330,7 @@ PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
AC_SUBST(GTK_PACKAGES)
AC_SUBST(GTK_PRIVATE_PACKAGES)
AC_SUBST(GTK_EXTRA_LIBS)
AC_SUBST(GTK_EXTRA_CFLAGS)
AC_SUBST(GTK_DEP_LIBS)
@@ -1501,6 +1499,9 @@ if test "x$enable_test_print_backend" != "xno" ; then
fi
AM_CONDITIONAL(TEST_PRINT_BACKEND, test "x$enable_test_print_backend" != "xno")
if test "$os_win32" = "yes"; then
AC_CHECK_TYPES([IPrintDialogCallback],[],[],[[#include <windows.h>]])
fi
################################################################
# Strip -export-dynamic from the link lines of various libraries
@@ -1664,6 +1665,20 @@ AC_CONFIG_COMMANDS([gdk/gdkconfig.h], [
G_BEGIN_DECLS
/* These macros are used to mark deprecated functions in GDK and
* GTK+ headers, and thus have to be exposed in installed headers.
* But please do *not* use them in other projects. Instead, use
* G_DEPRECATED or define your own wrappers around it.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define GDK_DEPRECATED
#define GDK_DEPRECATED_FOR(f)
#else
#define GDK_DEPRECATED G_DEPRECATED
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
#endif
_______EOF
cat >>$outfile <<_______EOF

View File

@@ -43,6 +43,7 @@ demos = \
textview.c \
textscroll.c \
toolpalette.c \
transparent.c \
tree_store.c \
ui_manager.c

View File

@@ -29,6 +29,14 @@ activate_action (GtkAction *action)
NULL);
return;
}
if (g_str_equal (name, "HideTitlebar"))
{
gboolean value = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), value);
return;
}
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
@@ -194,6 +202,11 @@ static GtkToggleActionEntry toggle_entries[] = {
"Prefer Dark Theme", /* tooltip */
G_CALLBACK (activate_action),
FALSE }, /* is_active */
{ "HideTitlebar", NULL,
"_Hide Titlebar when maximized", NULL,
"Hide Titlebar when maximized",
G_CALLBACK (activate_action),
FALSE }
};
static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
@@ -248,6 +261,7 @@ static const gchar *ui_info =
" </menu>"
" <menu action='PreferencesMenu'>"
" <menuitem action='DarkTheme'/>"
" <menuitem action='HideTitlebar'/>"
" <menu action='ColorMenu'>"
" <menuitem action='Red'/>"
" <menuitem action='Green'/>"

View File

@@ -78,7 +78,8 @@ find_toplevel_at_pointer (GdkDisplay *display)
GdkWindow *pointer_window;
GtkWidget *widget = NULL;
pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
pointer_window = gdk_device_get_window_at_position (gtk_get_current_event_device (),
NULL, NULL);
/* The user data field of a GdkWindow is used to store a pointer
* to the widget that created it.
@@ -131,11 +132,13 @@ query_for_toplevel (GdkScreen *screen,
gtk_widget_show_all (popup);
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
if (gdk_pointer_grab (gtk_widget_get_window (popup), FALSE,
GDK_BUTTON_RELEASE_MASK,
NULL,
cursor,
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
if (gdk_device_grab (gtk_get_current_event_device (),
gtk_widget_get_window (popup),
GDK_OWNERSHIP_NONE,
FALSE,
GDK_BUTTON_RELEASE_MASK,
cursor,
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
{
gboolean clicked = FALSE;

View File

@@ -126,7 +126,7 @@ scribble_motion_notify_event (GtkWidget *widget,
* can cope.
*/
gdk_window_get_pointer (event->window, &x, &y, &state);
gdk_window_get_device_position (event->window, event->device, &x, &y, &state);
if (state & GDK_BUTTON1_MASK)
draw_brush (widget, x, y);

View File

@@ -48,27 +48,27 @@ add_items (void)
g_return_if_fail (articles != NULL);
foo.number = 3;
foo.product = "bottles of coke";
foo.product = g_strdup ("bottles of coke");
foo.yummy = 20;
g_array_append_vals (articles, &foo, 1);
foo.number = 5;
foo.product = "packages of noodles";
foo.product = g_strdup ("packages of noodles");
foo.yummy = 50;
g_array_append_vals (articles, &foo, 1);
foo.number = 2;
foo.product = "packages of chocolate chip cookies";
foo.product = g_strdup ("packages of chocolate chip cookies");
foo.yummy = 90;
g_array_append_vals (articles, &foo, 1);
foo.number = 1;
foo.product = "can vanilla ice cream";
foo.product = g_strdup ("can vanilla ice cream");
foo.yummy = 60;
g_array_append_vals (articles, &foo, 1);
foo.number = 6;
foo.product = "eggs";
foo.product = g_strdup ("eggs");
foo.yummy = 10;
g_array_append_vals (articles, &foo, 1);
}

View File

@@ -225,29 +225,6 @@ motion_notify_event (GtkWidget *text_view,
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
gdk_window_get_pointer (gtk_widget_get_window (text_view),
NULL, NULL, NULL);
return FALSE;
}
/* Also update the cursor image if the window becomes visible
* (e.g. when a window covering it got iconified).
*/
static gboolean
visibility_notify_event (GtkWidget *text_view,
GdkEventVisibility *event)
{
gint wx, wy, bx, by;
gdk_window_get_pointer (gtk_widget_get_window (text_view),
&wx, &wy, NULL);
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
wx, wy, &bx, &by);
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), bx, by);
return FALSE;
}
@@ -285,8 +262,6 @@ do_hypertext (GtkWidget *do_widget)
G_CALLBACK (event_after), NULL);
g_signal_connect (view, "motion-notify-event",
G_CALLBACK (motion_notify_event), NULL);
g_signal_connect (view, "visibility-notify-event",
G_CALLBACK (visibility_notify_event), NULL);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));

View File

@@ -711,7 +711,7 @@ selection_cb (GtkTreeSelection *selection,
GtkTreeModel *model)
{
GtkTreeIter iter;
GValue value = {0, };
GValue value = G_VALUE_INIT;
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
return;

View File

@@ -30,8 +30,7 @@
#include <stdio.h>
static GtkWidget *
create_menu (gint depth,
gboolean tearoff)
create_menu (gint depth)
{
GtkWidget *menu;
GtkWidget *menuitem;
@@ -45,13 +44,6 @@ create_menu (gint depth,
menu = gtk_menu_new ();
group = NULL;
if (tearoff)
{
menuitem = gtk_tearoff_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
}
for (i = 0, j = 1; i < 5; i++, j++)
{
sprintf (buf, "item %2d - %d", depth, j);
@@ -63,7 +55,7 @@ create_menu (gint depth,
if (i == 3)
gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1, TRUE));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
}
return menu;
@@ -128,7 +120,7 @@ do_menus (GtkWidget *do_widget)
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
gtk_widget_show (menubar);
menu = create_menu (2, TRUE);
menu = create_menu (2);
menuitem = gtk_menu_item_new_with_label ("test\nline2");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
@@ -136,12 +128,12 @@ do_menus (GtkWidget *do_widget)
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("foo");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3, TRUE));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);
menuitem = gtk_menu_item_new_with_label ("bar");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, TRUE));
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
gtk_widget_show (menuitem);

View File

@@ -0,0 +1,248 @@
/* Transparent
*
* Use transparent background on GdkWindows to create a shadow effect on a GtkOverlay widget.
*/
#include <gtk/gtk.h>
#define SHADOW_OFFSET_X 7
#define SHADOW_OFFSET_Y 7
#define SHADOW_RADIUS 5
static void
draw_shadow_box (cairo_t *cr,
GdkRectangle rect,
double radius,
double transparency)
{
cairo_pattern_t *pattern;
double x0, x1, x2, x3;
double y0, y1, y2, y3;
x0 = rect.x;
x1 = rect.x + radius;
x2 = rect.x + rect.width - radius;
x3 = rect.x + rect.width;
y0 = rect.y;
y1 = rect.y + radius;
y2 = rect.y + rect.height - radius;
y3 = rect.y + rect.height;
/* Fill non-border part */
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
cairo_rectangle (cr,
x1, y1, x2 - x1, y2 - y1);
cairo_fill (cr);
/* Upper border */
pattern = cairo_pattern_create_linear (0, y0, 0, y1);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x1, y0,
x2 - x1, y1 - y0);
cairo_fill (cr);
/* Bottom border */
pattern = cairo_pattern_create_linear (0, y2, 0, y3);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x1, y2,
x2 - x1, y3 - y2);
cairo_fill (cr);
/* Left border */
pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y1,
x1 - x0, y2 - y1);
cairo_fill (cr);
/* Right border */
pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y1,
x3 - x2, y2 - y1);
cairo_fill (cr);
/* NW corner */
pattern = cairo_pattern_create_radial (x1, y1, 0,
x1, y1, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y0,
x1 - x0, y1 - y0);
cairo_fill (cr);
/* NE corner */
pattern = cairo_pattern_create_radial (x2, y1, 0,
x2, y1, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y0,
x3 - x2, y1 - y0);
cairo_fill (cr);
/* SW corner */
pattern = cairo_pattern_create_radial (x1, y2, 0,
x1, y2, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y2,
x1 - x0, y3 - y2);
cairo_fill (cr);
/* SE corner */
pattern = cairo_pattern_create_radial (x2, y2, 0,
x2, y2, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y2,
x3 - x2, y3 - y2);
cairo_fill (cr);
}
static gboolean
draw_callback (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
GdkRectangle rect;
gtk_widget_get_allocation (widget, &rect);
rect.x += SHADOW_OFFSET_X;
rect.y += SHADOW_OFFSET_Y;
rect.width -= SHADOW_OFFSET_X;
rect.height -= SHADOW_OFFSET_Y;
draw_shadow_box (cr,
rect, SHADOW_RADIUS, 0.4);
return FALSE;
}
GtkWidget *
do_transparent (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkWidget *overlay;
GtkWidget *align;
GtkWidget *entry;
GdkRGBA transparent = {0, 0, 0, 0};
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "Transparent");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
view = gtk_text_view_new ();
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view);
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_container_add (GTK_CONTAINER (window), overlay);
gtk_widget_override_background_color (overlay, 0, &transparent);
align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
gtk_alignment_set_padding (GTK_ALIGNMENT (align),
0, SHADOW_OFFSET_Y, 0, SHADOW_OFFSET_X);
g_signal_connect (align, "draw", G_CALLBACK (draw_callback), NULL);
entry = gtk_entry_new ();
gtk_container_add (GTK_CONTAINER (align), entry);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), align);
gtk_widget_set_halign (align, GTK_ALIGN_CENTER);
gtk_widget_set_valign (align, GTK_ALIGN_START);
gtk_widget_show_all (overlay);
}
if (!gtk_widget_get_visible (window))
{
gtk_widget_show (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

View File

@@ -9,10 +9,11 @@ DOC_MODULE=gdk3
DOC_MAIN_SGML_FILE=gdk-docs.sgml
# Extra options to supply to gtkdoc-scan
SCAN_OPTIONS=--deprecated-guards="GDK_ENABLE_BROKEN|GDK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--deprecated-guards=GDK_DISABLE_DEPRECATED \
--ignore-decorators=G_GNUC_WARN_UNUSED_RESULT
# The directory containing the source code. Relative to $(srcdir)
DOC_SOURCE_DIR=../../../gdk ../../../gdk/x11
DOC_SOURCE_DIR=$(top_srcdir)/gdk $(top_srcdir)/gdk/x11
# Used for dependencies
HFILE_GLOB=$(top_srcdir)/gdk/*.h $(top_srcdir)/gdk/x11/gdkx.h

View File

@@ -61,6 +61,10 @@
<title>Index of new symbols in 3.2</title>
<xi:include href="xml/api-index-3.2.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-4" role="3.4">
<title>Index of new symbols in 3.4</title>
<xi:include href="xml/api-index-3.4.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>

View File

@@ -74,6 +74,7 @@ gdk_grab_status_get_type
gdk_gravity_get_type
gdk_input_mode_get_type
gdk_input_source_get_type
gdk_modifier_intent_get_type
gdk_modifier_type_get_type
gdk_notify_type_get_type
gdk_property_state_get_type
@@ -198,6 +199,7 @@ gdk_screen_make_display_name
gdk_screen_get_n_monitors
gdk_screen_get_primary_monitor
gdk_screen_get_monitor_geometry
gdk_screen_get_monitor_workarea
gdk_screen_get_monitor_at_point
gdk_screen_get_monitor_at_window
gdk_screen_get_monitor_height_mm
@@ -365,7 +367,9 @@ gdk_window_restack
gdk_window_focus
gdk_window_register_dnd
gdk_window_begin_resize_drag
gdk_window_begin_resize_drag_for_device
gdk_window_begin_move_drag
gdk_window_begin_move_drag_for_device
gdk_window_constrain_size
gdk_window_beep
@@ -629,6 +633,7 @@ gdk_keymap_get_caps_lock_state
gdk_keymap_get_num_lock_state
gdk_keymap_add_virtual_modifiers
gdk_keymap_map_virtual_modifiers
gdk_keymap_get_modifier_mask
<SUBSECTION>
gdk_keyval_name
@@ -775,6 +780,7 @@ gdk_event_request_motions
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
gdk_event_triggers_context_menu
<SUBSECTION>
gdk_event_handler_set
@@ -956,6 +962,7 @@ gdk_x11_screen_supports_net_wm_hint
gdk_x11_window_foreign_new_for_display
gdk_x11_window_lookup_for_display
gdk_x11_window_get_xid
gdk_x11_window_set_hide_titlebar_when_maximized
gdk_x11_window_set_theme_variant
gdk_x11_window_set_user_time
gdk_x11_window_move_to_current_desktop
@@ -982,6 +989,98 @@ gdk_x11_display_string_to_compound_text
gdk_x11_display_utf8_to_compound_text
gdk_x11_free_compound_text
<SUBSECTION Standard>
GDK_TYPE_X11_APP_LAUNCH_CONTEXT
GDK_X11_APP_LAUNCH_CONTEXT
GDK_X11_APP_LAUNCH_CONTEXT_CLASS
GDK_IS_X11_APP_LAUNCH_CONTEXT
GDK_IS_X11_APP_LAUNCH_CONTEXT_CLASS
GDK_X11_APP_LAUNCH_CONTEXT_GET_CLASS
GDK_TYPE_X11_CURSOR
GDK_X11_CURSOR
GDK_X11_CURSOR_CLASS
GDK_IS_X11_CURSOR
GDK_IS_X11_CURSOR_CLASS
GDK_X11_CURSOR_GET_CLASS
GDK_TYPE_X11_DEVICE_CORE
GDK_X11_DEVICE_CORE
GDK_X11_DEVICE_CORE_CLASS
GDK_IS_X11_DEVICE_CORE
GDK_IS_X11_DEVICE_CORE_CLASS
GDK_X11_DEVICE_CORE_GET_CLASS
GDK_TYPE_X11_DEVICE_MANAGER_CORE
GDK_X11_DEVICE_MANAGER_CORE
GDK_X11_DEVICE_MANAGER_CORE_CLASS
GDK_IS_X11_DEVICE_MANAGER_CORE
GDK_IS_X11_DEVICE_MANAGER_CORE_CLASS
GDK_X11_DEVICE_MANAGER_CORE_GET_CLASS
GDK_TYPE_X11_DEVICE_MANAGER_XI2
GDK_X11_DEVICE_MANAGER_XI2
GDK_X11_DEVICE_MANAGER_XI2_CLASS
GDK_IS_X11_DEVICE_MANAGER_XI2
GDK_IS_X11_DEVICE_MANAGER_XI2_CLASS
GDK_X11_DEVICE_MANAGER_XI2_GET_CLASS
GDK_TYPE_X11_DEVICE_MANAGER_XI
GDK_X11_DEVICE_MANAGER_XI
GDK_X11_DEVICE_MANAGER_XI_CLASS
GDK_IS_X11_DEVICE_MANAGER_XI
GDK_IS_X11_DEVICE_MANAGER_XI_CLASS
GDK_X11_DEVICE_MANAGER_XI_GET_CLASS
GDK_TYPE_X11_DEVICE_XI2
GDK_X11_DEVICE_XI2
GDK_X11_DEVICE_XI2_CLASS
GDK_IS_X11_DEVICE_XI2
GDK_IS_X11_DEVICE_XI2_CLASS
GDK_X11_DEVICE_XI2_GET_CLASS
GDK_TYPE_X11_DEVICE_XI
GDK_X11_DEVICE_XI
GDK_X11_DEVICE_XI_CLASS
GDK_IS_X11_DEVICE_XI
GDK_IS_X11_DEVICE_XI_CLASS
GDK_X11_DEVICE_XI_GET_CLASS
GDK_TYPE_X11_DISPLAY
GDK_X11_DISPLAY
GDK_X11_DISPLAY_CLASS
GDK_IS_X11_DISPLAY
GDK_IS_X11_DISPLAY_CLASS
GDK_X11_DISPLAY_GET_CLASS
GDK_TYPE_X11_DISPLAY_MANAGER
GDK_X11_DISPLAY_MANAGER
GDK_X11_DISPLAY_MANAGER_CLASS
GDK_IS_X11_DISPLAY_MANAGER
GDK_IS_X11_DISPLAY_MANAGER_CLASS
GDK_X11_DISPLAY_MANAGER_GET_CLASS
GDK_TYPE_X11_DRAG_CONTEXT
GDK_X11_DRAG_CONTEXT
GDK_X11_DRAG_CONTEXT_CLASS
GDK_IS_X11_DRAG_CONTEXT
GDK_IS_X11_DRAG_CONTEXT_CLASS
GDK_X11_DRAG_CONTEXT_GET_CLASS
GDK_TYPE_X11_KEYMAP
GDK_X11_KEYMAP
GDK_X11_KEYMAP_CLASS
GDK_IS_X11_KEYMAP
GDK_IS_X11_KEYMAP_CLASS
GDK_X11_KEYMAP_GET_CLASS
GDK_TYPE_X11_SCREEN
GDK_X11_SCREEN
GDK_X11_SCREEN_CLASS
GDK_IS_X11_SCREEN
GDK_IS_X11_SCREEN_CLASS
GDK_X11_SCREEN_GET_CLASS
GDK_TYPE_X11_VISUAL
GDK_X11_VISUAL
GDK_X11_VISUAL_CLASS
GDK_IS_X11_VISUAL
GDK_IS_X11_VISUAL_CLASS
GDK_X11_VISUAL_GET_CLASS
GDK_TYPE_X11_WINDOW
GDK_X11_WINDOW
GDK_X11_WINDOW_CLASS
GDK_IS_X11_WINDOW
GDK_IS_X11_WINDOW_CLASS
GDK_X11_WINDOW_GET_CLASS
<SUBSECTION Private>
gdk_x11_app_launch_context_get_type
gdk_x11_cursor_get_type

View File

@@ -12,7 +12,7 @@ DOC_MAIN_SGML_FILE=gtk-docs.sgml
SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED"
# The directory containing the source code. Relative to $(srcdir)
DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=$(top_srcdir)/gtk
# Used for dependencies
HFILE_GLOB=$(top_srcdir)/gtk/*.h
@@ -365,7 +365,10 @@ HTML_IMAGES = \
$(srcdir)/images/handles.png \
$(srcdir)/images/extensions.png \
$(srcdir)/images/numerableicon.png \
$(srcdir)/images/numerableicon2.png
$(srcdir)/images/numerableicon2.png \
$(srcdir)/images/bloatpad-osx.png \
$(srcdir)/images/bloatpad-gnome.png \
$(srcdir)/images/bloatpad-xfce.png
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=--extra-dir=../gdk/html \

View File

@@ -47,9 +47,20 @@ $ cc `pkg-config --cflags --libs gtk+-3.0` hello.c -o hello
</para>
<para>
If you want to make sure that your program doesn't use any deprecated
functions, you can define the preprocessor symbol GTK_DISABLE_DEPRECATED
by using the command line option <literal>-DGTK_DISABLE_DEPRECATED=1</literal>.
Deprecated GTK+ functions are annotated to make the compiler
emit warnings when they are used (e.g. with gcc, you need to use
the -Wdeprecated-declarations option). If these warnings are
problematic, they can be turned off by defining the preprocessor
symbol GDK_DISABLE_DEPRECATION_WARNINGS by using the commandline
option <literal>-DGDK_DISABLE_DEPRECATION_WARNINGS</literal>
</para>
<para>
The older deprecation mechanism of hiding deprecated interfaces
entirely from the compiler by using the preprocessor symbol
GTK_DISABLE_DEPRECATED is still used for deprecated macros,
enumeration values, etc. To detect uses of these in your code,
use the commandline option <literal>-DGTK_DISABLE_DEPRECATED</literal>.
There are similar symbols GDK_DISABLE_DEPRECATED,
GDK_PIXBUF_DISABLE_DEPRECATED and G_DISABLE_DEPRECATED for GDK, GdkPixbuf and
GLib.

View File

@@ -338,6 +338,7 @@
<chapter id="Application">
<title>Application support</title>
<xi:include href="xml/gtkapplication.xml" />
<xi:include href="xml/gtkapplicationwindow.xml" />
</chapter>
</part>
@@ -385,6 +386,10 @@
<title>Index of new symbols in 3.2</title>
<xi:include href="xml/api-index-3.2.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-4" role="3.4">
<title>Index of new symbols in 3.4</title>
<xi:include href="xml/api-index-3.4.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>

View File

@@ -76,6 +76,9 @@ gtk_accelerator_valid
gtk_accelerator_parse
gtk_accelerator_name
gtk_accelerator_get_label
gtk_accelerator_parse_with_keycode
gtk_accelerator_name_with_keycode
gtk_accelerator_get_label_with_keycode
gtk_accelerator_set_default_mod_mask
gtk_accelerator_get_default_mod_mask
@@ -1132,6 +1135,7 @@ gtk_entry_completion_get_model
gtk_entry_completion_set_match_func
gtk_entry_completion_set_minimum_key_length
gtk_entry_completion_get_minimum_key_length
gtk_entry_completion_compute_prefix
gtk_entry_completion_complete
gtk_entry_completion_get_completion_prefix
gtk_entry_completion_insert_prefix
@@ -2820,9 +2824,11 @@ gtk_scale_new
gtk_scale_new_with_range
gtk_scale_set_digits
gtk_scale_set_draw_value
gtk_scale_set_has_origin
gtk_scale_set_value_pos
gtk_scale_get_digits
gtk_scale_get_draw_value
gtk_scale_get_has_origin
gtk_scale_get_value_pos
gtk_scale_get_layout
gtk_scale_get_layout_offsets
@@ -4349,6 +4355,7 @@ gtk_tree_view_remove_column
gtk_tree_view_insert_column
gtk_tree_view_insert_column_with_attributes
gtk_tree_view_insert_column_with_data_func
gtk_tree_view_get_n_columns
gtk_tree_view_get_column
gtk_tree_view_get_columns
gtk_tree_view_move_column_after
@@ -5202,6 +5209,7 @@ gtk_widget_set_mapped
gtk_widget_get_mapped
gtk_widget_get_requisition
gtk_widget_device_is_shadowed
gtk_widget_get_modifier_mask
<SUBSECTION>
gtk_widget_get_path
@@ -5287,6 +5295,7 @@ gtk_window_get_gravity
gtk_window_set_position
gtk_window_set_transient_for
gtk_window_set_destroy_with_parent
gtk_window_set_hide_titlebar_when_maximized
gtk_window_set_screen
gtk_window_get_screen
gtk_window_is_active
@@ -5332,6 +5341,7 @@ gtk_window_get_default_icon_list
gtk_window_get_default_icon_name
gtk_window_get_default_size
gtk_window_get_destroy_with_parent
gtk_window_get_hide_titlebar_when_maximized
gtk_window_get_icon
gtk_window_get_icon_list
gtk_window_get_icon_name
@@ -5652,6 +5662,12 @@ GTK_STYLE_CLASS_VIEW
GTK_STYLE_CLASS_WARNING
GTK_STYLE_CLASS_HORIZONTAL
GTK_STYLE_CLASS_VERTICAL
GTK_STYLE_CLASS_TOP
GTK_STYLE_CLASS_BOTTOM
GTK_STYLE_CLASS_LEFT
GTK_STYLE_CLASS_RIGHT
GTK_STYLE_CLASS_LINKED
GTK_STYLE_CLASS_ARROW
GTK_STYLE_REGION_COLUMN
GTK_STYLE_REGION_COLUMN_HEADER
GTK_STYLE_REGION_ROW
@@ -5731,6 +5747,7 @@ gtk_render_slider
gtk_render_activity
gtk_render_icon_pixbuf
gtk_render_icon
gtk_render_insertion_cursor
<SUBSECTION Standard>
GTK_TYPE_STYLE_CONTEXT
@@ -5835,6 +5852,7 @@ gtk_symbolic_color_new_name
gtk_symbolic_color_new_shade
gtk_symbolic_color_new_alpha
gtk_symbolic_color_new_mix
gtk_symbolic_color_new_win32
gtk_symbolic_color_ref
gtk_symbolic_color_unref
gtk_symbolic_color_resolve
@@ -6988,6 +7006,12 @@ gtk_application_add_window
gtk_application_remove_window
gtk_application_get_windows
<SUBSECTION>
gtk_application_get_app_menu
gtk_application_set_app_menu
gtk_application_get_menubar
gtk_application_set_menubar
<SUBSECTION Standard>
GtkApplicationClass
GTK_TYPE_APPLICATION
@@ -7001,6 +7025,28 @@ gtk_application_get_type
GtkApplicationPrivate
</SECTION>
<SECTION>
<FILE>gtkapplicationwindow</FILE>
<TITLE>GtkApplicationWindow</TITLE>
GtkApplicationWindow
gtk_application_window_new
gtk_application_window_set_show_menubar
gtk_application_window_get_show_menubar
<SUBSECTION Standard>
GtkApplicationWindowClass
GTK_TYPE_APPLICATION_WINDOW
GTK_APPLICATION_WINDOW
GTK_APPLICATION_WINDOW_CLASS
GTK_IS_APPLICATION_WINDOW
GTK_IS_APPLICATION_WINDOW_CLASS
GTK_APPLICATION_WINDOW_GET_CLASS
<SUBSECTION Private>
gtk_application_window_get_type
GtkApplicationWindowPrivate
</SECTION>
<SECTION>
<FILE>gtkgrid</FILE>
<TITLE>GtkGrid</TITLE>

View File

@@ -16,6 +16,7 @@ gtk_app_chooser_button_get_type
gtk_app_chooser_dialog_get_type
gtk_app_chooser_widget_get_type
gtk_application_get_type
gtk_application_window_get_type
gtk_arrow_get_type
gtk_aspect_frame_get_type
gtk_assistant_get_type

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -1203,8 +1203,6 @@ gtk_arrow_draw (GtkWidget *widget,
</para>
</section>
<xi:include href="migrating-GtkStyleContext.xml" />
</section>
</chapter>

View File

@@ -262,6 +262,8 @@ additional environment variables.
that enables <literal>XSETTINGS</literal> and has a value in
<literal>Gtk/IMModule</literal>, that will be used for the default
IM module.
This also can be a colon-separated list of input-methods, which
GTK+ will try in turn until it finds one available on the system.
</para>
</formalpara>

View File

@@ -106,6 +106,12 @@ in 256 color mode.
</refsect2>
<para>
More information about GTK+ on Windows, including detailed build
instructions, binary downloads, etc, can be found
<ulink url="http://live.gnome.org/GTK+/Win32">online</ulink>.
</para>
</refsect1>
</refentry>

View File

@@ -9,7 +9,7 @@ DOC_MODULE=gail-libgail-util3
DOC_MAIN_SGML_FILE=gail-libgail-util-docs.sgml
# The directory containing the source code (if it contains documentation).
DOC_SOURCE_DIR=../../../libgail-util
DOC_SOURCE_DIR=$(top_srcdir)/libgail-util
# Used for dependencies
HFILE_GLOB = $(top_srcdir)/libgail-util/*.h

View File

@@ -1,5 +1,8 @@
#include "config.h"
#define GDK_DISABLE_DEPRECATION_WARNINGS
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtkunixprint.h>
#include <gdk/gdkkeysyms.h>
#include <X11/Xatom.h>

View File

@@ -46,15 +46,14 @@ AM_CPPFLAGS = \
LDADD = \
$(top_builddir)/gtk/libgtk-3.la \
$(top_builddir)/gdk/libgdk-3.la \
$(GTK_DEP_LIBS)
drawing_LDADD = $(LDADD) \
$(top_builddir)/gdk/libgdk-3.la
noinst_PROGRAMS = \
hello-world \
window-default \
bloatpad \
plugman \
grid-packing \
drawing \
builder

View File

@@ -1,18 +1,94 @@
#include <stdlib.h>
#include <gtk/gtk.h>
static void
activate_toggle (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GVariant *state;
state = g_action_get_state (G_ACTION (action));
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
g_variant_unref (state);
}
static void
change_fullscreen_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
if (g_variant_get_boolean (state))
gtk_window_fullscreen (user_data);
else
gtk_window_unfullscreen (user_data);
g_simple_action_set_state (action, state);
}
static GtkClipboard *
get_clipboard (GtkWidget *widget)
{
return gtk_widget_get_clipboard (widget, gdk_atom_intern_static_string ("CLIPBOARD"));
}
static void
window_copy (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWindow *window = GTK_WINDOW (user_data);
GtkTextView *text = g_object_get_data ((GObject*)window, "bloatpad-text");
gtk_text_buffer_copy_clipboard (gtk_text_view_get_buffer (text),
get_clipboard ((GtkWidget*) text));
}
static void
window_paste (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWindow *window = GTK_WINDOW (user_data);
GtkTextView *text = g_object_get_data ((GObject*)window, "bloatpad-text");
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
get_clipboard ((GtkWidget*) text),
NULL,
TRUE);
}
static GActionEntry win_entries[] = {
{ "copy", window_copy, NULL, NULL, NULL },
{ "paste", window_paste, NULL, NULL, NULL },
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
};
static void
new_window (GApplication *app,
GFile *file)
{
GtkWidget *window, *scrolled, *view;
GtkWidget *window, *grid, *scrolled, *view;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));
window = gtk_application_window_new (GTK_APPLICATION (app));
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window);
gtk_window_set_title (GTK_WINDOW (window), "Bloatpad");
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
view = gtk_text_view_new ();
g_object_set_data ((GObject*)window, "bloatpad-text", view);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_container_add (GTK_CONTAINER (window), scrolled);
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
if (file != NULL)
{
@@ -61,6 +137,97 @@ bloat_pad_finalize (GObject *object)
G_OBJECT_CLASS (bloat_pad_parent_class)->finalize (object);
}
static void
new_activated (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
g_application_activate (user_data);
}
static void
show_about (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
gtk_show_about_dialog (NULL,
"program-name", "Bloatpad",
"title", "About Bloatpad",
"comments", "Not much to say, really.",
NULL);
}
static void
quit_app (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GList *list, *next;
GtkWindow *win;
g_print ("Going down...\n");
list = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
while (list)
{
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
list = next;
}
}
static GActionEntry app_entries[] = {
{ "new", new_activated, NULL, NULL, NULL },
{ "about", show_about, NULL, NULL, NULL },
{ "quit", quit_app, NULL, NULL, NULL },
};
static void
bloat_pad_startup (GApplication *application)
{
GtkBuilder *builder;
G_APPLICATION_CLASS (bloat_pad_parent_class)
->startup (application);
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
builder = gtk_builder_new ();
gtk_builder_add_from_string (builder,
"<interface>"
" <menu id='app-menu'>"
" <section>"
" <item label='_New Window' action='app.new' accel='<Primary>n'/>"
" </section>"
" <section>"
" <item label='_About Bloatpad' action='app.about'/>"
" </section>"
" <section>"
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
" </section>"
" </menu>"
" <menu id='menubar'>"
" <submenu label='_Edit'>"
" <section>"
" <item label='_Copy' action='win.copy' accel='<Primary>c'/>"
" <item label='_Paste' action='win.paste' accel='<Primary>v'/>"
" </section>"
" </submenu>"
" <submenu label='_View'>"
" <section>"
" <item label='_Fullscreen' action='win.fullscreen'/>"
" </section>"
" </submenu>"
" </menu>"
"</interface>", -1, NULL);
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
g_object_unref (builder);
}
static void
bloat_pad_init (BloatPad *app)
{
@@ -69,10 +236,15 @@ bloat_pad_init (BloatPad *app)
static void
bloat_pad_class_init (BloatPadClass *class)
{
G_OBJECT_CLASS (class)->finalize= bloat_pad_finalize;
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
application_class->startup = bloat_pad_startup;
application_class->activate = bloat_pad_activate;
application_class->open = bloat_pad_open;
object_class->finalize = bloat_pad_finalize;
G_APPLICATION_CLASS (class)->activate = bloat_pad_activate;
G_APPLICATION_CLASS (class)->open = bloat_pad_open;
}
BloatPad *
@@ -93,6 +265,8 @@ main (int argc, char **argv)
int status;
bloat_pad = bloat_pad_new ();
gtk_application_add_accelerator (GTK_APPLICATION (bloat_pad),
"F11", "win.fullscreen", NULL);
status = g_application_run (G_APPLICATION (bloat_pad), argc, argv);
g_object_unref (bloat_pad);

View File

@@ -109,27 +109,12 @@ motion_notify_event_cb (GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
{
int x, y;
GdkModifierType state;
/* paranoia check, in case we haven't gotten a configure event */
if (surface == NULL)
return FALSE;
/* This call is very important; it requests the next motion event.
* If you don't call gdk_window_get_pointer() you'll only get
* a single motion event. The reason is that we specified
* GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events().
* If we hadn't specified that, we could just use event->x, event->y
* as the pointer location. But we'd also get deluged in events.
* By requesting the next event as we handle the current one,
* we avoid getting a huge number of events faster than we
* can cope.
*/
gdk_window_get_pointer (event->window, &x, &y, &state);
if (state & GDK_BUTTON1_MASK)
draw_brush (widget, x, y);
if (event->state & GDK_BUTTON1_MASK)
draw_brush (widget, event->x, event->y);
/* We've handled it, stop processing */
return TRUE;
@@ -189,8 +174,7 @@ main (int argc,
*/
gtk_widget_set_events (da, gtk_widget_get_events (da)
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
| GDK_POINTER_MOTION_MASK);
gtk_widget_show_all (window);

467
examples/plugman.c Normal file
View File

@@ -0,0 +1,467 @@
#include <stdlib.h>
#include <gtk/gtk.h>
static void
activate_toggle (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GVariant *state;
state = g_action_get_state (G_ACTION (action));
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
g_variant_unref (state);
}
static void
change_fullscreen_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
if (g_variant_get_boolean (state))
gtk_window_fullscreen (user_data);
else
gtk_window_unfullscreen (user_data);
g_simple_action_set_state (action, state);
}
static GtkClipboard *
get_clipboard (GtkWidget *widget)
{
return gtk_widget_get_clipboard (widget, gdk_atom_intern_static_string ("CLIPBOARD"));
}
static void
window_copy (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWindow *window = GTK_WINDOW (user_data);
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
gtk_text_buffer_copy_clipboard (gtk_text_view_get_buffer (text),
get_clipboard ((GtkWidget*) text));
}
static void
window_paste (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkWindow *window = GTK_WINDOW (user_data);
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
get_clipboard ((GtkWidget*) text),
NULL,
TRUE);
}
static GActionEntry win_entries[] = {
{ "copy", window_copy, NULL, NULL, NULL },
{ "paste", window_paste, NULL, NULL, NULL },
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
};
static void
new_window (GApplication *app,
GFile *file)
{
GtkWidget *window, *grid, *scrolled, *view;
window = gtk_application_window_new (GTK_APPLICATION (app));
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window);
gtk_window_set_title (GTK_WINDOW (window), "Plugman");
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (window), grid);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_hexpand (scrolled, TRUE);
gtk_widget_set_vexpand (scrolled, TRUE);
view = gtk_text_view_new ();
g_object_set_data ((GObject*)window, "plugman-text", view);
gtk_container_add (GTK_CONTAINER (scrolled), view);
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
if (file != NULL)
{
gchar *contents;
gsize length;
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
{
GtkTextBuffer *buffer;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, contents, length);
g_free (contents);
}
}
gtk_widget_show_all (GTK_WIDGET (window));
}
static void
plug_man_activate (GApplication *application)
{
new_window (application, NULL);
}
static void
plug_man_open (GApplication *application,
GFile **files,
gint n_files,
const gchar *hint)
{
gint i;
for (i = 0; i < n_files; i++)
new_window (application, files[i]);
}
typedef GtkApplication PlugMan;
typedef GtkApplicationClass PlugManClass;
G_DEFINE_TYPE (PlugMan, plug_man, GTK_TYPE_APPLICATION)
static void
plug_man_finalize (GObject *object)
{
G_OBJECT_CLASS (plug_man_parent_class)->finalize (object);
}
static void
show_about (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
gtk_show_about_dialog (NULL,
"program-name", "Plugman",
"title", "About Plugman",
"comments", "A cheap Bloatpad clone.",
NULL);
}
static void
quit_app (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GList *list, *next;
GtkWindow *win;
g_print ("Going down...\n");
list = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
while (list)
{
win = list->data;
next = list->next;
gtk_widget_destroy (GTK_WIDGET (win));
list = next;
}
}
static gboolean is_red_plugin_enabled;
static gboolean is_black_plugin_enabled;
static gboolean
plugin_enabled (const gchar *name)
{
if (g_strcmp0 (name, "red") == 0)
return is_red_plugin_enabled;
else
return is_black_plugin_enabled;
}
static GMenuModel *
find_plugin_menu (void)
{
return (GMenuModel*) g_object_get_data (G_OBJECT (g_application_get_default ()), "plugin-menu");
}
static void
plugin_action (GAction *action,
GVariant *parameter,
gpointer data)
{
GApplication *app;
GList *list;
GtkWindow *window;
GtkWidget *text;
GdkRGBA color;
app = g_application_get_default ();
list = gtk_application_get_windows (GTK_APPLICATION (app));
window = GTK_WINDOW (list->data);
text = g_object_get_data ((GObject*)window, "plugman-text");
gdk_rgba_parse (&color, g_action_get_name (action));
gtk_widget_override_color (text, 0, &color);
}
static void
enable_plugin (const gchar *name)
{
GMenuModel *plugin_menu;
GAction *action;
g_print ("Enabling '%s' plugin\n", name);
action = (GAction *)g_simple_action_new (name, NULL);
g_signal_connect (action, "activate", G_CALLBACK (plugin_action), (gpointer)name);
g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()), action);
g_print ("Actions of '%s' plugin added\n", name);
plugin_menu = find_plugin_menu ();
if (plugin_menu)
{
GMenu *section;
GMenuItem *item;
gchar *label;
gchar *action;
section = g_menu_new ();
label = g_strdup_printf ("Turn text %s", name);
action = g_strconcat ("app.", name, NULL);
g_menu_insert (section, 0, label, action);
g_free (label);
g_free (action);
item = g_menu_item_new_section (NULL, (GMenuModel*)section);
g_menu_item_set_attribute (item, "id", "s", name);
g_menu_append_item (G_MENU (plugin_menu), item);
g_object_unref (item);
g_object_unref (section);
g_print ("Menus of '%s' plugin added\n", name);
}
else
g_warning ("Plugin menu not found\n");
if (g_strcmp0 (name, "red") == 0)
is_red_plugin_enabled = TRUE;
else
is_black_plugin_enabled = TRUE;
}
static void
disable_plugin (const gchar *name)
{
GMenuModel *plugin_menu;
g_print ("Disabling '%s' plugin\n", name);
plugin_menu = find_plugin_menu ();
if (plugin_menu)
{
const gchar *id;
gint i;
for (i = 0; i < g_menu_model_get_n_items (plugin_menu); i++)
{
if (g_menu_model_get_item_attribute (plugin_menu, i, "id", "s", &id) &&
g_strcmp0 (id, name) == 0)
{
g_menu_remove (G_MENU (plugin_menu), i);
g_print ("Menus of '%s' plugin removed\n", name);
}
}
}
else
g_warning ("Plugin menu not found\n");
g_action_map_remove_action (G_ACTION_MAP (g_application_get_default ()), name);
g_print ("Actions of '%s' plugin removed\n", name);
if (g_strcmp0 (name, "red") == 0)
is_red_plugin_enabled = FALSE;
else
is_black_plugin_enabled = FALSE;
}
static void
enable_or_disable_plugin (GtkToggleButton *button,
const gchar *name)
{
if (plugin_enabled (name))
disable_plugin (name);
else
enable_plugin (name);
}
static void
configure_plugins (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
GtkBuilder *builder;
GtkWidget *dialog;
GtkWidget *check;
GError *error = NULL;
builder = gtk_builder_new ();
gtk_builder_add_from_string (builder,
"<interface>"
" <object class='GtkDialog' id='plugin-dialog'>"
" <property name='border-width'>12</property>"
" <property name='title'>Plugins</property>"
" <child internal-child='vbox'>"
" <object class='GtkBox' id='content-area'>"
" <property name='visible'>True</property>"
" <child>"
" <object class='GtkCheckButton' id='red-plugin'>"
" <property name='label'>Red Plugin - turn your text red</property>"
" <property name='visible'>True</property>"
" </object>"
" </child>"
" <child>"
" <object class='GtkCheckButton' id='black-plugin'>"
" <property name='label'>Black Plugin - turn your text black</property>"
" <property name='visible'>True</property>"
" </object>"
" </child>"
" </object>"
" </child>"
" <child internal-child='action_area'>"
" <object class='GtkButtonBox' id='action-area'>"
" <property name='visible'>True</property>"
" <child>"
" <object class='GtkButton' id='close-button'>"
" <property name='label'>Close</property>"
" <property name='visible'>True</property>"
" </object>"
" </child>"
" </object>"
" </child>"
" <action-widgets>"
" <action-widget response='-5'>close-button</action-widget>"
" </action-widgets>"
" </object>"
"</interface>", -1, &error);
if (error)
{
g_warning ("%s", error->message);
g_error_free (error);
return;
}
dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red"));
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "red");
check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "black");
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
gtk_window_present (GTK_WINDOW (dialog));
}
static GActionEntry app_entries[] = {
{ "about", show_about, NULL, NULL, NULL },
{ "quit", quit_app, NULL, NULL, NULL },
{ "plugins", configure_plugins, NULL, NULL, NULL },
};
static void
plug_man_startup (GApplication *application)
{
GtkBuilder *builder;
G_APPLICATION_CLASS (plug_man_parent_class)
->startup (application);
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
builder = gtk_builder_new ();
gtk_builder_add_from_string (builder,
"<interface>"
" <menu id='app-menu'>"
" <section>"
" <item label='_About Plugman' action='app.about'/>"
" </section>"
" <section>"
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
" </section>"
" </menu>"
" <menu id='menubar'>"
" <submenu label='_Edit'>"
" <section>"
" <item label='_Copy' action='win.copy'/>"
" <item label='_Paste' action='win.paste'/>"
" </section>"
" <item><link name='section' id='plugins'>"
" </link></item>"
" <section>"
" <item label='Plugins' action='app.plugins'/>"
" </section>"
" </submenu>"
" <submenu label='_View'>"
" <section>"
" <item label='_Fullscreen' action='win.fullscreen'/>"
" </section>"
" </submenu>"
" </menu>"
"</interface>", -1, NULL);
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
g_object_set_data_full (G_OBJECT (application), "plugin-menu", gtk_builder_get_object (builder, "plugins"), g_object_unref);
g_object_unref (builder);
}
static void
plug_man_init (PlugMan *app)
{
}
static void
plug_man_class_init (PlugManClass *class)
{
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
GObjectClass *object_class = G_OBJECT_CLASS (class);
application_class->startup = plug_man_startup;
application_class->activate = plug_man_activate;
application_class->open = plug_man_open;
object_class->finalize = plug_man_finalize;
}
PlugMan *
plug_man_new (void)
{
g_type_init ();
return g_object_new (plug_man_get_type (),
"application-id", "org.gtk.Test.plugman",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL);
}
int
main (int argc, char **argv)
{
PlugMan *plug_man;
int status;
plug_man = plug_man_new ();
gtk_application_add_accelerator (GTK_APPLICATION (plug_man),
"F11", "win.fullscreen", NULL);
status = g_application_run (G_APPLICATION (plug_man), argc, argv);
g_object_unref (plug_man);
return status;
}

View File

@@ -8,5 +8,6 @@ Name: GDK
Description: GTK+ Drawing Kit
Version: @VERSION@
Requires: @GDK_PACKAGES@
Requires.private: @GDK_PRIVATE_PACKAGES@
Libs: -L${libdir} -lgdk-3 @GDK_EXTRA_LIBS@
Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ @GDK_EXTRA_CFLAGS@

View File

@@ -17,6 +17,7 @@ CLEANFILES =
EXTRA_DIST += \
keynames.txt \
keynames-translate.txt \
keyname-table.h \
gdkkeynames.c \
gen-keyname-table.pl \
@@ -112,6 +113,7 @@ gdk_c_sources = \
gdkcairo.c \
gdkcolor.c \
gdkcursor.c \
gdkdeprecated.c \
gdkdevice.c \
gdkdevicemanager.c \
gdkdisplay.c \

View File

@@ -175,30 +175,84 @@ struct BroadwayOutput {
GOutputStream *out;
int error;
guint32 serial;
gboolean proto_v7_plus;
};
static void
broadway_output_write_header (BroadwayOutput *output)
broadway_output_send_cmd (BroadwayOutput *output,
gboolean fin, BroadwayWSOpCode code,
const void *buf, gsize count)
{
g_output_stream_write (output->out, "\0", 1, NULL, NULL);
}
gboolean mask = FALSE;
guchar header[16];
size_t p;
static void
broadway_output_write (BroadwayOutput *output,
const void *buf, gsize count)
{
gboolean mid_header = count > 125 && count <= 65535;
gboolean long_header = count > 65535;
/* NB. big-endian spec => bit 0 == MSB */
header[0] = ( (fin ? 0x80 : 0) | (code & 0x0f) );
header[1] = ( (mask ? 0x80 : 0) |
(mid_header ? 126 : long_header ? 127 : count) );
p = 2;
if (mid_header)
{
*(guint16 *)(header + p) = GUINT16_TO_BE( (guint16)count );
p += 2;
}
else if (long_header)
{
*(guint64 *)(header + p) = GUINT64_TO_BE( count );
p += 8;
}
// FIXME: if we are paranoid we should 'mask' the data
// FIXME: we should really emit these as a single write
g_output_stream_write_all (output->out, header, p, NULL, NULL, NULL);
g_output_stream_write_all (output->out, buf, count, NULL, NULL, NULL);
}
static void
send_boundary (BroadwayOutput *output)
broadway_output_sendmsg (BroadwayOutput *output,
const void *buf, gsize count)
{
broadway_output_write (output, "\xff", 1);
broadway_output_write (output, "\0", 1);
if (!output->proto_v7_plus)
g_output_stream_write_all (output->out, buf, count, NULL, NULL, NULL);
else
broadway_output_send_cmd (output, TRUE, BROADWAY_WS_TEXT, buf, count);
}
void broadway_output_pong (BroadwayOutput *output)
{
if (output->proto_v7_plus)
broadway_output_send_cmd (output, TRUE, BROADWAY_WS_CNX_PONG, NULL, 0);
}
static void
broadway_output_sendmsg_initiate (BroadwayOutput *output)
{
if (!output->proto_v7_plus)
g_output_stream_write (output->out, "\0", 1, NULL, NULL);
else
{
}
}
int
broadway_output_flush (BroadwayOutput *output)
{
if (!output->proto_v7_plus)
{
broadway_output_sendmsg (output, "\xff", 1);
broadway_output_sendmsg (output, "\0", 1);
return !output->error;
}
else /* no need to flush */
return !output->error;
}
BroadwayOutput *
broadway_output_new(GOutputStream *out, guint32 serial)
broadway_output_new(GOutputStream *out, guint32 serial,
gboolean proto_v7_plus)
{
BroadwayOutput *output;
@@ -206,8 +260,9 @@ broadway_output_new(GOutputStream *out, guint32 serial)
output->out = g_object_ref (out);
output->serial = serial;
output->proto_v7_plus = proto_v7_plus;
broadway_output_write_header (output);
broadway_output_sendmsg_initiate (output);
return output;
}
@@ -225,13 +280,6 @@ broadway_output_get_next_serial (BroadwayOutput *output)
return output->serial;
}
int
broadway_output_flush (BroadwayOutput *output)
{
send_boundary (output);
return !output->error;
}
/************************************************************************
* Core rendering operations *
@@ -291,7 +339,7 @@ broadway_output_copy_rectangles (BroadwayOutput *output, int id,
assert (p == len);
broadway_output_write (output, buf, len);
broadway_output_sendmsg (output, buf, len);
free (buf);
}
@@ -309,7 +357,7 @@ broadway_output_grab_pointer (BroadwayOutput *output,
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
guint32
@@ -324,7 +372,7 @@ broadway_output_ungrab_pointer (BroadwayOutput *output)
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
return serial;
}
@@ -347,7 +395,7 @@ broadway_output_new_surface(BroadwayOutput *output,
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
void
@@ -361,7 +409,7 @@ broadway_output_show_surface(BroadwayOutput *output, int id)
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
void
@@ -375,7 +423,7 @@ broadway_output_hide_surface(BroadwayOutput *output, int id)
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
void
@@ -389,7 +437,7 @@ broadway_output_destroy_surface(BroadwayOutput *output, int id)
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
@@ -427,7 +475,7 @@ broadway_output_move_resize_surface (BroadwayOutput *output,
}
assert (p <= sizeof (buf));
broadway_output_write (output, buf, p);
broadway_output_sendmsg (output, buf, p);
}
void
@@ -445,7 +493,7 @@ broadway_output_set_transient_for (BroadwayOutput *output,
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
@@ -453,27 +501,31 @@ void
broadway_output_put_rgb (BroadwayOutput *output, int id, int x, int y,
int w, int h, int byte_stride, void *data)
{
char buf[HEADER_LEN + 15];
gsize len;
char *url;
gsize buf_size;
gsize url_len;
char *url, *buf;
int p;
url = to_png_rgb (w, h, byte_stride, (guint32*)data);
url_len = strlen (url);
buf_size = HEADER_LEN + 15 + url_len;
buf = g_malloc (buf_size);
p = write_header (output, buf, 'i');
append_uint16 (id, buf, &p);
append_uint16 (x, buf, &p);
append_uint16 (y, buf, &p);
url = to_png_rgb (w, h, byte_stride, (guint32*)data);
len = strlen (url);
append_uint32 (len, buf, &p);
append_uint32 (url_len, buf, &p);
assert (p == sizeof (buf));
g_assert (p == HEADER_LEN + 15);
strncpy (buf + p, url, url_len);
broadway_output_write (output, buf, sizeof (buf));
broadway_output_write (output, url, len);
broadway_output_sendmsg (output, buf, buf_size);
g_free (buf);
free (url);
}
@@ -704,37 +756,40 @@ void
broadway_output_put_rgba (BroadwayOutput *output, int id, int x, int y,
int w, int h, int byte_stride, void *data)
{
char buf[HEADER_LEN + 15];
gsize len;
char *url;
BroadwayBox *rects;
int p, i, n_rects;
guint8 *subdata;
rects = rgba_find_rects (data, w, h, byte_stride, &n_rects);
for (i = 0; i < n_rects; i++)
{
gsize url_len, buf_size;
char *buf, *url;
guint8 *subdata;
subdata = (guint8 *)data + rects[i].x1 * 4 + rects[i].y1 * byte_stride;
url = to_png_rgba (rects[i].x2 - rects[i].x1,
rects[i].y2 - rects[i].y1,
byte_stride, (guint32*)subdata);
url_len = strlen (url);
buf_size = HEADER_LEN + 15 + url_len;
buf = g_malloc (buf_size);
p = write_header (output, buf, 'i');
append_uint16 (id, buf, &p);
append_uint16 (x + rects[i].x1, buf, &p);
append_uint16 (y + rects[i].y1, buf, &p);
url = to_png_rgba (rects[i].x2 - rects[i].x1,
rects[i].y2 - rects[i].y1,
byte_stride, (guint32*)subdata);
len = strlen (url);
append_uint32 (len, buf, &p);
append_uint32 (url_len, buf, &p);
g_assert (p == HEADER_LEN + 15);
strncpy (buf + p, url, url_len);
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_write (output, url, len);
broadway_output_sendmsg (output, buf, buf_size);
free (url);
g_free (buf);
}
free (rects);
@@ -750,35 +805,7 @@ broadway_output_surface_flush (BroadwayOutput *output,
p = write_header (output, buf, 'f');
append_uint16 (id, buf, &p);
assert (p == sizeof (buf));
g_assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_sendmsg (output, buf, sizeof (buf));
}
#if 0
static void
send_image_a (BroadwayOutput *output, int id, int x, int y,
int w, int h, int byte_stride, guint8 *data)
{
char buf[HEADER_LEN + 15];
gsize len;
char *url;
p = write_header (output, buf, 'i');
append_uint16 (id, buf, &p);
append_uint16 (x, buf, &p);
append_uint16 (y, buf, &p);
url = to_png_a (w, h, byte_stride, data);
len = strlen (url);
append_uint32 (len, buf, &p);
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
broadway_output_write (output, url, len);
free (url);
}
#endif

View File

@@ -8,8 +8,18 @@ typedef struct {
int width, height;
} BroadwayRect;
typedef enum {
BROADWAY_WS_CONTINUATION = 0,
BROADWAY_WS_TEXT = 1,
BROADWAY_WS_BINARY = 2,
BROADWAY_WS_CNX_CLOSE = 8,
BROADWAY_WS_CNX_PING = 9,
BROADWAY_WS_CNX_PONG = 0xa
} BroadwayWSOpCode;
BroadwayOutput *broadway_output_new (GOutputStream *out,
guint32 serial);
guint32 serial,
gboolean proto_v7_plus);
void broadway_output_free (BroadwayOutput *output);
int broadway_output_flush (BroadwayOutput *output);
int broadway_output_has_error (BroadwayOutput *output);
@@ -66,3 +76,4 @@ void broadway_output_grab_pointer (BroadwayOutput *output,
int id,
gboolean owner_event);
guint32 broadway_output_ungrab_pointer (BroadwayOutput *output);
void broadway_output_pong (BroadwayOutput *output);

View File

@@ -2769,10 +2769,19 @@ function connect()
useToplevelWindows = true;
}
var loc = window.location.toString().replace("http:", "ws:");
loc = loc.substr(0, loc.lastIndexOf('/')) + "/socket";
var ws = null;
if ("WebSocket" in window) {
var loc = window.location.toString().replace("http:", "ws:");
loc = loc.substr(0, loc.lastIndexOf('/')) + "/socket";
var ws = new WebSocket(loc, "broadway");
ws = new WebSocket(loc, "broadway");
} else if ("MozWebSocket" in window) { // Firefox 6
ws = new MozWebSocket(loc);
} else {
alert("WebSocket not supported, input will not work!");
return;
}
ws.onopen = function() {
inputSocket = ws;
var w, h;
@@ -2797,9 +2806,7 @@ function connect()
ws.onmessage = function(event) {
handleMessage(event.data);
};
} else {
alert("WebSocket not supported, input will not work!");
}
setupDocument(document);
window.onunload = function (ev) {
for (var i = 0; i < toplevelWindows.length; i++)

View File

@@ -48,6 +48,10 @@
static void gdk_broadway_display_dispose (GObject *object);
static void gdk_broadway_display_finalize (GObject *object);
#if 0
#define DEBUG_WEBSOCKETS 1
#endif
G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
static void
@@ -128,7 +132,7 @@ typedef struct HttpRequest {
GString *request;
} HttpRequest;
static void start_output (HttpRequest *request);
static void start_output (HttpRequest *request, gboolean proto_v7_plus);
static void
http_request_free (HttpRequest *request)
@@ -146,6 +150,7 @@ struct BroadwayInput {
GSource *source;
gboolean seen_time;
gint64 time_base;
gboolean proto_v7_plus;
};
static void
@@ -229,7 +234,7 @@ parse_input_message (BroadwayInput *input, const char *message)
5 seconds after last_seen_time, to avoid issues that could appear when
a long hiatus due to a reconnect seems to be instant */
input->time_base = time_ - (broadway_display->last_seen_time + 5000);
}
}
time_ = time_ - input->time_base;
}
@@ -309,47 +314,158 @@ parse_input_message (BroadwayInput *input, const char *message)
}
static inline void
hex_dump (guchar *data, gsize len)
{
#ifdef DEBUG_WEBSOCKETS
gsize i, j;
for (j = 0; j < len + 15; j += 16)
{
fprintf (stderr, "0x%.4x ", j);
for (i = 0; i < 16; i++)
{
if ((j + i) < len)
fprintf (stderr, "%.2x ", data[j+i]);
else
fprintf (stderr, " ");
if (i == 8)
fprintf (stderr, " ");
}
fprintf (stderr, " | ");
for (i = 0; i < 16; i++)
if ((j + i) < len && g_ascii_isalnum(data[j+i]))
fprintf (stderr, "%c", data[j+i]);
else
fprintf (stderr, ".");
fprintf (stderr, "\n");
}
#endif
}
static void
parse_input (BroadwayInput *input)
{
GdkBroadwayDisplay *broadway_display;
char *buf, *ptr;
gsize len;
broadway_display = GDK_BROADWAY_DISPLAY (input->display);
buf = (char *)input->buffer->data;
len = input->buffer->len;
if (len == 0)
if (!input->buffer->len)
return;
if (buf[0] != 0)
if (input->proto_v7_plus)
{
broadway_display->input = NULL;
broadway_input_free (input);
return;
hex_dump (input->buffer->data, input->buffer->len);
while (input->buffer->len > 2)
{
gsize len, payload_len;
BroadwayWSOpCode code;
gboolean is_mask, fin;
guchar *buf, *data;
buf = input->buffer->data;
len = input->buffer->len;
#ifdef DEBUG_WEBSOCKETS
g_print ("Parse input first byte 0x%2x 0x%2x\n", buf[0], buf[1]);
#endif
fin = buf[0] & 0x80;
code = buf[0] & 0x0f;
payload_len = buf[1] & 0x7f;
is_mask = buf[1] & 0x80;
data = buf + 2;
if (payload_len > 125)
{
if (len < 4)
return;
payload_len = GUINT16_FROM_BE( *(guint16 *) data );
data += 2;
}
else if (payload_len > 126)
{
if (len < 10)
return;
payload_len = GUINT64_FROM_BE( *(guint64 *) data );
data += 8;
}
if (data - buf + payload_len > len)
return; /* wait to accumulate more */
if (is_mask)
{
gsize i;
for (i = 0; i < payload_len; i++)
data[i + 4] ^= data[i%4];
data += 4;
}
switch (code) {
case BROADWAY_WS_CNX_CLOSE:
break; /* hang around anyway */
case BROADWAY_WS_TEXT:
if (!fin)
{
#ifdef DEBUG_WEBSOCKETS
g_warning ("can't yet accept fragmented input");
#endif
}
else
parse_input_message (input, (char *)data);
break;
case BROADWAY_WS_CNX_PING:
broadway_output_pong (broadway_display->output);
break;
case BROADWAY_WS_CNX_PONG:
break; /* we never send pings, but tolerate pongs */
case BROADWAY_WS_BINARY:
case BROADWAY_WS_CONTINUATION:
default:
{
g_warning ("fragmented or unknown input code 0x%2x with fin set", code);
break;
}
}
g_byte_array_remove_range (input->buffer, 0, data - buf + payload_len);
}
}
while ((ptr = memchr (buf, 0xff, len)) != NULL)
else /* old style protocol */
{
*ptr = 0;
ptr++;
char *buf, *ptr;
gsize len;
parse_input_message (input, buf + 1);
buf = (char *)input->buffer->data;
len = input->buffer->len;
len -= ptr - buf;
buf = ptr;
if (len > 0 && buf[0] != 0)
if (buf[0] != 0)
{
broadway_display->input = NULL;
broadway_input_free (input);
break;
return;
}
}
g_byte_array_remove_range (input->buffer, 0, buf - (char *)input->buffer->data);
while ((ptr = memchr (buf, 0xff, len)) != NULL)
{
*ptr = 0;
ptr++;
parse_input_message (input, buf + 1);
len -= ptr - buf;
buf = ptr;
if (len > 0 && buf[0] != 0)
{
broadway_display->input = NULL;
broadway_input_free (input);
break;
}
}
g_byte_array_remove_range (input->buffer, 0, buf - (char *)input->buffer->data);
}
}
@@ -404,7 +520,7 @@ _gdk_broadway_display_read_all_input_nonblocking (GdkDisplay *display)
broadway_input_free (input);
if (res < 0)
{
g_print ("input error %s", error->message);
g_print ("input error %s\n", error->message);
g_error_free (error);
}
return;
@@ -537,6 +653,32 @@ send_error (HttpRequest *request,
http_request_free (request);
}
/* magic from: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17 */
#define SEC_WEB_SOCKET_KEY_MAGIC "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
/* 'x3JJHMbDL1EzLkh9GBhXDw==' generates 'HSmrc0sMlYUkAGmm5OPpG2HaGWk=' */
static gchar *
generate_handshake_response_wsietf_v7 (const gchar *key)
{
gsize digest_len = 20;
guchar digest[digest_len];
GChecksum *checksum;
checksum = g_checksum_new (G_CHECKSUM_SHA1);
if (!checksum)
return NULL;
g_checksum_update (checksum, (guchar *)key, -1);
g_checksum_update (checksum, (guchar *)SEC_WEB_SOCKET_KEY_MAGIC, -1);
g_checksum_get_digest (checksum, digest, &digest_len);
g_checksum_free (checksum);
g_assert (digest_len == 20);
return g_base64_encode (digest, digest_len);
}
static void
start_input (HttpRequest *request)
{
@@ -556,6 +698,8 @@ start_input (HttpRequest *request)
const void *data_buffer;
gsize data_buffer_size;
GInputStream *in;
char *key_v7;
gboolean proto_v7_plus;
broadway_display = GDK_BROADWAY_DISPLAY (request->display);
@@ -565,12 +709,16 @@ start_input (HttpRequest *request)
return;
}
#ifdef DEBUG_WEBSOCKETS
g_print ("incoming request:\n%s\n", request->request->str);
#endif
lines = g_strsplit (request->request->str, "\n", 0);
num_key1 = 0;
num_key2 = 0;
key1 = 0;
key2 = 0;
key_v7 = NULL;
origin = NULL;
host = NULL;
for (i = 0; lines[i] != NULL; i++)
@@ -605,6 +753,10 @@ start_input (HttpRequest *request)
key2 /= num_space;
num_key2++;
}
else if ((p = parse_line (lines[i], "Sec-WebSocket-Key")))
{
key_v7 = p;
}
else if ((p = parse_line (lines[i], "Origin")))
{
origin = p;
@@ -613,56 +765,97 @@ start_input (HttpRequest *request)
{
host = p;
}
else if ((p = parse_line (lines[i], "Sec-WebSocket-Origin")))
{
origin = p;
}
}
if (num_key1 != 1 || num_key2 != 1 || origin == NULL || host == NULL)
if (origin == NULL || host == NULL)
{
g_strfreev (lines);
send_error (request, 400, "Bad websocket request");
return;
}
challenge[0] = (key1 >> 24) & 0xff;
challenge[1] = (key1 >> 16) & 0xff;
challenge[2] = (key1 >> 8) & 0xff;
challenge[3] = (key1 >> 0) & 0xff;
challenge[4] = (key2 >> 24) & 0xff;
challenge[5] = (key2 >> 16) & 0xff;
challenge[6] = (key2 >> 8) & 0xff;
challenge[7] = (key2 >> 0) & 0xff;
if (!g_input_stream_read_all (G_INPUT_STREAM (request->data), challenge+8, 8, NULL, NULL, NULL))
if (key_v7 != NULL)
{
g_strfreev (lines);
send_error (request, 400, "Bad websocket request");
return;
char* accept = generate_handshake_response_wsietf_v7 (key_v7);
res = g_strdup_printf ("HTTP/1.1 101 Switching Protocols\r\n"
"Upgrade: websocket\r\n"
"Connection: Upgrade\r\n"
"Sec-WebSocket-Accept: %s\r\n"
"Sec-WebSocket-Origin: %s\r\n"
"Sec-WebSocket-Location: ws://%s/socket\r\n"
"Sec-WebSocket-Protocol: broadway\r\n"
"\r\n", accept, origin, host);
g_free (accept);
#ifdef DEBUG_WEBSOCKETS
g_print ("v7 proto response:\n%s", res);
#endif
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
res, strlen (res), NULL, NULL, NULL);
g_free (res);
proto_v7_plus = TRUE;
}
else
{
if (num_key1 != 1 || num_key2 != 1)
{
g_strfreev (lines);
send_error (request, 400, "Bad websocket request");
return;
}
checksum = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (checksum, challenge, 16);
len = 16;
g_checksum_get_digest (checksum, challenge, &len);
g_checksum_free (checksum);
challenge[0] = (key1 >> 24) & 0xff;
challenge[1] = (key1 >> 16) & 0xff;
challenge[2] = (key1 >> 8) & 0xff;
challenge[3] = (key1 >> 0) & 0xff;
challenge[4] = (key2 >> 24) & 0xff;
challenge[5] = (key2 >> 16) & 0xff;
challenge[6] = (key2 >> 8) & 0xff;
challenge[7] = (key2 >> 0) & 0xff;
res = g_strdup_printf ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
"Upgrade: WebSocket\r\n"
"Connection: Upgrade\r\n"
"Sec-WebSocket-Origin: %s\r\n"
"Sec-WebSocket-Location: ws://%s/socket\r\n"
"Sec-WebSocket-Protocol: broadway\r\n"
"\r\n",
origin, host);
if (!g_input_stream_read_all (G_INPUT_STREAM (request->data), challenge+8, 8, NULL, NULL, NULL))
{
g_strfreev (lines);
send_error (request, 400, "Bad websocket request");
return;
}
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
res, strlen (res), NULL, NULL, NULL);
g_free (res);
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
challenge, 16, NULL, NULL, NULL);
checksum = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (checksum, challenge, 16);
len = 16;
g_checksum_get_digest (checksum, challenge, &len);
g_checksum_free (checksum);
res = g_strdup_printf ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
"Upgrade: WebSocket\r\n"
"Connection: Upgrade\r\n"
"Sec-WebSocket-Origin: %s\r\n"
"Sec-WebSocket-Location: ws://%s/socket\r\n"
"Sec-WebSocket-Protocol: broadway\r\n"
"\r\n",
origin, host);
#ifdef DEBUG_WEBSOCKETS
g_print ("legacy response:\n%s", res);
#endif
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
res, strlen (res), NULL, NULL, NULL);
g_free (res);
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
challenge, 16, NULL, NULL, NULL);
proto_v7_plus = FALSE;
}
input = g_new0 (BroadwayInput, 1);
input->display = request->display;
input->connection = g_object_ref (request->connection);
input->proto_v7_plus = proto_v7_plus;
data_buffer = g_buffered_input_stream_peek_buffer (G_BUFFERED_INPUT_STREAM (request->data), &data_buffer_size);
input->buffer = g_byte_array_sized_new (data_buffer_size);
@@ -670,7 +863,7 @@ start_input (HttpRequest *request)
broadway_display->input = input;
start_output (request);
start_output (request, proto_v7_plus);
/* This will free and close the data input stream, but we got all the buffered content already */
http_request_free (request);
@@ -688,7 +881,7 @@ start_input (HttpRequest *request)
}
static void
start_output (HttpRequest *request)
start_output (HttpRequest *request, gboolean proto_v7_plus)
{
GSocket *socket;
GdkBroadwayDisplay *broadway_display;
@@ -708,7 +901,7 @@ start_output (HttpRequest *request)
broadway_display->output =
broadway_output_new (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
broadway_display->saved_serial);
broadway_display->saved_serial, proto_v7_plus);
_gdk_broadway_resync_windows ();

View File

@@ -87,19 +87,6 @@ gdk_broadway_display_manager_lookup_keyval (GdkDisplayManager *manager,
return _gdk_keyval_from_name (name);
}
static void
gdk_broadway_display_manager_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper)
{
/* FIXME implement this */
if (lower)
*lower = symbol;
if (upper)
*upper = symbol;
}
static void
gdk_broadway_display_manager_init (GdkBroadwayDisplayManager *manager)
{
@@ -129,7 +116,6 @@ gdk_broadway_display_manager_class_init (GdkBroadwayDisplayManagerClass *class)
manager_class->get_atom_name = _gdk_broadway_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_broadway_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_broadway_display_manager_get_keyval_name;
manager_class->keyval_convert_case = gdk_broadway_display_manager_keyval_convert_case;
}
void

View File

@@ -321,6 +321,7 @@ gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass)
screen_class->get_monitor_height_mm = gdk_broadway_screen_get_monitor_height_mm;
screen_class->get_monitor_plug_name = gdk_broadway_screen_get_monitor_plug_name;
screen_class->get_monitor_geometry = gdk_broadway_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_broadway_screen_get_monitor_geometry;
screen_class->is_composited = gdk_broadway_screen_is_composited;
screen_class->make_display_name = gdk_broadway_screen_make_display_name;
screen_class->get_active_window = gdk_broadway_screen_get_active_window;

View File

@@ -257,7 +257,7 @@ gdk_window_impl_broadway_init (GdkWindowImplBroadway *impl)
{
impl->toplevel_window_type = -1;
impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) gdk_cursor_unref);
(GDestroyNotify) g_object_unref);
}
static void
@@ -286,7 +286,7 @@ gdk_window_impl_broadway_finalize (GObject *object)
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
if (impl->cursor)
gdk_cursor_unref (impl->cursor);
g_object_unref (impl->cursor);
g_hash_table_destroy (impl->device_cursor);
@@ -1467,6 +1467,7 @@ create_moveresize_window (MoveResizeData *mv_resize,
static void
gdk_broadway_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
@@ -1504,6 +1505,7 @@ gdk_broadway_window_begin_resize_drag (GdkWindow *window,
static void
gdk_broadway_window_begin_move_drag (GdkWindow *window,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,

View File

@@ -101,7 +101,7 @@ static int gdk_initialized = 0; /* 1 if the library is initi
static gchar *gdk_progclass = NULL;
static GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
static GMutex gdk_threads_mutex;
static GCallback gdk_threads_lock = NULL;
static GCallback gdk_threads_unlock = NULL;
@@ -432,13 +432,13 @@ gdk_init (int *argc, char ***argv)
* Win32 backend, GDK calls should not be attempted from multiple threads
* at all.
*
* You must call g_thread_init() and gdk_threads_init() before executing
* any other GTK+ or GDK functions in a threaded GTK+ program.
* You must call gdk_threads_init() before executing any other GTK+ or
* GDK functions in a threaded GTK+ program.
*
* Idles, timeouts, and input functions from GLib, such as g_idle_add(), are
* executed outside of the main GTK+ lock.
* So, if you need to call GTK+ inside of such a callback, you must surround
* the callback with a gdk_threads_enter()/gdk_threads_leave() pair or use
* Idles, timeouts, and input functions from GLib, such as g_idle_add(),
* are executed outside of the main GTK+ lock. So, if you need to call
* GTK+ inside of such a callback, you must surround the callback with
* a gdk_threads_enter()/gdk_threads_leave() pair or use
* gdk_threads_add_idle_full() which does this for you.
* However, event dispatching from the mainloop is still executed within
* the main GTK+ lock, so callback functions connected to event signals
@@ -468,7 +468,6 @@ gdk_init (int *argc, char ***argv)
* {
* GtkWidget *window;
*
* g_thread_init (NULL);
* gdk_threads_init (<!-- -->);
* gdk_threads_enter (<!-- -->);
*
@@ -593,7 +592,6 @@ gdk_init (int *argc, char ***argv)
* pthread_t no_tid, yes_tid;
*
* /<!---->* init threads *<!---->/
* g_thread_init (NULL);
* gdk_threads_init (<!-- -->);
* gdk_threads_enter (<!-- -->);
*
@@ -641,9 +639,9 @@ gdk_init (int *argc, char ***argv)
/**
* gdk_threads_enter:
*
* This macro marks the beginning of a critical section in which GDK and
* GTK+ functions can be called safely and without causing race
* conditions. Only one thread at a time can be in such a critial
* This function marks the beginning of a critical section in which
* GDK and GTK+ functions can be called safely and without causing race
* conditions. Only one thread at a time can be in such a critial
* section.
*/
void
@@ -668,15 +666,13 @@ gdk_threads_leave (void)
static void
gdk_threads_impl_lock (void)
{
if (gdk_threads_mutex)
g_mutex_lock (gdk_threads_mutex);
g_mutex_lock (&gdk_threads_mutex);
}
static void
gdk_threads_impl_unlock (void)
{
if (gdk_threads_mutex)
g_mutex_unlock (gdk_threads_mutex);
g_mutex_unlock (&gdk_threads_mutex);
}
/**
@@ -684,18 +680,13 @@ gdk_threads_impl_unlock (void)
*
* Initializes GDK so that it can be used from multiple threads
* in conjunction with gdk_threads_enter() and gdk_threads_leave().
* g_thread_init() must be called previous to this function.
*
* This call must be made before any use of the main loop from
* GTK+; to be safe, call it before gtk_init().
**/
*/
void
gdk_threads_init (void)
{
if (!g_thread_supported ())
g_error ("g_thread_init() must be called before gdk_threads_init()");
gdk_threads_mutex = g_mutex_new ();
if (!gdk_threads_lock)
gdk_threads_lock = gdk_threads_impl_lock;
if (!gdk_threads_unlock)
@@ -783,7 +774,7 @@ gdk_threads_dispatch_free (gpointer data)
* removed from the list of event sources and will not be called again.
*
* This variant of g_idle_add_full() calls @function with the GDK lock
* held. It can be thought of a MT-safe version for GTK+ widgets for the
* held. It can be thought of a MT-safe version for GTK+ widgets for the
* following use case, where you have to worry about idle_callback()
* running in thread A and accessing @self after it has been finalized
* in thread B:

View File

@@ -178,6 +178,7 @@ gdk_event_request_motions
gdk_event_set_device
gdk_event_set_screen
gdk_event_set_source_device
gdk_event_triggers_context_menu
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
@@ -207,6 +208,7 @@ gdk_keymap_get_direction
gdk_keymap_get_entries_for_keycode
gdk_keymap_get_entries_for_keyval
gdk_keymap_get_for_display
gdk_keymap_get_modifier_mask
gdk_keymap_get_num_lock_state
gdk_keymap_get_type
gdk_keymap_have_bidi_layouts
@@ -222,6 +224,7 @@ gdk_keyval_to_lower
gdk_keyval_to_unicode
gdk_keyval_to_upper
gdk_list_visuals
gdk_modifier_intent_get_type
gdk_modifier_type_get_type
gdk_notify_startup_complete
gdk_notify_startup_complete_with_id
@@ -268,6 +271,7 @@ gdk_screen_get_height_mm
gdk_screen_get_monitor_at_point
gdk_screen_get_monitor_at_window
gdk_screen_get_monitor_geometry
gdk_screen_get_monitor_workarea
gdk_screen_get_monitor_height_mm
gdk_screen_get_monitor_plug_name
gdk_screen_get_monitor_width_mm
@@ -351,6 +355,7 @@ gdk_win32_pixbuf_to_hicon_libgtk_only
gdk_win32_selection_add_targets
gdk_win32_set_modal_dialog_libgtk_only
gdk_win32_window_is_win32
gdk_win32_window_get_impl_hwnd
gdk_win32_window_get_handle
gdk_win32_window_get_type
gdk_win32_display_get_type
@@ -362,9 +367,11 @@ gdk_window_at_pointer
gdk_window_attributes_type_get_type
gdk_window_beep
gdk_window_begin_move_drag
gdk_window_begin_move_drag_for_device
gdk_window_begin_paint_rect
gdk_window_begin_paint_region
gdk_window_begin_resize_drag
gdk_window_begin_resize_drag_for_device
gdk_window_window_class_get_type
gdk_window_configure_finished
gdk_window_constrain_size
@@ -573,7 +580,9 @@ gdk_x11_window_get_type
gdk_x11_window_get_xid
gdk_x11_window_move_to_current_desktop
gdk_x11_window_set_theme_variant
gdk_x11_window_set_hide_titlebar_when_maximized
gdk_x11_window_set_user_time
gdk_x11_window_set_utf8_property
gdk_x11_xatom_to_atom
gdk_x11_xatom_to_atom_for_display
#endif

View File

@@ -35,16 +35,16 @@ G_BEGIN_DECLS
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
GType gdk_app_launch_context_get_type (void);
#ifndef GDK_DISABLE_DEPRECATED
GDK_DEPRECATED_FOR(gdk_display_get_app_launch_context)
GdkAppLaunchContext *gdk_app_launch_context_new (void);
GDK_DEPRECATED_FOR(gdk_display_get_app_launch_context)
void gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
GdkDisplay *display);
#endif
void gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
GdkScreen *screen);
void gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,

View File

@@ -89,6 +89,8 @@ gdk_cairo_get_clip_rectangle (cairo_t *cr,
* Sets the specified #GdkColor as the source color of @cr.
*
* Since: 2.8
*
* Deprecated: 3.4: Use gdk_cairo_set_source_rgba() instead
*/
void
gdk_cairo_set_source_color (cairo_t *cr,
@@ -427,7 +429,11 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
gint x0 = x;
while (x < extents.width)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
if (((data[x / 8] >> (x%8)) & 1) == 0)
#else
if (((data[x / 8] >> (7-(x%8))) & 1) == 0)
#endif
/* This pixel is "transparent"*/
break;
x++;

View File

@@ -35,8 +35,6 @@ cairo_t * gdk_cairo_create (GdkWindow *window);
gboolean gdk_cairo_get_clip_rectangle (cairo_t *cr,
GdkRectangle *rect);
void gdk_cairo_set_source_color (cairo_t *cr,
const GdkColor *color);
void gdk_cairo_set_source_rgba (cairo_t *cr,
const GdkRGBA *rgba);
void gdk_cairo_set_source_pixbuf (cairo_t *cr,
@@ -57,6 +55,10 @@ cairo_region_t *
gdk_cairo_region_create_from_surface
(cairo_surface_t *surface);
GDK_DEPRECATED_FOR(gdk_cairo_set_source_rgba)
void gdk_cairo_set_source_color (cairo_t *cr,
const GdkColor *color);
G_END_DECLS
#endif /* __GDK_CAIRO_H__ */

View File

@@ -43,7 +43,7 @@ G_BEGIN_DECLS
* draw this color on the screen. Not used anymore.
* @red: The red component of the color. This is
* a value between 0 and 65535, with 65535 indicating
* full intensitiy
* full intensity
* @green: The green component of the color
* @blue: The blue component of the color
*

View File

@@ -228,10 +228,10 @@ GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
GdkCursor* gdk_cursor_new_from_name (GdkDisplay *display,
const gchar *name);
GdkDisplay* gdk_cursor_get_display (GdkCursor *cursor);
#ifndef GDK_DISABLE_DEPRECATED
GdkCursor* gdk_cursor_ref (GdkCursor *cursor);
GDK_DEPRECATED_FOR(g_object_ref)
GdkCursor * gdk_cursor_ref (GdkCursor *cursor);
GDK_DEPRECATED_FOR(g_object_unref)
void gdk_cursor_unref (GdkCursor *cursor);
#endif
GdkPixbuf* gdk_cursor_get_image (GdkCursor *cursor);
GdkCursorType gdk_cursor_get_cursor_type (GdkCursor *cursor);

107
gdk/gdkdeprecated.c Normal file
View File

@@ -0,0 +1,107 @@
/* GDK - The GIMP Drawing Kit
* gdkdeprecated.c
*
* Copyright 1995-2011 Red Hat Inc.
*
* Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#define GDK_DISABLE_DEPRECATION_WARNINGS
#include "config.h"
#include "gdkdisplay.h"
/**
* gdk_pointer_ungrab:
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
* timestamp is available.
*
* Ungrabs the pointer on the default display, if it is grabbed by this
* application.
*
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
* instead.
**/
void
gdk_pointer_ungrab (guint32 time)
{
gdk_display_pointer_ungrab (gdk_display_get_default (), time);
}
/**
* gdk_pointer_is_grabbed:
*
* Returns %TRUE if the pointer on the default display is currently
* grabbed by this application.
*
* Note that this does not take the inmplicit pointer grab on button
* presses into account.
*
* Return value: %TRUE if the pointer is currently grabbed by this application.
*
* Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
**/
gboolean
gdk_pointer_is_grabbed (void)
{
return gdk_display_pointer_is_grabbed (gdk_display_get_default ());
}
/**
* gdk_keyboard_ungrab:
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
* timestamp is available.
*
* Ungrabs the keyboard on the default display, if it is grabbed by this
* application.
*
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
* instead.
**/
void
gdk_keyboard_ungrab (guint32 time)
{
gdk_display_keyboard_ungrab (gdk_display_get_default (), time);
}
/**
* gdk_window_at_pointer:
* @win_x: (out) (allow-none): return location for origin of the window under the pointer
* @win_y: (out) (allow-none): return location for origin of the window under the pointer
*
* Obtains the window underneath the mouse pointer, returning the
* location of that window in @win_x, @win_y. Returns %NULL if the
* window under the mouse pointer is not known to GDK (if the window
* belongs to another application and a #GdkWindow hasn't been created
* for it with gdk_window_foreign_new())
*
* NOTE: For multihead-aware widgets or applications use
* gdk_display_get_window_at_pointer() instead.
*
* Return value: (transfer none): window under the mouse pointer
*
* Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
**/
GdkWindow*
gdk_window_at_pointer (gint *win_x,
gint *win_y)
{
return gdk_display_get_window_at_pointer (gdk_display_get_default (), win_x, win_y);
}

View File

@@ -33,18 +33,37 @@
* In addition to a single pointer and keyboard for user interface input,
* GDK contains support for a variety of input devices, including graphics
* tablets, touchscreens and multiple pointers/keyboards interacting
* simultaneously with the user interface. Under X, the support for multiple
* input devices is done through the <firstterm>XInput 2</firstterm> extension,
* which also supports additional features such as sub-pixel positioning
* information and additional device-dependent information.
* simultaneously with the user interface. Such input devices often have
* additional features, such as sub-pixel positioning information and
* additional device-dependent information.
*
* In order to query the device hierarchy and be aware of changes in the
* device hierarchy (such as virtual devices being created or removed, or
* physical devices being plugged or unplugged), GDK provides
* #GdkDeviceManager.
*
* By default, and if the platform supports it, GDK is aware of multiple
* keyboard/pointer pairs and multitouch devices, this behavior can be
* changed by calling gdk_disable_multidevice() before gdk_display_open(),
* although there would rarely be a reason to do that. For a widget or
* window to be dealt as multipointer aware,
* gdk_window_set_support_multidevice() or
* gtk_widget_set_support_multidevice() must have been called on it.
* keyboard/pointer pairs and multitouch devices. This behavior can be
* changed by calling gdk_disable_multidevice() before gdk_display_open().
* There should rarely be a need to do that though, since GDK defaults
* to a compatibility mode in which it will emit just one enter/leave
* event pair for all devices on a window. To enable per-device
* enter/leave events and other multi-pointer interaction features,
* gdk_window_set_support_multidevice() must be called on
* #GdkWindows (or gtk_widget_set_support_multidevice() on widgets).
* window. See the gdk_window_set_support_multidevice() documentation
* for more information.
*
* On X11, multi-device support is implemented through XInput 2.
* Unless gdk_disable_multidevice() is called, the XInput 2
* #GdkDeviceManager implementation will be used as the input source.
* Otherwise either the core or XInput 1 implementations will be used.
*
* For simple applications that don't have any special interest in
* input devices, the so-called <firstterm>client pointer</firstterm>
* provides a reasonable approximation to a simple setup with a single
* pointer and keyboard. The device that has been set as the client
* pointer can be accessed via gdk_device_manager_get_client_pointer().
*
* Conceptually, in multidevice mode there are 2 device types. Virtual
* devices (or master devices) are represented by the pointer cursors
@@ -60,28 +79,43 @@
* be controlling each of these virtual devices. Physical devices may also
* be "floating", which means they are not attached to any virtual device.
*
* <example><title>Master and slave devices</title>
* <screen>
* carlos@sacarino:~$ xinput list
* ⎡ Virtual core pointer id=2 [master pointer (3)]
* ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
* ⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (2)]
* ⎜ ↳ Wacom ISDv4 E6 Finger touch id=11 [slave pointer (2)]
* ⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
* ⎜ ↳ TPPS/2 IBM TrackPoint id=14 [slave pointer (2)]
* ⎜ ↳ Wacom ISDv4 E6 Pen eraser id=16 [slave pointer (2)]
* ⎣ Virtual core keyboard id=3 [master keyboard (2)]
* ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
* ↳ Power Button id=6 [slave keyboard (3)]
* ↳ Video Bus id=7 [slave keyboard (3)]
* ↳ Sleep Button id=8 [slave keyboard (3)]
* ↳ Integrated Camera id=9 [slave keyboard (3)]
* ↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
* ↳ ThinkPad Extra Buttons id=15 [slave keyboard (3)]
* </screen>
* </example>
*
* By default, GDK will automatically listen for events coming from all
* master devices, setting the #GdkDevice for all events coming from input
* devices,
* <footnote>
* Events containing device information are #GDK_MOTION_NOTIFY,
* devices. Events containing device information are #GDK_MOTION_NOTIFY,
* #GDK_BUTTON_PRESS, #GDK_2BUTTON_PRESS, #GDK_3BUTTON_PRESS,
* #GDK_BUTTON_RELEASE, #GDK_SCROLL, #GDK_KEY_PRESS, #GDK_KEY_RELEASE,
* #GDK_ENTER_NOTIFY, #GDK_LEAVE_NOTIFY, #GDK_FOCUS_CHANGE,
* #GDK_PROXIMITY_IN, #GDK_PROXIMITY_OUT, #GDK_DRAG_ENTER, #GDK_DRAG_LEAVE,
* #GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START, #GDK_DROP_FINISHED
* and #GDK_GRAB_BROKEN.
* </footnote>
* Although gdk_window_set_support_multidevice() must be called on
* #GdkWindows in order to support additional features of multiple pointer
* interaction, such as multiple per-device enter/leave events, the default
* setting will emit just one enter/leave event pair for all devices on the
* window. See gdk_window_set_support_multidevice() documentation for more
* information.
* and #GDK_GRAB_BROKEN. When dealing with an event on a master device,
* it is possible to get the source (slave) device that the event originated
* from via gdk_event_get_source_device().
*
* In order to listen for events coming from other than a virtual device,
* gdk_window_set_device_events() must be called. Generally, this function
* can be used to modify the event mask for any given device.
* In order to listen for events coming from devices
* other than a virtual device, gdk_window_set_device_events() must be
* called. Generally, this function can be used to modify the event mask
* for any given device.
*
* Input devices may also provide additional information besides X/Y.
* For example, graphics tablets may also provide pressure and X/Y tilt
@@ -95,14 +129,6 @@
* Devices may also have associated <firstterm>keys</firstterm> or
* macro buttons. Such keys can be globally set to map into normal X
* keyboard events. The mapping is set using gdk_device_set_key().
*
* In order to query the device hierarchy and be aware of changes in the
* device hierarchy (such as virtual devices being created or removed, or
* physical devices being plugged or unplugged), GDK provides
* #GdkDeviceManager. On X11, multidevice support is implemented through
* XInput 2. Unless gdk_disable_multidevice() is called, the XInput 2.x
* #GdkDeviceManager implementation will be used as the input source. Otherwise
* either the core or XInput 1.x implementations will be used.
*/
static void gdk_device_manager_set_property (GObject *object,

View File

@@ -404,42 +404,6 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
g_list_free (devices);
}
/**
* gdk_pointer_ungrab:
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
* timestamp is available.
*
* Ungrabs the pointer on the default display, if it is grabbed by this
* application.
*
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
* instead.
**/
void
gdk_pointer_ungrab (guint32 time)
{
gdk_display_pointer_ungrab (gdk_display_get_default (), time);
}
/**
* gdk_pointer_is_grabbed:
*
* Returns %TRUE if the pointer on the default display is currently
* grabbed by this application.
*
* Note that this does not take the inmplicit pointer grab on button
* presses into account.
*
* Return value: %TRUE if the pointer is currently grabbed by this application.
*
* Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
**/
gboolean
gdk_pointer_is_grabbed (void)
{
return gdk_display_pointer_is_grabbed (gdk_display_get_default ());
}
/**
* gdk_display_keyboard_ungrab:
* @display: a #GdkDisplay.
@@ -480,23 +444,6 @@ gdk_display_keyboard_ungrab (GdkDisplay *display,
g_list_free (devices);
}
/**
* gdk_keyboard_ungrab:
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
* timestamp is available.
*
* Ungrabs the keyboard on the default display, if it is grabbed by this
* application.
*
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
* instead.
**/
void
gdk_keyboard_ungrab (guint32 time)
{
gdk_display_keyboard_ungrab (gdk_display_get_default (), time);
}
/**
* gdk_beep:
*
@@ -782,8 +729,9 @@ synthesize_crossing_events (GdkDisplay *display,
src_toplevel == dest_toplevel)
{
/* Same toplevels */
gdk_window_get_pointer (dest_toplevel,
&x, &y, &state);
gdk_window_get_device_position (dest_toplevel,
device,
&x, &y, &state);
_gdk_synthesize_crossing_events (display,
src_window,
dest_window,
@@ -796,8 +744,9 @@ synthesize_crossing_events (GdkDisplay *display,
}
else if (dest_toplevel == NULL)
{
gdk_window_get_pointer (src_toplevel,
&x, &y, &state);
gdk_window_get_device_position (src_toplevel,
device,
&x, &y, &state);
_gdk_synthesize_crossing_events (display,
src_window,
NULL,
@@ -811,8 +760,9 @@ synthesize_crossing_events (GdkDisplay *display,
else
{
/* Different toplevels */
gdk_window_get_pointer (src_toplevel,
&x, &y, &state);
gdk_window_get_device_position (src_toplevel,
device,
&x, &y, &state);
_gdk_synthesize_crossing_events (display,
src_window,
NULL,
@@ -822,8 +772,9 @@ synthesize_crossing_events (GdkDisplay *display,
time,
NULL,
serial, FALSE);
gdk_window_get_pointer (dest_toplevel,
&x, &y, &state);
gdk_window_get_device_position (dest_toplevel,
device,
&x, &y, &state);
_gdk_synthesize_crossing_events (display,
NULL,
dest_window,
@@ -1275,9 +1226,14 @@ gdk_display_pointer_is_grabbed (GdkDisplay *display)
if (gdk_device_get_source (device) == GDK_SOURCE_MOUSE &&
gdk_display_device_is_grabbed (display, device))
return TRUE;
{
g_list_free (devices);
return TRUE;
}
}
g_list_free (devices);
return FALSE;
}

View File

@@ -52,13 +52,14 @@ GdkScreen * gdk_display_get_screen (GdkDisplay *display,
GdkScreen * gdk_display_get_default_screen (GdkDisplay *display);
#ifndef GDK_MULTIDEVICE_SAFE
#ifndef GDK_DISABLE_DEPRECATED
GDK_DEPRECATED_FOR(gdk_device_ungrab)
void gdk_display_pointer_ungrab (GdkDisplay *display,
guint32 time_);
GDK_DEPRECATED_FOR(gdk_device_ungrab)
void gdk_display_keyboard_ungrab (GdkDisplay *display,
guint32 time_);
GDK_DEPRECATED_FOR(gdk_display_device_is_grabbed)
gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display);
#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
gboolean gdk_display_device_is_grabbed (GdkDisplay *display,
@@ -70,9 +71,8 @@ void gdk_display_flush (GdkDisplay *display);
void gdk_display_close (GdkDisplay *display);
gboolean gdk_display_is_closed (GdkDisplay *display);
#ifndef GDK_DISABLE_DEPRECATED
GDK_DEPRECATED_FOR(gdk_device_manager_list_devices)
GList * gdk_display_list_devices (GdkDisplay *display);
#endif /* GDK_DISABLE_DEPRECATED */
GdkEvent* gdk_display_get_event (GdkDisplay *display);
GdkEvent* gdk_display_peek_event (GdkDisplay *display);
@@ -88,20 +88,21 @@ void gdk_display_set_double_click_distance (GdkDisplay *display,
GdkDisplay *gdk_display_get_default (void);
#ifndef GDK_MULTIDEVICE_SAFE
#ifndef GDK_DISABLE_DEPRECATED
GDK_DEPRECATED_FOR(gdk_device_get_position)
void gdk_display_get_pointer (GdkDisplay *display,
GdkScreen **screen,
gint *x,
gint *y,
GdkModifierType *mask);
GDK_DEPRECATED_FOR(gdk_device_get_window_at_position)
GdkWindow * gdk_display_get_window_at_pointer (GdkDisplay *display,
gint *win_x,
gint *win_y);
GDK_DEPRECATED_FOR(gdk_device_warp)
void gdk_display_warp_pointer (GdkDisplay *display,
GdkScreen *screen,
gint x,
gint y);
#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
GdkDisplay *gdk_display_open_default_libgtk_only (void);

View File

@@ -29,6 +29,7 @@
#include "gdkconfig.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkinternals.h"
#include "gdkkeysprivate.h"
#include "gdkmarshalers.h"
#include "gdkintl.h"
@@ -136,6 +137,8 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
object_class->set_property = gdk_display_manager_set_property;
object_class->get_property = gdk_display_manager_get_property;
klass->keyval_convert_case = _gdk_display_manager_real_keyval_convert_case;
/**
* GdkDisplayManager::display-opened:
* @manager: the object on which the signal is emitted

View File

@@ -580,7 +580,7 @@ gdk_event_copy (const GdkEvent *event)
case GDK_SELECTION_REQUEST:
new_event->selection.requestor = event->selection.requestor;
if (new_event->selection.requestor)
g_object_unref (new_event->selection.requestor);
g_object_ref (new_event->selection.requestor);
break;
default:
@@ -1448,6 +1448,56 @@ gdk_event_request_motions (const GdkEventMotion *event)
}
}
/**
* gdk_event_triggers_context_menu:
* @event: a #GdkEvent, currently only button events are meaningful values
*
* This function returns whether a #GdkEventButton should trigger a
* context menu, according to platform conventions. The right mouse
* button always triggers context menus. Additionally, if
* gdk_keymap_get_modifier_mask() returns a non-0 mask for
* %GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will
* also trigger a context menu if this modifier is pressed.
*
* This function should always be used instead of simply checking for
* event->button == 3.
*
* Returns: %TRUE if the event should trigger a context menu.
*
* Since: 3.4
**/
gboolean
gdk_event_triggers_context_menu (const GdkEvent *event)
{
g_return_val_if_fail (event != NULL, FALSE);
if (event->type == GDK_BUTTON_PRESS)
{
const GdkEventButton *bevent = (const GdkEventButton *) event;
GdkDisplay *display;
GdkModifierType modifier;
g_return_val_if_fail (GDK_IS_WINDOW (bevent->window), FALSE);
if (bevent->button == 3 &&
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
return TRUE;
display = gdk_window_get_display (bevent->window);
modifier = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
GDK_MODIFIER_INTENT_CONTEXT_MENU);
if (modifier != 0 &&
bevent->button == 1 &&
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
(bevent->state & modifier))
return TRUE;
}
return FALSE;
}
static gboolean
gdk_events_get_axis_distances (GdkEvent *event1,
GdkEvent *event2,

View File

@@ -371,6 +371,7 @@ typedef enum
* decorations.
* @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
* @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
* @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
*
* Specifies the state of a toplevel window.
*/
@@ -382,7 +383,8 @@ typedef enum
GDK_WINDOW_STATE_STICKY = 1 << 3,
GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
GDK_WINDOW_STATE_ABOVE = 1 << 5,
GDK_WINDOW_STATE_BELOW = 1 << 6
GDK_WINDOW_STATE_BELOW = 1 << 6,
GDK_WINDOW_STATE_FOCUSED = 1 << 7
} GdkWindowState;
/**
@@ -1076,7 +1078,8 @@ GdkDevice* gdk_event_get_device (const GdkEvent *event);
void gdk_event_set_source_device (GdkEvent *event,
GdkDevice *device);
GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
void gdk_event_request_motions (const GdkEventMotion *event);
void gdk_event_request_motions (const GdkEventMotion *event);
gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
gboolean gdk_events_get_distance (GdkEvent *event1,
GdkEvent *event2,

View File

@@ -204,6 +204,7 @@ struct _GdkWindow
guint input_only : 1;
guint modal_hint : 1;
guint composited : 1;
guint has_alpha_background : 1;
guint destroyed : 2;
@@ -227,10 +228,18 @@ struct _GdkWindow
gint abs_x, abs_y; /* Absolute offset in impl */
gint width, height;
guint32 clip_tag;
cairo_region_t *clip_region; /* Clip region (wrt toplevel) in window coords */
cairo_region_t *clip_region_with_children; /* Clip region in window coords */
/* The clip region is the part of the window, in window coordinates
that is fully or partially (i.e. semi transparently) visible in
the window hierarchy from the toplevel and down */
cairo_region_t *clip_region;
/* This is the clip region, with additionally all the opaque
child windows removed */
cairo_region_t *clip_region_with_children;
/* The layered region is the subset of clip_region that
is covered by non-opaque sibling or ancestor sibling window. */
cairo_region_t *layered_region;
GdkCursor *cursor;
GHashTable *device_cursor;
@@ -391,11 +400,6 @@ void _gdk_display_set_window_under_pointer (GdkDisplay *display,
void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
cairo_region_t *_gdk_window_calculate_full_clip_region (GdkWindow *window,
GdkWindow *base_window,
gboolean do_children,
gint *base_x_offset,
gint *base_y_offset);
gboolean _gdk_window_has_impl (GdkWindow *window);
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);

View File

@@ -26,6 +26,7 @@
#include "config.h"
#include "gdkkeysyms.h"
#include "gdkkeysprivate.h"
#include "gdkdisplay.h"
#include "gdkdisplaymanagerprivate.h"
@@ -108,6 +109,11 @@ enum {
LAST_SIGNAL
};
static GdkModifierType gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent);
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT)
@@ -117,6 +123,8 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->get_modifier_mask = gdk_keymap_real_get_modifier_mask;
/**
* GdkKeymap::direction-changed:
* @keymap: the object on which the signal is emitted
@@ -399,6 +407,9 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
gint *n_keys)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
g_return_val_if_fail (keys != NULL, FALSE);
g_return_val_if_fail (n_keys != NULL, FALSE);
g_return_val_if_fail (keyval != 0, FALSE);
return GDK_KEYMAP_GET_CLASS (keymap)->get_entries_for_keyval (keymap, keyval,
keys, n_keys);
@@ -431,6 +442,7 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
gint *n_entries)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
g_return_val_if_fail (n_entries != NULL, FALSE);
return GDK_KEYMAP_GET_CLASS (keymap)->get_entries_for_keycode (keymap, hardware_keycode,
keys, keyvals, n_entries);
@@ -454,6 +466,7 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
g_return_val_if_fail (key != NULL, 0);
return GDK_KEYMAP_GET_CLASS (keymap)->lookup_key (keymap, key);
}
@@ -605,6 +618,64 @@ gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
return GDK_KEYMAP_GET_CLASS(keymap)->map_virtual_modifiers (keymap, state);
}
static GdkModifierType
gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
switch (intent)
{
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
return 0;
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
return GDK_SHIFT_MASK;
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
return GDK_MOD1_MASK | GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
return 0;
default:
g_return_val_if_reached (0);
}
}
/**
* gdk_keymap_get_modifier_mask:
* @keymap: a #GdkKeymap
* @intent: the use case for the modifier mask
*
* Returns the modifier mask the @keymap's windowing system backend
* uses for a particular purpose.
*
* Note that this function always returns real hardware modifiers, not
* virtual ones (e.g. it will return #GDK_MOD1_MASK rather than
* #GDK_META_MASK if the backend maps MOD1 to META), so there are use
* cases where the return value of this function has to be transformed
* by gdk_keymap_add_virtual_modifiers() in order to contain the
* expected result.
*
* Returns: the modifier mask used for @intent.
*
* Since: 3.4
**/
GdkModifierType
gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_mask (keymap, intent);
}
/**
* gdk_keyval_name:
* @keyval: a key value
@@ -649,3 +720,129 @@ gdk_keyval_from_name (const gchar *keyval_name)
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->lookup_keyval (manager,
keyval_name);
}
void
_gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper)
{
guint xlower = symbol;
guint xupper = symbol;
/* Check for directly encoded 24-bit UCS characters: */
if ((symbol & 0xff000000) == 0x01000000)
{
if (lower)
*lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
if (upper)
*upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
return;
}
switch (symbol >> 8)
{
case 0: /* Latin 1 */
if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
xlower += (GDK_KEY_a - GDK_KEY_A);
else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
xupper -= (GDK_KEY_a - GDK_KEY_A);
else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
break;
case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol == GDK_KEY_Aogonek)
xlower = GDK_KEY_aogonek;
else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
else if (symbol == GDK_KEY_aogonek)
xupper = GDK_KEY_Aogonek;
else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
xlower += (GDK_KEY_racute - GDK_KEY_Racute);
else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
break;
case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
break;
case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
else if (symbol == GDK_KEY_ENG)
xlower = GDK_KEY_eng;
else if (symbol == GDK_KEY_eng)
xupper = GDK_KEY_ENG;
else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
break;
case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
break;
case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
symbol != GDK_KEY_Greek_iotaaccentdieresis &&
symbol != GDK_KEY_Greek_upsilonaccentdieresis)
xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
symbol != GDK_KEY_Greek_finalsmallsigma)
xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
break;
}
if (lower)
*lower = xlower;
if (upper)
*upper = xupper;
}

View File

@@ -114,6 +114,9 @@ void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state);
gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state);
GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent);
/* Key values
*/

View File

@@ -61,6 +61,8 @@ struct _GdkKeymapClass
GdkModifierType *state);
gboolean (* map_virtual_modifiers) (GdkKeymap *keymap,
GdkModifierType *state);
GdkModifierType (*get_modifier_mask) (GdkKeymap *keymap,
GdkModifierIntent intent);
/* Signals */
@@ -75,6 +77,11 @@ struct _GdkKeymap
GdkDisplay *display;
};
void _gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper);
G_END_DECLS
#endif

View File

@@ -78,27 +78,28 @@ const gchar * gdk_get_display_arg_name (void);
gchar* gdk_get_display (void);
#ifndef GDK_MULTIDEVICE_SAFE
#ifndef GDK_DISABLE_DEPRECATED
GDK_DEPRECATED_FOR(gdk_device_grab)
GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time_);
gboolean owner_events,
GdkEventMask event_mask,
GdkWindow *confine_to,
GdkCursor *cursor,
guint32 time_);
GDK_DEPRECATED_FOR(gdk_device_grab)
GdkGrabStatus gdk_keyboard_grab (GdkWindow *window,
gboolean owner_events,
guint32 time_);
#endif /* GDK_DISABLE_DEPRECATED */
gboolean owner_events,
guint32 time_);
#endif /* GDK_MULTIDEVICE_SAFE */
#ifndef GDK_MULTIHEAD_SAFE
#ifndef GDK_MULTIDEVICE_SAFE
#ifndef GDK_DISABLE_DEPRECATED
GDK_DEPRECATED_FOR(gdk_device_ungrab)
void gdk_pointer_ungrab (guint32 time_);
GDK_DEPRECATED_FOR(gdk_device_ungrab)
void gdk_keyboard_ungrab (guint32 time_);
GDK_DEPRECATED_FOR(gdk_display_device_is_grabbed)
gboolean gdk_pointer_is_grabbed (void);
#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
gint gdk_screen_width (void) G_GNUC_CONST;

View File

@@ -356,12 +356,11 @@ gdk_pango_context_get_for_screen (GdkScreen *screen)
PangoContext *context;
const cairo_font_options_t *options;
double dpi;
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
fontmap = pango_cairo_font_map_get_default ();
context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
context = pango_font_map_create_context (fontmap);
options = gdk_screen_get_font_options (screen);
pango_cairo_context_set_font_options (context, options);

View File

@@ -750,12 +750,16 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
/**
* gdk_screen_get_monitor_geometry:
* @screen: a #GdkScreen
* @monitor_num: the monitor number, between 0 and gdk_screen_get_n_monitors (screen)
* @dest: (out) (allow-none): a #GdkRectangle to be filled with the monitor geometry
* @monitor_num: the monitor number
* @dest: (out) (allow-none): a #GdkRectangle to be filled with
* the monitor geometry
*
* Retrieves the #GdkRectangle representing the size and position of
* the individual monitor within the entire screen area.
*
* Monitor numbers start at 0. To obtain the number of monitors of
* @screen, use gdk_screen_get_n_monitors().
*
* Note that the size of the entire screen area can be retrieved via
* gdk_screen_get_width() and gdk_screen_get_height().
*
@@ -769,6 +773,33 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
GDK_SCREEN_GET_CLASS(screen)->get_monitor_geometry (screen, monitor_num, dest);
}
/**
* gdk_screen_get_monitor_workarea:
* @screen: a #GdkScreen
* @monitor_num: the monitor number
* @dest: (out) (allow-none): a #GdkRectangle to be filled with
* the monitor workarea
*
* Retrieves the #GdkRectangle representing the size and position of
* the "work area" on a monitor within the entire screen area.
*
* The work area should be considered when positioning menus and
* similar popups, to avoid placing them below panels, docks or other
* desktop components.
*
* Monitor numbers start at 0. To obtain the number of monitors of
* @screen, use gdk_screen_get_n_monitors().
*
* Since: 3.4
*/
void
gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest)
{
GDK_SCREEN_GET_CLASS(screen)->get_monitor_workarea (screen, monitor_num, dest);
}
/**
* gdk_screen_list_visuals:
* @screen: the relevant #GdkScreen.

View File

@@ -57,11 +57,15 @@ GList * gdk_screen_list_visuals (GdkScreen *screen);
GList * gdk_screen_get_toplevel_windows (GdkScreen *screen);
gchar * gdk_screen_make_display_name (GdkScreen *screen);
gint gdk_screen_get_n_monitors (GdkScreen *screen);
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
gint gdk_screen_get_n_monitors (GdkScreen *screen);
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
void gdk_screen_get_monitor_workarea (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
gint gdk_screen_get_monitor_at_point (GdkScreen *screen,
gint x,
gint y);

View File

@@ -62,6 +62,9 @@ struct _GdkScreenClass
void (* get_monitor_geometry) (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
void (* get_monitor_workarea) (GdkScreen *screen,
gint monitor_num,
GdkRectangle *dest);
GList * (* list_visuals) (GdkScreen *screen);
GdkVisual * (* get_system_visual) (GdkScreen *screen);
GdkVisual * (* get_rgba_visual) (GdkScreen *screen);

View File

@@ -242,6 +242,44 @@ typedef enum
GDK_MODIFIER_MASK = 0x5c001fff
} GdkModifierType;
/**
* GdkModifierIntent:
* @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
* menu accelerators.
* @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
* Note that mouse button 3 always triggers context menus. When this modifier
* is not 0, it <strong>additionally</strong> triggers context menus when used
* with mouse button 1.
* @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
* using &lt;modifier&gt;-click or &lt;modifier&gt;-cursor-key
* @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
* which in most cases means toggling the clicked item into or out of the selection.
* @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
* key event cannot produce a symbol directly. This is meant to be used for
* input methods, and for use cases like typeahead search.
* @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
* groups (AltGr on X11/Windows and Option/Alt on OS X).
*
* This enum is used with gdk_keymap_get_modifier_mask() and
* gdk_get_modifier_mask() in order to determine what modifiers the
* currently used windowing system backend uses for particular
* purposes. For example, on X11/Windows, the Control key is used for
* invoking menu shortcuts (accelerators), whereas on Apple computers
* it's the Command key (which correspond to %GDK_CONTROL_MASK and
* %GDK_MOD2_MASK, respectively).
*
* Since: 3.4
**/
typedef enum
{
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
GDK_MODIFIER_INTENT_CONTEXT_MENU,
GDK_MODIFIER_INTENT_EXTEND_SELECTION,
GDK_MODIFIER_INTENT_MODIFY_SELECTION,
GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
GDK_MODIFIER_INTENT_SHIFT_GROUP
} GdkModifierIntent;
typedef enum
{
GDK_OK = 0,

File diff suppressed because it is too large Load Diff

View File

@@ -53,8 +53,8 @@ typedef struct _GdkWindowRedirect GdkWindowRedirect;
*/
typedef enum
{
GDK_INPUT_OUTPUT,
GDK_INPUT_ONLY
GDK_INPUT_OUTPUT, /*< nick=input-output >*/
GDK_INPUT_ONLY /*< nick=input-only >*/
} GdkWindowWindowClass;
/**
@@ -503,6 +503,7 @@ GdkVisual * gdk_window_get_visual (GdkWindow *window);
GdkScreen * gdk_window_get_screen (GdkWindow *window);
GdkDisplay * gdk_window_get_display (GdkWindow *window);
#ifndef GDK_MULTIDEVICE_SAFE
GDK_DEPRECATED_FOR(gdk_device_get_window_at_position)
GdkWindow* gdk_window_at_pointer (gint *win_x,
gint *win_y);
#endif /* GDK_MULTIDEVICE_SAFE */
@@ -656,6 +657,7 @@ void gdk_window_set_startup_id (GdkWindow *window,
const gchar *startup_id);
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
GDK_DEPRECATED_FOR(gdk_window_set_background_rgba)
void gdk_window_set_background (GdkWindow *window,
const GdkColor *color);
void gdk_window_set_background_rgba (GdkWindow *window,
@@ -710,10 +712,11 @@ void gdk_window_get_frame_extents (GdkWindow *window,
GdkRectangle *rect);
#ifndef GDK_MULTIDEVICE_SAFE
GdkWindow* gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
GDK_DEPRECATED_FOR(gdk_window_get_device_position)
GdkWindow * gdk_window_get_pointer (GdkWindow *window,
gint *x,
gint *y,
GdkModifierType *mask);
#endif /* GDK_MULTIDEVICE_SAFE */
GdkWindow * gdk_window_get_device_position (GdkWindow *window,
GdkDevice *device,
@@ -782,19 +785,32 @@ void gdk_window_register_dnd (GdkWindow *window);
GdkDragProtocol
gdk_window_get_drag_protocol(GdkWindow *window,
GdkWindow **target);
GdkWindow **target);
void gdk_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void gdk_window_begin_move_drag (GdkWindow *window,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void gdk_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void gdk_window_begin_resize_drag_for_device (GdkWindow *window,
GdkWindowEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void gdk_window_begin_move_drag (GdkWindow *window,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void gdk_window_begin_move_drag_for_device (GdkWindow *window,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
/* Interface for dirty-region queueing */
void gdk_window_invalidate_rect (GdkWindow *window,

View File

@@ -231,16 +231,18 @@ struct _GdkWindowImplClass
void (* set_functions) (GdkWindow *window,
GdkWMFunction functions);
void (* begin_resize_drag) (GdkWindow *window,
GdkWindowEdge edge,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
GdkWindowEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void (* begin_move_drag) (GdkWindow *window,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp);
void (* enable_synchronized_configure) (GdkWindow *window);
void (* configure_finished) (GdkWindow *window);
void (* set_opacity) (GdkWindow *window,

View File

@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
if (@ARGV != 1) {
die "Usage: gen-keyname-table.pl keynames.txt > keyname-table.h\n";
if (@ARGV != 2) {
die "Usage: gen-keyname-table.pl keynames.txt keynames-translate.txt > keyname-table.h\n";
}
open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n";
@@ -20,6 +20,18 @@ while (defined($_ = <IN>)) {
push @translate, $2;
}
}
close IN;
open IN, $ARGV[1] || die "Cannot open $ARGV[1]: $!\n";
while (defined($_ = <IN>)) {
next if /^!/;
if (!/^\s*([\w_]*\S)\s+$/) {
die "Cannot parse line $_";
}
push @translate, $1;
}
close IN;
$offset = 0;
@@ -99,13 +111,30 @@ print <<EOT;
#if 0
/*
* Translators, the strings in the 'keyboard label' context are
* display names for keyboard keys. Some of them have prefixes like
* XF86 or ISO_ - these should be removed in the translation. Similarly,
* underscores should be replaced by spaces. The prefix 'KP_' stands
* for 'key pad' and you may want to include that in your translation.
* Here are some examples of English translations:
* XF86AudioMute - Audio mute
* Scroll_lock - Scroll lock
* KP_Space - Space (keypad)
*/
EOT
for $key (@translate) {
if ($key eq 'KP_Space') {
print "/* Translators: KP_ means 'key pad' here */\n";
}
if ($key eq 'XF86MonBrightnessUp') {
print "/* Translators: 'Mon' means Monitor here, and the XF86 prefix should be removed */\n";
}
print <<EOT;
N_("keyboard label|$key")
NC_("keyboard label", "$key")
EOT
}
}
print <<EOT;

View File

@@ -0,0 +1,28 @@
XF86MonBrightnessUp
XF86MonBrightnessDown
XF86KbdBrightnessUp
XF86KbdBrightnessDown
XF86AudioMute
XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86AudioPlay
XF86AudioStop
XF86AudioNext
XF86AudioPrev
XF86AudioRecord
XF86AudioPause
XF86AudioRewind
XF86AudioMedia
XF86ScreenSaver
XF86Battery
XF86Launch1
XF86Forward
XF86Back
XF86Sleep
XF86Hibernate
XF86WLAN
XF86WebCam
XF86Display
XF86TouchpadToggle
XF86WakeUp
XF86Suspend

View File

@@ -165,6 +165,11 @@
window->width = content_rect.size.width;
window->height = content_rect.size.height;
/* Certain resize operations (e.g. going fullscreen), also move the
* origin of the window.
*/
_gdk_quartz_window_update_position (window);
[[self contentView] setFrame:NSMakeRect (0, 0, window->width, window->height)];
_gdk_window_update_size (window);

View File

@@ -268,7 +268,6 @@ gdk_quartz_device_core_query_state (GdkDevice *device,
gint *win_y,
GdkModifierType *mask)
{
GdkDisplay *display;
GdkWindow *found_window;
NSPoint point;
gint x_tmp, y_tmp;
@@ -276,10 +275,6 @@ gdk_quartz_device_core_query_state (GdkDevice *device,
found_window = gdk_quartz_device_core_query_state_helper (window, device,
win_x, win_y,
mask);
if (!found_window)
return FALSE;
display = gdk_window_get_display (window);
if (root_window)
*root_window = _gdk_root;

View File

@@ -91,19 +91,6 @@ gdk_quartz_display_manager_lookup_keyval (GdkDisplayManager *manager,
return _gdk_keyval_from_name (name);
}
static void
gdk_quartz_display_manager_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper)
{
/* FIXME implement this */
if (lower)
*lower = symbol;
if (upper)
*upper = symbol;
}
static void
gdk_quartz_display_manager_init (GdkQuartzDisplayManager *manager)
{
@@ -144,7 +131,6 @@ gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
manager_class->get_atom_name = _gdk_quartz_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_quartz_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_quartz_display_manager_get_keyval_name;
manager_class->keyval_convert_case = gdk_quartz_display_manager_keyval_convert_case;
}
void

View File

@@ -124,7 +124,7 @@ static NSAutoreleasePool *autorelease_pool;
* a run loop iteration, so we need to detect that and avoid triggering
* our "run the GLib main looop while the run loop is active machinery.
*/
static gboolean getting_events;
static gint getting_events = 0;
/************************************************************
********* Select Thread *********
@@ -207,9 +207,12 @@ signal_main_thread (void)
*/
if (!run_loop_polling_async)
CFRunLoopSourceSignal (select_main_thread_source);
if (CFRunLoopIsWaiting (main_thread_run_loop))
CFRunLoopWakeUp (main_thread_run_loop);
/* Don't check for CFRunLoopIsWaiting() here because it causes a
* race condition (the loop could go into waiting state right after
* we checked).
*/
CFRunLoopWakeUp (main_thread_run_loop);
}
static void *
@@ -632,17 +635,18 @@ gdk_event_check (GSource *source)
GDK_THREADS_ENTER ();
/* Refresh the autorelease pool if we're at the base CFRunLoop level
* (indicated by current_loop_level) and the base g_main_loop level
* (indicated by g_main_depth()). Messing with the autorelease pool at
* any level of nesting can cause access to deallocated memory because
* autorelease_pool is static and releasing a pool will cause all
* pools allocated inside of it to be released as well.
*/
/* Refresh the autorelease pool if we're at the base CFRunLoop level
* (indicated by current_loop_level) and the base g_main_loop level
* (indicated by g_main_depth()). Messing with the autorelease pool at
* any level of nesting can cause access to deallocated memory because
* autorelease_pool is static and releasing a pool will cause all pools
* allocated inside of it to be released as well.
*/
if (current_loop_level == 0 && g_main_depth() == 0)
{
if (autorelease_pool)
[autorelease_pool release];
[autorelease_pool drain];
autorelease_pool = [[NSAutoreleasePool alloc] init];
}
@@ -710,12 +714,12 @@ poll_func (GPollFD *ufds,
else
limit_date = [NSDate dateWithTimeIntervalSinceNow:timeout_/1000.0];
getting_events = TRUE;
getting_events++;
event = [NSApp nextEventMatchingMask: NSAnyEventMask
untilDate: limit_date
inMode: NSDefaultRunLoopMode
dequeue: YES];
getting_events = FALSE;
getting_events--;
if (n_ready < 0)
n_ready = select_thread_collect_poll (ufds, nfds);
@@ -776,8 +780,6 @@ query_main_context (GMainContext *context,
static void
run_loop_entry (void)
{
current_loop_level++;
if (acquired_loop_level == -1)
{
if (g_main_context_acquire (NULL))
@@ -926,16 +928,13 @@ run_loop_after_waiting (void)
static void
run_loop_exit (void)
{
g_return_if_fail (current_loop_level > 0);
if (current_loop_level == acquired_loop_level)
/* + 1 because we decrement current_loop_level separately in observer_callback() */
if ((current_loop_level + 1) == acquired_loop_level)
{
g_main_context_release (NULL);
acquired_loop_level = -1;
GDK_NOTE (EVENTLOOP, g_print ("EventLoop: Ended tracking run loop activity\n"));
}
current_loop_level--;
}
static void
@@ -943,9 +942,22 @@ run_loop_observer_callback (CFRunLoopObserverRef observer,
CFRunLoopActivity activity,
void *info)
{
if (getting_events) /* Activity we triggered */
switch (activity)
{
case kCFRunLoopEntry:
current_loop_level++;
break;
case kCFRunLoopExit:
g_return_if_fail (current_loop_level > 0);
current_loop_level--;
break;
default:
break;
}
if (getting_events > 0) /* Activity we triggered */
return;
switch (activity)
{
case kCFRunLoopEntry:

View File

@@ -50,13 +50,16 @@
/* This is the window corresponding to the key window */
static GdkWindow *current_keyboard_window;
/* This is the event mask and button state from the last event */
static GdkModifierType current_keyboard_modifiers;
static GdkModifierType current_button_state;
static void append_event (GdkEvent *event,
gboolean windowing);
static GdkWindow *find_toplevel_under_pointer (GdkDisplay *display,
NSPoint screen_point,
gint *x,
gint *y);
void
_gdk_quartz_events_init (void)
{
@@ -195,6 +198,25 @@ get_mouse_button_from_ns_event (NSEvent *event)
}
}
static GdkModifierType
get_mouse_button_modifiers_from_ns_buttons (NSUInteger nsbuttons)
{
GdkModifierType modifiers = 0;
if (nsbuttons & (1 << 0))
modifiers |= GDK_BUTTON1_MASK;
if (nsbuttons & (1 << 1))
modifiers |= GDK_BUTTON3_MASK;
if (nsbuttons & (1 << 2))
modifiers |= GDK_BUTTON2_MASK;
if (nsbuttons & (1 << 3))
modifiers |= GDK_BUTTON4_MASK;
if (nsbuttons & (1 << 4))
modifiers |= GDK_BUTTON5_MASK;
return modifiers;
}
static GdkModifierType
get_mouse_button_modifiers_from_ns_event (NSEvent *event)
{
@@ -210,25 +232,30 @@ get_mouse_button_modifiers_from_ns_event (NSEvent *event)
}
static GdkModifierType
get_keyboard_modifiers_from_ns_event (NSEvent *nsevent)
get_keyboard_modifiers_from_ns_flags (NSUInteger nsflags)
{
GdkModifierType modifiers = 0;
int nsflags;
nsflags = [nsevent modifierFlags];
if (nsflags & NSAlphaShiftKeyMask)
modifiers |= GDK_LOCK_MASK;
if (nsflags & NSShiftKeyMask)
modifiers |= GDK_SHIFT_MASK;
if (nsflags & NSControlKeyMask)
modifiers |= GDK_CONTROL_MASK;
if (nsflags & NSCommandKeyMask)
if (nsflags & NSAlternateKeyMask)
modifiers |= GDK_MOD1_MASK;
if (nsflags & NSCommandKeyMask)
modifiers |= GDK_MOD2_MASK;
return modifiers;
}
static GdkModifierType
get_keyboard_modifiers_from_ns_event (NSEvent *nsevent)
{
return get_keyboard_modifiers_from_ns_flags ([nsevent modifierFlags]);
}
/* Return an event mask from an NSEvent */
static GdkEventMask
get_event_mask_from_ns_event (NSEvent *nsevent)
@@ -304,6 +331,61 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
return 0;
}
static void
get_window_point_from_screen_point (GdkWindow *window,
NSPoint screen_point,
gint *x,
gint *y)
{
NSPoint point;
NSWindow *nswindow;
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
point = [nswindow convertScreenToBase:screen_point];
*x = point.x;
*y = window->height - point.y;
}
static GdkWindow *
get_toplevel_from_ns_event (NSEvent *nsevent,
NSPoint *screen_point,
gint *x,
gint *y)
{
GdkWindow *toplevel;
if ([nsevent window])
{
GdkQuartzView *view;
NSPoint point;
view = (GdkQuartzView *)[[nsevent window] contentView];
toplevel = [view gdkWindow];
point = [nsevent locationInWindow];
*screen_point = [[nsevent window] convertBaseToScreen:point];
*x = point.x;
*y = toplevel->height - point.y;
}
else
{
/* Fallback used when no NSWindow set. This happens e.g. when
* we allow motion events without a window set in gdk_event_translate()
* that occur immediately after the main menu bar was clicked/used.
*/
*screen_point = [NSEvent mouseLocation];
toplevel = find_toplevel_under_pointer (_gdk_display,
*screen_point,
x, y);
}
return toplevel;
}
static GdkEvent *
create_focus_event (GdkWindow *window,
gboolean in)
@@ -325,31 +407,18 @@ create_focus_event (GdkWindow *window,
static void
generate_motion_event (GdkWindow *window)
{
NSPoint point;
NSPoint screen_point;
NSWindow *nswindow;
GdkQuartzView *view;
GdkEvent *event;
gint x, y, x_root, y_root;
GdkDisplay *display;
event = gdk_event_new (GDK_MOTION_NOTIFY);
event->any.window = NULL;
event->any.send_event = TRUE;
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
view = (GdkQuartzView *)[nswindow contentView];
display = gdk_window_get_display (window);
screen_point = [NSEvent mouseLocation];
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
point = [nswindow convertScreenToBase:screen_point];
x = point.x;
y = window->height - point.y;
get_window_point_from_screen_point (window, screen_point, &x, &y);
event->any.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
@@ -359,7 +428,8 @@ generate_motion_event (GdkWindow *window)
event->motion.x_root = x_root;
event->motion.y_root = y_root;
/* FIXME event->axes */
event->motion.state = 0;
event->motion.state = _gdk_quartz_events_get_current_keyboard_modifiers () |
_gdk_quartz_events_get_current_mouse_modifiers ();
event->motion.is_hint = FALSE;
event->motion.device = _gdk_display->core_pointer;
@@ -414,9 +484,7 @@ _gdk_quartz_events_update_focus_window (GdkWindow *window,
void
_gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
{
NSPoint point;
NSPoint screen_point;
NSWindow *nswindow;
GdkEvent *event;
gint x, y, x_root, y_root;
@@ -424,16 +492,10 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
event->any.window = NULL;
event->any.send_event = FALSE;
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
screen_point = [NSEvent mouseLocation];
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
point = [nswindow convertScreenToBase:screen_point];
x = point.x;
y = window->height - point.y;
get_window_point_from_screen_point (window, screen_point, &x, &y);
event->crossing.window = window;
event->crossing.subwindow = NULL;
@@ -444,7 +506,8 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
event->crossing.y_root = y_root;
event->crossing.mode = GDK_CROSSING_NORMAL;
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
event->crossing.state = 0;
event->crossing.state = _gdk_quartz_events_get_current_keyboard_modifiers () |
_gdk_quartz_events_get_current_mouse_modifiers ();
gdk_event_set_device (event, _gdk_display->core_pointer);
@@ -482,17 +545,7 @@ find_toplevel_under_pointer (GdkDisplay *display,
info = _gdk_display_get_pointer_info (display, display->core_pointer);
toplevel = info->toplevel_under_pointer;
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
{
NSWindow *nswindow;
NSPoint point;
nswindow = ((GdkWindowImplQuartz *)toplevel->impl)->toplevel;
point = [nswindow convertScreenToBase:screen_point];
*x = point.x;
*y = toplevel->height - point.y;
}
get_window_point_from_screen_point (toplevel, screen_point, x, y);
return toplevel;
}
@@ -540,22 +593,17 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
gint *x,
gint *y)
{
NSPoint point;
NSPoint screen_point;
NSEventType event_type;
GdkWindow *toplevel;
GdkQuartzView *view;
GdkDisplay *display;
GdkDeviceGrabInfo *grab;
view = (GdkQuartzView *)[[nsevent window] contentView];
toplevel = [view gdkWindow];
toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
display = gdk_window_get_display (toplevel);
event_type = [nsevent type];
point = [nsevent locationInWindow];
screen_point = [[nsevent window] convertBaseToScreen:point];
/* From the docs for XGrabPointer:
*
@@ -603,16 +651,10 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
{
/* Finally check the grab window. */
GdkWindow *grab_toplevel;
NSWindow *grab_nswindow;
grab_toplevel = gdk_window_get_effective_toplevel (grab->window);
grab_nswindow = ((GdkWindowImplQuartz *)grab_toplevel->impl)->toplevel;
point = [grab_nswindow convertScreenToBase:screen_point];
/* Note: x_root and y_root are already right. */
*x = point.x;
*y = grab_toplevel->height - point.y;
get_window_point_from_screen_point (grab_toplevel, screen_point,
x, y);
return grab_toplevel;
}
@@ -670,20 +712,13 @@ find_window_for_ns_event (NSEvent *nsevent,
gint *y_root)
{
GdkQuartzView *view;
NSPoint point;
GdkWindow *toplevel;
NSPoint screen_point;
NSEventType event_type;
GdkWindow *toplevel;
view = (GdkQuartzView *)[[nsevent window] contentView];
toplevel = [view gdkWindow];
point = [nsevent locationInWindow];
screen_point = [[nsevent window] convertBaseToScreen:point];
*x = point.x;
*y = toplevel->height - point.y;
toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, x_root, y_root);
event_type = [nsevent type];
@@ -748,7 +783,8 @@ fill_crossing_event (GdkWindow *toplevel,
event->crossing.y_root = y_root;
event->crossing.mode = mode;
event->crossing.detail = detail;
event->crossing.state = get_keyboard_modifiers_from_ns_event (nsevent);
event->crossing.state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
gdk_event_set_device (event, _gdk_display->core_pointer);
@@ -766,9 +802,9 @@ fill_button_event (GdkWindow *window,
{
GdkEventType type;
gint state;
gint button;
state = get_keyboard_modifiers_from_ns_event (nsevent);
state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
switch ([nsevent type])
{
@@ -776,18 +812,19 @@ fill_button_event (GdkWindow *window,
case NSRightMouseDown:
case NSOtherMouseDown:
type = GDK_BUTTON_PRESS;
state &= ~get_mouse_button_modifiers_from_ns_event (nsevent);
break;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
type = GDK_BUTTON_RELEASE;
state |= get_mouse_button_modifiers_from_ns_event (nsevent);
break;
default:
g_assert_not_reached ();
}
button = get_mouse_button_from_ns_event (nsevent);
event->any.type = type;
event->button.window = window;
@@ -798,7 +835,7 @@ fill_button_event (GdkWindow *window,
event->button.y_root = y_root;
/* FIXME event->axes */
event->button.state = state;
event->button.button = button;
event->button.button = get_mouse_button_from_ns_event (nsevent);
event->button.device = _gdk_display->core_pointer;
}
@@ -811,22 +848,6 @@ fill_motion_event (GdkWindow *window,
gint x_root,
gint y_root)
{
GdkModifierType state;
state = get_keyboard_modifiers_from_ns_event (nsevent);
switch ([nsevent type])
{
case NSLeftMouseDragged:
case NSRightMouseDragged:
case NSOtherMouseDragged:
state |= get_mouse_button_modifiers_from_ns_event (nsevent);
break;
case NSMouseMoved:
break;
}
event->any.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
event->motion.time = get_time_from_ns_event (nsevent);
@@ -835,7 +856,8 @@ fill_motion_event (GdkWindow *window,
event->motion.x_root = x_root;
event->motion.y_root = y_root;
/* FIXME event->axes */
event->motion.state = state;
event->motion.state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
event->motion.is_hint = FALSE;
event->motion.device = _gdk_display->core_pointer;
}
@@ -912,7 +934,7 @@ fill_key_event (GdkWindow *window,
{
case GDK_KEY_Meta_R:
case GDK_KEY_Meta_L:
mask = GDK_MOD1_MASK;
mask = GDK_MOD2_MASK;
break;
case GDK_KEY_Shift_R:
case GDK_KEY_Shift_L:
@@ -923,7 +945,7 @@ fill_key_event (GdkWindow *window,
break;
case GDK_KEY_Alt_R:
case GDK_KEY_Alt_L:
mask = GDK_MOD5_MASK;
mask = GDK_MOD1_MASK;
break;
case GDK_KEY_Control_R:
case GDK_KEY_Control_L:
@@ -939,7 +961,7 @@ fill_key_event (GdkWindow *window,
event->key.state |= mask;
}
event->key.state |= current_button_state;
event->key.state |= _gdk_quartz_events_get_current_mouse_modifiers ();
event->key.string = NULL;
@@ -1039,13 +1061,41 @@ synthesize_crossing_event (GdkWindow *window,
GdkModifierType
_gdk_quartz_events_get_current_keyboard_modifiers (void)
{
return current_keyboard_modifiers;
if (gdk_quartz_osx_version () >= GDK_OSX_SNOW_LEOPARD)
{
return get_keyboard_modifiers_from_ns_flags ([NSClassFromString(@"NSEvent") modifierFlags]);
}
else
{
guint carbon_modifiers = GetCurrentKeyModifiers ();
GdkModifierType modifiers = 0;
if (carbon_modifiers & alphaLock)
modifiers |= GDK_LOCK_MASK;
if (carbon_modifiers & shiftKey)
modifiers |= GDK_SHIFT_MASK;
if (carbon_modifiers & controlKey)
modifiers |= GDK_CONTROL_MASK;
if (carbon_modifiers & optionKey)
modifiers |= GDK_MOD1_MASK;
if (carbon_modifiers & cmdKey)
modifiers |= GDK_MOD2_MASK;
return modifiers;
}
}
GdkModifierType
_gdk_quartz_events_get_current_mouse_modifiers (void)
{
return current_button_state;
if (gdk_quartz_osx_version () >= GDK_OSX_SNOW_LEOPARD)
{
return get_mouse_button_modifiers_from_ns_buttons ([NSClassFromString(@"NSEvent") pressedMouseButtons]);
}
else
{
return get_mouse_button_modifiers_from_ns_buttons (GetCurrentButtonState ());
}
}
/* Detect window resizing */
@@ -1055,11 +1105,12 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
{
GdkWindowImplQuartz *toplevel_impl;
gboolean lion;
/* Resizing only begins if an NSLeftMouseButton event is received in
* the resizing area. Handle anything else.
*/
if ([event type] != NSLeftMouseDown)
return FALSE;
return FALSE;
toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
if ([toplevel_impl->toplevel showsResizeIndicator])
@@ -1077,14 +1128,13 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
* is too important to not make functional.
*/
frame = [toplevel_impl->view bounds];
if (x > frame.size.width - GRIP_WIDTH
&& x < frame.size.width
&& y > frame.size.height - GRIP_HEIGHT
&& y < frame.size.height)
{
return TRUE;
}
if (x > frame.size.width - GRIP_WIDTH &&
x < frame.size.width &&
y > frame.size.height - GRIP_HEIGHT &&
y < frame.size.height)
return TRUE;
}
/* If we're on Lion and within 5 pixels of an edge,
* then assume that the user wants to resize, and
* return NULL to let Quartz get on with it. We check
@@ -1092,14 +1142,12 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
* This extra check is in case the user starts
* dragging before GDK recognizes the grab.
*/
lion = gdk_quartz_osx_version() >= GDK_OSX_LION;
lion = gdk_quartz_osx_version () >= GDK_OSX_LION;
if (lion && (x < GDK_LION_RESIZE ||
x > toplevel->width - GDK_LION_RESIZE ||
y > toplevel->height - GDK_LION_RESIZE))
{
return TRUE;
}
x > toplevel->width - GDK_LION_RESIZE ||
y > toplevel->height - GDK_LION_RESIZE))
return TRUE;
return FALSE;
}
@@ -1132,25 +1180,6 @@ gdk_event_translate (GdkEvent *event,
return FALSE;
}
/* Keep track of button state, since we don't get that information
* for key events.
*/
switch (event_type)
{
case NSLeftMouseDown:
case NSRightMouseDown:
case NSOtherMouseDown:
current_button_state |= get_mouse_button_modifiers_from_ns_event (nsevent);
break;
case NSLeftMouseUp:
case NSRightMouseUp:
case NSOtherMouseUp:
current_button_state &= ~get_mouse_button_modifiers_from_ns_event (nsevent);
break;
default:
break;
}
if (_gdk_default_filters)
{
/* Apply global filters */
@@ -1166,10 +1195,33 @@ gdk_event_translate (GdkEvent *event,
nswindow = [nsevent window];
/* Ignore events for no window or ones not created by GDK. */
if (!nswindow || ![[nswindow contentView] isKindOfClass:[GdkQuartzView class]])
/* Ignore events for windows not created by GDK. */
if (nswindow && ![[nswindow contentView] isKindOfClass:[GdkQuartzView class]])
return FALSE;
/* Ignore events for ones with no windows */
if (!nswindow)
{
GdkWindow *toplevel = NULL;
if (event_type == NSMouseMoved)
{
/* Motion events received after clicking the menu bar do not have the
* window field set. Instead of giving up on the event immediately,
* we first check whether this event is within our window bounds.
*/
NSPoint screen_point = [NSEvent mouseLocation];
gint x_tmp, y_tmp;
toplevel = find_toplevel_under_pointer (_gdk_display,
screen_point,
&x_tmp, &y_tmp);
}
if (!toplevel)
return FALSE;
}
/* Ignore events and break grabs while the window is being
* dragged. This is a workaround for the window getting events for
* the window title.
@@ -1186,8 +1238,9 @@ gdk_event_translate (GdkEvent *event,
window = find_window_for_ns_event (nsevent, &x, &y, &x_root, &y_root);
if (!window)
return FALSE;
/* Quartz handles resizing on its own, so we want to stay out of the way. */
if (test_resize(nsevent, window, x, y))
if (test_resize (nsevent, window, x, y))
return FALSE;
/* Apply any window filters. */
@@ -1238,8 +1291,6 @@ gdk_event_translate (GdkEvent *event,
}
}
current_keyboard_modifiers = get_keyboard_modifiers_from_ns_event (nsevent);
return_val = TRUE;
switch (event_type)

View File

@@ -31,14 +31,13 @@ GdkOSXVersion
gdk_quartz_osx_version (void)
{
gint minor;
OSErr err = Gestalt(gestaltSystemVersionMinor, &minor);
g_return_val_if_fail(err == noErr, GDK_OSX_UNSUPPORTED);
OSErr err = Gestalt (gestaltSystemVersionMinor, &minor);
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
if (minor < GDK_OSX_MIN)
return GDK_OSX_UNSUPPORTED;
return GDK_OSX_UNSUPPORTED;
else if (minor > GDK_OSX_CURRENT)
return GDK_OSX_NEW;
return GDK_OSX_NEW;
else
return minor;
return minor;
}

View File

@@ -359,18 +359,10 @@ maybe_update_keymap (void)
p[j] = GDK_KEY_ISO_Left_Tab;
if (!found)
{
guint tmp;
tmp = gdk_unicode_to_keyval (uc);
if (tmp != (uc | 0x01000000))
p[j] = tmp;
else
p[j] = 0;
}
p[j] = gdk_unicode_to_keyval (uc);
}
}
if (p[3] == p[2])
p[3] = 0;
if (p[2] == p[1])
@@ -453,20 +445,12 @@ maybe_update_keymap (void)
*/
if (found && p[j] == GDK_KEY_Tab && modifiers[j] == shiftKey)
p[j] = GDK_KEY_ISO_Left_Tab;
if (!found)
{
guint tmp;
tmp = gdk_unicode_to_keyval (uc);
if (tmp != (uc | 0x01000000))
p[j] = tmp;
else
p[j] = 0;
}
p[j] = gdk_unicode_to_keyval (uc);
}
}
if (p[3] == p[2])
p[3] = 0;
if (p[2] == p[1])
@@ -561,8 +545,8 @@ gdk_quartz_keymap_get_entries_for_keyval (GdkKeymap *keymap,
(*n_keys)++;
key.keycode = i / KEYVALS_PER_KEYCODE;
key.group = 0;
key.level = i % KEYVALS_PER_KEYCODE;
key.group = (i % KEYVALS_PER_KEYCODE) >= 2;
key.level = i % 2;
g_array_append_val (keys_array, key);
}
@@ -617,7 +601,7 @@ gdk_quartz_keymap_get_entries_for_keycode (GdkKeymap *keymap,
GdkKeymapKey key;
key.keycode = hardware_keycode;
key.group = i / 2;
key.group = i >= 2;
key.level = i % 2;
g_array_append_val (keys_array, key);
@@ -673,6 +657,11 @@ translate_keysym (guint hardware_keycode,
tmp_keyval = upper;
}
if (effective_group)
*effective_group = group;
if (effective_level)
*effective_level = level;
return tmp_keyval;
}
@@ -703,12 +692,18 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
return FALSE;
/* Check if shift or capslock modify the keyval */
for (bit = GDK_SHIFT_MASK; bit < GDK_CONTROL_MASK; bit <<= 1)
/* Check if modifiers modify the keyval */
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
{
if (translate_keysym (hardware_keycode, group, state & ~bit, NULL, NULL) !=
translate_keysym (hardware_keycode, group, state | bit, NULL, NULL))
if (translate_keysym (hardware_keycode,
(bit == GDK_MOD1_MASK) ? 0 : group,
state & ~bit,
NULL, NULL) !=
translate_keysym (hardware_keycode,
(bit == GDK_MOD1_MASK) ? 1 : group,
state | bit,
NULL, NULL))
tmp_modifiers |= bit;
}
@@ -727,17 +722,49 @@ static void
gdk_quartz_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
/* FIXME: For now, we've mimiced the Windows backend. */
if (*state & GDK_MOD2_MASK)
*state |= GDK_META_MASK;
}
static gboolean
gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
/* FIXME: For now, we've mimiced the Windows backend. */
if (*state & GDK_META_MASK)
*state |= GDK_MOD2_MASK;
return TRUE;
}
static GdkModifierType
gdk_quartz_keymap_get_modifier_mask (GdkKeymap *keymap,
GdkModifierIntent intent)
{
switch (intent)
{
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
return GDK_MOD2_MASK;
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
return GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
return GDK_SHIFT_MASK;
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
return GDK_MOD2_MASK;
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
return GDK_MOD2_MASK | GDK_CONTROL_MASK;
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
return GDK_MOD1_MASK;
default:
g_return_val_if_reached (0);
}
}
/* What sort of key event is this? Returns one of
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
*/
@@ -827,4 +854,5 @@ gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
keymap_class->get_modifier_mask = gdk_quartz_keymap_get_modifier_mask;
}

View File

@@ -462,6 +462,7 @@ gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
screen_class->get_monitor_height_mm = gdk_quartz_screen_get_monitor_height_mm;
screen_class->get_monitor_plug_name = gdk_quartz_screen_get_monitor_plug_name;
screen_class->get_monitor_geometry = gdk_quartz_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_quartz_screen_get_monitor_geometry;
screen_class->is_composited = gdk_quartz_screen_is_composited;
screen_class->make_display_name = gdk_quartz_screen_make_display_name;
screen_class->get_active_window = gdk_quartz_screen_get_active_window;

View File

@@ -2441,6 +2441,7 @@ gdk_quartz_window_set_skip_pager_hint (GdkWindow *window,
static void
gdk_quartz_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
@@ -2472,6 +2473,7 @@ gdk_quartz_window_begin_resize_drag (GdkWindow *window,
static void
gdk_quartz_window_begin_move_drag (GdkWindow *window,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
@@ -2530,9 +2532,17 @@ gdk_quartz_window_get_frame_extents (GdkWindow *window,
rect->height = ns_rect.size.height;
}
/* Fake protocol to make gcc think that it's OK to call setStyleMask
even if it isn't. We check to make sure before actually calling
it. */
@protocol CanSetStyleMask
- (void)setStyleMask:(int)mask;
@end
static void
gdk_quartz_window_set_decorations (GdkWindow *window,
GdkWMDecoration decorations)
GdkWMDecoration decorations)
{
GdkWindowImplQuartz *impl;
NSUInteger old_mask, new_mask;
@@ -2589,7 +2599,7 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
*/
if ([impl->toplevel respondsToSelector:@selector(setStyleMask:)])
{
[impl->toplevel setStyleMask:new_mask];
[(id<CanSetStyleMask>)impl->toplevel setStyleMask:new_mask];
}
else
{

View File

@@ -168,7 +168,6 @@ static GdkCursor *
create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
{
GdkWaylandCursor *cursor;
struct wl_visual *visual;
int stride, fd;
char *filename;
GError *error = NULL;
@@ -224,33 +223,30 @@ create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
else
memset (cursor->map, 0, 4);
visual = display->premultiplied_argb_visual;
cursor->buffer = wl_shm_create_buffer(display->shm,
fd,
cursor->width,
cursor->height,
stride, visual);
stride, WL_SHM_FORMAT_ARGB32);
close(fd);
return GDK_CURSOR (cursor);
}
#define DATADIR "/usr/share/wayland"
static const struct {
GdkCursorType type;
const char *filename;
int hotspot_x, hotspot_y;
} cursor_definitions[] = {
{ GDK_BLANK_CURSOR, NULL, 0, 0 },
{ GDK_HAND1, DATADIR "/hand1.png", 18, 11 },
{ GDK_HAND2, DATADIR "/hand2.png", 14, 8 },
{ GDK_LEFT_PTR, DATADIR "/left_ptr.png", 10, 5 },
{ GDK_SB_H_DOUBLE_ARROW, DATADIR "/sb_h_double_arrow.png", 15, 15 },
{ GDK_SB_V_DOUBLE_ARROW, DATADIR "/sb_v_double_arrow.png", 15, 15 },
{ GDK_XTERM, DATADIR "/xterm.png", 15, 15 },
{ GDK_BOTTOM_RIGHT_CORNER, DATADIR "/bottom_right_corner.png", 28, 28 }
{ GDK_HAND1, "hand1.png", 18, 11 },
{ GDK_HAND2, "hand2.png", 14, 8 },
{ GDK_LEFT_PTR, "left_ptr.png", 10, 5 },
{ GDK_SB_H_DOUBLE_ARROW, "sb_h_double_arrow.png", 15, 15 },
{ GDK_SB_V_DOUBLE_ARROW, "sb_v_double_arrow.png", 15, 15 },
{ GDK_XTERM, "xterm.png", 15, 15 },
{ GDK_BOTTOM_RIGHT_CORNER, "bottom_right_corner.png", 28, 28 }
};
GdkCursor *
@@ -258,7 +254,7 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type)
{
GdkDisplayWayland *wayland_display;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
int i;
@@ -270,8 +266,8 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
if (i == G_N_ELEMENTS (cursor_definitions))
{
g_warning("unhandled cursor type %d, falling back to blank\n",
cursor_type);
g_warning ("Unhandled cursor type %d, falling back to blank\n",
cursor_type);
i = 0;
}
@@ -283,20 +279,44 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
return g_object_ref (wayland_display->cursors[i]);
GDK_NOTE (CURSOR,
g_message ("creating new cursor for type %d, filename %s",
g_message ("Creating new cursor for type %d, filename %s",
cursor_type, cursor_definitions[i].filename));
if (cursor_type != GDK_BLANK_CURSOR)
pixbuf = gdk_pixbuf_new_from_file(cursor_definitions[i].filename, &error);
else
pixbuf = NULL;
if (error != NULL)
{
GDK_NOTE (CURSOR,
g_message ("failed to load %s: %s",
cursor_definitions[i].filename, error->message));
g_error_free(error);
return NULL;
const gchar * const *directories;
gint j;
directories = g_get_system_data_dirs();
for (j = 0; directories[j] != NULL; j++)
{
gchar *filename;
filename = g_build_filename (directories[j],
"wayland",
cursor_definitions[i].filename,
NULL);
if (g_file_test (filename, G_FILE_TEST_EXISTS))
{
pixbuf = gdk_pixbuf_new_from_file (filename, &error);
if (error != NULL)
{
g_warning ("Failed to load cursor: %s: %s",
filename, error->message);
g_error_free(error);
return NULL;
}
break;
}
}
if (!pixbuf)
{
g_warning ("Unable to find cursor for: %s",
cursor_definitions[i].filename);
return NULL;
}
}
wayland_display->cursors[i] =

View File

@@ -43,6 +43,8 @@ typedef struct _GdkDeviceCore GdkDeviceCore;
typedef struct _GdkDeviceCoreClass GdkDeviceCoreClass;
typedef struct _GdkWaylandDevice GdkWaylandDevice;
typedef struct _DataOffer DataOffer;
struct _GdkWaylandDevice
{
GdkDisplay *display;
@@ -52,8 +54,12 @@ struct _GdkWaylandDevice
GdkWindow *pointer_focus;
GdkWindow *keyboard_focus;
struct wl_input_device *device;
struct wl_data_device *data_device;
int32_t x, y, surface_x, surface_y;
uint32_t time;
DataOffer *drag_offer;
DataOffer *selection_offer;
};
struct _GdkDeviceCore
@@ -114,7 +120,7 @@ gdk_device_core_get_state (GdkDevice *device,
{
gint x_int, y_int;
gdk_window_get_pointer (window, &x_int, &y_int, mask);
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
if (axes)
{
@@ -595,17 +601,171 @@ static const struct wl_input_device_listener input_device_listener = {
input_handle_keyboard_focus,
};
struct _DataOffer {
struct wl_data_offer *offer;
gint ref_count;
GPtrArray *types;
};
static void
data_offer_offer (void *data,
struct wl_data_offer *wl_data_offer,
const char *type)
{
DataOffer *offer = (DataOffer *)data;
g_debug (G_STRLOC ": %s wl_data_offer = %p type = %s",
G_STRFUNC, wl_data_offer, type);
g_ptr_array_add (offer->types, g_strdup (type));
}
static void
data_offer_unref (DataOffer *offer)
{
offer->ref_count--;
if (offer->ref_count == 0)
{
g_ptr_array_free (offer->types, TRUE);
g_free (offer);
}
}
static const struct wl_data_offer_listener data_offer_listener = {
data_offer_offer,
};
static void
data_device_data_offer (void *data,
struct wl_data_device *data_device,
uint32_t id)
{
DataOffer *offer;
g_debug (G_STRLOC ": %s data_device = %p id = %lu",
G_STRFUNC, data_device, (long unsigned int)id);
/* This structure is reference counted to handle the case where you get a
* leave but are in the middle of transferring data
*/
offer = g_new0 (DataOffer, 1);
offer->ref_count = 1;
offer->types = g_ptr_array_new_with_free_func (g_free);
offer->offer = (struct wl_data_offer *)
wl_proxy_create_for_id ((struct wl_proxy *) data_device,
id,
&wl_data_offer_interface);
/* The DataOffer structure is then retrieved later since this sets the user
* data.
*/
wl_data_offer_add_listener (offer->offer,
&data_offer_listener,
offer);
}
static void
data_device_enter (void *data,
struct wl_data_device *data_device,
uint32_t time,
struct wl_surface *surface,
int32_t x,
int32_t y,
struct wl_data_offer *offer)
{
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
g_debug (G_STRLOC ": %s data_device = %p time = %d, surface = %p, x = %d y = %d, offer = %p",
G_STRFUNC, data_device, time, surface, x, y, offer);
/* Retrieve the DataOffer associated with with the wl_data_offer - this
* association is made when the listener is attached.
*/
g_assert (device->drag_offer == NULL);
device->drag_offer = wl_data_offer_get_user_data (offer);
}
static void
data_device_leave (void *data,
struct wl_data_device *data_device)
{
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
g_debug (G_STRLOC ": %s data_device = %p",
G_STRFUNC, data_device);
data_offer_unref (device->drag_offer);
device->drag_offer = NULL;
}
static void
data_device_motion (void *data,
struct wl_data_device *data_device,
uint32_t time,
int32_t x,
int32_t y)
{
g_debug (G_STRLOC ": %s data_device = %p, time = %d, x = %d, y = %d",
G_STRFUNC, data_device, time, x, y);
}
static void
data_device_drop (void *data,
struct wl_data_device *data_device)
{
g_debug (G_STRLOC ": %s data_device = %p",
G_STRFUNC, data_device);
}
static void
data_device_selection (void *data,
struct wl_data_device *wl_data_device,
struct wl_data_offer *offer)
{
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
GdkDeviceManager *device_manager =
gdk_display_get_device_manager (device->display);
GdkDeviceManagerCore *device_manager_core =
GDK_DEVICE_MANAGER_CORE (device_manager);
g_debug (G_STRLOC ": %s wl_data_device = %p wl_data_offer = %p",
G_STRFUNC, wl_data_device, offer);
if (device->selection_offer)
{
data_offer_unref (device->selection_offer);
device->selection_offer = NULL;
}
/* Retrieve the DataOffer associated with with the wl_data_offer - this
* association is made when the listener is attached.
*/
g_assert (device->selection_offer == NULL);
device->selection_offer = wl_data_offer_get_user_data (offer);
}
static const struct wl_data_device_listener data_device_listener = {
data_device_data_offer,
data_device_enter,
data_device_leave,
data_device_motion,
data_device_drop,
data_device_selection
};
void
_gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
struct wl_input_device *wl_device)
{
GdkDisplay *display;
GdkDisplayWayland *display_wayland;
GdkDeviceManagerCore *device_manager_core =
GDK_DEVICE_MANAGER_CORE(device_manager);
GdkWaylandDevice *device;
device = g_new0 (GdkWaylandDevice, 1);
display = gdk_device_manager_get_display (device_manager);
display_wayland = GDK_DISPLAY_WAYLAND (display);
device->display = display;
device->pointer = g_object_new (GDK_TYPE_DEVICE_CORE,
@@ -635,6 +795,12 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
wl_input_device_add_listener(device->device,
&input_device_listener, device);
device->data_device =
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
device->device);
wl_data_device_add_listener (device->data_device,
&data_device_listener, device);
device_manager_core->devices =
g_list_prepend (device_manager_core->devices, device->keyboard);
device_manager_core->devices =

View File

@@ -90,38 +90,6 @@ gdk_input_init (GdkDisplay *display)
g_list_free (list);
}
static void
shell_handle_configure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,
struct wl_surface *surface,
int32_t width, int32_t height)
{
GdkWindow *window;
GdkDisplay *display;
GdkEvent *event;
window = wl_surface_get_user_data(surface);
display = gdk_window_get_display (window);
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = window;
event->configure.send_event = FALSE;
event->configure.width = width;
event->configure.height = height;
_gdk_window_update_size (window);
_gdk_wayland_window_update_size (window, width, height, edges);
g_object_ref(window);
_gdk_wayland_display_deliver_event (display, event);
}
static const struct wl_shell_listener shell_listener = {
shell_handle_configure,
};
static void
output_handle_geometry(void *data,
struct wl_output *wl_output,
@@ -143,31 +111,6 @@ display_handle_mode(void *data,
{
}
static void
compositor_handle_visual(void *data,
struct wl_compositor *compositor,
uint32_t id, uint32_t token)
{
GdkDisplayWayland *d = data;
switch (token) {
case WL_COMPOSITOR_VISUAL_ARGB32:
d->argb_visual = wl_visual_create(d->wl_display, id, 1);
break;
case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32:
d->premultiplied_argb_visual =
wl_visual_create(d->wl_display, id, 1);
break;
case WL_COMPOSITOR_VISUAL_XRGB32:
d->rgb_visual = wl_visual_create(d->wl_display, id, 1);
break;
}
}
static const struct wl_compositor_listener compositor_listener = {
compositor_handle_visual,
};
static const struct wl_output_listener output_listener = {
output_handle_geometry,
display_handle_mode
@@ -182,23 +125,25 @@ gdk_display_handle_global(struct wl_display *display, uint32_t id,
struct wl_input_device *input;
if (strcmp(interface, "wl_compositor") == 0) {
display_wayland->compositor = wl_compositor_create(display, id, 1);
wl_compositor_add_listener(display_wayland->compositor,
&compositor_listener, display_wayland);
display_wayland->compositor =
wl_display_bind(display, id, &wl_compositor_interface);
} else if (strcmp(interface, "wl_shm") == 0) {
display_wayland->shm = wl_shm_create(display, id, 1);
display_wayland->shm = wl_display_bind(display, id, &wl_shm_interface);
} else if (strcmp(interface, "wl_shell") == 0) {
display_wayland->shell = wl_shell_create(display, id, 1);
wl_shell_add_listener(display_wayland->shell,
&shell_listener, display_wayland);
display_wayland->shell = wl_display_bind(display, id, &wl_shell_interface);
} else if (strcmp(interface, "wl_output") == 0) {
display_wayland->output = wl_output_create(display, id, 1);
display_wayland->output =
wl_display_bind(display, id, &wl_output_interface);
wl_output_add_listener(display_wayland->output,
&output_listener, display_wayland);
} else if (strcmp(interface, "wl_input_device") == 0) {
input = wl_input_device_create(display, id, 1);
input = wl_display_bind(display, id, &wl_input_device_interface);
_gdk_wayland_device_manager_add_device (gdk_display->device_manager,
input);
} else if (strcmp(interface, "wl_data_device_manager") == 0) {
display_wayland->data_device_manager =
wl_display_bind(display, id,
&wl_data_device_manager_interface);
}
}
@@ -375,28 +320,16 @@ gdk_wayland_display_beep (GdkDisplay *display)
g_return_if_fail (GDK_IS_DISPLAY (display));
}
static void
sync_callback(void *data)
{
gboolean *done = data;
*done = TRUE;
}
static void
gdk_wayland_display_sync (GdkDisplay *display)
{
GdkDisplayWayland *display_wayland;
gboolean done;
g_return_if_fail (GDK_IS_DISPLAY (display));
display_wayland = GDK_DISPLAY_WAYLAND (display);
wl_display_sync_callback(display_wayland->wl_display, sync_callback, &done);
wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_WRITABLE);
while (!done)
wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_READABLE);
wl_display_roundtrip(display_wayland->wl_display);
}
static void

View File

@@ -71,12 +71,12 @@ struct _GdkDisplayWayland
/* Wayland fields below */
struct wl_display *wl_display;
struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual;
struct wl_compositor *compositor;
struct wl_shm *shm;
struct wl_shell *shell;
struct wl_output *output;
struct wl_input_device *input_device;
struct wl_data_device_manager *data_device_manager;
GSource *event_source;
EGLDisplay egl_display;
EGLContext egl_context;

View File

@@ -47,6 +47,9 @@ struct _GdkWaylandDisplayManager
GdkDisplay *default_display;
GSList *displays;
GHashTable *name_to_atoms;
guint next_atom;
};
struct _GdkWaylandDisplayManagerClass
@@ -92,18 +95,51 @@ gdk_wayland_display_manager_get_default_display (GdkDisplayManager *manager)
}
static GdkAtom
gdk_wayland_display_manager_atom_intern (GdkDisplayManager *manager,
gdk_wayland_display_manager_atom_intern (GdkDisplayManager *manager_in,
const gchar *atom_name,
gboolean dup)
{
return 0;
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (manager_in);
GdkAtom atom;
gpointer data;
const gchar *atom_name_intern;
atom_name_intern = g_intern_string (atom_name);
data = g_hash_table_lookup (manager->name_to_atoms, atom_name_intern);
if (data)
{
atom = GDK_POINTER_TO_ATOM (data);
return atom;
}
atom = _GDK_MAKE_ATOM (manager->next_atom);
g_hash_table_insert (manager->name_to_atoms,
(gchar *)atom_name_intern,
GDK_ATOM_TO_POINTER (atom));
manager->next_atom++;
return atom;
}
static gchar *
gdk_wayland_display_manager_get_atom_name (GdkDisplayManager *manager,
gdk_wayland_display_manager_get_atom_name (GdkDisplayManager *manager_in,
GdkAtom atom)
{
return 0;
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (manager_in);
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, manager->name_to_atoms);
while (g_hash_table_iter_next (&iter, &key, &value))
{
if (GDK_POINTER_TO_ATOM (key) == atom)
return g_strdup (value);
}
return NULL;
}
static guint
@@ -138,132 +174,6 @@ gdk_wayland_display_manager_get_keyval_name (GdkDisplayManager *manager,
return buf;
}
static void
gdk_wayland_display_manager_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper)
{
guint xlower = symbol;
guint xupper = symbol;
/* Check for directly encoded 24-bit UCS characters: */
if ((symbol & 0xff000000) == 0x01000000)
{
if (lower)
*lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
if (upper)
*upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
return;
}
switch (symbol >> 8)
{
case 0: /* Latin 1 */
if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
xlower += (GDK_KEY_a - GDK_KEY_A);
else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
xupper -= (GDK_KEY_a - GDK_KEY_A);
else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
break;
case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol == GDK_KEY_Aogonek)
xlower = GDK_KEY_aogonek;
else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
else if (symbol == GDK_KEY_aogonek)
xupper = GDK_KEY_Aogonek;
else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
xlower += (GDK_KEY_racute - GDK_KEY_Racute);
else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
break;
case 2: /* Latin 3 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
break;
case 3: /* Latin 4 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
else if (symbol == GDK_KEY_ENG)
xlower = GDK_KEY_eng;
else if (symbol == GDK_KEY_eng)
xupper = GDK_KEY_ENG;
else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
break;
case 6: /* Cyrillic */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
break;
case 7: /* Greek */
/* Assume the KeySym is a legal value (ignore discontinuities) */
if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
symbol != GDK_KEY_Greek_iotaaccentdieresis &&
symbol != GDK_KEY_Greek_upsilonaccentdieresis)
xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
symbol != GDK_KEY_Greek_finalsmallsigma)
xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
break;
}
if (lower)
*lower = xlower;
if (upper)
*upper = xupper;
}
static void
gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
{
@@ -280,12 +190,46 @@ gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
manager_class->get_atom_name = gdk_wayland_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_wayland_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_wayland_display_manager_get_keyval_name;
manager_class->keyval_convert_case = gdk_wayland_display_manager_keyval_convert_case;
}
struct {
const gchar *name;
guint atom_id;
} predefined_atoms[] = {
{ "NONE", 0 },
{ "PRIMARY", 1 },
{ "SECONDARY", 2 },
{ "ATOM", 4 },
{ "BITMAP", 5 },
{ "COLORMAP", 7 },
{ "DRAWABLE", 17 },
{ "INTEGER", 19 },
{ "PIXMAP", 20 },
{ "STRING", 31 },
{ "WINDOW", 33 },
{ "CLIPBOARD", 69 },
};
static void
gdk_wayland_display_manager_init (GdkWaylandDisplayManager *manager)
{
gint i;
manager->name_to_atoms = g_hash_table_new (NULL, NULL);
for (i = 0; i < G_N_ELEMENTS (predefined_atoms); i++)
{
GdkAtom atom;
const gchar *atom_name = predefined_atoms[i].name;
atom = _GDK_MAKE_ATOM (predefined_atoms[i].atom_id);
g_hash_table_insert (manager->name_to_atoms,
(gchar *)g_intern_static_string (atom_name),
GDK_ATOM_TO_POINTER (atom));
}
manager->next_atom =
predefined_atoms[G_N_ELEMENTS (predefined_atoms) - 1].atom_id + 1;
}
void

View File

@@ -53,9 +53,7 @@ struct _GdkScreenWayland
int width_mm, height_mm;
/* Visual Part */
GdkVisual *argb_visual;
GdkVisual *premultiplied_argb_visual;
GdkVisual *rgb_visual;
GdkVisual *visual;
/* Xinerama/RandR 1.2 */
gint n_monitors;
@@ -155,10 +153,7 @@ gdk_wayland_screen_finalize (GObject *object)
if (screen_wayland->root_window)
g_object_unref (screen_wayland->root_window);
/* Visual Part */
g_object_unref (screen_wayland->argb_visual);
g_object_unref (screen_wayland->premultiplied_argb_visual);
g_object_unref (screen_wayland->rgb_visual);
g_object_unref (screen_wayland->visual);
deinit_multihead (GDK_SCREEN (object));
@@ -294,13 +289,13 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
static GdkVisual *
gdk_wayland_screen_get_system_visual (GdkScreen * screen)
{
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->argb_visual;
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->visual;
}
static GdkVisual *
gdk_wayland_screen_get_rgba_visual (GdkScreen *screen)
{
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->argb_visual;
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->visual;
}
static gboolean
@@ -349,7 +344,6 @@ typedef struct _GdkWaylandVisualClass GdkWaylandVisualClass;
struct _GdkWaylandVisual
{
GdkVisual visual;
struct wl_visual *wl_visual;
};
struct _GdkWaylandVisualClass
@@ -384,21 +378,21 @@ gdk_wayland_screen_visual_get_best_type (GdkScreen *screen)
static GdkVisual*
gdk_wayland_screen_visual_get_best (GdkScreen *screen)
{
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
return GDK_SCREEN_WAYLAND (screen)->visual;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
return GDK_SCREEN_WAYLAND (screen)->visual;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
return GDK_SCREEN_WAYLAND (screen)->visual;
}
static GdkVisual*
@@ -406,7 +400,7 @@ gdk_wayland_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
return GDK_SCREEN_WAYLAND (screen)->visual;
}
static void
@@ -440,9 +434,7 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
screen_wayland = GDK_SCREEN_WAYLAND (screen);
list = g_list_append (NULL, screen_wayland->argb_visual);
list = g_list_append (NULL, screen_wayland->premultiplied_argb_visual);
list = g_list_append (NULL, screen_wayland->rgb_visual);
list = g_list_append (NULL, screen_wayland->visual);
return list;
}
@@ -451,7 +443,7 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
#define GDK_WAYLAND_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_VISUAL, GdkWaylandVisual))
static GdkVisual *
gdk_wayland_visual_new (GdkScreen *screen, struct wl_visual *wl_visual)
gdk_wayland_visual_new (GdkScreen *screen)
{
GdkVisual *visual;
@@ -460,8 +452,6 @@ gdk_wayland_visual_new (GdkScreen *screen, struct wl_visual *wl_visual)
visual->type = GDK_VISUAL_TRUE_COLOR;
visual->depth = 32;
GDK_WAYLAND_VISUAL (visual)->wl_visual = wl_visual;
return visual;
}
@@ -470,10 +460,6 @@ _gdk_wayland_screen_new (GdkDisplay *display)
{
GdkScreen *screen;
GdkScreenWayland *screen_wayland;
GdkDisplayWayland *display_wayland;
struct wl_visual *visual;
display_wayland = GDK_DISPLAY_WAYLAND (display);
screen = g_object_new (GDK_TYPE_SCREEN_WAYLAND, NULL);
@@ -482,15 +468,7 @@ _gdk_wayland_screen_new (GdkDisplay *display)
screen_wayland->width = 8192;
screen_wayland->height = 8192;
visual = display_wayland->argb_visual;
screen_wayland->argb_visual = gdk_wayland_visual_new (screen, visual);
visual = display_wayland->premultiplied_argb_visual;
screen_wayland->premultiplied_argb_visual =
gdk_wayland_visual_new (screen, visual);
visual = display_wayland->rgb_visual;
screen_wayland->rgb_visual = gdk_wayland_visual_new (screen, visual);
screen_wayland->visual = gdk_wayland_visual_new (screen);
screen_wayland->root_window =
_gdk_wayland_screen_create_root_window (screen,
@@ -524,6 +502,7 @@ _gdk_screen_wayland_class_init (GdkScreenWaylandClass *klass)
screen_class->get_monitor_height_mm = gdk_wayland_screen_get_monitor_height_mm;
screen_class->get_monitor_plug_name = gdk_wayland_screen_get_monitor_plug_name;
screen_class->get_monitor_geometry = gdk_wayland_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_wayland_screen_get_monitor_geometry;
screen_class->get_system_visual = gdk_wayland_screen_get_system_visual;
screen_class->get_rgba_visual = gdk_wayland_screen_get_rgba_visual;
screen_class->is_composited = gdk_wayland_screen_is_composited;

View File

@@ -99,6 +99,7 @@ struct _GdkWindowImplWayland
gint8 toplevel_window_type;
struct wl_surface *surface;
struct wl_shell_surface *shell_surface;
unsigned int mapped : 1;
GdkWindow *transient_for;
@@ -337,12 +338,12 @@ gdk_wayland_window_attach_image (GdkWindow *window)
data->buffer =
wl_egl_pixmap_create_buffer(data->pixmap);
if (impl->resize_edges & WL_SHELL_RESIZE_LEFT)
if (impl->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
dx = server_width - data->width;
else
dx = 0;
if (impl->resize_edges & WL_SHELL_RESIZE_TOP)
if (impl->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
dy = server_height - data->height;
else
dy = 0;
@@ -360,7 +361,7 @@ gdk_window_impl_wayland_finalize (GObject *object)
impl = GDK_WINDOW_IMPL_WAYLAND (object);
if (impl->cursor)
gdk_cursor_unref (impl->cursor);
g_object_unref (impl->cursor);
if (impl->server_surface)
cairo_surface_destroy (impl->server_surface);
@@ -387,15 +388,13 @@ gdk_wayland_create_cairo_surface (GdkDisplayWayland *display,
{
GdkWaylandCairoSurfaceData *data;
cairo_surface_t *surface;
struct wl_visual *visual;
data = g_new (GdkWaylandCairoSurfaceData, 1);
data->display = display;
data->buffer = NULL;
visual = display->premultiplied_argb_visual;
data->width = width;
data->height = height;
data->pixmap = wl_egl_pixmap_create(width, height, visual, 0);
data->pixmap = wl_egl_pixmap_create(width, height, 0);
data->image =
display->create_image(display->egl_display, NULL, EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer) data->pixmap, NULL);
@@ -452,8 +451,6 @@ gdk_wayland_window_map (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent;
GdkDisplayWayland *display_wayland =
GDK_DISPLAY_WAYLAND (gdk_window_get_display (impl->wrapper));
if (!impl->mapped)
{
@@ -466,15 +463,47 @@ gdk_wayland_window_map (GdkWindow *window)
window->y);
parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl);
wl_shell_set_transient (display_wayland->shell, impl->surface, parent->surface,
window->x, window->y, 0);
wl_shell_surface_set_transient (impl->shell_surface, parent->shell_surface,
window->x, window->y, 0);
}
else
wl_shell_set_toplevel (display_wayland->shell, impl->surface);
wl_shell_surface_set_toplevel (impl->shell_surface);
impl->mapped = TRUE;
}
}
static void
shell_surface_handle_configure(void *data,
struct wl_shell_surface *shell_surface,
uint32_t time,
uint32_t edges,
int32_t width,
int32_t height)
{
GdkWindow *window = GDK_WINDOW (data);
GdkDisplay *display;
GdkEvent *event;
display = gdk_window_get_display (window);
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = window;
event->configure.send_event = FALSE;
event->configure.width = width;
event->configure.height = height;
_gdk_window_update_size (window);
_gdk_wayland_window_update_size (window, width, height, edges);
g_object_ref(window);
_gdk_wayland_display_deliver_event (display, event);
}
static const struct wl_shell_surface_listener shell_surface_listener = {
shell_surface_handle_configure,
};
static void
gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
{
@@ -494,6 +523,11 @@ gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
impl->surface = wl_compositor_create_surface(display_wayland->compositor);
wl_surface_set_user_data(impl->surface, window);
impl->shell_surface = wl_shell_get_shell_surface (display_wayland->shell,
impl->surface);
wl_shell_surface_add_listener(impl->shell_surface,
&shell_surface_listener, window);
_gdk_make_event (window, GDK_MAP, NULL, FALSE);
event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY, NULL, FALSE);
event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
@@ -1105,15 +1139,13 @@ gdk_wayland_window_set_functions (GdkWindow *window,
static void
gdk_wayland_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkDeviceManager *dm;
GdkWindowImplWayland *impl;
GdkDevice *device;
uint32_t grab_type;
if (GDK_WINDOW_DESTROYED (window) ||
@@ -1123,35 +1155,35 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
switch (edge)
{
case GDK_WINDOW_EDGE_NORTH_WEST:
grab_type = WL_SHELL_RESIZE_TOP_LEFT;
grab_type = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
break;
case GDK_WINDOW_EDGE_NORTH:
grab_type = WL_SHELL_RESIZE_TOP;
grab_type = WL_SHELL_SURFACE_RESIZE_TOP;
break;
case GDK_WINDOW_EDGE_NORTH_EAST:
grab_type = WL_SHELL_RESIZE_RIGHT;
grab_type = WL_SHELL_SURFACE_RESIZE_RIGHT;
break;
case GDK_WINDOW_EDGE_WEST:
grab_type = WL_SHELL_RESIZE_LEFT;
grab_type = WL_SHELL_SURFACE_RESIZE_LEFT;
break;
case GDK_WINDOW_EDGE_EAST:
grab_type = WL_SHELL_RESIZE_RIGHT;
grab_type = WL_SHELL_SURFACE_RESIZE_RIGHT;
break;
case GDK_WINDOW_EDGE_SOUTH_WEST:
grab_type = WL_SHELL_RESIZE_BOTTOM_LEFT;
grab_type = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
break;
case GDK_WINDOW_EDGE_SOUTH:
grab_type = WL_SHELL_RESIZE_BOTTOM;
grab_type = WL_SHELL_SURFACE_RESIZE_BOTTOM;
break;
case GDK_WINDOW_EDGE_SOUTH_EAST:
grab_type = WL_SHELL_RESIZE_BOTTOM_RIGHT;
grab_type = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
break;
default:
@@ -1161,25 +1193,22 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
}
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
dm = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (dm);
wl_shell_resize(GDK_DISPLAY_WAYLAND (display)->shell, impl->surface,
_gdk_wayland_device_get_device (device),
timestamp, grab_type);
wl_shell_surface_resize(impl->shell_surface,
_gdk_wayland_device_get_device (device),
timestamp, grab_type);
}
static void
gdk_wayland_window_begin_move_drag (GdkWindow *window,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkDeviceManager *dm;
GdkWindowImplWayland *impl;
GdkDevice *device;
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
@@ -1187,11 +1216,8 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
dm = gdk_display_get_device_manager (display);
device = gdk_device_manager_get_client_pointer (dm);
wl_shell_move(GDK_DISPLAY_WAYLAND (display)->shell, impl->surface,
_gdk_wayland_device_get_device (device), timestamp);
wl_shell_surface_move(impl->shell_surface,
_gdk_wayland_device_get_device (device), timestamp);
}
static void

View File

@@ -318,8 +318,37 @@ gdk_device_win32_grab (GdkDevice *device,
GdkCursor *cursor,
guint32 time_)
{
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
HCURSOR hcursor;
GdkWin32Cursor *cursor_private;
cursor_private = (GdkWin32Cursor*) cursor;
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
SetCapture (GDK_WINDOW_HWND (window));
{
if (!cursor)
hcursor = NULL;
else if ((hcursor = CopyCursor (cursor_private->hcursor)) == NULL)
WIN32_API_FAILED ("CopyCursor");
if (_gdk_win32_grab_cursor != NULL)
{
if (GetCursor () == _gdk_win32_grab_cursor)
SetCursor (NULL);
DestroyCursor (_gdk_win32_grab_cursor);
}
_gdk_win32_grab_cursor = hcursor;
if (_gdk_win32_grab_cursor != NULL)
SetCursor (_gdk_win32_grab_cursor);
else if (impl->hcursor != NULL)
SetCursor (impl->hcursor);
else
SetCursor (LoadCursor (NULL, IDC_ARROW));
SetCapture (GDK_WINDOW_HWND (window));
}
return GDK_GRAB_SUCCESS;
}
@@ -338,11 +367,28 @@ gdk_device_win32_ungrab (GdkDevice *device,
info->serial_end = 0;
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
ReleaseCapture ();
{
if (_gdk_win32_grab_cursor != NULL)
{
if (GetCursor () == _gdk_win32_grab_cursor)
SetCursor (NULL);
DestroyCursor (_gdk_win32_grab_cursor);
}
_gdk_win32_grab_cursor = NULL;
ReleaseCapture ();
}
_gdk_display_device_grab_update (display, device, NULL, 0);
}
static void
screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
{
*client_pt = screen_pt;
ScreenToClient (hwnd, client_pt);
}
static GdkWindow *
gdk_device_win32_window_at_position (GdkDevice *device,
gint *win_x,
@@ -350,45 +396,75 @@ gdk_device_win32_window_at_position (GdkDevice *device,
GdkModifierType *mask,
gboolean get_toplevel)
{
GdkWindow *window;
POINT point, pointc;
GdkWindow *window = NULL;
POINT screen_pt, client_pt;
HWND hwnd, hwndc;
RECT rect;
GetCursorPos (&pointc);
point = pointc;
hwnd = WindowFromPoint (point);
GetCursorPos (&screen_pt);
if (hwnd == NULL)
if (get_toplevel)
{
window = _gdk_root;
*win_x = pointc.x + _gdk_offset_x;
*win_y = pointc.y + _gdk_offset_y;
return window;
/* Only consider visible children of the desktop to avoid the various
* non-visible windows you often find on a running Windows box. These
* might overlap our windows and cause our walk to fail. As we assume
* WindowFromPoint() can find our windows, we follow similar logic
* here, and ignore invisible and disabled windows.
*/
hwnd = GetDesktopWindow ();
do {
window = gdk_win32_handle_table_lookup (hwnd);
if (window != NULL &&
GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT &&
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
break;
screen_to_client (hwnd, screen_pt, &client_pt);
hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED |
CWP_SKIPINVISIBLE);
/* Verify that we're really inside the client area of the window */
if (hwndc != hwnd)
{
GetClientRect (hwndc, &rect);
screen_to_client (hwndc, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwndc = hwnd;
}
} while (hwndc != hwnd && (hwnd = hwndc, 1));
}
ScreenToClient (hwnd, &point);
do
else
{
if (get_toplevel &&
(window = gdk_win32_handle_table_lookup (hwnd)) != NULL &&
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
break;
hwnd = WindowFromPoint (screen_pt);
hwndc = ChildWindowFromPoint (hwnd, point);
ClientToScreen (hwnd, &point);
ScreenToClient (hwndc, &point);
/* Verify that we're really inside the client area of the window */
GetClientRect (hwnd, &rect);
screen_to_client (hwnd, screen_pt, &client_pt);
if (!PtInRect (&rect, client_pt))
hwnd = NULL;
/* If we didn't hit any window at that point, return the desktop */
if (hwnd == NULL)
{
if (win_x)
*win_x = screen_pt.x + _gdk_offset_x;
if (win_y)
*win_y = screen_pt.y + _gdk_offset_y;
return _gdk_root;
}
window = gdk_win32_handle_table_lookup (hwnd);
}
while (hwndc != hwnd && (hwnd = hwndc, 1));
window = gdk_win32_handle_table_lookup (hwnd);
if (window && (win_x || win_y))
{
GetClientRect (hwnd, &rect);
*win_x = point.x - rect.left;
*win_y = point.y - rect.top;
if (win_x)
*win_x = client_pt.x;
if (win_y)
*win_y = client_pt.y;
}
return window;

View File

@@ -360,9 +360,10 @@ print_cursor (int index)
}
#endif
static void
_gdk_input_wintab_init_check (GdkDeviceManagerWin32 *device_manager)
void
_gdk_input_wintab_init_check (GdkDeviceManager *_device_manager)
{
GdkDeviceManagerWin32 *device_manager = (GdkDeviceManagerWin32 *)_device_manager;
static gboolean wintab_initialized = FALSE;
GdkDeviceWintab *device;
GdkWindowAttr wa;
@@ -577,8 +578,8 @@ _gdk_input_wintab_init_check (GdkDeviceManagerWin32 *device_manager)
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
"name", device_name,
"type", GDK_DEVICE_TYPE_SLAVE,
"source", GDK_SOURCE_PEN,
"mode", GDK_MODE_SCREEN,
"input-source", GDK_SOURCE_PEN,
"input-mode", GDK_MODE_SCREEN,
"has-cursor", FALSE,
"display", _gdk_display,
"device-manager", device_manager,
@@ -690,8 +691,6 @@ gdk_device_manager_win32_constructed (GObject *object)
_gdk_device_set_associated_device (device_manager->core_pointer, device_manager->core_keyboard);
_gdk_device_set_associated_device (device_manager->core_keyboard, device_manager->core_pointer);
_gdk_input_wintab_init_check (device_manager);
}
static GList *

View File

@@ -25,6 +25,7 @@
#include "gdkwin32display.h"
#include "gdkwin32screen.h"
#include "gdkwin32window.h"
#include "gdkwin32.h"
#define HAVE_MONITOR_INFO
@@ -79,7 +80,7 @@ enum_monitor (HMONITOR hmonitor,
DWORD dwFlags;
CHAR szDevice[CCHDEVICENAME];
} MONITORINFOEXA2;
MONITORINFOEXA2 monitor_info;
HDC hDC;
@@ -252,7 +253,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
PFN_ProcessIdToSessionId processIdToSessionId;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
if (display_name_cache != NULL)
return display_name_cache;
@@ -304,7 +305,7 @@ static gint
gdk_win32_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return 1;
}
@@ -341,15 +342,194 @@ gdk_win32_display_supports_selection_notification (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return FALSE;
return TRUE;
}
static HWND _hwnd_next_viewer = NULL;
static int debug_indent = 0;
/*
* maybe this should be integrated with the default message loop - or maybe not ;-)
*/
static LRESULT CALLBACK
inner_clipboard_window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
switch (message)
{
case WM_DESTROY: /* remove us from chain */
{
ChangeClipboardChain (hwnd, _hwnd_next_viewer);
PostQuitMessage (0);
return 0;
}
case WM_CHANGECBCHAIN:
{
HWND hwndRemove = (HWND) wparam; /* handle of window being removed */
HWND hwndNext = (HWND) lparam; /* handle of next window in chain */
if (hwndRemove == _hwnd_next_viewer)
_hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext;
else if (_hwnd_next_viewer != NULL)
return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
return 0;
}
#ifdef WM_CLIPBOARDUPDATE
case WM_CLIPBOARDUPDATE:
#endif
case WM_DRAWCLIPBOARD:
{
int success;
HWND hwndOwner;
#ifdef G_ENABLE_DEBUG
UINT nFormat = 0;
#endif
GdkEvent *event;
GdkWindow *owner;
success = OpenClipboard (hwnd);
g_return_val_if_fail (success, 0);
hwndOwner = GetClipboardOwner ();
owner = gdk_win32_window_lookup_for_display (_gdk_display, hwndOwner);
if (owner == NULL)
owner = gdk_win32_window_foreign_new_for_display (_gdk_display, hwndOwner);
GDK_NOTE (DND, g_print (" drawclipboard owner: %p", hwndOwner));
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_DND)
{
while ((nFormat = EnumClipboardFormats (nFormat)) != 0)
g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
}
#endif
GDK_NOTE (DND, g_print (" \n"));
event = gdk_event_new (GDK_OWNER_CHANGE);
event->owner_change.window = _gdk_root;
event->owner_change.owner = owner;
event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
event->owner_change.selection = GDK_SELECTION_CLIPBOARD;
event->owner_change.time = _gdk_win32_get_next_tick (0);
event->owner_change.selection_time = GDK_CURRENT_TIME;
_gdk_win32_append_event (event);
CloseClipboard ();
if (_hwnd_next_viewer != NULL)
return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
/* clear error to avoid confusing SetClipboardViewer() return */
SetLastError (0);
return 0;
}
default:
/* Otherwise call DefWindowProcW(). */
GDK_NOTE (EVENTS, g_print (" DefWindowProcW"));
return DefWindowProc (hwnd, message, wparam, lparam);
}
}
static LRESULT CALLBACK
_clipboard_window_procedure (HWND hwnd,
UINT message,
WPARAM wparam,
LPARAM lparam)
{
LRESULT retval;
GDK_NOTE (EVENTS, g_print ("%s%*s%s %p",
(debug_indent > 0 ? "\n" : ""),
debug_indent, "",
_gdk_win32_message_to_string (message), hwnd));
debug_indent += 2;
retval = inner_clipboard_window_procedure (hwnd, message, wparam, lparam);
debug_indent -= 2;
GDK_NOTE (EVENTS, g_print (" => %I64d%s", (gint64) retval, (debug_indent == 0 ? "\n" : "")));
return retval;
}
/*
* Creates a hidden window and adds it to the clipboard chain
*/
static HWND
_gdk_win32_register_clipboard_notification (void)
{
WNDCLASS wclass = { 0, };
HWND hwnd;
ATOM klass;
wclass.lpszClassName = "GdkClipboardNotification";
wclass.lpfnWndProc = _clipboard_window_procedure;
wclass.hInstance = _gdk_app_hmodule;
klass = RegisterClass (&wclass);
if (!klass)
return NULL;
hwnd = CreateWindow (MAKEINTRESOURCE (klass),
NULL, WS_POPUP,
0, 0, 0, 0, NULL, NULL,
_gdk_app_hmodule, NULL);
if (!hwnd)
goto failed;
SetLastError (0);
_hwnd_next_viewer = SetClipboardViewer (hwnd);
if (_hwnd_next_viewer == NULL && GetLastError() != 0)
goto failed;
/* FIXME: http://msdn.microsoft.com/en-us/library/ms649033(v=VS.85).aspx */
/* This is only supported by Vista, and not yet by mingw64 */
/* if (AddClipboardFormatListener (hwnd) == FALSE) */
/* goto failed; */
return hwnd;
failed:
g_critical ("Failed to install clipboard viewer");
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
return NULL;
}
static gboolean
gdk_win32_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
GdkAtom selection)
{
return FALSE;
static HWND hwndViewer = NULL;
gboolean ret = FALSE;
GDK_NOTE (DND,
g_print ("gdk_display_request_selection_notification (..., %s)",
gdk_atom_name (selection)));
if (selection == GDK_SELECTION_CLIPBOARD ||
selection == GDK_SELECTION_PRIMARY)
{
if (!hwndViewer)
{
hwndViewer = _gdk_win32_register_clipboard_notification ();
GDK_NOTE (DND, g_print (" registered"));
}
ret = (hwndViewer != NULL);
}
else
{
GDK_NOTE (DND, g_print (" unsupported"));
ret = FALSE;
}
GDK_NOTE (DND, g_print (" -> %s\n", ret ? "TRUE" : "FALSE"));
return ret;
}
static gboolean
@@ -409,6 +589,15 @@ gdk_win32_display_flush (GdkDisplay * display)
GdiFlush ();
}
static void
gdk_win32_display_sync (GdkDisplay * display)
{
g_return_if_fail (display == _gdk_display);
GdiFlush ();
}
static void
gdk_win32_display_dispose (GObject *object)
{
@@ -480,7 +669,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->get_screen = gdk_win32_display_get_screen;
display_class->get_default_screen = gdk_win32_display_get_default_screen;
display_class->beep = gdk_win32_display_beep;
display_class->sync = _gdk_win32_display_sync;
display_class->sync = gdk_win32_display_sync;
display_class->flush = gdk_win32_display_flush;
display_class->has_pending = _gdk_win32_display_has_pending;
display_class->queue_events = _gdk_win32_display_queue_events;

View File

@@ -82,19 +82,6 @@ gdk_win32_display_manager_lookup_keyval (GdkDisplayManager *manager,
return _gdk_keyval_from_name (name);
}
static void
gdk_win32_display_manager_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper)
{
/* FIXME implement this */
if (lower)
*lower = symbol;
if (upper)
*upper = symbol;
}
static void
gdk_win32_display_manager_init (GdkWin32DisplayManager *manager)
{
@@ -131,5 +118,4 @@ gdk_win32_display_manager_class_init (GdkWin32DisplayManagerClass *class)
manager_class->get_atom_name = _gdk_win32_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_win32_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_win32_display_manager_get_keyval_name;
manager_class->keyval_convert_case = gdk_win32_display_manager_keyval_convert_case;
}

View File

@@ -88,8 +88,6 @@
#include <gdk/gdk.h>
#include <glib/gstdio.h>
typedef struct _GdkDragContextPrivateWin32 GdkDragContextPrivateWin32;
typedef enum {
GDK_DRAG_STATUS_DRAG,
GDK_DRAG_STATUS_MOTION_WAIT,
@@ -97,29 +95,18 @@ typedef enum {
GDK_DRAG_STATUS_DROP
} GdkDragStatus;
/* Structure that holds information about a drag in progress.
* this is used on both source and destination sides.
*/
struct _GdkDragContextPrivateWin32 {
gboolean being_finalized;
gint ref_count;
IUnknown *iface;
DWORD last_key_state;
POINT last_pt; /* Coordinates from last event */
guint drag_status : 4; /* Current status of drag */
guint drop_failed : 1; /* Whether the drop was unsuccessful */
};
#define PRIVATE_DATA(context) (GDK_WIN32_DRAG_CONTEXT (context)->windowing_data)
static GList *contexts;
static GdkDragContext *current_dest_drag = NULL;
struct _GdkWin32DragContext
{
GdkDragContext context;
GdkDragContextPrivateWin32 *windowing_data;
guint drag_status : 4; /* Current status of drag */
guint drop_failed : 1; /* Whether the drop was unsuccessful */
POINT ole2_dnd_last_pt; /* Coordinates from last event */
DWORD ole2_dnd_last_key_state; /* Key state from last event */
gboolean ole2_dnd_being_finalized;
gint ole2_dnd_ref_count;
IUnknown *ole2_dnd_iface;
};
struct _GdkWin32DragContextClass
@@ -127,49 +114,41 @@ struct _GdkWin32DragContextClass
GdkDragContextClass parent_class;
};
G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
static GList *contexts;
static GdkDragContext *current_dest_drag = NULL;
static gboolean use_ole2_dnd = FALSE;
G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
static void
gdk_win32_drag_context_init (GdkWin32DragContext *dragcontext)
gdk_win32_drag_context_init (GdkWin32DragContext *context)
{
GdkDragContextPrivateWin32 *private;
private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext,
GDK_TYPE_DRAG_CONTEXT,
GdkDragContextPrivateWin32);
dragcontext->windowing_data = private;
if (!use_ole2_dnd)
{
contexts = g_list_prepend (contexts, dragcontext);
contexts = g_list_prepend (contexts, context);
}
else
{
private->being_finalized = FALSE;
private->ref_count = 1;
private->iface = NULL;
context->ole2_dnd_being_finalized = FALSE;
context->ole2_dnd_ref_count = 1;
context->ole2_dnd_iface = NULL;
}
GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", dragcontext));
GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", context));
}
static void
gdk_win32_drag_context_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
GdkDragContext *context;
GdkWin32DragContext *context_win32;
GDK_NOTE (DND, g_print ("gdk_drag_context_finalize %p\n", object));
g_list_free (context->targets);
g_return_if_fail (GDK_IS_WIN32_DRAG_CONTEXT (object));
if (context->source_window)
g_object_unref (context->source_window);
if (context->dest_window)
g_object_unref (context->dest_window);
context = GDK_DRAG_CONTEXT (object);
context_win32 = GDK_WIN32_DRAG_CONTEXT (object);
if (!use_ole2_dnd)
{
@@ -180,12 +159,11 @@ gdk_win32_drag_context_finalize (GObject *object)
}
else
{
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (context);
if (private->iface)
if (context_win32->ole2_dnd_iface)
{
private->being_finalized = TRUE;
private->iface->lpVtbl->Release (private->iface);
private->iface = NULL;
context_win32->ole2_dnd_being_finalized = TRUE;
context_win32->ole2_dnd_iface->lpVtbl->Release (context_win32->ole2_dnd_iface);
context_win32->ole2_dnd_iface = NULL;
}
}
@@ -194,10 +172,16 @@ gdk_win32_drag_context_finalize (GObject *object)
/* Drag Contexts */
GdkDragContext *
static GdkDragContext *
gdk_drag_context_new (void)
{
return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
GdkWin32DragContext *context_win32;
GdkDragContext *context;
context_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT, NULL);
context = GDK_DRAG_CONTEXT(context_win32);
return context;
}
static GdkDragContext *
@@ -207,12 +191,10 @@ gdk_drag_context_find (gboolean is_source,
{
GList *tmp_list = contexts;
GdkDragContext *context;
GdkDragContextPrivateWin32 *private;
while (tmp_list)
{
context = (GdkDragContext *)tmp_list->data;
private = PRIVATE_DATA (context);
if ((!context->is_source == !is_source) &&
((source == NULL) || (context->source_window && (context->source_window == source))) &&
@@ -279,8 +261,9 @@ static ULONG STDMETHODCALLTYPE
idroptarget_addref (LPDROPTARGET This)
{
target_drag_context *ctx = (target_drag_context *) This;
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
int ref_count = ++private->ref_count;
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
int ref_count = ++context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idroptarget_addref %p %d\n", This, ref_count));
g_object_ref (G_OBJECT (ctx->context));
@@ -325,12 +308,13 @@ static ULONG STDMETHODCALLTYPE
idroptarget_release (LPDROPTARGET This)
{
target_drag_context *ctx = (target_drag_context *) This;
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
int ref_count = --private->ref_count;
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
int ref_count = --context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idroptarget_release %p %d\n", This, ref_count));
if (!private->being_finalized)
if (!context_win32->ole2_dnd_being_finalized)
g_object_unref (G_OBJECT (ctx->context));
if (ref_count == 0)
@@ -540,8 +524,9 @@ static ULONG STDMETHODCALLTYPE
idropsource_addref (LPDROPSOURCE This)
{
source_drag_context *ctx = (source_drag_context *) This;
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
int ref_count = ++private->ref_count;
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
int ref_count = ++context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idropsource_addref %p %d\n", This, ref_count));
g_object_ref (G_OBJECT (ctx->context));
@@ -586,12 +571,13 @@ static ULONG STDMETHODCALLTYPE
idropsource_release (LPDROPSOURCE This)
{
source_drag_context *ctx = (source_drag_context *) This;
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
int ref_count = --private->ref_count;
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
int ref_count = --context_win32->ole2_dnd_ref_count;
GDK_NOTE (DND, g_print ("idropsource_release %p %d\n", This, ref_count));
if (!private->being_finalized)
if (!context_win32->ole2_dnd_being_finalized)
g_object_unref (G_OBJECT (ctx->context));
if (ref_count == 0)
@@ -605,14 +591,14 @@ idropsource_release (LPDROPSOURCE This)
* have been emitted and false otherwise.
*/
static gboolean
send_change_events (GdkDragContext *ctx,
send_change_events (GdkDragContext *context,
DWORD key_state,
gboolean esc_pressed)
{
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx);
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
POINT pt;
gboolean changed = FALSE;
HWND hwnd = GDK_WINDOW_HWND (ctx->source_window);
HWND hwnd = GDK_WINDOW_HWND (context->source_window);
LPARAM lparam;
WPARAM wparam;
@@ -622,46 +608,46 @@ send_change_events (GdkDragContext *ctx,
if (!API_CALL (ScreenToClient, (hwnd, &pt)))
return FALSE;
if (pt.x != private->last_pt.x || pt.y != private->last_pt.y ||
key_state != private->last_key_state)
if (pt.x != context_win32->ole2_dnd_last_pt.x || pt.y != context_win32->ole2_dnd_last_pt.y ||
key_state != context_win32->ole2_dnd_last_key_state)
{
lparam = MAKELPARAM (pt.x, pt.y);
wparam = key_state;
if (pt.x != private->last_pt.x || pt.y != private->last_pt.y)
if (pt.x != context_win32->ole2_dnd_last_pt.x || pt.y != context_win32->ole2_dnd_last_pt.y)
{
GDK_NOTE (DND, g_print ("Sending WM_MOUSEMOVE (%ld,%ld)\n", pt.x, pt.y));
SendMessage (hwnd, WM_MOUSEMOVE, wparam, lparam);
}
if ((key_state & MK_LBUTTON) != (private->last_key_state & MK_LBUTTON))
if ((key_state & MK_LBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_LBUTTON))
{
if (key_state & MK_LBUTTON)
SendMessage (hwnd, WM_LBUTTONDOWN, wparam, lparam);
else
SendMessage (hwnd, WM_LBUTTONUP, wparam, lparam);
}
if ((key_state & MK_MBUTTON) != (private->last_key_state & MK_MBUTTON))
if ((key_state & MK_MBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_MBUTTON))
{
if (key_state & MK_MBUTTON)
SendMessage (hwnd, WM_MBUTTONDOWN, wparam, lparam);
else
SendMessage (hwnd, WM_MBUTTONUP, wparam, lparam);
}
if ((key_state & MK_RBUTTON) != (private->last_key_state & MK_RBUTTON))
if ((key_state & MK_RBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_RBUTTON))
{
if (key_state & MK_RBUTTON)
SendMessage (hwnd, WM_RBUTTONDOWN, wparam, lparam);
else
SendMessage (hwnd, WM_RBUTTONUP, wparam, lparam);
}
if ((key_state & MK_CONTROL) != (private->last_key_state & MK_CONTROL))
if ((key_state & MK_CONTROL) != (context_win32->ole2_dnd_last_key_state & MK_CONTROL))
{
if (key_state & MK_CONTROL)
SendMessage (hwnd, WM_KEYDOWN, VK_CONTROL, 0);
else
SendMessage (hwnd, WM_KEYUP, VK_CONTROL, 0);
}
if ((key_state & MK_SHIFT) != (private->last_key_state & MK_SHIFT))
if ((key_state & MK_SHIFT) != (context_win32->ole2_dnd_last_key_state & MK_SHIFT))
{
if (key_state & MK_CONTROL)
SendMessage (hwnd, WM_KEYDOWN, VK_SHIFT, 0);
@@ -670,8 +656,8 @@ send_change_events (GdkDragContext *ctx,
}
changed = TRUE;
private->last_key_state = key_state;
private->last_pt = pt;
context_win32->ole2_dnd_last_key_state = key_state;
context_win32->ole2_dnd_last_pt = pt;
}
if (esc_pressed)
@@ -1172,16 +1158,19 @@ static IEnumFORMATETCVtbl ief_vtbl = {
static target_drag_context *
target_context_new (GdkWindow *window)
{
GdkDragContext *context;
GdkWin32DragContext *context_win32;
target_drag_context *result;
GdkDragContextPrivateWin32 *private;
GdkDevice *device;
GdkDeviceManager *device_manager;
result = g_new0 (target_drag_context, 1);
context = gdk_drag_context_new ();
context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
result = g_new0 (target_drag_context, 1);
result->context = context;
result->idt.lpVtbl = &idt_vtbl;
result->context = gdk_drag_context_new ();
result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = FALSE;
@@ -1194,14 +1183,12 @@ target_context_new (GdkWindow *window)
result->context->dest_window = window;
g_object_ref (window);
/* FIXME: result->context->targets? */
/* FIXME: context->targets? */
result->context->actions = GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE;
result->context->suggested_action = GDK_ACTION_MOVE;
result->context->action = GDK_ACTION_MOVE;
private = PRIVATE_DATA(result->context);
private->iface = (IUnknown *) &result->idt;
context_win32->ole2_dnd_iface = (IUnknown *) &result->idt;
idroptarget_addref (&result->idt);
GDK_NOTE (DND, g_print ("target_context_new: %p\n", result));
@@ -1213,16 +1200,19 @@ static source_drag_context *
source_context_new (GdkWindow *window,
GList *targets)
{
GdkDragContext *context;
GdkWin32DragContext *context_win32;
source_drag_context *result;
GdkDragContextPrivateWin32 *private;
GdkDevice *device;
GdkDeviceManager *device_manager;
result = g_new0 (source_drag_context, 1);
context = gdk_drag_context_new ();
context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
result = g_new0 (source_drag_context, 1);
result->context = context;
result->ids.lpVtbl = &ids_vtbl;
result->context = gdk_drag_context_new ();
result->context->protocol = GDK_DRAG_PROTO_OLE2;
result->context->is_source = TRUE;
@@ -1236,8 +1226,7 @@ source_context_new (GdkWindow *window,
result->context->dest_window = NULL;
result->context->targets = g_list_copy (targets);
private = PRIVATE_DATA(result->context);
private->iface = (IUnknown *) &result->ids;
context_win32->ole2_dnd_iface = (IUnknown *) &result->ids;
idropsource_addref (&result->ids);
GDK_NOTE (DND, g_print ("source_context_new: %p\n", result));
@@ -1667,7 +1656,6 @@ local_send_enter (GdkDragContext *context,
guint32 time)
{
GdkEvent *tmp_event;
GdkDragContextPrivateWin32 *private;
GdkDragContext *new_context;
GdkDevice *device;
GdkDeviceManager *device_manager;
@@ -1676,8 +1664,6 @@ local_send_enter (GdkDragContext *context,
context,
current_dest_drag));
private = PRIVATE_DATA (context);
if (current_dest_drag != NULL)
{
g_object_unref (G_OBJECT (current_dest_drag));
@@ -1727,6 +1713,7 @@ local_send_motion (GdkDragContext *context,
guint32 time)
{
GdkEvent *tmp_event;
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
GDK_NOTE (DND, g_print ("local_send_motion: context=%p (%d,%d) current_dest_drag=%p\n",
context, x_root, y_root,
@@ -1736,6 +1723,8 @@ local_send_motion (GdkDragContext *context,
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
(current_dest_drag->source_window == context->source_window))
{
GdkWin32DragContext *current_dest_drag_win32;
tmp_event = gdk_event_new (GDK_DRAG_MOTION);
tmp_event->dnd.window = g_object_ref (current_dest_drag->dest_window);
tmp_event->dnd.send_event = FALSE;
@@ -1748,10 +1737,11 @@ local_send_motion (GdkDragContext *context,
tmp_event->dnd.x_root = x_root;
tmp_event->dnd.y_root = y_root;
PRIVATE_DATA (current_dest_drag)->last_pt.x = x_root - _gdk_offset_x;
PRIVATE_DATA (current_dest_drag)->last_pt.y = y_root - _gdk_offset_y;
current_dest_drag_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
current_dest_drag_win32->ole2_dnd_last_pt.x = x_root - _gdk_offset_x;
current_dest_drag_win32->ole2_dnd_last_pt.y = y_root - _gdk_offset_y;
PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
context_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
gdk_event_put (tmp_event);
@@ -1773,8 +1763,7 @@ local_send_drop (GdkDragContext *context,
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
(current_dest_drag->source_window == context->source_window))
{
GdkDragContextPrivateWin32 *private;
private = PRIVATE_DATA (current_dest_drag);
GdkWin32DragContext *context_win32;
/* Pass ownership of context to the event */
tmp_event = gdk_event_new (GDK_DROP_START);
@@ -1784,8 +1773,9 @@ local_send_drop (GdkDragContext *context,
tmp_event->dnd.time = GDK_CURRENT_TIME;
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (current_dest_drag));
tmp_event->dnd.x_root = private->last_pt.x + _gdk_offset_x;
tmp_event->dnd.y_root = private->last_pt.y + _gdk_offset_y;
context_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
tmp_event->dnd.x_root = context_win32->ole2_dnd_last_pt.x + _gdk_offset_x;
tmp_event->dnd.y_root = context_win32->ole2_dnd_last_pt.y + _gdk_offset_y;
current_dest_drag = NULL;
@@ -1870,11 +1860,12 @@ _gdk_win32_dnd_do_dragdrop (void)
if (use_ole2_dnd)
{
GdkDragContext* drag_ctx;
GdkDragContextPrivateWin32 *private;
GdkWin32DragContext *drag_ctx_win32;
BYTE kbd_state[256];
data_object *dobj;
HRESULT hr;
DWORD dwEffect;
#if 0
HGLOBAL global;
STGMEDIUM medium;
@@ -1884,25 +1875,25 @@ _gdk_win32_dnd_do_dragdrop (void)
return;
drag_ctx = pending_src_context->context;
private = PRIVATE_DATA (drag_ctx);
drag_ctx_win32 = GDK_WIN32_DRAG_CONTEXT (drag_ctx);
dobj = data_object_new (drag_ctx);
API_CALL (GetCursorPos, (&private->last_pt));
API_CALL (ScreenToClient, (GDK_WINDOW_HWND (drag_ctx->source_window), &private->last_pt));
private->last_key_state = 0;
API_CALL (GetCursorPos, (&drag_ctx_win32->ole2_dnd_last_pt));
API_CALL (ScreenToClient, (GDK_WINDOW_HWND (drag_ctx->source_window), &drag_ctx_win32->ole2_dnd_last_pt));
drag_ctx_win32->ole2_dnd_last_key_state = 0;
API_CALL (GetKeyboardState, (kbd_state));
if (kbd_state[VK_CONTROL])
private->last_key_state |= MK_CONTROL;
drag_ctx_win32->ole2_dnd_last_key_state |= MK_CONTROL;
if (kbd_state[VK_SHIFT])
private->last_key_state |= MK_SHIFT;
drag_ctx_win32->ole2_dnd_last_key_state |= MK_SHIFT;
if (kbd_state[VK_LBUTTON])
private->last_key_state |= MK_LBUTTON;
drag_ctx_win32->ole2_dnd_last_key_state |= MK_LBUTTON;
if (kbd_state[VK_MBUTTON])
private->last_key_state |= MK_MBUTTON;
drag_ctx_win32->ole2_dnd_last_key_state |= MK_MBUTTON;
if (kbd_state[VK_RBUTTON])
private->last_key_state |= MK_RBUTTON;
drag_ctx_win32->ole2_dnd_last_key_state |= MK_RBUTTON;
#if 0
global = GlobalAlloc (GMEM_FIXED, sizeof (ctx));
@@ -2000,46 +1991,87 @@ _gdk_win32_window_get_drag_protocol (GdkWindow *window,
return protocol;
}
typedef struct {
gint x;
gint y;
HWND ignore;
HWND result;
} find_window_enum_arg;
static BOOL CALLBACK
find_window_enum_proc (HWND hwnd,
LPARAM lparam)
{
RECT rect;
POINT tl, br;
find_window_enum_arg *a = (find_window_enum_arg *) lparam;
if (hwnd == a->ignore)
return TRUE;
if (!IsWindowVisible (hwnd))
return TRUE;
tl.x = tl.y = 0;
ClientToScreen (hwnd, &tl);
GetClientRect (hwnd, &rect);
br.x = rect.right;
br.y = rect.bottom;
ClientToScreen (hwnd, &br);
if (a->x >= tl.x && a->y >= tl.y && a->x < br.x && a->y < br.y)
{
a->result = hwnd;
return FALSE;
}
else
return TRUE;
}
static GdkWindow *
gdk_win32_drag_context_find_window (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
GdkDragProtocol *protocol)
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
GdkDragProtocol *protocol)
{
GdkWindow *dest_window;
POINT pt;
HWND hwnd;
GdkWindow *dest_window, *dw;
find_window_enum_arg a;
pt.x = x_root - _gdk_offset_x;
pt.y = y_root - _gdk_offset_y;
a.x = x_root - _gdk_offset_x;
a.y = y_root - _gdk_offset_y;
a.ignore = drag_window ? GDK_WINDOW_HWND (drag_window) : NULL;
a.result = NULL;
hwnd = WindowFromPoint (pt);
EnumWindows (find_window_enum_proc, (LPARAM) &a);
if (hwnd == NULL)
if (a.result == NULL)
dest_window = NULL;
else
{
dest_window = gdk_win32_handle_table_lookup (hwnd);
if (dest_window)
g_object_ref (dest_window);
dw = gdk_win32_handle_table_lookup (a.result);
if (dw)
{
dest_window = gdk_window_get_toplevel (dw);
g_object_ref (dest_window);
}
else
dest_window = gdk_win32_window_foreign_new_for_display (_gdk_display, hwnd);
dest_window = gdk_win32_window_foreign_new_for_display (_gdk_display, a.result);
if (use_ole2_dnd)
*protocol = GDK_DRAG_PROTO_OLE2;
*protocol = GDK_DRAG_PROTO_OLE2;
else if (context->source_window)
*protocol = GDK_DRAG_PROTO_LOCAL;
else
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
}
GDK_NOTE (DND,
g_print ("gdk_drag_find_window: %p %+d%+d: %p: %p %s\n",
(drag_window ? GDK_WINDOW_HWND (drag_window) : NULL),
x_root, y_root,
hwnd,
a.result,
(dest_window ? GDK_WINDOW_HWND (dest_window) : NULL),
_gdk_win32_drag_protocol_to_string (*protocol)));
@@ -2056,7 +2088,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
GdkDragAction possible_actions,
guint32 time)
{
GdkDragContextPrivateWin32 *private;
GdkWin32DragContext *context_win32;
g_return_val_if_fail (context != NULL, FALSE);
@@ -2072,7 +2104,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
_gdk_win32_drag_action_to_string (context->suggested_action),
_gdk_win32_drag_action_to_string (context->action)));
private = PRIVATE_DATA (context);
context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
if (!use_ole2_dnd)
{
@@ -2095,7 +2127,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
/* Send a leave to the last destination */
gdk_drag_do_leave (context, time);
private->drag_status = GDK_DRAG_STATUS_DRAG;
context_win32->drag_status = GDK_DRAG_STATUS_DRAG;
/* Check if new destination accepts drags, and which protocol */
if (dest_window)
@@ -2124,7 +2156,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
/* Push a status event, to let the client know that
* the drag changed
*/
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
tmp_event->dnd.window = g_object_ref (context->source_window);
/* We use this to signal a synthetic status. Perhaps
* we should use an extra field...
@@ -2133,21 +2165,21 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
tmp_event->dnd.context = g_object_ref (context);
tmp_event->dnd.time = time;
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
gdk_event_put (tmp_event);
gdk_event_free (tmp_event);
gdk_event_free (tmp_event);
}
/* Send a drag-motion event */
private->last_pt.x = x_root - _gdk_offset_x;
private->last_pt.y = y_root - _gdk_offset_y;
context_win32->ole2_dnd_last_pt.x = x_root - _gdk_offset_x;
context_win32->ole2_dnd_last_pt.y = y_root - _gdk_offset_y;
if (context->dest_window)
{
if (private->drag_status == GDK_DRAG_STATUS_DRAG)
if (context_win32->drag_status == GDK_DRAG_STATUS_DRAG)
{
switch (context->protocol)
{
@@ -2224,14 +2256,11 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time)
{
GdkDragContextPrivateWin32 *private;
GdkDragContext *src_context;
GdkEvent *tmp_event;
g_return_if_fail (context != NULL);
private = PRIVATE_DATA (context);
GDK_NOTE (DND, g_print ("gdk_drag_status: %s\n"
" context=%p:{actions=%s,suggested=%s,action=%s}\n",
_gdk_win32_drag_action_to_string (action),
@@ -2250,17 +2279,17 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
if (src_context)
{
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (src_context);
GdkWin32DragContext *src_context_win32 = GDK_WIN32_DRAG_CONTEXT (src_context);
if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
private->drag_status = GDK_DRAG_STATUS_DRAG;
if (src_context_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
src_context_win32->drag_status = GDK_DRAG_STATUS_DRAG;
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
tmp_event->dnd.window = g_object_ref (context->source_window);
tmp_event->dnd.send_event = FALSE;
tmp_event->dnd.context = g_object_ref (src_context);
tmp_event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
if (action == GDK_ACTION_DEFAULT)
action = 0;
@@ -2269,7 +2298,7 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
gdk_event_put (tmp_event);
gdk_event_free (tmp_event);
gdk_event_free (tmp_event);
}
}
}
@@ -2296,7 +2325,6 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time)
{
GdkDragContextPrivateWin32 *private;
GdkDragContext *src_context;
GdkEvent *tmp_event;
@@ -2304,8 +2332,6 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
GDK_NOTE (DND, g_print ("gdk_drop_finish\n"));
private = PRIVATE_DATA (context);
if (!use_ole2_dnd)
{
src_context = gdk_drag_context_find (TRUE,
@@ -2368,6 +2394,9 @@ _gdk_win32_window_register_dnd (GdkWindow *window)
g_return_if_fail (window != NULL);
if (gdk_window_get_window_type (window) == GDK_WINDOW_OFFSCREEN)
return;
if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL)
return;
else
@@ -2423,7 +2452,9 @@ _gdk_win32_window_register_dnd (GdkWindow *window)
static gboolean
gdk_win32_drag_context_drop_status (GdkDragContext *context)
{
return ! PRIVATE_DATA (context)->drop_failed;
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
return ! context_win32->drop_failed;
}
static GdkAtom
@@ -2448,8 +2479,6 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
gdk_win32_drag_context_parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_win32_drag_context_finalize;
context_class->find_window = gdk_win32_drag_context_find_window;
@@ -2461,6 +2490,4 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
context_class->drop_finish = gdk_win32_drag_context_drop_finish;
context_class->drop_status = gdk_win32_drag_context_drop_status;
context_class->get_selection = gdk_win32_drag_context_get_selection;
g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
}

File diff suppressed because it is too large Load Diff

View File

@@ -59,17 +59,12 @@ _gdk_window_move_resize_child (GdkWindow *window,
gint height)
{
GdkWindowImplWin32 *impl;
gboolean is_move;
gboolean is_resize;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
is_move = (x - window->x != 0) && (y - window->y != 0);
is_resize = window->width != width && window->height != height;
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s@%+d%+d %dx%d@%+d%+d\n",
_gdk_win32_window_description (window),
window->x, window->y, width, height, x, y));
@@ -93,19 +88,15 @@ _gdk_window_move_resize_child (GdkWindow *window,
_gdk_win32_window_tmp_unset_bg (window, TRUE);
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
"NOACTIVATE|NOZORDER%s%s)\n",
"NOACTIVATE|NOZORDER)\n",
GDK_WINDOW_HWND (window),
window->x + window->parent->abs_x, window->y + window->parent->abs_y,
width, height,
(is_move ? "" : "|NOMOVE"),
(is_resize ? "" : "|NOSIZE")));
width, height));
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
window->x + window->parent->abs_x, window->y + window->parent->abs_y,
width, height,
SWP_NOACTIVATE | SWP_NOZORDER |
(is_move ? 0 : SWP_NOMOVE) |
(is_resize ? 0 : SWP_NOSIZE)));
SWP_NOACTIVATE | SWP_NOZORDER));
_gdk_win32_window_tmp_reset_bg (window, TRUE);
}

View File

@@ -79,6 +79,7 @@ gint _gdk_input_ignore_wintab = FALSE;
gint _gdk_max_colors = 0;
gboolean _modal_operation_in_progress = FALSE;
HWND _modal_move_resize_window = NULL;
gboolean _ignore_destroy_clipboard = FALSE;
HGLOBAL _delayed_rendering_data = NULL;

View File

@@ -121,4 +121,7 @@ _gdk_input_init (GdkDisplay *display)
_gdk_input_devices = g_list_append (NULL, display->core_pointer);
_gdk_input_devices = g_list_concat (_gdk_input_devices,
g_list_copy (device_manager->wintab_devices));
_gdk_input_wintab_init_check (device_manager);
}

View File

@@ -187,7 +187,7 @@ void _gdk_dropfiles_store (gchar *data);
void _gdk_push_modal_window (GdkWindow *window);
void _gdk_remove_modal_window (GdkWindow *window);
GdkWindow *_gdk_modal_current (void);
gboolean _gdk_modal_blocked (GdkWindow *window);
#ifdef G_ENABLE_DEBUG
gchar *_gdk_win32_color_to_string (const GdkColor *color);
@@ -343,6 +343,8 @@ extern gint _gdk_max_colors;
/* TRUE while a modal sizing, moving, or dnd operation is in progress */
extern gboolean _modal_operation_in_progress;
extern HWND _modal_move_resize_window;
/* TRUE when we are emptying the clipboard ourselves */
extern gboolean _ignore_destroy_clipboard;
@@ -354,6 +356,8 @@ extern GHashTable *_format_atom_table;
/* Hold the result of a delayed rendering */
extern HGLOBAL _delayed_rendering_data;
extern HCURSOR _gdk_win32_grab_cursor;
HGLOBAL _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
GdkAtom target);
@@ -386,7 +390,6 @@ gboolean _gdk_win32_display_supports_cursor_color (GdkDisplay *display);
GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
void _gdk_win32_display_sync (GdkDisplay * display);
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
void _gdk_win32_display_queue_events (GdkDisplay *display);
@@ -403,7 +406,7 @@ gboolean _gdk_win32_display_set_selection_owner (GdkDisplay *display,
guint32 time,
gboolean send_event);
void _gdk_win32_display_send_selection_notify (GdkDisplay *display,
HWND requestor,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
@@ -493,6 +496,8 @@ GdkAtom _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
gint only_if_exists);
gchar *_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom);
void _gdk_win32_append_event (GdkEvent *event);
void _gdk_win32_emit_configure_event (GdkWindow *window);
/* Initialization */
void _gdk_win32_windowing_init (void);
@@ -503,5 +508,6 @@ void _gdk_visual_init (void);
void _gdk_dnd_init (void);
void _gdk_events_init (void);
void _gdk_input_init (GdkDisplay *display);
void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager);
#endif /* __GDK_PRIVATE_WIN32_H__ */

View File

@@ -222,6 +222,7 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
screen_class->get_monitor_height_mm = gdk_win32_screen_get_monitor_height_mm;
screen_class->get_monitor_plug_name = gdk_win32_screen_get_monitor_plug_name;
screen_class->get_monitor_geometry = gdk_win32_screen_get_monitor_geometry;
screen_class->get_monitor_workarea = gdk_win32_screen_get_monitor_geometry;
screen_class->get_system_visual = _gdk_win32_screen_get_system_visual;
screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual;
screen_class->is_composited = gdk_win32_screen_is_composited;
@@ -238,4 +239,4 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
screen_class->query_depths = _gdk_win32_screen_query_depths;
screen_class->query_visual_types = _gdk_win32_screen_query_visual_types;
screen_class->list_visuals = _gdk_win32_screen_list_visuals;
}
}

View File

@@ -587,14 +587,14 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
* it.
*
* If the data is from Mozilla Firefox or IE7, and
* starts with an "oldfashioned" BITMAPINFOHEADER,
* starts with an "old fashioned" BITMAPINFOHEADER,
* i.e. with biSize==40, and biCompression == BI_RGB and
* biBitCount==32, we assume that the "extra" byte in
* each pixel in fact is alpha.
*
* The gdk-pixbuf bmp loader doesn't trust 32-bit BI_RGB
* nitmaps to in fact have alpha, so we have to convince
* it by changint the bitmap header to a version 5
* bitmaps to in fact have alpha, so we have to convince
* it by changing the bitmap header to a version 5
* BI_BITFIELDS one with explicit alpha mask indicated.
*
* The RGB bytes that are in bitmaps on the clipboard
@@ -721,6 +721,17 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
bi->biSize +
bi->biClrUsed * sizeof (RGBQUAD));
if (bi->biCompression == BI_BITFIELDS && bi->biBitCount >= 16)
{
/* Screenshots taken with PrintScreen or
* Alt + PrintScreen are found on the clipboard in
* this format. In this case the BITMAPINFOHEADER is
* followed by three DWORD specifying the masks of the
* red green and blue components, so adjust the offset
* accordingly. */
bf->bfOffBits += (3 * sizeof (DWORD));
}
memcpy ((char *) data + sizeof (BITMAPFILEHEADER),
bi,
data_length);
@@ -874,7 +885,7 @@ _gdk_selection_property_delete (GdkWindow *window)
void
_gdk_win32_display_send_selection_notify (GdkDisplay *display,
HWND requestor,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,

View File

@@ -80,6 +80,7 @@ G_BEGIN_DECLS
/* Return true if the GdkWindow is a win32 implemented window */
gboolean gdk_win32_window_is_win32 (GdkWindow *window);
HWND gdk_win32_window_get_impl_hwnd (GdkWindow *window);
/* Return the Gdk* for a particular HANDLE */
gpointer gdk_win32_handle_table_lookup (HWND handle);

Some files were not shown because too many files have changed in this diff Show More