Compare commits
129 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b2be2f6f1 | |||
| b51662cafa | |||
| a328313885 | |||
| 8528385c80 | |||
| c7eba11400 | |||
| 2cb50c9af2 | |||
| bc5e401de4 | |||
| fb99b5eeb4 | |||
| d6e23b0924 | |||
| 42c0d95791 | |||
| 6d7ac9e87e | |||
| 607a1e8fc5 | |||
| 02eeed70bd | |||
| 849661a573 | |||
| ca84ac7a6a | |||
| 8d421b2af2 | |||
| b2776581da | |||
| f7eb9edb9b | |||
| fe87311f51 | |||
| c38159d4d7 | |||
| 075911ccfd | |||
| 20a5364a5f | |||
| 4a3037574d | |||
| fee9840d52 | |||
| 10bd4f8a72 | |||
| 1d986aa8a4 | |||
| 33790437ce | |||
| 239f52d543 | |||
| f2d71d3da5 | |||
| 61e625d9a6 | |||
| 9e3330c90b | |||
| 108c831e23 | |||
| 77f071b5ff | |||
| fb35e29a19 | |||
| b1f4497697 | |||
| 29569e6049 | |||
| c201145d02 | |||
| eb214aae74 | |||
| fbef4384aa | |||
| 88909ac9b2 | |||
| 84d9872a26 | |||
| 576ba1a03d | |||
| bb448f619c | |||
| 9827003e06 | |||
| 14100b867c | |||
| 5926e3cfec | |||
| e09d7b5456 | |||
| c9b8f866df | |||
| eea525ac89 | |||
| 76e7a9e5b7 | |||
| 5a523e500b | |||
| 33ea7850c9 | |||
| 9856a2faeb | |||
| a19c4b207c | |||
| 264739e6ad | |||
| 10b4eaa10b | |||
| be21cc53bc | |||
| cda35f142f | |||
| 5c98ea081e | |||
| 78866ca13d | |||
| d4382300b4 | |||
| 7ef01e70f7 | |||
| 10316b6ab2 | |||
| e11d9904bc | |||
| f1d33f76c7 | |||
| fe72a8192d | |||
| bf543ac8f4 | |||
| 93f7a97f01 | |||
| cc188dffa9 | |||
| 33e3b9ddbb | |||
| 8c4b0b66b8 | |||
| 2781c9544b | |||
| 4765dde5cf | |||
| 658b0e8092 | |||
| 0e5d05f8e0 | |||
| f1570c5c92 | |||
| e042c53caa | |||
| a7b6859561 | |||
| 14235c9c17 | |||
| 6a6bed8e04 | |||
| 7a07995944 | |||
| 62afe5cda6 | |||
| 95f6b7fa82 | |||
| ae2438df90 | |||
| fafb78e38e | |||
| 4068758bb8 | |||
| bb87595220 | |||
| 001a1517da | |||
| 76b285f475 | |||
| 0b796299c1 | |||
| 5d2af3e13d | |||
| 15d2f1697d | |||
| 460a54ce15 | |||
| 3ab0ccf643 | |||
| cebd79e7eb | |||
| 4e321365cf | |||
| 1b088606f7 | |||
| 7bf410f927 | |||
| 5476f09d35 | |||
| a49c9a27fb | |||
| e5a3cf5a36 | |||
| 59a0f62079 | |||
| fbbd6b2c2e | |||
| d77977aa62 | |||
| da35350ee3 | |||
| 40996af9c1 | |||
| 7e29b38bd4 | |||
| c1b86a5eab | |||
| 68587c203c | |||
| 80e08d1b1b | |||
| 0a05318277 | |||
| 5c187245a4 | |||
| 739059cc91 | |||
| 86e966b944 | |||
| ef08d3975c | |||
| c50007b33a | |||
| 9f20e16683 | |||
| 4f2ce2f7b6 | |||
| a404a56254 | |||
| 7a59b443ee | |||
| 127bfd71d7 | |||
| 35341511b9 | |||
| 65888ac515 | |||
| 313f51d1f8 | |||
| 5ddf0f4e5f | |||
| 5e726db14e | |||
| 705dde471f | |||
| d83640dc34 | |||
| ed20c3255b |
@@ -1,49 +1,3 @@
|
||||
Overview of Changes in GTK+ 3.3.16
|
||||
==================================
|
||||
|
||||
* The widget-factory theme test is now installed
|
||||
as a demo named gtk3-widget-factory
|
||||
|
||||
* The Raleigh theme is now a pure fallback theme
|
||||
that doesn't share any CSS with other themes
|
||||
anymore
|
||||
|
||||
* GtkColorSelectionDialog has been deprecated in
|
||||
favor of a new color chooser widget named
|
||||
GtkColorChooserDialog
|
||||
|
||||
* The GtkApplication session support has been simplified
|
||||
|
||||
* Bug fixes:
|
||||
612283 Clarification for GtkListStore::gtk_list_store_insert_with_values
|
||||
668114 odd spacing in about dialog credits
|
||||
669116 GtkNotebook's child-notify::position not always emitted...
|
||||
669208 x11: Cancel _NET_WM_MOVERESIZE if we get a matching ButtonRelease
|
||||
669511 gtkcsstypes.c: variable is declared at middle of block
|
||||
669636 gtkactiongroup: clarify set_translation_domain docs
|
||||
669638 gtkbuilder-menus: translation-domain can be NULL
|
||||
669794 Orca + Trees/Tables == incorrect cells presented, crashes...
|
||||
669947 gtkuimanager: clarify @pos of insert_action_group
|
||||
670077 license text has poor alignment with close button
|
||||
670078 no stroke around credits scrollable area
|
||||
670400 First shortcut capture is broken
|
||||
|
||||
* Translation updates:
|
||||
Belarusian
|
||||
Bulgarian
|
||||
Danish
|
||||
Estonian
|
||||
Galician
|
||||
Hebrew
|
||||
Italian
|
||||
Japanese
|
||||
Kazakh
|
||||
Lithuanian
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
Traditional Chinese
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.14
|
||||
==================================
|
||||
|
||||
|
||||
+40
-67
@@ -139,8 +139,6 @@ copy ..\..\..\gtk\gtkaction.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkactiongroup.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkactionable.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkactivatable.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkadjustment.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -157,8 +155,6 @@ copy ..\..\..\gtk\gtkappchooserwidget.h $(CopyDir)\include\gtk-$(GtkApiVersion)\
|
||||
|
||||
copy ..\..\..\gtk\gtkapplication.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkapplicationwindow.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkarrow.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkaspectframe.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -221,13 +217,9 @@ copy ..\..\..\gtk\gtkclipboard.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcolorbutton.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcolorchooser.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtkcolorsel.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcolorchooserwidget.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcolorchooserdialog.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcolorutils.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtkcolorseldialog.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcombobox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
@@ -237,8 +229,6 @@ copy ..\..\..\gtk\gtkcontainer.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcssprovider.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkcsssection.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkdebug.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkdialog.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -275,11 +265,7 @@ copy ..\..\..\gtk\gtkfixed.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkfontbutton.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkfontchooser.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkfontchooserdialog.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkfontchooserwidget.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtkfontsel.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkframe.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
@@ -287,6 +273,22 @@ copy ..\..\..\gtk\gtkgradient.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkgrid.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhandlebox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhbbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhpaned.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhscale.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhscrollbar.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhseparator.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkhsv.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkiconfactory.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkicontheme.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -299,8 +301,6 @@ copy ..\..\..\gtk\gtkimagemenuitem.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkimcontext.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkimcontextinfo.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkimcontextsimple.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkimmodule.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -369,8 +369,6 @@ copy ..\..\..\gtk\gtkprintsettings.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkprivate.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkprivatetypebuiltins.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkprogressbar.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkradioaction.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -383,6 +381,8 @@ copy ..\..\..\gtk\gtkradiotoolbutton.h $(CopyDir)\include\gtk-$(GtkApiVersion)\g
|
||||
|
||||
copy ..\..\..\gtk\gtkrange.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkrc.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkrecentaction.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkrecentchooser.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -435,6 +435,8 @@ copy ..\..\..\gtk\gtkstatusicon.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkstock.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkstyle.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkstylecontext.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkstyleproperties.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -445,6 +447,10 @@ copy ..\..\..\gtk\gtkswitch.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtksymboliccolor.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtktable.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtktearoffmenuitem.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtktestutils.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtktextattributes.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -513,12 +519,24 @@ copy ..\..\..\gtk\gtktypebuiltins.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkuimanager.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvbbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkversion.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkviewport.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvolumebutton.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvpaned.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvscale.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvscrollbar.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkvseparator.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkwidget.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
copy ..\..\..\gtk\gtkwidgetpath.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
@@ -526,51 +544,6 @@ copy ..\..\..\gtk\gtkwidgetpath.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtkwindow.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
|
||||
|
||||
mkdir $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkcolorsel.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkcolorseldialog.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkfontsel.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhandlebox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhbbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhpaned.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhscale.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhsv.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhscrollbar.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkhseparator.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkrc.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkstyle.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtktable.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtktearoffmenuitem.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkvbbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkvbox.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkvscale.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkvscrollbar.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkvseparator.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkvpaned.h $(CopyDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated
|
||||
|
||||
|
||||
mkdir $(CopyDir)\include\gail-$(GtkApiVersion)\libgail-util
|
||||
|
||||
copy ..\..\..\libgail-util\gail-util.h $(CopyDir)\include\gail-$(GtkApiVersion)\libgail-util
|
||||
@@ -592,7 +565,7 @@ mkdir $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
|
||||
copy ..\..\..\gtk\org.gtk.WindowState.gschema.xml $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
echo "Compiling gsettings XML Files..."
|
||||
|
||||
|
||||
@@ -164,7 +164,6 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\application.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\appwindow.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\assistant.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\builder.c" />
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\application.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\appwindow.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -124,7 +124,6 @@ copy ..\..\..\gtk\gtkaccelmap.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtkaccessible.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkaction.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkactiongroup.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkactionable.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkactivatable.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkadjustment.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkalignment.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
@@ -133,7 +132,6 @@ copy ..\..\..\gtk\gtkappchooserbutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\g
|
||||
copy ..\..\..\gtk\gtkappchooserdialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkappchooserwidget.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkapplication.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkapplicationwindow.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkarrow.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkaspectframe.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkassistant.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
@@ -165,15 +163,12 @@ copy ..\..\..\gtk\gtkcheckbutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk&#x
|
||||
copy ..\..\..\gtk\gtkcheckmenuitem.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkclipboard.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorbutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorchooser.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorchooserwidget.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorchooserdialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorutils.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorsel.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcolorseldialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcombobox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcomboboxtext.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcontainer.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcssprovider.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkcsssection.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkdebug.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkdialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkdnd.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
@@ -192,19 +187,24 @@ copy ..\..\..\gtk\gtkfilechooserwidget.h $(OutDir)\include\gtk-$(GtkApiVersion)\
|
||||
copy ..\..\..\gtk\gtkfilefilter.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkfixed.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkfontbutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkfontchooser.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkfontchooserdialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkfontchooserwidget.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkfontsel.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkframe.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkgradient.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkgrid.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhandlebox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhbbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhpaned.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhscale.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhscrollbar.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhseparator.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkhsv.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkiconfactory.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkicontheme.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkiconview.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimage.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimagemenuitem.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimcontext.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimcontextinfo.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimcontextsimple.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimmodule.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkimmulticontext.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
@@ -239,13 +239,13 @@ copy ..\..\..\gtk\gtkprintoperation.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtkprintoperationpreview.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkprintsettings.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkprivate.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkprivatetypebuiltins.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkprogressbar.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkradioaction.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkradiobutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkradiomenuitem.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkradiotoolbutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkrange.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkrc.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkrecentaction.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkrecentchooser.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkrecentchooserdialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
@@ -272,11 +272,14 @@ copy ..\..\..\gtk\gtkspinner.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk
&
|
||||
copy ..\..\..\gtk\gtkstatusbar.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkstatusicon.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkstock.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkstyle.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkstylecontext.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkstyleproperties.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkstyleprovider.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkswitch.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtksymboliccolor.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtktable.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtktearoffmenuitem.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtktestutils.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtktextattributes.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtktextbuffer.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
@@ -311,37 +314,19 @@ copy ..\..\..\gtk\gtktreeview.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk
|
||||
copy ..\..\..\gtk\gtktreeviewcolumn.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtktypebuiltins.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkuimanager.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvbbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkversion.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkviewport.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvolumebutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk
;
|
||||
copy ..\..\..\gtk\gtkvolumebutton.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvpaned.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvscale.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvscrollbar.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkvseparator.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkwidget.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkwidgetpath.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
copy ..\..\..\gtk\gtkwindow.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk

|
||||
|
||||
mkdir $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
|
||||
copy ..\..\..\gtk\deprecated\gtkcolorsel.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkcolorseldialog.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkfontsel.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhandlebox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhbbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhpaned.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhscale.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhsv.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhscrollbar.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkhseparator.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkrc.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkstyle.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtktable.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtktearoffmenuitem.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkvbbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkvbox.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkvscale.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkvscrollbar.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkvseparator.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
copy ..\..\..\gtk\deprecated\gtkvpaned.h $(OutDir)\include\gtk-$(GtkApiVersion)\gtk\deprecated

|
||||
|
||||
mkdir $(OutDir)\include\gail-$(GtkApiVersion)\libgail-util

|
||||
copy ..\..\..\libgail-util\gail-util.h $(OutDir)\include\gail-$(GtkApiVersion)\libgail-util

|
||||
copy ..\..\..\libgail-util\gailmisc.h $(OutDir)\include\gail-$(GtkApiVersion)\libgail-util

|
||||
@@ -354,7 +339,7 @@ copy $(ConfigurationName)\$(PlatformName)\bin\gailutil.lib $(OutDir)\lib
&#
|
||||
|
||||
mkdir $(OutDir)\share\glib-2.0\schemas

|
||||
copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(OutDir)\share\glib-2.0\schemas

|
||||
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(OutDir)\share\glib-2.0\schemas

|
||||
copy ..\..\..\gtk\org.gtk.WindowState.gschema.xml $(OutDir)\share\glib-2.0\schemas

|
||||
echo "Compiling gsettings XML Files..."

|
||||
$(OutDir)\bin\glib-compile-schemas.exe $(OutDir)\share\glib-2.0\schemas

|
||||
"
|
||||
|
||||
@@ -160,7 +160,6 @@
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\application.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\appwindow.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\assistant.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\builder.c" />
|
||||
|
||||
+40
-24
@@ -5,8 +5,8 @@
|
||||
/* always defined to indicate that i18n is enabled */
|
||||
#define ENABLE_NLS 1
|
||||
|
||||
/* define to enable packagekit */
|
||||
/* #undef ENABLE_PACKAGEKIT */
|
||||
/* Define if gio can sniff image data */
|
||||
/* #undef GDK_PIXBUF_USE_GIO_MIME */
|
||||
|
||||
/* The prefix for our gettext translation domains. */
|
||||
#define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
|
||||
@@ -20,8 +20,8 @@
|
||||
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
|
||||
#define HAVE_BIND_TEXTDOMAIN_CODESET 1
|
||||
|
||||
/* define if we have colord */
|
||||
/* #undef HAVE_COLORD */
|
||||
/* Is the wctype implementation broken */
|
||||
/* #undef HAVE_BROKEN_WCTYPE */
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
/* #undef HAVE_CRT_EXTERNS_H */
|
||||
@@ -73,8 +73,8 @@
|
||||
/* #undef HAVE_INTTYPES_H */
|
||||
#endif
|
||||
|
||||
/* Define to 1 if the system has the type `IPrintDialogCallback'. */
|
||||
#define HAVE_IPRINTDIALOGCALLBACK 1
|
||||
/* Define to 1 if ipc.h is available */
|
||||
/* #undef HAVE_IPC_H */
|
||||
|
||||
/* Define if your <locale.h> file defines LC_MESSAGES. */
|
||||
/* #undef HAVE_LC_MESSAGES */
|
||||
@@ -100,14 +100,12 @@
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
/* #undef HAVE_MMAP */
|
||||
|
||||
/* Define to 1 if nearbyint() is available */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_NEARBYINT 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if libpapi available */
|
||||
/* #undef HAVE_PAPI */
|
||||
|
||||
/* Define to 1 is libjpeg supports progressive JPEG */
|
||||
/* #undef HAVE_PROGRESSIVE_JPEG */
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
/* #undef HAVE_PWD_H */
|
||||
|
||||
@@ -151,8 +149,8 @@
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
/* #undef HAVE_SYS_PARAM_H */
|
||||
/* Define to 1 if sys/select.h is available */
|
||||
/* #undef HAVE_SYS_SELECT_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
@@ -173,6 +171,9 @@
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
/* #undef HAVE_SYS_WAIT_H */
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#ifndef _MSC_VER
|
||||
#define HAVE_UNISTD_H 1
|
||||
@@ -183,6 +184,12 @@
|
||||
/* Have uxtheme.h include file */
|
||||
#define HAVE_UXTHEME_H 1
|
||||
|
||||
/* Have wchar.h include file */
|
||||
#define HAVE_WCHAR_H 1
|
||||
|
||||
/* Have wctype.h include file */
|
||||
#define HAVE_WCTYPE_H 1
|
||||
|
||||
/* Define if we have X11R6 */
|
||||
/* #undef HAVE_X11R6 */
|
||||
|
||||
@@ -204,9 +211,6 @@
|
||||
/* Define to 1 if XFree Xinerama is available */
|
||||
/* #undef HAVE_XFREE_XINERAMA */
|
||||
|
||||
/* Have XGenericEvent */
|
||||
/* #undef HAVE_XGENERICEVENTS */
|
||||
|
||||
/* Define to 1 if xinerama is available */
|
||||
/* #undef HAVE_XINERAMA */
|
||||
|
||||
@@ -216,6 +220,9 @@
|
||||
/* Define to use XKB extension */
|
||||
/* #undef HAVE_XKB */
|
||||
|
||||
/* Define to 1 if xshm.h is available */
|
||||
/* #undef HAVE_XSHM_H */
|
||||
|
||||
/* Have the SYNC extension library */
|
||||
/* #undef HAVE_XSYNC */
|
||||
|
||||
@@ -241,6 +248,9 @@
|
||||
/* Define if <X11/extensions/XIproto.h> needed for xReply */
|
||||
/* #undef NEED_XIPROTO_H_FOR_XREPLY */
|
||||
|
||||
/* Define to 1 if fd_set is not available */
|
||||
#define NO_FD_SET 1
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#ifndef _MSC_VER
|
||||
/* #undef NO_MINUS_C_MINUS_O */
|
||||
@@ -260,15 +270,11 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "gtk+"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@"
|
||||
|
||||
/* Use NSBundle functions to determine load paths for libraries, translations,
|
||||
etc. */
|
||||
/* #undef QUARTZ_RELOCATION */
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
@@ -276,8 +282,15 @@
|
||||
/* Define to 1 if gmodule works and should be used */
|
||||
#define USE_GMODULE 1
|
||||
|
||||
/* Define to 1 if XInput 2.0 is available */
|
||||
/* #undef XINPUT_2 */
|
||||
/* Whether to load modules via .la files rather than directly */
|
||||
/* #undef USE_LA_MODULES */
|
||||
|
||||
/* Define to 1 if XXM is available and should be used */
|
||||
#ifndef _MSC_VER
|
||||
# define USE_MMX 1
|
||||
#else
|
||||
# undef USE_MMX
|
||||
#endif
|
||||
|
||||
/* Define to 1 if no XInput should be used */
|
||||
/* #undef XINPUT_NONE */
|
||||
@@ -294,6 +307,9 @@
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
/* #undef _LARGE_FILES */
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#define gid_t int
|
||||
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [3])
|
||||
m4_define([gtk_micro_version], [17])
|
||||
m4_define([gtk_micro_version], [15])
|
||||
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.31.18])
|
||||
m4_define([glib_required_version], [2.31.14])
|
||||
m4_define([pango_required_version], [1.29.0])
|
||||
m4_define([atk_required_version], [2.1.5])
|
||||
m4_define([cairo_required_version], [1.10.0])
|
||||
|
||||
@@ -29,6 +29,7 @@ demos = \
|
||||
links.c \
|
||||
list_store.c \
|
||||
menus.c \
|
||||
multitouch.c \
|
||||
offscreen_window.c \
|
||||
offscreen_window2.c \
|
||||
overlay.c \
|
||||
|
||||
@@ -0,0 +1,698 @@
|
||||
/* Multitouch
|
||||
*
|
||||
* Demonstrates some general multitouch event handling,
|
||||
* using GdkTouchCluster in order to get grouped motion
|
||||
* events for the touches within a cluster. Each of the
|
||||
* created rectangles has one of those GdkTouchCluster
|
||||
* objects.
|
||||
*
|
||||
* Touch events are also enabled on additional widgets,
|
||||
* enabling simultaneous touch interaction on those. Not
|
||||
* all widgets are prepared for multitouch interaction,
|
||||
* as there are constraints that not all widgets may
|
||||
* apply to.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo-common.h"
|
||||
|
||||
#define RECT_BORDER_WIDTH 6
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *area = NULL;
|
||||
static GtkWidget *red = NULL;
|
||||
static GtkWidget *green = NULL;
|
||||
static GtkWidget *blue = NULL;
|
||||
static GtkWidget *alpha = NULL;
|
||||
|
||||
static GQueue *shapes = NULL;
|
||||
|
||||
typedef struct {
|
||||
GdkTouchCluster *cluster;
|
||||
GdkRGBA color;
|
||||
|
||||
gdouble angle;
|
||||
gdouble zoom;
|
||||
|
||||
gdouble center_x;
|
||||
gdouble center_y;
|
||||
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gdouble width;
|
||||
gdouble height;
|
||||
|
||||
gdouble base_zoom;
|
||||
gdouble base_angle;
|
||||
gdouble initial_distance;
|
||||
gdouble initial_angle;
|
||||
|
||||
GdkPoint points[4];
|
||||
} ShapeInfo;
|
||||
|
||||
static void
|
||||
calculate_rotated_point (gdouble angle,
|
||||
gdouble zoom,
|
||||
gdouble center_x,
|
||||
gdouble center_y,
|
||||
gdouble point_x,
|
||||
gdouble point_y,
|
||||
gdouble *ret_x,
|
||||
gdouble *ret_y)
|
||||
{
|
||||
gdouble distance, xd, yd, ang;
|
||||
|
||||
if (angle == 0)
|
||||
{
|
||||
*ret_x = point_x;
|
||||
*ret_y = point_y;
|
||||
return;
|
||||
}
|
||||
|
||||
xd = center_x - point_x;
|
||||
yd = center_y - point_y;
|
||||
|
||||
if (xd == 0 && yd == 0)
|
||||
{
|
||||
*ret_x = center_x;
|
||||
*ret_y = center_y;
|
||||
return;
|
||||
}
|
||||
|
||||
distance = sqrt ((xd * xd) + (yd * yd));
|
||||
distance *= zoom;
|
||||
|
||||
ang = atan2 (xd, yd);
|
||||
|
||||
/* Invert angle */
|
||||
ang = (2 * G_PI) - ang;
|
||||
|
||||
/* Shift it 270° */
|
||||
ang += 3 * (G_PI / 2);
|
||||
|
||||
/* And constraint it to 0°-360° */
|
||||
ang = fmod (ang, 2 * G_PI);
|
||||
ang += angle;
|
||||
|
||||
*ret_x = center_x + (distance * cos (ang));
|
||||
*ret_y = center_y + (distance * sin (ang));
|
||||
}
|
||||
|
||||
static void
|
||||
shape_info_allocate_input_rect (ShapeInfo *info)
|
||||
{
|
||||
gint width, height, i;
|
||||
|
||||
width = info->width;
|
||||
height = info->height;
|
||||
|
||||
/* Top/left */
|
||||
info->points[0].x = info->x - info->center_x;
|
||||
info->points[0].y = info->y - info->center_y;
|
||||
|
||||
/* Top/right */
|
||||
info->points[1].x = info->x - info->center_x + width;
|
||||
info->points[1].y = info->y - info->center_y;
|
||||
|
||||
/* Bottom/right */
|
||||
info->points[2].x = info->x - info->center_x + width;
|
||||
info->points[2].y = info->y - info->center_y + height;
|
||||
|
||||
/* Bottom/left */
|
||||
info->points[3].x = info->x - info->center_x;
|
||||
info->points[3].y = info->y - info->center_y + height;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gdouble ret_x, ret_y;
|
||||
|
||||
calculate_rotated_point (info->angle,
|
||||
info->zoom,
|
||||
info->x,
|
||||
info->y,
|
||||
(gdouble) info->points[i].x,
|
||||
(gdouble) info->points[i].y,
|
||||
&ret_x,
|
||||
&ret_y);
|
||||
|
||||
info->points[i].x = (gint) ret_x;
|
||||
info->points[i].y = (gint) ret_y;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shape_info_bounding_rect (ShapeInfo *info,
|
||||
GdkRectangle *rect)
|
||||
{
|
||||
gint i, left, right, top, bottom;
|
||||
|
||||
left = top = G_MAXINT;
|
||||
right = bottom = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (info->points[i].x < left)
|
||||
left = info->points[i].x;
|
||||
|
||||
if (info->points[i].x > right)
|
||||
right = info->points[i].x;
|
||||
|
||||
if (info->points[i].y < top)
|
||||
top = info->points[i].y;
|
||||
|
||||
if (info->points[i].y > bottom)
|
||||
bottom = info->points[i].y;
|
||||
}
|
||||
|
||||
rect->x = left - 20;
|
||||
rect->y = top - 20;
|
||||
rect->width = right - left + 40;
|
||||
rect->height = bottom - top + 40;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
shape_info_point_in (ShapeInfo *info,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkPoint *left, *right, *top, *bottom;
|
||||
gint i;
|
||||
|
||||
left = right = top = bottom = NULL;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
GdkPoint *p = &info->points[i];
|
||||
|
||||
if (!left ||
|
||||
p->x < left->x ||
|
||||
(p->x == left->x && p->y > left->y))
|
||||
left = p;
|
||||
|
||||
if (!right ||
|
||||
p->x > right->x ||
|
||||
(p->x == right->x && p->y < right->y))
|
||||
right = p;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
GdkPoint *p = &info->points[i];
|
||||
|
||||
if (p == left || p == right)
|
||||
continue;
|
||||
|
||||
if (!top ||
|
||||
p->y < top->y)
|
||||
top = p;
|
||||
|
||||
if (!bottom ||
|
||||
p->y > bottom->y)
|
||||
bottom = p;
|
||||
}
|
||||
|
||||
g_assert (left && right && top && bottom);
|
||||
|
||||
if (x < left->x ||
|
||||
x > right->x ||
|
||||
y < top->y ||
|
||||
y > bottom->y)
|
||||
return FALSE;
|
||||
|
||||
/* Check whether point is above the sides
|
||||
* between leftmost and topmost, and
|
||||
* topmost and rightmost corners.
|
||||
*/
|
||||
if (x <= top->x)
|
||||
{
|
||||
if (left->y - ((left->y - top->y) * (((gdouble) x - left->x) / (top->x - left->x))) > y)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (top->y + ((right->y - top->y) * (((gdouble) x - top->x) / (right->x - top->x))) > y)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check whether point is below the sides
|
||||
* between leftmost and bottom, and
|
||||
* bottom and rightmost corners.
|
||||
*/
|
||||
if (x <= bottom->x)
|
||||
{
|
||||
if (left->y + ((bottom->y - left->y) * (((gdouble) x - left->x) / (bottom->x - left->x))) < y)
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bottom->y - ((bottom->y - right->y) * (((gdouble) x - bottom->x) / (right->x - bottom->x))) < y)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static ShapeInfo *
|
||||
shape_info_new (gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
ShapeInfo *info;
|
||||
|
||||
info = g_slice_new0 (ShapeInfo);
|
||||
info->cluster = NULL;
|
||||
info->color = *color;
|
||||
|
||||
info->x = x;
|
||||
info->y = y;
|
||||
info->width = width;
|
||||
info->height = height;
|
||||
|
||||
info->angle = 0;
|
||||
info->zoom = 1;
|
||||
|
||||
info->base_zoom = 1;
|
||||
info->base_angle = 0;
|
||||
info->initial_distance = 0;
|
||||
info->initial_angle = 0;
|
||||
|
||||
shape_info_allocate_input_rect (info);
|
||||
|
||||
g_queue_push_tail (shapes, info);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static void
|
||||
shape_info_free (ShapeInfo *info)
|
||||
{
|
||||
g_slice_free (ShapeInfo, info);
|
||||
}
|
||||
|
||||
static void
|
||||
shape_info_draw (cairo_t *cr,
|
||||
ShapeInfo *info)
|
||||
{
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_translate (cr,
|
||||
info->points[0].x + RECT_BORDER_WIDTH / 2,
|
||||
info->points[0].y + RECT_BORDER_WIDTH / 2);
|
||||
|
||||
cairo_scale (cr, info->zoom, info->zoom);
|
||||
cairo_rotate (cr, info->angle);
|
||||
|
||||
cairo_rectangle (cr, 0, 0,
|
||||
info->width - RECT_BORDER_WIDTH,
|
||||
info->height - RECT_BORDER_WIDTH);
|
||||
gdk_cairo_set_source_rgba (cr, &info->color);
|
||||
cairo_fill_preserve (cr);
|
||||
|
||||
cairo_set_line_width (cr, RECT_BORDER_WIDTH);
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
shape_update_scales (ShapeInfo *info)
|
||||
{
|
||||
gtk_range_set_value (GTK_RANGE (red), info->color.red);
|
||||
gtk_range_set_value (GTK_RANGE (green), info->color.green);
|
||||
gtk_range_set_value (GTK_RANGE (blue), info->color.blue);
|
||||
gtk_range_set_value (GTK_RANGE (alpha), info->color.alpha);
|
||||
}
|
||||
|
||||
static void
|
||||
range_value_changed_cb (GtkRange *range,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkRectangle rect;
|
||||
ShapeInfo *shape;
|
||||
gdouble value;
|
||||
|
||||
widget = GTK_WIDGET (range);
|
||||
shape = g_queue_peek_head (shapes);
|
||||
|
||||
if (!shape)
|
||||
return;
|
||||
|
||||
value = gtk_range_get_value (range);
|
||||
|
||||
if (widget == red)
|
||||
shape->color.red = value;
|
||||
else if (widget == green)
|
||||
shape->color.green = value;
|
||||
else if (widget == blue)
|
||||
shape->color.blue = value;
|
||||
else if (widget == alpha)
|
||||
shape->color.alpha = value;
|
||||
|
||||
shape_info_bounding_rect (shape, &rect);
|
||||
gdk_window_invalidate_rect (gtk_widget_get_window (area),
|
||||
&rect, FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_cb (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer user_data)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
for (l = shapes->tail; l; l = l->prev)
|
||||
shape_info_draw (cr, l->data);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
button_press_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ShapeInfo *shape = NULL;
|
||||
guint touch_id;
|
||||
|
||||
if (gdk_event_get_touch_id (event, &touch_id))
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = shapes->tail; l; l = l->prev)
|
||||
{
|
||||
ShapeInfo *info = l->data;
|
||||
|
||||
if (shape_info_point_in (info,
|
||||
(gint) event->button.x,
|
||||
(gint) event->button.y))
|
||||
shape = info;
|
||||
}
|
||||
|
||||
if (!shape)
|
||||
return FALSE;
|
||||
|
||||
/* Put on top */
|
||||
g_queue_remove (shapes, shape);
|
||||
g_queue_push_head (shapes, shape);
|
||||
|
||||
shape_update_scales (shape);
|
||||
|
||||
if (!shape->cluster)
|
||||
shape->cluster = gdk_window_create_touch_cluster (gtk_widget_get_window (widget),
|
||||
gdk_event_get_device (event));
|
||||
else if (gdk_touch_cluster_get_n_touches (shape->cluster) == 0)
|
||||
{
|
||||
/* Only change cluster device if there were no touches */
|
||||
gdk_touch_cluster_set_device (shape->cluster,
|
||||
gdk_event_get_device (event));
|
||||
}
|
||||
|
||||
gdk_touch_cluster_add_touch (shape->cluster, touch_id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
multitouch_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
ShapeInfo *info = NULL;
|
||||
gboolean new_center = FALSE;
|
||||
gboolean new_position = FALSE;
|
||||
gdouble event_x, event_y;
|
||||
cairo_region_t *region;
|
||||
GdkRectangle rect;
|
||||
GList *l;
|
||||
|
||||
for (l = shapes->head; l; l = l->next)
|
||||
{
|
||||
ShapeInfo *shape = l->data;
|
||||
|
||||
if (event->multitouch.group == shape->cluster)
|
||||
{
|
||||
info = shape;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!info)
|
||||
return FALSE;
|
||||
|
||||
shape_info_bounding_rect (info, &rect);
|
||||
region = cairo_region_create_rectangle ((cairo_rectangle_int_t *) &rect);
|
||||
|
||||
if (event->multitouch.n_events == 1)
|
||||
{
|
||||
/* Update center if we just got to
|
||||
* this situation from either way */
|
||||
if (event->type == GDK_MULTITOUCH_ADDED ||
|
||||
event->type == GDK_MULTITOUCH_REMOVED)
|
||||
new_center = TRUE;
|
||||
|
||||
event_x = event->multitouch.events[0]->x;
|
||||
event_y = event->multitouch.events[0]->y;
|
||||
new_position = TRUE;
|
||||
}
|
||||
else if (event->multitouch.n_events == 2)
|
||||
{
|
||||
gdouble distance, angle;
|
||||
|
||||
gdk_events_get_center ((GdkEvent *) event->multitouch.events[0],
|
||||
(GdkEvent *) event->multitouch.events[1],
|
||||
&event_x, &event_y);
|
||||
|
||||
gdk_events_get_distance ((GdkEvent *) event->multitouch.events[0],
|
||||
(GdkEvent *) event->multitouch.events[1],
|
||||
&distance);
|
||||
|
||||
gdk_events_get_angle ((GdkEvent *) event->multitouch.events[0],
|
||||
(GdkEvent *) event->multitouch.events[1],
|
||||
&angle);
|
||||
|
||||
if (event->type == GDK_MULTITOUCH_ADDED)
|
||||
{
|
||||
/* Second touch was just added, update base zoom/angle */
|
||||
info->base_zoom = info->zoom;
|
||||
info->base_angle = info->angle;
|
||||
info->initial_angle = angle;
|
||||
info->initial_distance = distance;
|
||||
new_center = TRUE;
|
||||
}
|
||||
|
||||
info->zoom = MAX (info->base_zoom * (distance / info->initial_distance), 1.0);
|
||||
info->angle = info->base_angle + (angle - info->initial_angle);
|
||||
new_position = TRUE;
|
||||
}
|
||||
|
||||
if (new_center)
|
||||
{
|
||||
gdouble origin_x, origin_y;
|
||||
|
||||
origin_x = info->x - info->center_x;
|
||||
origin_y = info->y - info->center_y;
|
||||
|
||||
calculate_rotated_point (- info->angle,
|
||||
1 / info->zoom,
|
||||
info->x - origin_x,
|
||||
info->y - origin_y,
|
||||
event_x - origin_x,
|
||||
event_y - origin_y,
|
||||
&info->center_x,
|
||||
&info->center_y);
|
||||
}
|
||||
|
||||
if (new_position)
|
||||
{
|
||||
info->x = event_x;
|
||||
info->y = event_y;
|
||||
}
|
||||
|
||||
shape_info_allocate_input_rect (info);
|
||||
|
||||
shape_info_bounding_rect (info, &rect);
|
||||
cairo_region_union_rectangle (region, (cairo_rectangle_int_t *) &rect);
|
||||
gdk_window_invalidate_region (gtk_widget_get_window (widget), region, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
window_destroyed_cb (GtkWidget *widget,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_queue_foreach (shapes, (GFunc) shape_info_free, NULL);
|
||||
g_queue_free (shapes);
|
||||
|
||||
shapes = NULL;
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
new_rectangle_clicked_cb (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
ShapeInfo *info;
|
||||
GdkRGBA color;
|
||||
|
||||
color.red = color.green = color.blue = color.alpha = 0.5;
|
||||
info = shape_info_new (0, 0, 100, 150, &color);
|
||||
|
||||
shape_info_bounding_rect (info, &rect);
|
||||
gdk_window_invalidate_rect (gtk_widget_get_window (area), &rect, FALSE);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_drawing_area (void)
|
||||
{
|
||||
area = gtk_drawing_area_new ();
|
||||
|
||||
gtk_widget_add_events (area,
|
||||
GDK_TOUCH_MASK |
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK);
|
||||
|
||||
gtk_widget_set_size_request (area, 600, 600);
|
||||
|
||||
g_signal_connect (area, "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
g_signal_connect (area, "button-press-event",
|
||||
G_CALLBACK (button_press_cb), NULL);
|
||||
g_signal_connect (area, "multitouch-event",
|
||||
G_CALLBACK (multitouch_cb), NULL);
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_scale (void)
|
||||
{
|
||||
GtkWidget *scale;
|
||||
|
||||
scale = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, 0, 1, 0.01);
|
||||
gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
|
||||
|
||||
gtk_widget_set_vexpand (scale, TRUE);
|
||||
gtk_widget_set_margin_left (scale, 15);
|
||||
gtk_widget_set_margin_right (scale, 15);
|
||||
|
||||
gtk_widget_add_events (scale, GDK_TOUCH_MASK);
|
||||
|
||||
g_signal_connect (scale, "value-changed",
|
||||
G_CALLBACK (range_value_changed_cb), NULL);
|
||||
return scale;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_window (void)
|
||||
{
|
||||
GtkWidget *grid, *label, *button;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Multitouch demo");
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (window_destroyed_cb), NULL);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
area = create_drawing_area ();
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
area, 0, 0, 1, 3);
|
||||
gtk_widget_set_hexpand (area, TRUE);
|
||||
gtk_widget_set_vexpand (area, TRUE);
|
||||
|
||||
/* "red" label/scale */
|
||||
label = gtk_label_new ("Red");
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
label, 1, 0, 1, 1);
|
||||
|
||||
red = create_scale ();
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
red, 1, 1, 1, 1);
|
||||
|
||||
/* "green" label/scale */
|
||||
label = gtk_label_new ("Green");
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
label, 2, 0, 1, 1);
|
||||
|
||||
green = create_scale ();
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
green, 2, 1, 1, 1);
|
||||
|
||||
/* "blue" label/scale */
|
||||
label = gtk_label_new ("Blue");
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
label, 3, 0, 1, 1);
|
||||
|
||||
blue = create_scale ();
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
blue, 3, 1, 1, 1);
|
||||
|
||||
/* "alpha" label/scale */
|
||||
label = gtk_label_new ("Alpha");
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
label, 4, 0, 1, 1);
|
||||
|
||||
alpha = create_scale ();
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
alpha, 4, 1, 1, 1);
|
||||
|
||||
/* button */
|
||||
button = gtk_button_new_from_stock (GTK_STOCK_NEW);
|
||||
gtk_widget_add_events (button, GDK_TOUCH_MASK);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
button, 1, 2, 4, 1);
|
||||
gtk_widget_set_vexpand (button, FALSE);
|
||||
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (new_rectangle_clicked_cb), NULL);
|
||||
|
||||
gtk_widget_show_all (grid);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_multitouch (GtkWidget *do_widget)
|
||||
{
|
||||
if (!shapes)
|
||||
shapes = g_queue_new ();
|
||||
|
||||
if (!window)
|
||||
window = create_window ();
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
|
||||
g_queue_foreach (shapes, (GFunc) shape_info_free, NULL);
|
||||
g_queue_free (shapes);
|
||||
shapes = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
<xi:include href="xml/windows.xml" />
|
||||
<xi:include href="xml/events.xml" />
|
||||
<xi:include href="xml/event_structs.xml" />
|
||||
<xi:include href="xml/touchcluster.xml" />
|
||||
<xi:include href="xml/keys.xml" />
|
||||
<xi:include href="xml/selections.xml" />
|
||||
<xi:include href="xml/dnd.xml" />
|
||||
|
||||
@@ -631,7 +631,6 @@ gdk_keymap_get_direction
|
||||
gdk_keymap_have_bidi_layouts
|
||||
gdk_keymap_get_caps_lock_state
|
||||
gdk_keymap_get_num_lock_state
|
||||
gdk_keymap_get_modifier_state
|
||||
gdk_keymap_add_virtual_modifiers
|
||||
gdk_keymap_map_virtual_modifiers
|
||||
gdk_keymap_get_modifier_mask
|
||||
@@ -782,13 +781,13 @@ gdk_event_get_root_coords
|
||||
gdk_event_get_scroll_direction
|
||||
gdk_event_get_state
|
||||
gdk_event_get_time
|
||||
GdkEventSequence
|
||||
gdk_event_get_event_sequence
|
||||
gdk_event_get_touch_id
|
||||
gdk_event_request_motions
|
||||
gdk_events_get_angle
|
||||
gdk_events_get_center
|
||||
gdk_events_get_distance
|
||||
gdk_event_triggers_context_menu
|
||||
gdk_event_get_touch_id
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_event_handler_set
|
||||
@@ -821,7 +820,6 @@ GdkEvent
|
||||
GdkEventAny
|
||||
GdkEventKey
|
||||
GdkEventButton
|
||||
GdkEventTouch
|
||||
GdkEventScroll
|
||||
GdkEventMotion
|
||||
GdkEventExpose
|
||||
@@ -837,6 +835,7 @@ GdkEventWindowState
|
||||
GdkEventSetting
|
||||
GdkEventOwnerChange
|
||||
GdkEventGrabBroken
|
||||
GdkEventMultiTouch
|
||||
|
||||
<SUBSECTION>
|
||||
GdkScrollDirection
|
||||
@@ -864,6 +863,29 @@ gdk_event_get_type
|
||||
gdk_owner_change_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Multitouch</TITLE>
|
||||
<FILE>touchcluster</FILE>
|
||||
GdkTouchCluster
|
||||
gdk_touch_cluster_add_touch
|
||||
gdk_touch_cluster_remove_touch
|
||||
gdk_touch_cluster_remove_all
|
||||
gdk_touch_cluster_set_device
|
||||
gdk_touch_cluster_get_device
|
||||
gdk_touch_cluster_get_touches
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_window_create_touch_cluster
|
||||
gdk_window_remove_touch_cluster
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_TOUCH_CLUSTER
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_touch_cluster_get_type
|
||||
</SECTION>
|
||||
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Cursors</TITLE>
|
||||
<FILE>cursors</FILE>
|
||||
|
||||
@@ -9,5 +9,6 @@ gdk_display_manager_get_type
|
||||
gdk_drag_context_get_type
|
||||
gdk_keymap_get_type
|
||||
gdk_screen_get_type
|
||||
gdk_touch_cluster_get_type
|
||||
gdk_visual_get_type
|
||||
gdk_window_get_type
|
||||
|
||||
@@ -119,6 +119,7 @@ content_files = \
|
||||
running.sgml \
|
||||
building.sgml \
|
||||
compiling.sgml \
|
||||
device-interaction-patterns.xml \
|
||||
drawing-model.xml \
|
||||
glossary.xml \
|
||||
migrating-2to3.xml \
|
||||
@@ -142,6 +143,7 @@ content_files = \
|
||||
overview.xml
|
||||
|
||||
expand_content_files = \
|
||||
device-interaction-patterns.xml \
|
||||
drawing-model.xml \
|
||||
getting_started.xml \
|
||||
glossary.xml \
|
||||
|
||||
@@ -0,0 +1,578 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-device-interaction-patterns">
|
||||
<title>Multitouch and other device interaction patterns</title>
|
||||
|
||||
<para>
|
||||
Depending on the platform, GTK+ is able to handle a wide range of input
|
||||
devices. Those are offered to applications in a 2-level hierarchy, with
|
||||
virtual devices (or master devices) representing the visual cursors
|
||||
displayed in the screen, which are each controlled by a number of physical
|
||||
devices (or slave devices). Those devices can respectively be retrieved
|
||||
from an input event with gdk_event_get_device() and
|
||||
gdk_event_get_source_device().
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In X11, GTK+ uses XInput2 for input events, which caters for a fully dynamic
|
||||
device hierarchy, and support for multiple virtual pointer/keyboard pairs.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Listing and modifying the device hierarchy</title>
|
||||
<programlisting>
|
||||
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)]
|
||||
|
||||
carlos@sacarino:~$ xinput create-master eek
|
||||
carlos@sacarino:~$ xinput list
|
||||
...
|
||||
⎡ eek pointer id=17 [master pointer (18)]
|
||||
⎜ ↳ eek XTEST pointer id=19 [slave pointer (17)]
|
||||
⎣ eek keyboard id=18 [master keyboard (17)]
|
||||
↳ eek XTEST keyboard id=20 [slave keyboard (18)]
|
||||
|
||||
carlos@sacarino:~$ xinput reattach 10 17
|
||||
carlos@sacarino:~$ xinput list
|
||||
...
|
||||
⎡ eek pointer id=17 [master pointer (18)]
|
||||
⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (17)]
|
||||
⎜ ↳ eek XTEST pointer id=19 [slave pointer (17)]
|
||||
⎣ eek keyboard id=18 [master keyboard (17)]
|
||||
↳ eek XTEST keyboard id=20 [slave keyboard (18)]
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Anytime a virtual device is added or removed, or a physical device
|
||||
is attached to another virtual device, or left floating (detached
|
||||
from any virtual device), #GdkDeviceManager will emit the corresponding
|
||||
#GdkDeviceManager::device-added, #GdkDeviceManager::device-removed, or
|
||||
#GdkDeviceManager::device-changed signals.
|
||||
</para>
|
||||
|
||||
<section id="gtk-device-patterns-client-pointer">
|
||||
<title>The client pointer</title>
|
||||
|
||||
<para>
|
||||
In X11, Under the presence of multiple virtual pointers, GDK and XInput2
|
||||
use the "client pointer" principle to allow several legacy applications
|
||||
to interact simultaneously with different virtual pointer/keyboard pairs,
|
||||
it would be usually set by the window manager for a focused window, so
|
||||
different application windows could operate on different client pointers.
|
||||
gdk_device_manager_get_client_pointer() may be called to get the client
|
||||
pointer #GdkDevice
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Under the hood, X11 uses the client pointer (or its paired keyboard) to
|
||||
satisfy core calls such as XGrabPointer/Keyboard, XQueryPointer and
|
||||
others that have been superseded by XInput2.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In platforms without multidevice features, gdk_device_manager_get_client_pointer()
|
||||
will return the only virtual pointer available.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="gtk-device-patterns-simple">
|
||||
<title>Simple device handling</title>
|
||||
|
||||
<para>
|
||||
There are applications that could have little gain in knowing about
|
||||
multiple devices, although there are situations where a device could
|
||||
be needed (i.e. popping up a menu on the pointer coordinates).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For such applications, the client pointer may be a good enough
|
||||
approximation for these operations. Under the presence of multiple
|
||||
device pairs, this gives a behavior that is most similar to that
|
||||
of legacy applications (i.e. gtk+2).
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Getting the client pointer and keyboard</title>
|
||||
<programlisting>
|
||||
GdkDisplay *display;
|
||||
GdkDeviceManager *device_manager;
|
||||
GdkDevice *client_pointer, client_keyboard;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
client_pointer = gdk_device_manager_get_client_pointer (device_manager);
|
||||
|
||||
/* Or if we need a keyboard too */
|
||||
client_keyboard = gdk_device_get_associated_device (client_pointer);
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section id="gtk-device-patterns-multiple-devices">
|
||||
<title>Dealing with multiple devices</title>
|
||||
|
||||
<para>
|
||||
There may be several usecases to deal with multiple devices, including,
|
||||
but not limited to:
|
||||
</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
Retrieving advanced information from an input device: i.e. stylus pressure/tilt
|
||||
in drawing applications.
|
||||
</listitem>
|
||||
<listitem>
|
||||
Receiving events from a dedicated input device: i.e. joysticks in games.
|
||||
</listitem>
|
||||
<listitem>
|
||||
Collaborative interfaces, handling simultaneous input from multiple users.
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>
|
||||
However, the patterns to make them work are very similar.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Event handling</title>
|
||||
|
||||
<para>
|
||||
Each device will emit its own event stream, this means
|
||||
that you will need to check the GdkEvent you get in
|
||||
your event handlers
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Reacting differently to devices</title>
|
||||
<programlisting>
|
||||
static gboolean
|
||||
my_widget_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
GdkDevice *device, *source_device;
|
||||
|
||||
device = gdk_event_get_device ((GdkEvent *) event);
|
||||
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||
|
||||
g_print ("Motion event by '%s', coming from HW device '%s'\n",
|
||||
gdk_device_get_name (device),
|
||||
gdk_device_get_name (source_device));
|
||||
|
||||
/* Handle touch devices differently */
|
||||
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
{
|
||||
...
|
||||
}
|
||||
else
|
||||
{
|
||||
...
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
The mechanism above could also be used for fine grained event discarding
|
||||
(i.e. so rubberband selection doesn't jump to another pointer entering
|
||||
the widget for example)
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Reacting differently to devices</title>
|
||||
<programlisting>
|
||||
static gboolean
|
||||
my_widget_button_press (Gtkwidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GET_PRIV(widget)->current_pointer = gdk_event_get_device ((GdkEvent *) event);
|
||||
...
|
||||
}
|
||||
|
||||
static gboolean
|
||||
my_widget_button_release (Gtkwidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GET_PRIV(widget)->current_pointer = NULL;
|
||||
...
|
||||
}
|
||||
|
||||
static gboolean
|
||||
my_widget_motion_notify (Gtkwidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
if (gdk_event_get_device (event) !=
|
||||
GET_PRIV(widget)->current_pointer)
|
||||
return FALSE;
|
||||
|
||||
...
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Grabs</title>
|
||||
|
||||
<para>
|
||||
Grabs are a mechanism to coerce a device into sending events to
|
||||
a window, but with multidevice there's an other side of the coin,
|
||||
how other devices are supposed to interact while the grab is in
|
||||
effect.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The GdkGrabOwnership enum passed to gdk_device_grab() may be used
|
||||
to block other devices' interaction. %GDK_OWNERSHIP_NONE applies
|
||||
no restrictions, allowing other devices to interact, even with
|
||||
the grab window. %GDK_OWNERSHIP_WINDOW blocks other devices from
|
||||
interacting with the grab window, but they'll still be able to
|
||||
interact with the rest of the application, whereas
|
||||
%GDK_OWNERSHIP_APPLICATION will render the whole application
|
||||
insensitive to input from other devices. Different devices may
|
||||
have simultaneous grabs on the same or different windows.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Grabbing as a result of an input event</title>
|
||||
<programlisting>
|
||||
gboolean
|
||||
my_widget_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
GdkDevice *pointer, *keyboard;
|
||||
|
||||
pointer = gdk_event_get_device ((GdkEvent *) event);
|
||||
keyboard = gdk_device_get_associated_device (pointer);
|
||||
|
||||
/* Grab both keyboard/pointer, other devices will be
|
||||
* unable to interact with the widget window meanwhile
|
||||
*/
|
||||
gdk_device_grab (pointer,
|
||||
gtk_widget_get_window (widget),
|
||||
GDK_OWNERSHIP_WINDOW,
|
||||
...);
|
||||
gdk_device_grab (keyboard,
|
||||
gtk_widget_get_window (widget),
|
||||
GDK_OWNERSHIP_WINDOW,
|
||||
...);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
For GTK+ grabs, there's only a boolean value, equivalent to
|
||||
%GDK_OWNERSHIP_NONE and %GDK_OWNERSHIP_WINDOW, but the mechanism
|
||||
is quite similar.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Once the device is grabbed, there may be different situations
|
||||
that could break the grabs, so the widget needs to listen to
|
||||
#GdkGrabBrokenEvent and the #GtkWidget::grab-notify signal to
|
||||
handle these situations.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Handling broken grabs</title>
|
||||
<programlisting>
|
||||
static gboolean
|
||||
my_widget_grab_broken (GtkWidget *widget,
|
||||
GdkEventGrabBroken *event)
|
||||
{
|
||||
MyWidgetPrivate *priv = GET_PRIV (widget);
|
||||
|
||||
if (gdk_event_get_device (event) == priv->grab_pointer)
|
||||
{
|
||||
/* Undo state */
|
||||
...
|
||||
priv->grab_pointer = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
my_widget_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed)
|
||||
{
|
||||
MyWidgetPrivate *priv = GET_PRIV (widget);
|
||||
|
||||
if (gtk_widget_device_is_shadowed (widget, priv->grab_device))
|
||||
{
|
||||
/* Device was "shadowed" by another widget's grab,
|
||||
* release and undo state
|
||||
*/
|
||||
...
|
||||
priv->grab_pointer = NULL;
|
||||
}
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Handling multipointer</title>
|
||||
|
||||
<para>
|
||||
Widgets do react by default to every virtual device, although
|
||||
by default they are set in a compatibility mode that makes them
|
||||
behave better with multiple pointers, without necessarily
|
||||
being multipointer aware.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This compatibility mode most notably disables per-device
|
||||
enter/leave events, so these are stacked, and the crossing
|
||||
events are only emitted when the first pointer enters the
|
||||
window, and after the last pointer leaves it. This behavior
|
||||
is controlled through gtk_widget_set_support_multidevice()
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Reading device axis values</title>
|
||||
|
||||
<para>
|
||||
Button and motion events provide further information about
|
||||
the device axes' current state. Note the device axes are
|
||||
hardware and driver dependent, therefore the set of axes
|
||||
is not set in stone, although there are a few more common ones.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Getting to know the axes provided by a device</title>
|
||||
<programlisting>
|
||||
carlos@sacarino:~$ xinput list "Wacom ISDv4 E6 Pen stylus" |grep "Label"
|
||||
Label: Abs X
|
||||
Label: Abs Y
|
||||
Label: Abs Pressure
|
||||
Label: Abs Tilt X
|
||||
Label: Abs Tilt Y
|
||||
Label: Abs Wheel
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Getting an axis value</title>
|
||||
<programlisting>
|
||||
gboolean
|
||||
my_widget_motion_notify (GtkWidget *widget,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
GdkAtom *label_atom;
|
||||
gdouble pressure;
|
||||
|
||||
label_atom = gdk_atom_intern_static_string ("Abs Pressure");
|
||||
gdk_device_get_axis_value (gdk_event_get_device ((GdkEvent *) event),
|
||||
event->axes, label_atom, &pressure);
|
||||
|
||||
/* Do something with pressure */
|
||||
...
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
All pointer devices report axes information, master and slave. to
|
||||
achieve this, master pointers modify their list of axes at runtime
|
||||
to reflect those of the currently routed slave, emitting
|
||||
#GdkDevice::changed as the routed slave device changes.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Dealing with slave (or floating) devices</title>
|
||||
|
||||
<para>
|
||||
By default, GTK+ listens to all master devices, and typically
|
||||
all slave devices will be attached to a master device. so
|
||||
gdk_event_get_source_device() is the recommended way to deal
|
||||
with the physical device triggering the event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In more specialized setups, some devices could be floating
|
||||
(i.e. tablets that don't route events through any virtual
|
||||
pointer, but are expected to interact with drawing applications).
|
||||
In that case, such specialized applications could want to interact
|
||||
directly with the device. To do so, the device must be enabled,
|
||||
and the widget wanting its events needs to add the event mask.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Enabling events for a slave device</title>
|
||||
<programlisting>
|
||||
GdkDevice *device;
|
||||
|
||||
/* Gets the first device found with the given GdkInputSource */
|
||||
device = get_device (gtk_widget_get_display (widget),
|
||||
GDK_SOURCE_PEN);
|
||||
gdk_device_set_mode (device, GDK_MODE_SCREEN);
|
||||
gtk_widget_add_device_events (widget, device,
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK);
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
After these calls, the widget would specifically receive events
|
||||
from the physical device, regardless of it being floating or
|
||||
connected to a master device. In this second case, and if you
|
||||
want exclusive control of the device, you can temporarily detach
|
||||
the stylus device from its master by doing a GDK grab on it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For events coming directly from slave devices, both
|
||||
gdk_event_get_device() and gdk_event_get_source_device() will
|
||||
return the same device of type %GDK_DEVICE_TYPE_SLAVE or
|
||||
%GDK_DEVICE_TYPE_FLOATING.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
This is less useful than it used to be in GTK+2/XInput1, at least
|
||||
for attached slaves, as there is gdk_event_get_source_device(),
|
||||
and master devices' events provide axes information.
|
||||
</note>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section id="gtk-device-patterns-multitouch-widgets">
|
||||
<title>Multitouch in GTK+ widgets</title>
|
||||
|
||||
<para>
|
||||
Since version 3.4, GTK+ offers support for multitouch devices through a new
|
||||
set of events and higher level tools like #GdkTouchCluster and
|
||||
#GtkGesturesInterpreter.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If the widget does not have %GDK_TOUCH_MASK set in the event mask, it will
|
||||
only be allowed to interact with the touch emulating pointer events, and will
|
||||
only receive pointer events.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If the widget does have %GDK_TOUCH_MASK enabled, it will be able to receive
|
||||
events of type %GDK_TOUCH_PRESS, %GDK_TOUCH_RELEASE and %GDK_TOUCH_MOTION,
|
||||
which will be respectively emitted through the #GtkWidget::button-press-event,
|
||||
#GtkWidget::button-release-event and #GtkWidget::motion-notify-event signals.
|
||||
There may be multiple, simultaneous sequences of events, those will be
|
||||
recognized and referenced by their touch ID. See gdk_event_get_touch_id().
|
||||
</para>
|
||||
|
||||
<para>
|
||||
#GtkWidget<!-- -->s may create GdkTouchCluster<!-- -->s via
|
||||
gdk_window_create_touch_cluster(), those may be used to group
|
||||
touch events together, which are notified through #GdkEventMultitouch,
|
||||
this event will be emitted in #GtkWidget<!-- -->s through the
|
||||
#GtkWidget::multitouch-event signal.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Widgets may also handle gestures being performed on them,
|
||||
gtk_widget_enable_gesture() and gtk_widget_disable_gesture() are
|
||||
provided as a simple API, although widgets may also create a
|
||||
#GtkGesturesInterpreter and feed it events directly.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="gtk-device-patterns-multitouch">
|
||||
<title>Multitouch across a widget hierarchy</title>
|
||||
|
||||
<para>
|
||||
Fully touch driven applications might not want to confine multitouch
|
||||
operations within a single widget, but rather offer simultaneous
|
||||
interaction with multiple widgets.
|
||||
</para>
|
||||
<para>
|
||||
GTK+ is able to provide such experience, although it does not enable
|
||||
%GDK_TOUCH_MASK by default on its stock widgets. If a widget meets the
|
||||
following requirements, it is ready to be used in a multitouch UI:
|
||||
</para>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
The widget handles #GtkWidget::button-press-event, #GtkWidget::button-release-event
|
||||
and #GtkWidget::motion-notify-event, and does something meaningful while the button 1
|
||||
is pressed. If any explicit check on the event type being %GDK_BUTTON_PRESS,
|
||||
%GDK_BUTTON_RELEASE or %GDK_MOTION_NOTIFY is performed, the event types
|
||||
%GDK_TOUCH_PRESS, %GDK_TOUCH_RELEASE or %GDK_TOUCH_MOTION also need to be handled.
|
||||
</listitem>
|
||||
<listitem>
|
||||
The widget relies on the implicit grab as long as the button press/touch is active,
|
||||
GDK or GTK+ grabs would break the implicit grabs other touch sequences may have on
|
||||
other widgets.
|
||||
</listitem>
|
||||
<listitem>
|
||||
The widget does not require (or opts out) keyboard interaction while a touch is
|
||||
active on it. Touch interaction does not necessarily bring the keyboard focus with it.
|
||||
</listitem>
|
||||
<listitem>
|
||||
If the widget is only meant to interact with one touch sequence at a time (i.e.
|
||||
buttons), it has to be able to discern and reject operations on any later touch
|
||||
sequence as long as the touch it is interacting with remains active.
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<para>
|
||||
If a widget meets those requirements, enabling %GDK_TOUCH_MASK on it will suffice
|
||||
to make it handle multitouch events in a way that doesn't disrupt other touch
|
||||
operations.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
<title>Enabling touch events on a widget</title>
|
||||
<programlisting>
|
||||
gtk_widget_add_events (widget, GDK_TOUCH_MASK);
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<note>
|
||||
Not all GTK+ stock widgets are immediately suitable for handling touch
|
||||
events, there could be even design reasons on some of those which render
|
||||
them unsuitable.
|
||||
</note>
|
||||
</section>
|
||||
|
||||
<section id="gtk-device-patterns-recommendations">
|
||||
<title>Recommendations</title>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
Device operations often come up as a result of input events, favor
|
||||
gdk_event_get_device() and gtk_get_current_event_device() before
|
||||
gdk_device_manager_get_client_pointer().
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
Store the devices the widget is currently interacting with, handle
|
||||
GdkEventGrabBroken and #GtkWidget::grab-notify to undo/nullify these.
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
</chapter>
|
||||
@@ -68,6 +68,12 @@
|
||||
<xi:include href="xml/gtkstyle.xml" />
|
||||
</part>
|
||||
|
||||
<part id="multitouch-and-multidevice">
|
||||
<title>Interacting with input devices</title>
|
||||
<xi:include href="xml/device-interaction-patterns.xml" />
|
||||
<xi:include href="xml/gtkgesturesinterpreter.xml" />
|
||||
</part>
|
||||
|
||||
<part id="gtkobjects">
|
||||
<title>GTK+ Widgets and Objects</title>
|
||||
|
||||
|
||||
@@ -1579,6 +1579,51 @@ GtkFramePrivate
|
||||
gtk_frame_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgesturesinterpreter</FILE>
|
||||
<TITLE>GtkGesturesInterpreter</TITLE>
|
||||
GtkGesturesInterpreter
|
||||
GtkGestureType
|
||||
gtk_gestures_interpreter_new
|
||||
gtk_gestures_interpreter_add_gesture
|
||||
gtk_gestures_interpreter_remove_gesture
|
||||
gtk_gestures_interpreter_feed_event
|
||||
gtk_gestures_interpreter_finish
|
||||
gtk_gestures_interpreter_get_n_active_strokes
|
||||
|
||||
<SUBSECTION Gestures>
|
||||
GtkGestureStroke
|
||||
gtk_gesture_stroke_new
|
||||
gtk_gesture_stroke_copy
|
||||
gtk_gesture_stroke_free
|
||||
gtk_gesture_stroke_append_vector
|
||||
gtk_gesture_stroke_get_n_vectors
|
||||
gtk_gesture_stroke_get_vector
|
||||
GtkGesture
|
||||
GtkGestureFlags
|
||||
gtk_gesture_new
|
||||
gtk_gesture_copy
|
||||
gtk_gesture_free
|
||||
gtk_gesture_add_stroke
|
||||
gtk_gesture_get_n_strokes
|
||||
gtk_gesture_get_stroke
|
||||
gtk_gesture_get_flags
|
||||
gtk_gesture_register
|
||||
gtk_gesture_register_static
|
||||
gtk_gesture_lookup
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_GESTURES_INTERPRETER
|
||||
GTK_IS_GESTURES_INTERPRETER
|
||||
GTK_TYPE_GESTURES_INTERPRETER
|
||||
GTK_IS_GESTURES_INTERPRETER_CLASS
|
||||
GTK_GESTURES_INTERPRETER_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_gestures_interpreter_get_type
|
||||
gtk_gesture_stroke_get_type
|
||||
gtk_gesture_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkhandlebox</FILE>
|
||||
<TITLE>GtkHandleBox</TITLE>
|
||||
@@ -2939,10 +2984,9 @@ gtk_scrolled_window_get_min_content_width
|
||||
gtk_scrolled_window_set_min_content_width
|
||||
gtk_scrolled_window_get_min_content_height
|
||||
gtk_scrolled_window_set_min_content_height
|
||||
GtkKineticScrollingFlags
|
||||
gtk_scrolled_window_set_kinetic_scrolling
|
||||
gtk_scrolled_window_get_kinetic_scrolling
|
||||
gtk_scrolled_window_set_capture_button_press
|
||||
gtk_scrolled_window_get_capture_button_press
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_SCROLLED_WINDOW
|
||||
@@ -5032,6 +5076,7 @@ GtkAllocation
|
||||
GtkSelectionData
|
||||
GtkWidgetAuxInfo
|
||||
GtkWidgetHelpType
|
||||
GtkCapturedEventFlags
|
||||
gtk_widget_new
|
||||
gtk_widget_destroy
|
||||
gtk_widget_in_destruction
|
||||
@@ -5217,6 +5262,7 @@ gtk_widget_get_mapped
|
||||
gtk_widget_get_requisition
|
||||
gtk_widget_device_is_shadowed
|
||||
gtk_widget_get_modifier_mask
|
||||
gtk_widget_release_captured_events
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_widget_get_path
|
||||
@@ -5266,6 +5312,10 @@ gtk_widget_set_vexpand_set
|
||||
gtk_widget_queue_compute_expand
|
||||
gtk_widget_compute_expand
|
||||
|
||||
<SUBSECTION Gestures>
|
||||
gtk_widget_enable_gesture
|
||||
gtk_widget_disable_gesture
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_WIDGET
|
||||
GTK_IS_WIDGET
|
||||
@@ -7023,6 +7073,8 @@ GtkApplicationInhibitFlags
|
||||
gtk_application_inhibit
|
||||
gtk_application_uninhibit
|
||||
gtk_application_is_inhibited
|
||||
GtkApplicationEndSessionStyle
|
||||
gtk_application_end_session
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_application_get_app_menu
|
||||
|
||||
@@ -77,6 +77,7 @@ gtk_font_chooser_widget_get_type
|
||||
gtk_font_selection_dialog_get_type
|
||||
gtk_font_selection_get_type
|
||||
gtk_frame_get_type
|
||||
gtk_gestures_interpreter_get_type
|
||||
gtk_grid_get_type
|
||||
gtk_handle_box_get_type
|
||||
gtk_hbox_get_type
|
||||
|
||||
+32
-2
@@ -224,14 +224,34 @@ about_activated (GSimpleAction *action,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
quit_app (GtkApplication *app)
|
||||
{
|
||||
GList *list, *next;
|
||||
GtkWindow *win;
|
||||
|
||||
g_print ("Going down...\n");
|
||||
|
||||
list = gtk_application_get_windows (app);
|
||||
while (list)
|
||||
{
|
||||
win = list->data;
|
||||
next = list->next;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (win));
|
||||
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
quit_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GApplication *app = user_data;
|
||||
GtkApplication *app = user_data;
|
||||
|
||||
g_application_quit (app);
|
||||
quit_app (app);
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
@@ -327,6 +347,14 @@ bloat_pad_class_init (BloatPadClass *class)
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
quit_cb (GtkApplication *app)
|
||||
{
|
||||
g_print ("Session manager to us to quit\n");
|
||||
|
||||
quit_app (app);
|
||||
}
|
||||
|
||||
BloatPad *
|
||||
bloat_pad_new (void)
|
||||
{
|
||||
@@ -343,6 +371,8 @@ bloat_pad_new (void)
|
||||
"register-session", TRUE,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (bloat_pad, "quit", G_CALLBACK (quit_cb), NULL);
|
||||
|
||||
return bloat_pad;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ gdk_public_h_sources = \
|
||||
gdkselection.h \
|
||||
gdktestutils.h \
|
||||
gdkthreads.h \
|
||||
gdktouchcluster.h \
|
||||
gdktypes.h \
|
||||
gdkvisual.h \
|
||||
gdkwindow.h
|
||||
@@ -130,6 +131,7 @@ gdk_c_sources = \
|
||||
gdkrgba.c \
|
||||
gdkscreen.c \
|
||||
gdkselection.c \
|
||||
gdktouchcluster.c \
|
||||
gdkvisual.c \
|
||||
gdkwindow.c \
|
||||
gdkwindowimpl.c
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void gdk_broadway_screen_dispose (GObject *object);
|
||||
static void gdk_broadway_screen_finalize (GObject *object);
|
||||
static void gdk_broadway_screen_dispose (GObject *object);
|
||||
static void gdk_broadway_screen_finalize (GObject *object);
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwayScreen, gdk_broadway_screen, GDK_TYPE_SCREEN)
|
||||
|
||||
@@ -49,48 +49,61 @@ gdk_broadway_screen_init (GdkBroadwayScreen *screen)
|
||||
static GdkDisplay *
|
||||
gdk_broadway_screen_get_display (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_BROADWAY_SCREEN (screen)->display;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_BROADWAY_SCREEN (screen)->width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_BROADWAY_SCREEN (screen)->height;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return gdk_screen_get_width (screen) * 25.4 / 96;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return gdk_screen_get_height (screen) * 25.4 / 96;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_broadway_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_BROADWAY_SCREEN (screen)->root_window;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_screen_size_changed (GdkScreen *screen,
|
||||
BroadwayInputScreenResizeNotify *msg)
|
||||
_gdk_broadway_screen_size_changed (GdkScreen *screen, BroadwayInputScreenResizeNotify *msg)
|
||||
{
|
||||
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
||||
gint width, height;
|
||||
@@ -137,12 +150,16 @@ gdk_broadway_screen_finalize (GObject *object)
|
||||
static gint
|
||||
gdk_broadway_screen_get_n_monitors (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -150,6 +167,7 @@ static gint
|
||||
gdk_broadway_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num == 0, -1);
|
||||
|
||||
return gdk_screen_get_width_mm (screen);
|
||||
@@ -159,6 +177,7 @@ static gint
|
||||
gdk_broadway_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num == 0, -1);
|
||||
|
||||
return gdk_screen_get_height_mm (screen);
|
||||
@@ -168,6 +187,7 @@ static gchar *
|
||||
gdk_broadway_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
g_return_val_if_fail (monitor_num == 0, NULL);
|
||||
|
||||
return g_strdup ("browser");
|
||||
@@ -180,6 +200,7 @@ gdk_broadway_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
{
|
||||
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
||||
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
g_return_if_fail (monitor_num == 0);
|
||||
|
||||
if (dest)
|
||||
@@ -194,7 +215,11 @@ gdk_broadway_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
static GdkVisual *
|
||||
gdk_broadway_screen_get_rgba_visual (GdkScreen *screen)
|
||||
{
|
||||
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
||||
GdkBroadwayScreen *broadway_screen;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
broadway_screen = GDK_BROADWAY_SCREEN (screen);
|
||||
|
||||
return broadway_screen->rgba_visual;
|
||||
}
|
||||
@@ -229,6 +254,8 @@ _gdk_broadway_screen_setup (GdkScreen *screen)
|
||||
static gboolean
|
||||
gdk_broadway_screen_is_composited (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -236,6 +263,8 @@ gdk_broadway_screen_is_composited (GdkScreen *screen)
|
||||
static gchar *
|
||||
gdk_broadway_screen_make_display_name (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return g_strdup ("browser");
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <gdk/gdkselection.h>
|
||||
#include <gdk/gdktestutils.h>
|
||||
#include <gdk/gdkthreads.h>
|
||||
#include <gdk/gdktouchcluster.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkvisual.h>
|
||||
#include <gdk/gdkwindow.h>
|
||||
|
||||
+6
-2
@@ -168,7 +168,7 @@ gdk_event_get_scroll_direction
|
||||
gdk_event_get_source_device
|
||||
gdk_event_get_state
|
||||
gdk_event_get_time
|
||||
gdk_event_get_event_sequence
|
||||
gdk_event_get_touch_id
|
||||
gdk_event_get_type
|
||||
gdk_event_handler_set
|
||||
gdk_event_mask_get_type
|
||||
@@ -210,7 +210,6 @@ 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_modifier_state
|
||||
gdk_keymap_get_num_lock_state
|
||||
gdk_keymap_get_type
|
||||
gdk_keymap_have_bidi_layouts
|
||||
@@ -329,6 +328,11 @@ gdk_threads_enter
|
||||
gdk_threads_init
|
||||
gdk_threads_leave
|
||||
gdk_threads_set_lock_functions
|
||||
gdk_touch_cluster_add_touch
|
||||
gdk_touch_cluster_get_device
|
||||
gdk_touch_cluster_get_type G_GNUC_CONST
|
||||
gdk_touch_cluster_list_touches
|
||||
gdk_touch_cluster_remove_touch
|
||||
gdk_unicode_to_keyval
|
||||
gdk_utf8_to_string_target
|
||||
gdk_visibility_state_get_type
|
||||
|
||||
+2
-6
@@ -61,10 +61,7 @@ typedef enum
|
||||
* of a stylus on a graphics tablet.
|
||||
* @GDK_SOURCE_CURSOR: the device is a graphics tablet "puck" or similar device.
|
||||
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
|
||||
* @GDK_SOURCE_TOUCHSCREEN: the device is a direct-input touch device, such
|
||||
* as a touchscreen or tablet. This device type has been added in 3.4.
|
||||
* @GDK_SOURCE_TOUCHPAD: the device is an indirect touch device, such
|
||||
* as a touchpad. This device type has been added in 3.4.
|
||||
* @GDK_SOURCE_TOUCH: the device is a touch capable device.
|
||||
*
|
||||
* An enumeration describing the type of an input device in general terms.
|
||||
*/
|
||||
@@ -75,8 +72,7 @@ typedef enum
|
||||
GDK_SOURCE_ERASER,
|
||||
GDK_SOURCE_CURSOR,
|
||||
GDK_SOURCE_KEYBOARD,
|
||||
GDK_SOURCE_TOUCHSCREEN,
|
||||
GDK_SOURCE_TOUCHPAD
|
||||
GDK_SOURCE_TOUCH
|
||||
} GdkInputSource;
|
||||
|
||||
/**
|
||||
|
||||
+29
-24
@@ -702,9 +702,9 @@ _gdk_display_break_touch_grabs (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkWindow *new_grab_window)
|
||||
{
|
||||
guint i;
|
||||
guint i = 0;
|
||||
|
||||
for (i = 0; i < display->touch_implicit_grabs->len; i++)
|
||||
while (i < display->touch_implicit_grabs->len)
|
||||
{
|
||||
GdkTouchGrabInfo *info;
|
||||
|
||||
@@ -713,25 +713,31 @@ _gdk_display_break_touch_grabs (GdkDisplay *display,
|
||||
|
||||
if (info->device == device &&
|
||||
info->window != new_grab_window)
|
||||
generate_grab_broken_event (GDK_WINDOW (info->window),
|
||||
device, TRUE, new_grab_window);
|
||||
{
|
||||
generate_grab_broken_event (GDK_WINDOW (info->window),
|
||||
device, TRUE, new_grab_window);
|
||||
_gdk_window_finish_touch_id (info->window, device, info->touch_id);
|
||||
g_array_remove_index_fast (display->touch_implicit_grabs, i);
|
||||
}
|
||||
else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_display_add_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence,
|
||||
GdkWindow *window,
|
||||
GdkWindow *native_window,
|
||||
GdkEventMask event_mask,
|
||||
unsigned long serial,
|
||||
guint32 time)
|
||||
_gdk_display_add_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
guint touch_id,
|
||||
GdkWindow *window,
|
||||
GdkWindow *native_window,
|
||||
GdkEventMask event_mask,
|
||||
unsigned long serial,
|
||||
guint32 time)
|
||||
{
|
||||
GdkTouchGrabInfo info;
|
||||
|
||||
info.device = device;
|
||||
info.sequence = sequence;
|
||||
info.touch_id = touch_id;
|
||||
info.window = g_object_ref (window);
|
||||
info.native_window = g_object_ref (native_window);
|
||||
info.serial = serial;
|
||||
@@ -742,9 +748,9 @@ _gdk_display_add_touch_grab (GdkDisplay *display,
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_display_end_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence)
|
||||
_gdk_display_end_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
guint touch_id)
|
||||
{
|
||||
guint i;
|
||||
|
||||
@@ -756,7 +762,7 @@ _gdk_display_end_touch_grab (GdkDisplay *display,
|
||||
GdkTouchGrabInfo, i);
|
||||
|
||||
if (info->device == device &&
|
||||
info->sequence == sequence)
|
||||
info->touch_id == touch_id)
|
||||
{
|
||||
g_array_remove_index_fast (display->touch_implicit_grabs, i);
|
||||
return TRUE;
|
||||
@@ -974,8 +980,7 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
* synthesized when needed.
|
||||
*/
|
||||
if (source_device &&
|
||||
(gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN ||
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHPAD))
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
info->need_touch_press_enter = TRUE;
|
||||
|
||||
pointer_window = NULL;
|
||||
@@ -1115,10 +1120,10 @@ _gdk_display_has_device_grab (GdkDisplay *display,
|
||||
}
|
||||
|
||||
GdkTouchGrabInfo *
|
||||
_gdk_display_has_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence,
|
||||
gulong serial)
|
||||
_gdk_display_has_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
guint touch_id,
|
||||
gulong serial)
|
||||
{
|
||||
guint i;
|
||||
|
||||
@@ -1130,7 +1135,7 @@ _gdk_display_has_touch_grab (GdkDisplay *display,
|
||||
GdkTouchGrabInfo, i);
|
||||
|
||||
if (info->device == device &&
|
||||
info->sequence == sequence)
|
||||
info->touch_id == touch_id)
|
||||
{
|
||||
if (serial >= info->serial)
|
||||
return info;
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GdkDevice *device;
|
||||
GdkEventSequence *sequence;
|
||||
guint touch_id;
|
||||
|
||||
GdkWindow *window;
|
||||
GdkWindow *native_window;
|
||||
@@ -278,7 +278,7 @@ gboolean _gdk_display_check_grab_ownership (GdkDisplay *display
|
||||
gulong serial);
|
||||
void _gdk_display_add_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence,
|
||||
guint touch_id,
|
||||
GdkWindow *window,
|
||||
GdkWindow *native_window,
|
||||
GdkEventMask event_mask,
|
||||
@@ -286,11 +286,11 @@ void _gdk_display_add_touch_grab (GdkDisplay *display
|
||||
guint32 time);
|
||||
GdkTouchGrabInfo * _gdk_display_has_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence,
|
||||
guint touch_id,
|
||||
gulong serial);
|
||||
gboolean _gdk_display_end_touch_grab (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence);
|
||||
guint touch_id);
|
||||
void _gdk_display_enable_motion_hints (GdkDisplay *display,
|
||||
GdkDevice *device);
|
||||
GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
|
||||
|
||||
+208
-99
@@ -445,6 +445,7 @@ gdk_event_new (GdkEventType type)
|
||||
switch (type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
new_event->motion.x = 0.;
|
||||
new_event->motion.y = 0.;
|
||||
new_event->motion.x_root = 0.;
|
||||
@@ -454,20 +455,13 @@ gdk_event_new (GdkEventType type)
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
new_event->button.x = 0.;
|
||||
new_event->button.y = 0.;
|
||||
new_event->button.x_root = 0.;
|
||||
new_event->button.y_root = 0.;
|
||||
break;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
new_event->touch.x = 0.;
|
||||
new_event->touch.y = 0.;
|
||||
new_event->touch.x_root = 0.;
|
||||
new_event->touch.y_root = 0.;
|
||||
break;
|
||||
case GDK_SCROLL:
|
||||
new_event->scroll.x = 0.;
|
||||
new_event->scroll.y = 0.;
|
||||
@@ -591,21 +585,15 @@ gdk_event_copy (const GdkEvent *event)
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
if (event->button.axes)
|
||||
new_event->button.axes = g_memdup (event->button.axes,
|
||||
sizeof (gdouble) * gdk_device_get_n_axes (event->button.device));
|
||||
break;
|
||||
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
if (event->touch.axes)
|
||||
new_event->touch.axes = g_memdup (event->touch.axes,
|
||||
sizeof (gdouble) * gdk_device_get_n_axes (event->touch.device));
|
||||
break;
|
||||
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
if (event->motion.axes)
|
||||
new_event->motion.axes = g_memdup (event->motion.axes,
|
||||
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
|
||||
@@ -625,6 +613,22 @@ gdk_event_copy (const GdkEvent *event)
|
||||
g_object_ref (new_event->selection.requestor);
|
||||
break;
|
||||
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
{
|
||||
GdkEventMotion **motion_events;
|
||||
guint i;
|
||||
|
||||
motion_events = g_new0 (GdkEventMotion*, event->multitouch.n_events);
|
||||
|
||||
for (i = 0; i < event->multitouch.n_events; i++)
|
||||
motion_events[i] = (GdkEventMotion *) gdk_event_copy ((GdkEvent *) event->multitouch.events[i]);
|
||||
|
||||
new_event->multitouch.events = motion_events;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -681,16 +685,11 @@ gdk_event_free (GdkEvent *event)
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
g_free (event->button.axes);
|
||||
break;
|
||||
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
g_free (event->touch.axes);
|
||||
break;
|
||||
|
||||
|
||||
case GDK_EXPOSE:
|
||||
case GDK_DAMAGE:
|
||||
if (event->expose.region)
|
||||
@@ -698,6 +697,7 @@ gdk_event_free (GdkEvent *event)
|
||||
break;
|
||||
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
g_free (event->motion.axes);
|
||||
break;
|
||||
|
||||
@@ -717,6 +717,20 @@ gdk_event_free (GdkEvent *event)
|
||||
g_object_unref (event->selection.requestor);
|
||||
break;
|
||||
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
if (event->multitouch.events)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < event->multitouch.n_events; i++)
|
||||
gdk_event_free ((GdkEvent *) event->multitouch.events[i]);
|
||||
|
||||
g_free (event->multitouch.events);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -745,17 +759,15 @@ gdk_event_get_time (const GdkEvent *event)
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
return event->motion.time;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
return event->button.time;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
return event->touch.time;
|
||||
case GDK_SCROLL:
|
||||
return event->scroll.time;
|
||||
case GDK_KEY_PRESS:
|
||||
@@ -780,6 +792,10 @@ gdk_event_get_time (const GdkEvent *event)
|
||||
case GDK_DROP_START:
|
||||
case GDK_DROP_FINISHED:
|
||||
return event->dnd.time;
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
return event->multitouch.time;
|
||||
case GDK_CLIENT_EVENT:
|
||||
case GDK_VISIBILITY_NOTIFY:
|
||||
case GDK_CONFIGURE:
|
||||
@@ -825,19 +841,16 @@ gdk_event_get_state (const GdkEvent *event,
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
*state = event->motion.state;
|
||||
return TRUE;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
*state = event->button.state;
|
||||
return TRUE;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
*state = event->touch.state;
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
*state = event->button.state;
|
||||
return TRUE;
|
||||
case GDK_SCROLL:
|
||||
*state = event->scroll.state;
|
||||
@@ -850,6 +863,11 @@ gdk_event_get_state (const GdkEvent *event,
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
*state = event->crossing.state;
|
||||
return TRUE;
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
*state = event->multitouch.state;
|
||||
return TRUE;
|
||||
case GDK_PROPERTY_NOTIFY:
|
||||
case GDK_VISIBILITY_NOTIFY:
|
||||
case GDK_CLIENT_EVENT:
|
||||
@@ -925,17 +943,13 @@ gdk_event_get_coords (const GdkEvent *event,
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
x = event->button.x;
|
||||
y = event->button.y;
|
||||
break;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
x = event->touch.x;
|
||||
y = event->touch.y;
|
||||
break;
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
x = event->motion.x;
|
||||
y = event->motion.y;
|
||||
break;
|
||||
@@ -975,6 +989,7 @@ gdk_event_get_root_coords (const GdkEvent *event,
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
x = event->motion.x_root;
|
||||
y = event->motion.y_root;
|
||||
break;
|
||||
@@ -986,16 +1001,11 @@ gdk_event_get_root_coords (const GdkEvent *event,
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
x = event->button.x_root;
|
||||
y = event->button.y_root;
|
||||
break;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
x = event->touch.x_root;
|
||||
y = event->touch.y_root;
|
||||
break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
x = event->crossing.x_root;
|
||||
@@ -1237,6 +1247,7 @@ gdk_event_get_axis (const GdkEvent *event,
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
x = event->motion.x;
|
||||
y = event->motion.y;
|
||||
break;
|
||||
@@ -1246,16 +1257,11 @@ gdk_event_get_axis (const GdkEvent *event,
|
||||
break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
x = event->button.x;
|
||||
y = event->button.y;
|
||||
break;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
x = event->touch.x;
|
||||
y = event->touch.y;
|
||||
break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
x = event->crossing.x;
|
||||
@@ -1274,20 +1280,15 @@ gdk_event_get_axis (const GdkEvent *event,
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->type == GDK_BUTTON_PRESS ||
|
||||
event->type == GDK_BUTTON_RELEASE)
|
||||
event->type == GDK_BUTTON_RELEASE ||
|
||||
event->type == GDK_TOUCH_PRESS ||
|
||||
event->type == GDK_TOUCH_RELEASE)
|
||||
{
|
||||
device = event->button.device;
|
||||
axes = event->button.axes;
|
||||
}
|
||||
else if (event->type == GDK_TOUCH_BEGIN ||
|
||||
event->type == GDK_TOUCH_UPDATE ||
|
||||
event->type == GDK_TOUCH_END ||
|
||||
event->type == GDK_TOUCH_CANCEL)
|
||||
{
|
||||
device = event->touch.device;
|
||||
axes = event->touch.axes;
|
||||
}
|
||||
else if (event->type == GDK_MOTION_NOTIFY)
|
||||
else if (event->type == GDK_MOTION_NOTIFY ||
|
||||
event->type == GDK_TOUCH_MOTION)
|
||||
{
|
||||
device = event->motion.device;
|
||||
axes = event->motion.axes;
|
||||
@@ -1324,20 +1325,17 @@ gdk_event_set_device (GdkEvent *event,
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
event->motion.device = device;
|
||||
break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
event->button.device = device;
|
||||
break;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
event->touch.device = device;
|
||||
break;
|
||||
case GDK_SCROLL:
|
||||
event->scroll.device = device;
|
||||
break;
|
||||
@@ -1345,6 +1343,10 @@ gdk_event_set_device (GdkEvent *event,
|
||||
case GDK_PROXIMITY_OUT:
|
||||
event->proximity.device = device;
|
||||
break;
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
event->multitouch.device = device;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1377,22 +1379,24 @@ gdk_event_get_device (const GdkEvent *event)
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
return event->motion.device;
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
return event->button.device;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
return event->touch.device;
|
||||
case GDK_SCROLL:
|
||||
return event->scroll.device;
|
||||
case GDK_PROXIMITY_IN:
|
||||
case GDK_PROXIMITY_OUT:
|
||||
return event->proximity.device;
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
return event->multitouch.device;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1401,14 +1405,13 @@ gdk_event_get_device (const GdkEvent *event)
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
case GDK_FOCUS_CHANGE:
|
||||
@@ -1424,6 +1427,9 @@ gdk_event_get_device (const GdkEvent *event)
|
||||
case GDK_GRAB_BROKEN:
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDeviceManager *device_manager;
|
||||
@@ -1791,32 +1797,135 @@ gdk_event_get_screen (const GdkEvent *event)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_event_sequence:
|
||||
* gdk_event_get_touch_id:
|
||||
* @event: a #GdkEvent
|
||||
* @touch_id: return location of the touch ID of a touch event
|
||||
*
|
||||
* Returns the #GdkEventSequence to which @event belongs.
|
||||
* Currently, only touch events (i.e. those with type %GDK_TOUCH_BEGIN,
|
||||
* %GDK_TOUCH_UPDATE, %GDK_TOUCH_END or %GDK_TOUCH_CANCEL) are
|
||||
* connected in sequences. If the event does not belong to an
|
||||
* event sequence, %NULL is returned.
|
||||
* If @event if of type %GDK_TOUCH_MOTION, %GDK_TOUCH_PRESS or
|
||||
* %GDK_TOUCH_RELEASE, fills in @touch_id and returns %TRUE,
|
||||
* else it returns %FALSE.
|
||||
*
|
||||
* Returns: the event sequence that the event belongs to, or %NULL
|
||||
* Returns: %TRUE if the touch ID can be extracted from @event.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
GdkEventSequence *
|
||||
gdk_event_get_event_sequence (const GdkEvent *event)
|
||||
**/
|
||||
gboolean
|
||||
gdk_event_get_touch_id (const GdkEvent *event,
|
||||
guint *touch_id)
|
||||
{
|
||||
if (!event)
|
||||
return FALSE;
|
||||
|
||||
if (event->type == GDK_TOUCH_MOTION)
|
||||
{
|
||||
if (touch_id)
|
||||
*touch_id = event->motion.touch_id;
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->type == GDK_TOUCH_PRESS ||
|
||||
event->type == GDK_TOUCH_RELEASE)
|
||||
{
|
||||
if (touch_id)
|
||||
*touch_id = event->button.touch_id;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (touch_id)
|
||||
*touch_id = 0;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_get_touch_area:
|
||||
* @event: a #GdkEvent
|
||||
*
|
||||
* This function takes a #GdkEvent coming from a touch device
|
||||
* (eg. gdk_event_get_source_device() returns a device of type
|
||||
* %GDK_SOURCE_TOUCH), and returns the area covered by the touch
|
||||
* as a #cairo_region_t. or %NULL if the device doesn't provide
|
||||
* this information, or the touch area information couldn't be
|
||||
* extracted from the event.
|
||||
*
|
||||
* <note><warning>Not all touch capable devices provide this
|
||||
* information, so provide fallbacks to this function returning
|
||||
* %NULL, even if the window receiving events is only meant
|
||||
* to react to touch events.</warning></note>
|
||||
*
|
||||
* Returns: (transfer full): the touch region, or %NULL if unavailable
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
cairo_region_t *
|
||||
gdk_event_get_touch_area (GdkEvent *event)
|
||||
{
|
||||
gdouble *axes, minor_axis, major_axis, orientation_axis;
|
||||
GdkAtom major, minor, orientation;
|
||||
GdkDevice *device;
|
||||
|
||||
g_return_val_if_fail (event != NULL, NULL);
|
||||
|
||||
device = gdk_event_get_source_device (event);
|
||||
|
||||
if (!device)
|
||||
return NULL;
|
||||
|
||||
if (event->type == GDK_TOUCH_BEGIN ||
|
||||
event->type == GDK_TOUCH_UPDATE ||
|
||||
event->type == GDK_TOUCH_END ||
|
||||
event->type == GDK_TOUCH_CANCEL)
|
||||
return event->touch.sequence;
|
||||
if (event->type == GDK_MOTION_NOTIFY ||
|
||||
event->type == GDK_TOUCH_MOTION)
|
||||
axes = event->motion.axes;
|
||||
else if (event->type == GDK_BUTTON_PRESS ||
|
||||
event->type == GDK_2BUTTON_PRESS ||
|
||||
event->type == GDK_3BUTTON_PRESS ||
|
||||
event->type == GDK_BUTTON_RELEASE)
|
||||
axes = event->button.axes;
|
||||
else
|
||||
return NULL;
|
||||
|
||||
major = gdk_atom_intern_static_string ("Abs MT Touch Major");
|
||||
minor = gdk_atom_intern_static_string ("Abs MT Touch Minor");
|
||||
orientation = gdk_atom_intern_static_string ("Abs MT Orientation");
|
||||
|
||||
if (gdk_device_get_axis_value (device, axes, major, &major_axis) &&
|
||||
gdk_device_get_axis_value (device, axes, minor, &minor_axis) &&
|
||||
gdk_device_get_axis_value (device, axes, orientation, &orientation_axis))
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
GdkScreen *screen;
|
||||
gdouble x, y;
|
||||
|
||||
/* FIXME: We're assuming the device is mapped to a single screen,
|
||||
* could lead to stretched/shrinked shapes in multimonitor, although
|
||||
* that'd be an unusual setup for touchscreens.
|
||||
*/
|
||||
screen = gdk_window_get_screen (event->any.window);
|
||||
gdk_event_get_coords (event, &x, &y);
|
||||
|
||||
if (orientation_axis == 0)
|
||||
{
|
||||
/* Orientation is horizontal */
|
||||
rect.width = (gint) gdk_screen_get_width (screen) * major_axis;
|
||||
rect.height = (gint) gdk_screen_get_height (screen) * minor_axis;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Orientation is vertical */
|
||||
rect.height = (gint) gdk_screen_get_height (screen) * major_axis;
|
||||
rect.width = (gint) gdk_screen_get_width (screen) * minor_axis;
|
||||
}
|
||||
|
||||
/* Something is wrong here */
|
||||
if (rect.width == 0 ||
|
||||
rect.height == 0)
|
||||
return NULL;
|
||||
|
||||
rect.x = x - rect.width / 2;
|
||||
rect.y = y - rect.height / 2;
|
||||
|
||||
return cairo_region_create_rectangle (&rect);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+92
-71
@@ -35,6 +35,7 @@
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdktouchcluster.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -130,7 +131,6 @@ typedef struct _GdkEventExpose GdkEventExpose;
|
||||
typedef struct _GdkEventVisibility GdkEventVisibility;
|
||||
typedef struct _GdkEventMotion GdkEventMotion;
|
||||
typedef struct _GdkEventButton GdkEventButton;
|
||||
typedef struct _GdkEventTouch GdkEventTouch;
|
||||
typedef struct _GdkEventScroll GdkEventScroll;
|
||||
typedef struct _GdkEventKey GdkEventKey;
|
||||
typedef struct _GdkEventFocus GdkEventFocus;
|
||||
@@ -144,8 +144,7 @@ typedef struct _GdkEventDND GdkEventDND;
|
||||
typedef struct _GdkEventWindowState GdkEventWindowState;
|
||||
typedef struct _GdkEventSetting GdkEventSetting;
|
||||
typedef struct _GdkEventGrabBroken GdkEventGrabBroken;
|
||||
|
||||
typedef struct _GdkEventSequence GdkEventSequence;
|
||||
typedef struct _GdkEventMultiTouch GdkEventMultiTouch;
|
||||
|
||||
typedef union _GdkEvent GdkEvent;
|
||||
|
||||
@@ -266,14 +265,18 @@ typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
|
||||
* was added in 2.8.
|
||||
* @GDK_DAMAGE: the content of the window has been changed. This event type
|
||||
* was added in 2.14.
|
||||
* @GDK_TOUCH_BEGIN: A new touch event sequence has just started. This event
|
||||
* type was added in 3.4.
|
||||
* @GDK_TOUCH_UPDATE: A touch event sequence has been updated. This event type
|
||||
* was added in 3.4.
|
||||
* @GDK_TOUCH_END: A touch event sequence has finished. This event type
|
||||
* was added in 3.4.
|
||||
* @GDK_TOUCH_CANCEL: A touch event sequence has been canceled. This event type
|
||||
* was added in 3.4.
|
||||
* @GDK_TOUCH_MOTION: A touch device has been updated. This event type was
|
||||
* added in 3.4.
|
||||
* @GDK_TOUCH_PRESS: A new touch stream has just started. This event type was
|
||||
* added in 3.4.
|
||||
* @GDK_TOUCH_RELEASE: A touch stream has finished. This event type was
|
||||
* added in 3.4.
|
||||
* @GDK_MULTITOUCH_ADDED: A touch ID was added to a #GdkTouchCluster. This
|
||||
* event type was added in 3.4.
|
||||
* @GDK_MULTITOUCH_UPDATED: A touch within a #GdkTouchCluster has been updated.
|
||||
* This event type was added in 3.4.
|
||||
* @GDK_MULTITOUCH_REMOVED: A touch ID was removed from a #GdkTouchCluster. This
|
||||
* event type was added in 3.4.
|
||||
* @GDK_EVENT_LAST: marks the end of the GdkEventType enumeration. Added in 2.18
|
||||
*
|
||||
* Specifies the type of the event.
|
||||
@@ -321,10 +324,12 @@ typedef enum
|
||||
GDK_OWNER_CHANGE = 34,
|
||||
GDK_GRAB_BROKEN = 35,
|
||||
GDK_DAMAGE = 36,
|
||||
GDK_TOUCH_BEGIN = 37,
|
||||
GDK_TOUCH_UPDATE = 38,
|
||||
GDK_TOUCH_END = 39,
|
||||
GDK_TOUCH_CANCEL = 40,
|
||||
GDK_TOUCH_MOTION = 37,
|
||||
GDK_TOUCH_PRESS = 38,
|
||||
GDK_TOUCH_RELEASE = 39,
|
||||
GDK_MULTITOUCH_ADDED = 40,
|
||||
GDK_MULTITOUCH_UPDATED = 41,
|
||||
GDK_MULTITOUCH_REMOVED = 42,
|
||||
GDK_EVENT_LAST /* helper variable for decls */
|
||||
} GdkEventType;
|
||||
|
||||
@@ -577,8 +582,13 @@ struct _GdkEventVisibility
|
||||
* screen.
|
||||
* @y_root: the y coordinate of the pointer relative to the root of the
|
||||
* screen.
|
||||
* @touch_id: touch ID, only meaningful if event is of type %GDK_TOUCH_MOTION.
|
||||
*
|
||||
* Generated when the pointer moves.
|
||||
* Generated when the pointer/touch moves.
|
||||
*
|
||||
* If the event has a type of %GDK_TOUCH_MOTION, this event will
|
||||
* pertain to a sequence identified by gdk_event_get_touch_id().
|
||||
* With multitouch devices, there may be several ongoing sequences.
|
||||
*/
|
||||
struct _GdkEventMotion
|
||||
{
|
||||
@@ -593,12 +603,63 @@ struct _GdkEventMotion
|
||||
gint16 is_hint;
|
||||
GdkDevice *device;
|
||||
gdouble x_root, y_root;
|
||||
guint touch_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* GdkEventMultiTouch:
|
||||
* @type: the type of the event (%GDK_MULTITOUCH_ADDED, %GDK_MULTITOUCH_UPDATED
|
||||
* or %GDK_MULTITOUCH_REMOVED).
|
||||
* @window: the window which received the event.
|
||||
* @send_event: %TRUE if the event was sent explicitly (e.g. using
|
||||
* <function>XSendEvent</function>).
|
||||
* @time: the time of the event in milliseconds.
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See #GdkModifierType.
|
||||
* @device: the device where the event originated.
|
||||
* @group: the #GdkTouchCluster containing the touches that generated this event
|
||||
* @events: an array of events of type %GDK_TOUCH_MOTION for the touches in @group
|
||||
* @updated_touch_id: the touch ID that caused this event to be generated
|
||||
* @n_events: the number of events in @events
|
||||
* @n_updated_event: the index in @events of the event corresponding to
|
||||
* @updated_touch_id, or -1 for %GDK_MULTITOUCH_REMOVED events.
|
||||
*
|
||||
* Used for multitouch events. The @type field will be one of
|
||||
* %GDK_MULTITOUCH_ADDED, %GDK_MULTITOUCH_UPDATED or
|
||||
* %GDK_MULTITOUCH_REMOVED.
|
||||
*
|
||||
* Multitouch events group the events from the touches in a
|
||||
* #GdkTouchCluster, so one of these events is generated
|
||||
* whenever a touch ID generates a new event, or a touch ID
|
||||
* is added or removed.
|
||||
*
|
||||
* For any given touch ID, %GDK_MULTITOUCH_ADDED and
|
||||
* %GDK_MULTITOUCH_REMOVED events are always paired,
|
||||
* with any number of %GDK_MULTITOUCH_UPDATED
|
||||
* events in between. The minimum event stream is an
|
||||
* added/removed pair.
|
||||
*/
|
||||
struct _GdkEventMultiTouch
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 time;
|
||||
guint state;
|
||||
GdkDevice *device;
|
||||
GdkTouchCluster *group;
|
||||
GdkEventMotion **events;
|
||||
guint updated_touch_id;
|
||||
gint8 n_events;
|
||||
gint8 n_updated_event;
|
||||
};
|
||||
|
||||
/**
|
||||
* GdkEventButton:
|
||||
* @type: the type of the event (%GDK_BUTTON_PRESS, %GDK_2BUTTON_PRESS,
|
||||
* %GDK_3BUTTON_PRESS, %GDK_BUTTON_RELEASE).
|
||||
* %GDK_3BUTTON_PRESS, %GDK_BUTTON_RELEASE, %GDK_TOUCH_PRESS or
|
||||
* %GDK_TOUCH_RELEASE).
|
||||
* @window: the window which received the event.
|
||||
* @send_event: %TRUE if the event was sent explicitly (e.g. using
|
||||
* <function>XSendEvent</function>).
|
||||
@@ -619,10 +680,13 @@ struct _GdkEventMotion
|
||||
* screen.
|
||||
* @y_root: the y coordinate of the pointer relative to the root of the
|
||||
* screen.
|
||||
* @touch_id: touch ID, only meaningful if event is of type %GDK_TOUCH_PRESS
|
||||
* or %GDK_TOUCH_RELEASE.
|
||||
*
|
||||
* Used for button press and button release events. The
|
||||
* @type field will be one of %GDK_BUTTON_PRESS,
|
||||
* %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS or %GDK_BUTTON_RELEASE,
|
||||
* %GDK_2BUTTON_PRESS, %GDK_3BUTTON_PRESS, %GDK_BUTTON_RELEASE,
|
||||
* %GDK_TOUCH_PRESS and %GDK_TOUCH_RELEASE.
|
||||
*
|
||||
* Double and triple-clicks result in a sequence of events being received.
|
||||
* For double-clicks the order of events will be:
|
||||
@@ -654,6 +718,11 @@ struct _GdkEventMotion
|
||||
* For a double click to occur, the second button press must occur within
|
||||
* 1/4 of a second of the first. For a triple click to occur, the third
|
||||
* button press must also occur within 1/2 second of the first button press.
|
||||
*
|
||||
* If the event has a type of %GDK_TOUCH_PRESS or %GDK_TOUCH_RELEASE,
|
||||
* this event will pertain to a sequence identified by
|
||||
* gdk_event_get_touch_id(). With multitouch devices, there may be
|
||||
* several ongoing sequences.
|
||||
*/
|
||||
struct _GdkEventButton
|
||||
{
|
||||
@@ -668,57 +737,7 @@ struct _GdkEventButton
|
||||
guint button;
|
||||
GdkDevice *device;
|
||||
gdouble x_root, y_root;
|
||||
};
|
||||
|
||||
/**
|
||||
* GdkEventTouch:
|
||||
* @type: the type of the event (%GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
|
||||
* %GDK_TOUCH_END, %GDK_TOUCH_CANCEL)
|
||||
* @window: the window which received the event
|
||||
* @send_event: %TRUE if the event was sent explicitly (e.g. using
|
||||
* <function>XSendEvent</function>)
|
||||
* @time: the time of the event in milliseconds.
|
||||
* @x: the x coordinate of the pointer relative to the window
|
||||
* @y: the y coordinate of the pointer relative to the window
|
||||
* @axes: @x, @y translated to the axes of @device, or %NULL if @device is
|
||||
* the mouse
|
||||
* @state: (type GdkModifierType): a bit-mask representing the state of
|
||||
* the modifier keys (e.g. Control, Shift and Alt) and the pointer
|
||||
* buttons. See #GdkModifierType
|
||||
* @sequence: the event sequence that the event belongs to
|
||||
* @emulating_pointer: whether the event should be used for emulating
|
||||
* pointer event
|
||||
* @device: the device where the event originated
|
||||
* @x_root: the x coordinate of the pointer relative to the root of the
|
||||
* screen
|
||||
* @y_root: the y coordinate of the pointer relative to the root of the
|
||||
* screen
|
||||
*
|
||||
* Used for touch events.
|
||||
* @type field will be one of %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
|
||||
* %GDK_TOUCH_END or %GDK_TOUCH_CANCEL.
|
||||
*
|
||||
* Touch events are grouped into sequences by means of the @sequence
|
||||
* field, which can also be obtained with gdk_event_get_event_sequence().
|
||||
* Each sequence begins with a %GDK_TOUCH_BEGIN event, followed by
|
||||
* any number of %GDK_TOUCH_UPDATE events, and ends with a %GDK_TOUCH_END
|
||||
* (or %GDK_TOUCH_CANCEL) event. With multitouch devices, there may be
|
||||
* several active sequences at the same time.
|
||||
*/
|
||||
struct _GdkEventTouch
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 time;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gdouble *axes;
|
||||
guint state;
|
||||
GdkEventSequence *sequence;
|
||||
gboolean emulating_pointer;
|
||||
GdkDevice *device;
|
||||
gdouble x_root, y_root;
|
||||
guint touch_id;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1149,7 +1168,6 @@ union _GdkEvent
|
||||
GdkEventVisibility visibility;
|
||||
GdkEventMotion motion;
|
||||
GdkEventButton button;
|
||||
GdkEventTouch touch;
|
||||
GdkEventScroll scroll;
|
||||
GdkEventKey key;
|
||||
GdkEventCrossing crossing;
|
||||
@@ -1163,6 +1181,7 @@ union _GdkEvent
|
||||
GdkEventWindowState window_state;
|
||||
GdkEventSetting setting;
|
||||
GdkEventGrabBroken grab_broken;
|
||||
GdkEventMultiTouch multitouch;
|
||||
};
|
||||
|
||||
GType gdk_event_get_type (void) G_GNUC_CONST;
|
||||
@@ -1227,7 +1246,9 @@ void gdk_event_set_screen (GdkEvent *event,
|
||||
GdkScreen *screen);
|
||||
GdkScreen *gdk_event_get_screen (const GdkEvent *event);
|
||||
|
||||
GdkEventSequence *gdk_event_get_event_sequence (const GdkEvent *event);
|
||||
gboolean gdk_event_get_touch_id (const GdkEvent *event,
|
||||
guint *touch_id);
|
||||
cairo_region_t * gdk_event_get_touch_area (GdkEvent *event);
|
||||
|
||||
void gdk_set_show_events (gboolean show_events);
|
||||
gboolean gdk_get_show_events (void);
|
||||
|
||||
@@ -266,6 +266,12 @@ struct _GdkWindow
|
||||
gulong device_changed_handler_id;
|
||||
|
||||
guint num_offscreen_children;
|
||||
|
||||
/* Store of latest per-touch events, keys are
|
||||
* GdkDevices, values are hashtables of touchID/info
|
||||
*/
|
||||
GHashTable *touch_event_tracker;
|
||||
GList *touch_clusters;
|
||||
};
|
||||
|
||||
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
|
||||
|
||||
@@ -378,27 +378,6 @@ gdk_keymap_get_num_lock_state (GdkKeymap *keymap)
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->get_num_lock_state (keymap);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_get_modifier_state:
|
||||
* @keymap: a #GdkKeymap
|
||||
*
|
||||
* Returns the current modifier state.
|
||||
*
|
||||
* Returns: the current modifier state.
|
||||
*
|
||||
* Since: 3.2
|
||||
*/
|
||||
guint
|
||||
gdk_keymap_get_modifier_state (GdkKeymap *keymap)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
|
||||
|
||||
if (GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_state)
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_state (keymap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_get_entries_for_keyval:
|
||||
* @keymap: a #GdkKeymap
|
||||
|
||||
@@ -110,7 +110,6 @@ PangoDirection gdk_keymap_get_direction (GdkKeymap *keymap)
|
||||
gboolean gdk_keymap_have_bidi_layouts (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
|
||||
guint gdk_keymap_get_modifier_state (GdkKeymap *keymap);
|
||||
void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
|
||||
@@ -63,7 +63,6 @@ struct _GdkKeymapClass
|
||||
GdkModifierType *state);
|
||||
GdkModifierType (*get_modifier_mask) (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
guint (* get_modifier_state) (GdkKeymap *keymap);
|
||||
|
||||
|
||||
/* Signals */
|
||||
|
||||
+21
-72
@@ -548,9 +548,7 @@ gdk_screen_set_property (GObject *object,
|
||||
GdkDisplay *
|
||||
gdk_screen_get_display (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_display (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_display (screen);
|
||||
}
|
||||
|
||||
|
||||
@@ -567,9 +565,7 @@ gdk_screen_get_display (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_width (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_width (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -585,9 +581,7 @@ gdk_screen_get_width (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_height (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_height (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -604,9 +598,7 @@ gdk_screen_get_height (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_width_mm (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_width_mm (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -623,9 +615,7 @@ gdk_screen_get_width_mm (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_height_mm (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_height_mm (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -642,9 +632,7 @@ gdk_screen_get_height_mm (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_number (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_number (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -660,9 +648,7 @@ gdk_screen_get_number (GdkScreen *screen)
|
||||
GdkWindow *
|
||||
gdk_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_root_window (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_root_window (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -678,9 +664,7 @@ gdk_screen_get_root_window (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_n_monitors (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_n_monitors (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_n_monitors (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -703,9 +687,7 @@ gdk_screen_get_n_monitors (GdkScreen *screen)
|
||||
gint
|
||||
gdk_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_primary_monitor (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_primary_monitor (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -723,10 +705,7 @@ gint
|
||||
gdk_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num >= 0, -1);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_monitor_width_mm (screen, monitor_num);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_monitor_width_mm (screen, monitor_num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -744,10 +723,7 @@ gint
|
||||
gdk_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num >= 0, -1);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_monitor_height_mm (screen, monitor_num);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_monitor_height_mm (screen, monitor_num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -768,10 +744,7 @@ gchar *
|
||||
gdk_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
g_return_val_if_fail (monitor_num >= 0, NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_monitor_plug_name (screen, monitor_num);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_monitor_plug_name (screen, monitor_num);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -797,9 +770,6 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
g_return_if_fail (monitor_num >= 0);
|
||||
|
||||
GDK_SCREEN_GET_CLASS(screen)->get_monitor_geometry (screen, monitor_num, dest);
|
||||
}
|
||||
|
||||
@@ -827,10 +797,7 @@ gdk_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
g_return_if_fail (monitor_num >= 0);
|
||||
|
||||
GDK_SCREEN_GET_CLASS (screen)->get_monitor_workarea (screen, monitor_num, dest);
|
||||
GDK_SCREEN_GET_CLASS(screen)->get_monitor_workarea (screen, monitor_num, dest);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -852,9 +819,7 @@ gdk_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
GList *
|
||||
gdk_screen_list_visuals (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->list_visuals (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->list_visuals (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -872,9 +837,7 @@ gdk_screen_list_visuals (GdkScreen *screen)
|
||||
GdkVisual *
|
||||
gdk_screen_get_system_visual (GdkScreen * screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_system_visual (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_system_visual (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -903,9 +866,7 @@ gdk_screen_get_system_visual (GdkScreen * screen)
|
||||
GdkVisual *
|
||||
gdk_screen_get_rgba_visual (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_rgba_visual (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_rgba_visual (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -927,9 +888,7 @@ gdk_screen_get_rgba_visual (GdkScreen *screen)
|
||||
gboolean
|
||||
gdk_screen_is_composited (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->is_composited (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->is_composited (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -946,9 +905,7 @@ gdk_screen_is_composited (GdkScreen *screen)
|
||||
gchar *
|
||||
gdk_screen_make_display_name (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->make_display_name (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->make_display_name (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -977,9 +934,7 @@ gdk_screen_make_display_name (GdkScreen *screen)
|
||||
GdkWindow *
|
||||
gdk_screen_get_active_window (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_active_window (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_active_window (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1011,9 +966,7 @@ gdk_screen_get_active_window (GdkScreen *screen)
|
||||
GList *
|
||||
gdk_screen_get_window_stack (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_window_stack (screen);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_window_stack (screen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1038,9 +991,5 @@ gdk_screen_get_setting (GdkScreen *screen,
|
||||
const gchar *name,
|
||||
GValue *value)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
||||
g_return_val_if_fail (name != NULL, FALSE);
|
||||
g_return_val_if_fail (value != NULL, FALSE);
|
||||
|
||||
return GDK_SCREEN_GET_CLASS (screen)->get_setting (screen, name, value);
|
||||
return GDK_SCREEN_GET_CLASS(screen)->get_setting (screen, name, value);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,448 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2011 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdktouchcluster.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
* SECTION:touchcluster
|
||||
* @Short_description: Multitouch handling
|
||||
* @Title: Multitouch
|
||||
* @See_also: #GdkEventMultiTouch
|
||||
*
|
||||
* #GdkTouchCluster is an object that gathers touch IDs from a
|
||||
* #GdkDevice, in order to send #GdkEventMultiTouch events
|
||||
* whenever a touch ID that is contained in the cluster sends
|
||||
* an event.
|
||||
*
|
||||
* #GdkTouchCluster<!-- -->s are always associated to a window,
|
||||
* you need to create them through gdk_window_create_touch_cluster(),
|
||||
* and free them through gdk_window_remove_touch_cluster().
|
||||
*
|
||||
* Touch IDs from devices can be obtained from %GDK_TOUCH_PRESS,
|
||||
* %GDK_TOUCH_MOTION or %GDK_TOUCH_RELEASE events through
|
||||
* gdk_event_get_touch_id(), and then be added via
|
||||
* gdk_touch_cluster_add_touch(). Note that touch IDs are
|
||||
* very transient, and they must be dealt with as such.
|
||||
* touch IDs must not be stored after a GDK_TOUCH_RELEASE,
|
||||
* and should always be retrieved from the events being
|
||||
* currently received.
|
||||
*
|
||||
* <example>
|
||||
* <title>Adding touch IDs to a cluster in a GTK+ widget</title>
|
||||
* <programlisting>
|
||||
* static gboolean
|
||||
* widget_button_press (GtkWidget *widget,
|
||||
* GdkEvent *event)
|
||||
* {
|
||||
* guint touch_id;
|
||||
*
|
||||
* if (gdk_event_get_touch_id (event, &touch_id))
|
||||
* {
|
||||
* /<!-- -->* It is a touch event, delegate processing
|
||||
* * to the multitouch event handler
|
||||
* *<!-- -->/
|
||||
* gdk_touch_cluster_add_touch (priv->touch_cluster, touch_id);
|
||||
* return TRUE;
|
||||
* }
|
||||
*
|
||||
* /<!-- -->* Normal button processing *<!-- -->/
|
||||
* ...
|
||||
* }
|
||||
* </programlisting>
|
||||
* </example>
|
||||
*
|
||||
* Anytime a touch ID is within a cluster, no %GDK_TOUCH_PRESS,
|
||||
* %GDK_TOUCH_MOTION or %GDK_TOUCH_RELEASE events will happen
|
||||
* for the individual touch. The event will be available instead
|
||||
* as part of the #GdkMultitouchEvent that will be emitted. This
|
||||
* will hold true until gdk_touch_cluster_remove_touch() is
|
||||
* called for it. Note that GTK+ will automatically take a
|
||||
* touch ID out of any cluster if %GDK_TOUCH_RELEASE is gotten
|
||||
* internally.
|
||||
*
|
||||
* <example>
|
||||
* <title>Typical multitouch event handler</title>
|
||||
* <programlisting>
|
||||
* static gboolean
|
||||
* widget_multitouch_event (GtkWidget *widget,
|
||||
* GdkEvent *event)
|
||||
* {
|
||||
* if (event->type == GDK_MULTITOUCH_ADDED ||
|
||||
* event->type == GDK_MULTITOUCH_REMOVED)
|
||||
* {
|
||||
* /<!-- -->* Update control mode based
|
||||
* * on the current number of touches
|
||||
* *<!-- -->/
|
||||
* priv->control_mode = update_control_mode (event->multitouch.n_events);
|
||||
* }
|
||||
* else
|
||||
* {
|
||||
* /<!-- -->* A touch ID in the cluster has updated
|
||||
* * its coordinates, update widget based on the
|
||||
* * current control mode.
|
||||
* *<!-- -->/
|
||||
* update_view (widget, priv->control_mode,
|
||||
* event->multitouch.events,
|
||||
* event->multitouch.n_events);
|
||||
* }
|
||||
*
|
||||
* return TRUE;
|
||||
* }
|
||||
* </programlisting>
|
||||
* </example>
|
||||
*/
|
||||
|
||||
typedef struct GdkTouchClusterPrivate GdkTouchClusterPrivate;
|
||||
|
||||
struct GdkTouchClusterPrivate
|
||||
{
|
||||
GdkDevice *device;
|
||||
GArray *touches;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DEVICE
|
||||
};
|
||||
|
||||
enum {
|
||||
TOUCH_ADDED,
|
||||
TOUCH_REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gdk_touch_cluster_finalize (GObject *object);
|
||||
static void gdk_touch_cluster_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gdk_touch_cluster_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GdkTouchCluster, gdk_touch_cluster, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gdk_touch_cluster_class_init (GdkTouchClusterClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_touch_cluster_finalize;
|
||||
object_class->get_property = gdk_touch_cluster_get_property;
|
||||
object_class->set_property = gdk_touch_cluster_set_property;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DEVICE,
|
||||
g_param_spec_object ("device",
|
||||
P_("Device"),
|
||||
P_("Device attached to the cluster"),
|
||||
GDK_TYPE_DEVICE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS));
|
||||
|
||||
signals[TOUCH_ADDED] =
|
||||
g_signal_new (g_intern_static_string ("touch-added"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkTouchClusterClass, touch_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
signals[TOUCH_REMOVED] =
|
||||
g_signal_new (g_intern_static_string ("touch-removed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkTouchClusterClass, touch_removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__UINT,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GdkTouchClusterPrivate));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_touch_cluster_init (GdkTouchCluster *cluster)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
priv = cluster->priv = G_TYPE_INSTANCE_GET_PRIVATE (cluster,
|
||||
GDK_TYPE_TOUCH_CLUSTER,
|
||||
GdkTouchClusterPrivate);
|
||||
priv->touches = g_array_new (FALSE, FALSE, sizeof (guint));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_touch_cluster_finalize (GObject *object)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
priv = GDK_TOUCH_CLUSTER (object)->priv;
|
||||
g_array_free (priv->touches, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (gdk_touch_cluster_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_touch_cluster_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEVICE:
|
||||
gdk_touch_cluster_set_device (GDK_TOUCH_CLUSTER (object),
|
||||
g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_touch_cluster_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
priv = GDK_TOUCH_CLUSTER (object)->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DEVICE:
|
||||
g_value_set_object (value, priv->device);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_add_touch:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
* @touch_id: a touch ID from a touch event
|
||||
*
|
||||
* Adds a touch ID to @cluster, so it will generate a
|
||||
* %GDK_MULTITOUCH_ADDED event, followed by %GDK_MULTITOUCH_UPDATED
|
||||
* events whenever this touch ID is updated.
|
||||
*
|
||||
* If @touch_id already pertained to another #GdkTouchCluster, it
|
||||
* will be removed from it, generating a %GDK_MULTITOUCH_REMOVED
|
||||
* for that another cluster.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
void
|
||||
gdk_touch_cluster_add_touch (GdkTouchCluster *cluster,
|
||||
guint touch_id)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
|
||||
|
||||
priv = cluster->priv;
|
||||
|
||||
for (i = 0; i < priv->touches->len; i++)
|
||||
{
|
||||
if (touch_id == g_array_index (priv->touches, guint, i))
|
||||
return;
|
||||
}
|
||||
|
||||
g_array_append_val (priv->touches, touch_id);
|
||||
g_signal_emit (cluster, signals [TOUCH_ADDED], 0, touch_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_remove_touch:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
* @touch_id: a touch ID from a touch event
|
||||
*
|
||||
* Removes a touch ID from @cluster, generating a %GDK_MULTITOUCH_REMOVED
|
||||
* event for @cluster, and causing any further input from @touch_id
|
||||
* to be reported trough %GDK_TOUCH_MOTION events.
|
||||
*
|
||||
* <note><para>
|
||||
* Note that GTK+ automatically removes a touch ID from any cluster
|
||||
* if a %GDK_TOUCH_RELEASE event is gotten internally.
|
||||
* </para></note>
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
void
|
||||
gdk_touch_cluster_remove_touch (GdkTouchCluster *cluster,
|
||||
guint touch_id)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
|
||||
|
||||
priv = cluster->priv;
|
||||
|
||||
for (i = 0; i < priv->touches->len; i++)
|
||||
{
|
||||
if (touch_id == g_array_index (priv->touches, guint, i))
|
||||
{
|
||||
g_array_remove_index_fast (priv->touches, i);
|
||||
g_signal_emit (cluster, signals [TOUCH_REMOVED], 0, touch_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_remove_all:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
*
|
||||
* Removes all touch IDs from @cluster.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
void
|
||||
gdk_touch_cluster_remove_all (GdkTouchCluster *cluster)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
guint touch_id;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
|
||||
|
||||
priv = cluster->priv;
|
||||
|
||||
for (i = priv->touches->len - 1; i >= 0; i--)
|
||||
{
|
||||
touch_id = g_array_index (priv->touches, guint, i);
|
||||
g_signal_emit (cluster, signals [TOUCH_REMOVED], 0, touch_id);
|
||||
g_array_remove_index_fast (priv->touches, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_get_touches:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
* @length: return location for the number of touches returned
|
||||
*
|
||||
* Returns the list of touches as an array of @guint.
|
||||
*
|
||||
* Returns: (transfer full) (array zero-terminated=0 length=length) (element-type uint): A list of touch IDs.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
guint *
|
||||
gdk_touch_cluster_get_touches (GdkTouchCluster *cluster,
|
||||
gint *len)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_TOUCH_CLUSTER (cluster), NULL);
|
||||
|
||||
priv = cluster->priv;
|
||||
|
||||
if (len)
|
||||
*len = (gint) priv->touches->len;
|
||||
|
||||
return g_memdup (priv->touches->data,
|
||||
sizeof (guint) * priv->touches->len);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_get_n_touches:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
*
|
||||
* Returns the number of touches contained in @cluster.
|
||||
*
|
||||
* Returns: The number of touches.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
gint
|
||||
gdk_touch_cluster_get_n_touches (GdkTouchCluster *cluster)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_TOUCH_CLUSTER (cluster), 0);
|
||||
|
||||
priv = cluster->priv;
|
||||
return (gint) priv->touches->len;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_set_device:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
* @device: a #GdkDevice
|
||||
*
|
||||
* Sets the current device associated to @cluster, all contained
|
||||
* touch IDs must pertain to this device. As a consequence,
|
||||
* gdk_touch_cluster_remove_all() will be called on @cluster
|
||||
* if the current device changes.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
void
|
||||
gdk_touch_cluster_set_device (GdkTouchCluster *cluster,
|
||||
GdkDevice *device)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
g_return_if_fail (GDK_IS_TOUCH_CLUSTER (cluster));
|
||||
g_return_if_fail (!device || GDK_IS_DEVICE (device));
|
||||
|
||||
priv = cluster->priv;
|
||||
|
||||
if (priv->device != device)
|
||||
gdk_touch_cluster_remove_all (cluster);
|
||||
|
||||
priv->device = device;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_touch_cluster_get_device:
|
||||
* @cluster: a #GdkTouchCluster
|
||||
*
|
||||
* Returns the slave/floating device this touch cluster pertains to,
|
||||
* only touch IDs from this device can be included in @cluster.
|
||||
* the #GdkDevice will typically have the %GDK_SOURCE_TOUCH input source.
|
||||
*
|
||||
* Returns: (transfer none): The #GdkDevice generating the contained touch IDs
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
GdkDevice *
|
||||
gdk_touch_cluster_get_device (GdkTouchCluster *cluster)
|
||||
{
|
||||
GdkTouchClusterPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_TOUCH_CLUSTER (cluster), NULL);
|
||||
|
||||
priv = cluster->priv;
|
||||
return priv->device;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 2011 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_TOUCH_CLUSTER_H__
|
||||
#define __GDK_TOUCH_CLUSTER_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_TOUCH_CLUSTER (gdk_touch_cluster_get_type ())
|
||||
#define GDK_TOUCH_CLUSTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_TOUCH_CLUSTER, GdkTouchCluster))
|
||||
#define GDK_IS_TOUCH_CLUSTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_TOUCH_CLUSTER))
|
||||
|
||||
typedef struct _GdkTouchCluster GdkTouchCluster;
|
||||
typedef struct _GdkTouchClusterClass GdkTouchClusterClass;
|
||||
|
||||
struct _GdkTouchCluster
|
||||
{
|
||||
GObject parent_instance;
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _GdkTouchClusterClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* touch_added) (GdkTouchCluster *cluster,
|
||||
guint touch_id);
|
||||
void (* touch_removed) (GdkTouchCluster *cluster,
|
||||
guint touch_id);
|
||||
|
||||
gpointer padding[16];
|
||||
};
|
||||
|
||||
GType gdk_touch_cluster_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void gdk_touch_cluster_add_touch (GdkTouchCluster *cluster,
|
||||
guint touch_id);
|
||||
void gdk_touch_cluster_remove_touch (GdkTouchCluster *cluster,
|
||||
guint touch_id);
|
||||
void gdk_touch_cluster_remove_all (GdkTouchCluster *cluster);
|
||||
|
||||
guint * gdk_touch_cluster_get_touches (GdkTouchCluster *cluster,
|
||||
gint *length);
|
||||
gint gdk_touch_cluster_get_n_touches (GdkTouchCluster *cluster);
|
||||
|
||||
void gdk_touch_cluster_set_device (GdkTouchCluster *cluster,
|
||||
GdkDevice *device);
|
||||
GdkDevice * gdk_touch_cluster_get_device (GdkTouchCluster *cluster);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_TOUCH_CLUSTER_H__ */
|
||||
+8
-8
@@ -350,7 +350,7 @@ typedef enum
|
||||
* @GDK_SUBSTRUCTURE_MASK: receive events about window configuration changes of
|
||||
* child windows
|
||||
* @GDK_SCROLL_MASK: receive scroll events
|
||||
* @GDK_TOUCH_MASK: receive touch events
|
||||
* @GDK_TOUCH_MASK: receive (multi)touch events
|
||||
* @GDK_ALL_EVENTS_MASK: the combination of all the above event masks.
|
||||
*
|
||||
* A set of bit-flags to indicate which events a window is to receive.
|
||||
@@ -367,12 +367,12 @@ typedef enum
|
||||
* To receive more motion events after a motion hint event, the application
|
||||
* needs to asks for more, by calling gdk_event_request_motions().
|
||||
*
|
||||
* If %GDK_TOUCH_MASK is enabled, the window will receive touch events
|
||||
* from touch-enabled devices. Those will come as sequences of #GdkEventTouch
|
||||
* with type %GDK_TOUCH_UPDATE, enclosed by two events with
|
||||
* type %GDK_TOUCH_BEGIN and %GDK_TOUCH_END (or %GDK_TOUCH_CANCEL).
|
||||
* gdk_event_get_event_sequence() returns the event sequence for these
|
||||
* events, so different sequences may be distinguished.
|
||||
* If %GDK_TOUCH_MASK is enabled, the window will receive (multi)touch events
|
||||
* from touch-enabled devices. Those will come as sequences #GdkEventMotion
|
||||
* with type %GDK_TOUCH_MOTION, enclosed by 2 #GdkEventButton events with
|
||||
* type %GDK_TOUCH_PRESS / %GDK_TOUCH_RELEASE. gdk_event_get_touch_id() will
|
||||
* return the touch ID on those events, so different sequences may be
|
||||
* distinguished.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
@@ -398,7 +398,7 @@ typedef enum
|
||||
GDK_SUBSTRUCTURE_MASK = 1 << 20,
|
||||
GDK_SCROLL_MASK = 1 << 21,
|
||||
GDK_TOUCH_MASK = 1 << 22,
|
||||
GDK_ALL_EVENTS_MASK = 0x7FFFFE
|
||||
GDK_ALL_EVENTS_MASK = 0x3FFFFF
|
||||
} GdkEventMask;
|
||||
|
||||
/**
|
||||
|
||||
+599
-290
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,7 @@
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
#include <gdk/gdktouchcluster.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -878,6 +879,12 @@ void gdk_window_set_support_multidevice (GdkWindow *window,
|
||||
gboolean support_multidevice);
|
||||
gboolean gdk_window_get_support_multidevice (GdkWindow *window);
|
||||
|
||||
/* Multitouch support */
|
||||
GdkTouchCluster * gdk_window_create_touch_cluster (GdkWindow *window,
|
||||
GdkDevice *device);
|
||||
void gdk_window_remove_touch_cluster (GdkWindow *window,
|
||||
GdkTouchCluster *cluster);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WINDOW_H__ */
|
||||
|
||||
+28
-41
@@ -136,7 +136,7 @@ const static struct {
|
||||
guint keycode;
|
||||
guint keyval;
|
||||
unsigned int modmask; /* So we can tell when a mod key is pressed/released */
|
||||
} modifier_keys[] = {
|
||||
} known_keys[] = {
|
||||
{ 54, GDK_KEY_Meta_R, NSCommandKeyMask },
|
||||
{ 55, GDK_KEY_Meta_L, NSCommandKeyMask },
|
||||
{ 56, GDK_KEY_Shift_L, NSShiftKeyMask },
|
||||
@@ -145,29 +145,23 @@ const static struct {
|
||||
{ 59, GDK_KEY_Control_L, NSControlKeyMask },
|
||||
{ 60, GDK_KEY_Shift_R, NSShiftKeyMask },
|
||||
{ 61, GDK_KEY_Alt_R, NSAlternateKeyMask },
|
||||
{ 62, GDK_KEY_Control_R, NSControlKeyMask }
|
||||
};
|
||||
|
||||
const static struct {
|
||||
guint keycode;
|
||||
guint keyval;
|
||||
} function_keys[] = {
|
||||
{ 122, GDK_KEY_F1 },
|
||||
{ 120, GDK_KEY_F2 },
|
||||
{ 99, GDK_KEY_F3 },
|
||||
{ 118, GDK_KEY_F4 },
|
||||
{ 96, GDK_KEY_F5 },
|
||||
{ 97, GDK_KEY_F6 },
|
||||
{ 98, GDK_KEY_F7 },
|
||||
{ 100, GDK_KEY_F8 },
|
||||
{ 101, GDK_KEY_F9 },
|
||||
{ 109, GDK_KEY_F10 },
|
||||
{ 103, GDK_KEY_F11 },
|
||||
{ 111, GDK_KEY_F12 },
|
||||
{ 105, GDK_KEY_F13 },
|
||||
{ 107, GDK_KEY_F14 },
|
||||
{ 113, GDK_KEY_F15 },
|
||||
{ 106, GDK_KEY_F16 }
|
||||
{ 62, GDK_KEY_Control_R, NSControlKeyMask },
|
||||
{ 122, GDK_KEY_F1, 0 },
|
||||
{ 120, GDK_KEY_F2, 0 },
|
||||
{ 99, GDK_KEY_F3, 0 },
|
||||
{ 118, GDK_KEY_F4, 0 },
|
||||
{ 96, GDK_KEY_F5, 0 },
|
||||
{ 97, GDK_KEY_F6, 0 },
|
||||
{ 98, GDK_KEY_F7, 0 },
|
||||
{ 100, GDK_KEY_F8, 0 },
|
||||
{ 101, GDK_KEY_F9, 0 },
|
||||
{ 109, GDK_KEY_F10, 0 },
|
||||
{ 103, GDK_KEY_F11, 0 },
|
||||
{ 111, GDK_KEY_F12, 0 },
|
||||
{ 105, GDK_KEY_F13, 0 },
|
||||
{ 107, GDK_KEY_F14, 0 },
|
||||
{ 113, GDK_KEY_F15, 0 },
|
||||
{ 106, GDK_KEY_F16, 0 }
|
||||
};
|
||||
|
||||
const static struct {
|
||||
@@ -410,6 +404,7 @@ maybe_update_keymap (void)
|
||||
0,
|
||||
&state, 4, &nChars, chars);
|
||||
|
||||
|
||||
/* FIXME: Theoretically, we can get multiple UTF-16 values;
|
||||
* we should convert them to proper unicode and figure
|
||||
* out whether there are really keyboard layouts that
|
||||
@@ -475,21 +470,13 @@ maybe_update_keymap (void)
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (modifier_keys); i++)
|
||||
for (i = 0; i < G_N_ELEMENTS (known_keys); i++)
|
||||
{
|
||||
p = keyval_array + modifier_keys[i].keycode * KEYVALS_PER_KEYCODE;
|
||||
p = keyval_array + known_keys[i].keycode * KEYVALS_PER_KEYCODE;
|
||||
|
||||
if (p[0] == 0 && p[1] == 0 &&
|
||||
p[2] == 0 && p[3] == 0)
|
||||
p[0] = modifier_keys[i].keyval;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (function_keys); i++)
|
||||
{
|
||||
p = keyval_array + function_keys[i].keycode * KEYVALS_PER_KEYCODE;
|
||||
|
||||
p[0] = function_keys[i].keyval;
|
||||
p[1] = p[2] = p[3] = 0;
|
||||
p[0] = known_keys[i].keyval;
|
||||
}
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (known_numeric_keys); i++)
|
||||
@@ -805,11 +792,11 @@ _gdk_quartz_keys_event_type (NSEvent *event)
|
||||
keycode = [event keyCode];
|
||||
flags = [event modifierFlags];
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (modifier_keys); i++)
|
||||
for (i = 0; i < G_N_ELEMENTS (known_keys); i++)
|
||||
{
|
||||
if (modifier_keys[i].keycode == keycode)
|
||||
if (known_keys[i].keycode == keycode)
|
||||
{
|
||||
if (flags & modifier_keys[i].modmask)
|
||||
if (flags & known_keys[i].modmask)
|
||||
return GDK_KEY_PRESS;
|
||||
else
|
||||
return GDK_KEY_RELEASE;
|
||||
@@ -826,12 +813,12 @@ _gdk_quartz_keys_is_modifier (guint keycode)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (modifier_keys); i++)
|
||||
for (i = 0; i < G_N_ELEMENTS (known_keys); i++)
|
||||
{
|
||||
if (modifier_keys[i].modmask == 0)
|
||||
if (known_keys[i].modmask == 0)
|
||||
break;
|
||||
|
||||
if (modifier_keys[i].keycode == keycode)
|
||||
if (known_keys[i].keycode == keycode)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,6 +291,7 @@ gdk_quartz_screen_get_display (GdkScreen *screen)
|
||||
return _gdk_display;
|
||||
}
|
||||
|
||||
|
||||
static GdkWindow *
|
||||
gdk_quartz_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
@@ -303,7 +304,7 @@ gdk_quartz_screen_get_number (GdkScreen *screen)
|
||||
return 0;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gchar *
|
||||
_gdk_windowing_substitute_screen_number (const gchar *display_name,
|
||||
int screen_number)
|
||||
{
|
||||
@@ -415,30 +416,6 @@ gdk_quartz_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
*dest = GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
GdkQuartzScreen *quartz_screen = GDK_QUARTZ_SCREEN (screen);
|
||||
NSArray *array;
|
||||
NSScreen *nsscreen;
|
||||
NSRect rect;
|
||||
|
||||
GDK_QUARTZ_ALLOC_POOL;
|
||||
|
||||
array = [NSScreen screens];
|
||||
nsscreen = [array objectAtIndex:monitor_num];
|
||||
rect = [nsscreen visibleFrame];
|
||||
|
||||
dest->x = rect.origin.x - quartz_screen->min_x;
|
||||
dest->y = quartz_screen->height - (rect.origin.y + rect.size.height) + quartz_screen->min_y;
|
||||
dest->width = rect.size.width;
|
||||
dest->height = rect.size.height;
|
||||
|
||||
GDK_QUARTZ_RELEASE_POOL;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gdk_quartz_screen_make_display_name (GdkScreen *screen)
|
||||
{
|
||||
@@ -485,7 +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_workarea;
|
||||
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;
|
||||
|
||||
@@ -163,54 +163,72 @@ gdk_wayland_screen_finalize (GObject *object)
|
||||
static GdkDisplay *
|
||||
gdk_wayland_screen_get_display (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->display;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->height;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->width_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->height_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_wayland_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->root_window;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_n_monitors (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->n_monitors;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_wayland_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_SCREEN_WAYLAND (screen)->primary_monitor;
|
||||
}
|
||||
|
||||
@@ -220,6 +238,8 @@ gdk_wayland_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
{
|
||||
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num >= 0, -1);
|
||||
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, -1);
|
||||
|
||||
return screen_wayland->monitors[monitor_num].width_mm;
|
||||
@@ -231,6 +251,8 @@ gdk_wayland_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
{
|
||||
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num >= 0, -1);
|
||||
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, -1);
|
||||
|
||||
return screen_wayland->monitors[monitor_num].height_mm;
|
||||
@@ -242,6 +264,8 @@ gdk_wayland_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
{
|
||||
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
g_return_val_if_fail (monitor_num >= 0, NULL);
|
||||
g_return_val_if_fail (monitor_num < screen_wayland->n_monitors, NULL);
|
||||
|
||||
return g_strdup (screen_wayland->monitors[monitor_num].output_name);
|
||||
@@ -254,6 +278,8 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
{
|
||||
GdkScreenWayland *screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
||||
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
g_return_if_fail (monitor_num >= 0);
|
||||
g_return_if_fail (monitor_num < screen_wayland->n_monitors);
|
||||
|
||||
if (dest)
|
||||
@@ -287,6 +313,8 @@ gdk_wayland_screen_make_display_name (GdkScreen *screen)
|
||||
static GdkWindow *
|
||||
gdk_wayland_screen_get_active_window (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
+15
-14
@@ -27,16 +27,13 @@ struct _GdkWin32Screen
|
||||
{
|
||||
GdkScreen parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkWin32ScreenClass
|
||||
{
|
||||
GdkScreenClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkWin32Screen, gdk_win32_screen, GDK_TYPE_SCREEN)
|
||||
|
||||
static void
|
||||
gdk_win32_screen_init (GdkWin32Screen *display)
|
||||
gdk_win32_screen_init(GdkWin32Screen *display)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -94,41 +91,45 @@ gdk_win32_screen_get_primary_monitor (GdkScreen *screen)
|
||||
|
||||
static gint
|
||||
gdk_win32_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint num_monitor)
|
||||
gint num_monitor)
|
||||
{
|
||||
g_return_val_if_fail (screen == _gdk_screen, 0);
|
||||
g_return_val_if_fail (num_monitor < _gdk_num_monitors, 0);
|
||||
g_return_val_if_fail (num_monitor >= 0, 0);
|
||||
|
||||
return _gdk_monitors[num_monitor].width_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_win32_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
gint num_monitor)
|
||||
gint num_monitor)
|
||||
{
|
||||
g_return_val_if_fail (screen == _gdk_screen, 0);
|
||||
g_return_val_if_fail (num_monitor < _gdk_num_monitors, 0);
|
||||
g_return_val_if_fail (num_monitor >= 0, 0);
|
||||
|
||||
return _gdk_monitors[num_monitor].height_mm;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gdk_win32_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
gint num_monitor)
|
||||
gint num_monitor)
|
||||
{
|
||||
g_return_val_if_fail (screen == _gdk_screen, 0);
|
||||
g_return_val_if_fail (num_monitor < _gdk_num_monitors, 0);
|
||||
g_return_val_if_fail (num_monitor >= 0, 0);
|
||||
|
||||
return g_strdup (_gdk_monitors[num_monitor].name);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
gint num_monitor,
|
||||
GdkRectangle *dest)
|
||||
gdk_win32_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
gint num_monitor,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
g_return_if_fail (screen == _gdk_screen);
|
||||
g_return_if_fail (num_monitor < _gdk_num_monitors);
|
||||
g_return_if_fail (num_monitor >= 0);
|
||||
|
||||
*dest = _gdk_monitors[num_monitor].rect;
|
||||
}
|
||||
@@ -140,16 +141,16 @@ gdk_win32_screen_get_rgba_visual (GdkScreen *screen)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static gint
|
||||
gdk_win32_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (screen == _gdk_screen, 0);
|
||||
|
||||
g_return_val_if_fail (screen == _gdk_screen, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
gchar *
|
||||
gchar *
|
||||
_gdk_windowing_substitute_screen_number (const gchar *display_name,
|
||||
int screen_number)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkkeysyms.h"
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
#include <X11/XKBlib.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define HAS_FOCUS(toplevel) \
|
||||
((toplevel)->has_focus || (toplevel)->has_pointer_focus)
|
||||
|
||||
+57
-177
@@ -252,39 +252,25 @@ translate_device_classes (GdkDisplay *display,
|
||||
g_object_thaw_notify (G_OBJECT (device));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_touch_device (XIAnyClassInfo **classes,
|
||||
guint n_classes,
|
||||
GdkInputSource *device_type,
|
||||
gint *num_touches)
|
||||
static gint
|
||||
count_device_touches (XIAnyClassInfo **classes,
|
||||
guint n_classes)
|
||||
{
|
||||
#ifdef XINPUT_2_2
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < n_classes; i++)
|
||||
{
|
||||
XITouchClassInfo *class = (XITouchClassInfo *) classes[i];
|
||||
XITouchClassInfo *valuator_info = (XITouchClassInfo *) classes[i];
|
||||
|
||||
if (class->type != XITouchClass)
|
||||
if (valuator_info->type != XITouchClass)
|
||||
continue;
|
||||
|
||||
if (class->num_touches > 0)
|
||||
{
|
||||
if (class->mode == XIDirectTouch)
|
||||
*device_type = GDK_SOURCE_TOUCHSCREEN;
|
||||
else if (class->mode == XIDependentTouch)
|
||||
*device_type = GDK_SOURCE_TOUCHPAD;
|
||||
else
|
||||
continue;
|
||||
|
||||
*num_touches = class->num_touches;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
return valuator_info->num_touches;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
@@ -293,17 +279,15 @@ create_device (GdkDeviceManager *device_manager,
|
||||
XIDeviceInfo *dev)
|
||||
{
|
||||
GdkInputSource input_source;
|
||||
GdkInputSource touch_source;
|
||||
GdkDeviceType type;
|
||||
GdkDevice *device;
|
||||
GdkInputMode mode;
|
||||
gint num_touches = 0;
|
||||
|
||||
if (dev->use == XIMasterKeyboard || dev->use == XISlaveKeyboard)
|
||||
input_source = GDK_SOURCE_KEYBOARD;
|
||||
else if (dev->use == XISlavePointer &&
|
||||
is_touch_device (dev->classes, dev->num_classes, &touch_source, &num_touches))
|
||||
input_source = touch_source;
|
||||
count_device_touches (dev->classes, dev->num_classes) > 0)
|
||||
input_source = GDK_SOURCE_TOUCH;
|
||||
else
|
||||
{
|
||||
gchar *tmp_name;
|
||||
@@ -317,7 +301,7 @@ create_device (GdkDeviceManager *device_manager,
|
||||
else if (strstr (tmp_name, "finger") ||
|
||||
(strstr (tmp_name, "touch") &&
|
||||
!strstr (tmp_name, "touchpad")))
|
||||
input_source = GDK_SOURCE_TOUCHSCREEN;
|
||||
input_source = GDK_SOURCE_TOUCH;
|
||||
else if (strstr (tmp_name, "wacom") ||
|
||||
strstr (tmp_name, "pen"))
|
||||
input_source = GDK_SOURCE_PEN;
|
||||
@@ -346,20 +330,6 @@ create_device (GdkDeviceManager *device_manager,
|
||||
break;
|
||||
}
|
||||
|
||||
GDK_NOTE (INPUT,
|
||||
({
|
||||
const gchar *type_names[] = { "master", "slave", "floating" };
|
||||
const gchar *source_names[] = { "mouse", "pen", "eraser", "cursor", "keyboard", "direct touch", "indirect touch" };
|
||||
const gchar *mode_names[] = { "disabled", "screen", "window" };
|
||||
g_message ("input device:\n\tname: %s\n\ttype: %s\n\tsource: %s\n\tmode: %s\n\thas cursor: %d\n\ttouches: %d",
|
||||
dev->name,
|
||||
type_names[type],
|
||||
source_names[input_source],
|
||||
mode_names[mode],
|
||||
dev->use == XIMasterPointer,
|
||||
num_touches);
|
||||
}));
|
||||
|
||||
device = g_object_new (GDK_TYPE_X11_DEVICE_XI2,
|
||||
"name", dev->name,
|
||||
"type", type,
|
||||
@@ -1140,6 +1110,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
break;
|
||||
case XI_ButtonPress:
|
||||
case XI_ButtonRelease:
|
||||
#ifdef XINPUT_2_2
|
||||
case XI_TouchBegin:
|
||||
case XI_TouchEnd:
|
||||
#endif /* XINPUT_2_2 */
|
||||
{
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkDevice *source_device;
|
||||
@@ -1177,7 +1151,14 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
}
|
||||
else
|
||||
{
|
||||
event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
|
||||
#ifdef XINPUT_2_2
|
||||
if (ev->evtype == XI_TouchBegin)
|
||||
event->button.type = GDK_TOUCH_PRESS;
|
||||
else if (ev->evtype == XI_TouchEnd)
|
||||
event->button.type = GDK_TOUCH_RELEASE;
|
||||
else
|
||||
#endif /* XINPUT_2_2 */
|
||||
event->button.type = (ev->evtype == XI_ButtonPress) ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
|
||||
|
||||
event->button.window = window;
|
||||
event->button.time = xev->time;
|
||||
@@ -1210,10 +1191,22 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
event->button.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
|
||||
event->button.button = xev->detail;
|
||||
if (ev->evtype == XI_TouchBegin)
|
||||
event->button.state |= GDK_BUTTON1_MASK;
|
||||
|
||||
#ifdef XINPUT_2_2
|
||||
if (ev->evtype == XI_TouchBegin ||
|
||||
ev->evtype == XI_TouchEnd)
|
||||
{
|
||||
event->button.button = 1;
|
||||
event->button.touch_id = xev->detail;
|
||||
}
|
||||
else
|
||||
#endif /* XINPUT_2_2 */
|
||||
event->button.button = xev->detail;
|
||||
}
|
||||
|
||||
if (xev->flags & XIPointerEmulated)
|
||||
if (xev->flags & (XIPointerEmulated | XITouchEmulatingPointer))
|
||||
_gdk_event_set_pointer_emulated (event, TRUE);
|
||||
|
||||
if (return_val == FALSE)
|
||||
@@ -1230,14 +1223,29 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case XI_Motion:
|
||||
#ifdef XINPUT_2_2
|
||||
case XI_TouchUpdate:
|
||||
#endif /* XINPUT_2_2 */
|
||||
{
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkDevice *source_device;
|
||||
|
||||
event->motion.type = GDK_MOTION_NOTIFY;
|
||||
if (ev->evtype == XI_Motion)
|
||||
{
|
||||
event->motion.touch_id = 0;
|
||||
event->motion.type = GDK_MOTION_NOTIFY;
|
||||
}
|
||||
#ifdef XINPUT_2_2
|
||||
else
|
||||
{
|
||||
event->motion.touch_id = xev->detail;
|
||||
event->motion.type = GDK_TOUCH_MOTION;
|
||||
}
|
||||
#endif
|
||||
|
||||
event->motion.window = window;
|
||||
|
||||
event->motion.time = xev->time;
|
||||
event->motion.x = (gdouble) xev->event_x;
|
||||
event->motion.y = (gdouble) xev->event_y;
|
||||
@@ -1253,7 +1261,10 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
|
||||
event->motion.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
|
||||
if (xev->flags & XIPointerEmulated)
|
||||
if (ev->evtype == XI_TouchUpdate)
|
||||
event->motion.state |= GDK_BUTTON1_MASK;
|
||||
|
||||
if (xev->flags & (XIPointerEmulated | XITouchEmulatingPointer))
|
||||
_gdk_event_set_pointer_emulated (event, TRUE);
|
||||
|
||||
/* There doesn't seem to be motion hints in XI */
|
||||
@@ -1275,137 +1286,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef XINPUT_2_2
|
||||
case XI_TouchBegin:
|
||||
case XI_TouchEnd:
|
||||
{
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkDevice *source_device;
|
||||
|
||||
GDK_NOTE(EVENTS,
|
||||
g_message ("touch %s:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %d",
|
||||
ev->evtype == XI_TouchBegin ? "begin" : "end",
|
||||
xev->event,
|
||||
xev->detail,
|
||||
xev->flags & XITouchEmulatingPointer));
|
||||
|
||||
if (ev->evtype == XI_TouchBegin)
|
||||
event->touch.type = GDK_TOUCH_BEGIN;
|
||||
else if (ev->evtype == XI_TouchEnd)
|
||||
event->touch.type = GDK_TOUCH_END;
|
||||
|
||||
event->touch.window = window;
|
||||
event->touch.time = xev->time;
|
||||
event->touch.x = (gdouble) xev->event_x;
|
||||
event->touch.y = (gdouble) xev->event_y;
|
||||
event->touch.x_root = (gdouble) xev->root_x;
|
||||
event->touch.y_root = (gdouble) xev->root_y;
|
||||
|
||||
event->touch.device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->touch.axes = translate_axes (event->touch.device,
|
||||
event->touch.x,
|
||||
event->touch.y,
|
||||
event->touch.window,
|
||||
&xev->valuators);
|
||||
|
||||
if (gdk_device_get_mode (event->touch.device) == GDK_MODE_WINDOW)
|
||||
{
|
||||
GdkDevice *device = event->touch.device;
|
||||
|
||||
/* Update event coordinates from axes */
|
||||
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_X, &event->touch.x);
|
||||
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_Y, &event->touch.y);
|
||||
}
|
||||
|
||||
event->touch.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
|
||||
if (ev->evtype == XI_TouchBegin)
|
||||
event->touch.state |= GDK_BUTTON1_MASK;
|
||||
|
||||
event->touch.sequence = GUINT_TO_POINTER (xev->detail);
|
||||
|
||||
if (xev->flags & XITouchEmulatingPointer)
|
||||
{
|
||||
event->touch.emulating_pointer = TRUE;
|
||||
_gdk_event_set_pointer_emulated (event, TRUE);
|
||||
}
|
||||
|
||||
if (return_val == FALSE)
|
||||
break;
|
||||
|
||||
if (!set_screen_from_root (display, event, xev->root))
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (ev->evtype == XI_TouchBegin)
|
||||
set_user_time (event);
|
||||
}
|
||||
break;
|
||||
|
||||
case XI_TouchUpdate:
|
||||
{
|
||||
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
|
||||
GdkDevice *source_device;
|
||||
|
||||
GDK_NOTE(EVENTS,
|
||||
g_message ("touch update:\twindow %ld\n\ttouch id: %u\n\tpointer emulating: %d",
|
||||
xev->event,
|
||||
xev->detail,
|
||||
xev->flags & XITouchEmulatingPointer));
|
||||
|
||||
event->touch.window = window;
|
||||
event->touch.sequence = GUINT_TO_POINTER (xev->detail);
|
||||
event->touch.type = GDK_TOUCH_UPDATE;
|
||||
event->touch.time = xev->time;
|
||||
event->touch.x = (gdouble) xev->event_x;
|
||||
event->touch.y = (gdouble) xev->event_y;
|
||||
event->touch.x_root = (gdouble) xev->root_x;
|
||||
event->touch.y_root = (gdouble) xev->root_y;
|
||||
|
||||
event->touch.device = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
gdk_event_set_source_device (event, source_device);
|
||||
|
||||
event->touch.state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
||||
|
||||
event->touch.state |= GDK_BUTTON1_MASK;
|
||||
|
||||
if (xev->flags & XITouchEmulatingPointer)
|
||||
{
|
||||
event->touch.emulating_pointer = TRUE;
|
||||
_gdk_event_set_pointer_emulated (event, TRUE);
|
||||
}
|
||||
|
||||
event->touch.axes = translate_axes (event->touch.device,
|
||||
event->touch.x,
|
||||
event->touch.y,
|
||||
event->touch.window,
|
||||
&xev->valuators);
|
||||
|
||||
if (gdk_device_get_mode (event->touch.device) == GDK_MODE_WINDOW)
|
||||
{
|
||||
GdkDevice *device = event->touch.device;
|
||||
|
||||
/* Update event coordinates from axes */
|
||||
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_X, &event->touch.x);
|
||||
gdk_device_get_axis (device, event->touch.axes, GDK_AXIS_Y, &event->touch.y);
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case XI_Enter:
|
||||
case XI_Leave:
|
||||
{
|
||||
|
||||
@@ -1403,7 +1403,7 @@ _gdk_x11_display_open (const gchar *display_name)
|
||||
XkbSelectEventDetails (display_x11->xdisplay,
|
||||
XkbUseCoreKbd, XkbStateNotify,
|
||||
XkbAllStateComponentsMask,
|
||||
XkbModifierStateMask|XkbGroupStateMask);
|
||||
XkbGroupLockMask|XkbModifierLockMask);
|
||||
|
||||
XkbSetDetectableAutoRepeat (display_x11->xdisplay,
|
||||
True,
|
||||
|
||||
+5
-26
@@ -77,8 +77,7 @@ struct _GdkX11Keymap
|
||||
guint have_direction : 1;
|
||||
guint have_lock_state : 1;
|
||||
guint caps_lock_state : 1;
|
||||
guint num_lock_state : 1;
|
||||
guint modifier_state;
|
||||
guint num_lock_state : 1;
|
||||
guint current_serial;
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
@@ -601,14 +600,12 @@ update_direction (GdkX11Keymap *keymap_x11,
|
||||
|
||||
static gboolean
|
||||
update_lock_state (GdkX11Keymap *keymap_x11,
|
||||
gint locked_mods,
|
||||
gint effective_mods)
|
||||
gint locked_mods)
|
||||
{
|
||||
XkbDescPtr xkb G_GNUC_UNUSED;
|
||||
gboolean have_lock_state;
|
||||
gboolean caps_lock_state;
|
||||
gboolean num_lock_state;
|
||||
guint modifier_state;
|
||||
|
||||
/* ensure keymap_x11->num_lock_mask is initialized */
|
||||
xkb = get_xkb (keymap_x11);
|
||||
@@ -616,18 +613,14 @@ update_lock_state (GdkX11Keymap *keymap_x11,
|
||||
have_lock_state = keymap_x11->have_lock_state;
|
||||
caps_lock_state = keymap_x11->caps_lock_state;
|
||||
num_lock_state = keymap_x11->num_lock_state;
|
||||
modifier_state = keymap_x11->modifier_state;
|
||||
|
||||
keymap_x11->have_lock_state = TRUE;
|
||||
keymap_x11->caps_lock_state = (locked_mods & GDK_LOCK_MASK) != 0;
|
||||
keymap_x11->num_lock_state = (locked_mods & keymap_x11->num_lock_mask) != 0;
|
||||
/* FIXME: sanitize this */
|
||||
keymap_x11->modifier_state = (guint)effective_mods;
|
||||
|
||||
return !have_lock_state
|
||||
|| (caps_lock_state != keymap_x11->caps_lock_state)
|
||||
|| (num_lock_state != keymap_x11->num_lock_state)
|
||||
|| (modifier_state != keymap_x11->modifier_state);
|
||||
|| (num_lock_state != keymap_x11->num_lock_state);
|
||||
}
|
||||
|
||||
/* keep this in sync with the XkbSelectEventDetails()
|
||||
@@ -647,9 +640,7 @@ _gdk_x11_keymap_state_changed (GdkDisplay *display,
|
||||
if (update_direction (keymap_x11, XkbStateGroup (&xkb_event->state)))
|
||||
g_signal_emit_by_name (keymap_x11, "direction-changed");
|
||||
|
||||
if (update_lock_state (keymap_x11,
|
||||
xkb_event->state.locked_mods,
|
||||
xkb_event->state.mods))
|
||||
if (update_lock_state (keymap_x11, xkb_event->state.locked_mods))
|
||||
g_signal_emit_by_name (keymap_x11, "state-changed");
|
||||
}
|
||||
}
|
||||
@@ -670,7 +661,7 @@ ensure_lock_state (GdkKeymap *keymap)
|
||||
XkbStateRec state_rec;
|
||||
|
||||
XkbGetState (GDK_DISPLAY_XDISPLAY (display), XkbUseCoreKbd, &state_rec);
|
||||
update_lock_state (keymap_x11, state_rec.locked_mods, state_rec.mods);
|
||||
update_lock_state (keymap_x11, state_rec.locked_mods);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_XKB */
|
||||
@@ -761,16 +752,6 @@ gdk_x11_keymap_get_num_lock_state (GdkKeymap *keymap)
|
||||
return keymap_x11->num_lock_state;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_x11_keymap_get_modifier_state (GdkKeymap *keymap)
|
||||
{
|
||||
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
||||
|
||||
ensure_lock_state (keymap);
|
||||
|
||||
return keymap_x11->modifier_state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
guint keyval,
|
||||
@@ -1509,7 +1490,6 @@ _gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap,
|
||||
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
||||
gint i;
|
||||
|
||||
update_keyrange (keymap_x11);
|
||||
if (keycode < keymap_x11->min_keycode ||
|
||||
keycode > keymap_x11->max_keycode)
|
||||
return FALSE;
|
||||
@@ -1599,7 +1579,6 @@ gdk_x11_keymap_class_init (GdkX11KeymapClass *klass)
|
||||
keymap_class->have_bidi_layouts = gdk_x11_keymap_have_bidi_layouts;
|
||||
keymap_class->get_caps_lock_state = gdk_x11_keymap_get_caps_lock_state;
|
||||
keymap_class->get_num_lock_state = gdk_x11_keymap_get_num_lock_state;
|
||||
keymap_class->get_modifier_state = gdk_x11_keymap_get_modifier_state;
|
||||
keymap_class->get_entries_for_keyval = gdk_x11_keymap_get_entries_for_keyval;
|
||||
keymap_class->get_entries_for_keycode = gdk_x11_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_x11_keymap_lookup_key;
|
||||
|
||||
+57
-8
@@ -93,42 +93,56 @@ gdk_x11_screen_init (GdkX11Screen *screen)
|
||||
static GdkDisplay *
|
||||
gdk_x11_screen_get_display (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_X11_SCREEN (screen)->display;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return WidthMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return HeightMMOfScreen (GDK_X11_SCREEN (screen)->xscreen);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_X11_SCREEN (screen)->screen_num;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_x11_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
return GDK_X11_SCREEN (screen)->root_window;
|
||||
}
|
||||
|
||||
@@ -198,21 +212,27 @@ gdk_x11_screen_finalize (GObject *object)
|
||||
static gint
|
||||
gdk_x11_screen_get_n_monitors (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_X11_SCREEN (screen)->n_monitors;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
|
||||
|
||||
return GDK_X11_SCREEN (screen)->primary_monitor;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_x11_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
gdk_x11_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num >= 0, -1);
|
||||
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
|
||||
|
||||
return x11_screen->monitors[monitor_num].width_mm;
|
||||
@@ -224,6 +244,8 @@ gdk_x11_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
|
||||
g_return_val_if_fail (monitor_num >= 0, -1);
|
||||
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, -1);
|
||||
|
||||
return x11_screen->monitors[monitor_num].height_mm;
|
||||
@@ -235,6 +257,8 @@ gdk_x11_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
g_return_val_if_fail (monitor_num >= 0, NULL);
|
||||
g_return_val_if_fail (monitor_num < x11_screen->n_monitors, NULL);
|
||||
|
||||
return g_strdup (x11_screen->monitors[monitor_num].output_name);
|
||||
@@ -273,6 +297,8 @@ gdk_x11_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
g_return_if_fail (GDK_IS_SCREEN (screen));
|
||||
g_return_if_fail (monitor_num >= 0);
|
||||
g_return_if_fail (monitor_num < x11_screen->n_monitors);
|
||||
|
||||
if (dest)
|
||||
@@ -389,7 +415,11 @@ gdk_x11_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
static GdkVisual *
|
||||
gdk_x11_screen_get_rgba_visual (GdkScreen *screen)
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
GdkX11Screen *x11_screen;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
return x11_screen->rgba_visual;
|
||||
}
|
||||
@@ -911,7 +941,11 @@ _gdk_x11_screen_setup (GdkScreen *screen)
|
||||
static gboolean
|
||||
gdk_x11_screen_is_composited (GdkScreen *screen)
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
GdkX11Screen *x11_screen;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
||||
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
return x11_screen->is_composited;
|
||||
}
|
||||
@@ -1059,6 +1093,8 @@ gdk_x11_screen_make_display_name (GdkScreen *screen)
|
||||
{
|
||||
const gchar *old_display;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
old_display = gdk_display_get_name (gdk_screen_get_display (screen));
|
||||
|
||||
return substitute_screen_number (old_display,
|
||||
@@ -1068,7 +1104,7 @@ gdk_x11_screen_make_display_name (GdkScreen *screen)
|
||||
static GdkWindow *
|
||||
gdk_x11_screen_get_active_window (GdkScreen *screen)
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
GdkX11Screen *x11_screen;
|
||||
GdkWindow *ret = NULL;
|
||||
Atom type_return;
|
||||
gint format_return;
|
||||
@@ -1076,10 +1112,14 @@ gdk_x11_screen_get_active_window (GdkScreen *screen)
|
||||
gulong bytes_after_return;
|
||||
guchar *data = NULL;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
if (!gdk_x11_screen_supports_net_wm_hint (screen,
|
||||
gdk_atom_intern_static_string ("_NET_ACTIVE_WINDOW")))
|
||||
return NULL;
|
||||
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
if (XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
|
||||
gdk_x11_get_xatom_by_name_for_display (x11_screen->display,
|
||||
"_NET_ACTIVE_WINDOW"),
|
||||
@@ -1109,7 +1149,7 @@ gdk_x11_screen_get_active_window (GdkScreen *screen)
|
||||
static GList *
|
||||
gdk_x11_screen_get_window_stack (GdkScreen *screen)
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
GdkX11Screen *x11_screen;
|
||||
GList *ret = NULL;
|
||||
Atom type_return;
|
||||
gint format_return;
|
||||
@@ -1117,10 +1157,14 @@ gdk_x11_screen_get_window_stack (GdkScreen *screen)
|
||||
gulong bytes_after_return;
|
||||
guchar *data = NULL;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
|
||||
if (!gdk_x11_screen_supports_net_wm_hint (screen,
|
||||
gdk_atom_intern_static_string ("_NET_CLIENT_LIST_STACKING")))
|
||||
return NULL;
|
||||
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
if (XGetWindowProperty (x11_screen->xdisplay, x11_screen->xroot_window,
|
||||
gdk_x11_get_xatom_by_name_for_display (x11_screen->display,
|
||||
"_NET_CLIENT_LIST_STACKING"),
|
||||
@@ -1175,14 +1219,19 @@ gdk_x11_screen_get_setting (GdkScreen *screen,
|
||||
const gchar *name,
|
||||
GValue *value)
|
||||
{
|
||||
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
const char *xsettings_name = NULL;
|
||||
XSettingsResult result;
|
||||
XSettingsSetting *setting = NULL;
|
||||
GdkX11Screen *x11_screen;
|
||||
gboolean success = FALSE;
|
||||
gint i;
|
||||
GValue tmp_val = G_VALUE_INIT;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
|
||||
|
||||
x11_screen = GDK_X11_SCREEN (screen);
|
||||
|
||||
for (i = 0; i < GDK_SETTINGS_N_ELEMENTS(); i++)
|
||||
if (strcmp (GDK_SETTINGS_GDK_NAME (i), name) == 0)
|
||||
{
|
||||
@@ -1697,7 +1746,7 @@ gdk_x11_screen_class_init (GdkX11ScreenClass *klass)
|
||||
screen_class->list_visuals = _gdk_x11_screen_list_visuals;
|
||||
|
||||
signals[WINDOW_MANAGER_CHANGED] =
|
||||
g_signal_new (g_intern_static_string ("window-manager-changed"),
|
||||
g_signal_new (g_intern_static_string ("window_manager_changed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GdkX11ScreenClass, window_manager_changed),
|
||||
|
||||
@@ -249,6 +249,7 @@ gtk_public_h_sources = \
|
||||
gtkfontchooserdialog.h \
|
||||
gtkfontchooserwidget.h \
|
||||
gtkframe.h \
|
||||
gtkgesturesinterpreter.h \
|
||||
gtkgradient.h \
|
||||
gtkgrid.h \
|
||||
gtkiconfactory.h \
|
||||
@@ -657,6 +658,7 @@ gtk_base_c_sources = \
|
||||
gtkfontchooserutils.c \
|
||||
gtkfontchooserwidget.c \
|
||||
gtkframe.c \
|
||||
gtkgesturesinterpreter.c \
|
||||
gtkgradient.c \
|
||||
gtkgrid.c \
|
||||
gtkiconcache.c \
|
||||
|
||||
@@ -1807,7 +1807,7 @@ _gtk_tree_view_accessible_toggle_visibility (GtkTreeView *treeview,
|
||||
id);
|
||||
}
|
||||
|
||||
static GtkTreeViewColumn *
|
||||
GtkTreeViewColumn *
|
||||
get_effective_focus_column (GtkTreeView *treeview,
|
||||
GtkTreeViewColumn *column)
|
||||
{
|
||||
|
||||
@@ -423,6 +423,81 @@ hsv_to_rgb (gdouble *h,
|
||||
}
|
||||
}
|
||||
|
||||
/* Converts from RGB to HSV */
|
||||
static void
|
||||
rgb_to_hsv (gdouble *r,
|
||||
gdouble *g,
|
||||
gdouble *b)
|
||||
{
|
||||
gdouble red, green, blue;
|
||||
gdouble h, s, v;
|
||||
gdouble min, max;
|
||||
gdouble delta;
|
||||
|
||||
red = *r;
|
||||
green = *g;
|
||||
blue = *b;
|
||||
|
||||
h = 0.0;
|
||||
|
||||
if (red > green)
|
||||
{
|
||||
if (red > blue)
|
||||
max = red;
|
||||
else
|
||||
max = blue;
|
||||
|
||||
if (green < blue)
|
||||
min = green;
|
||||
else
|
||||
min = blue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (green > blue)
|
||||
max = green;
|
||||
else
|
||||
max = blue;
|
||||
|
||||
if (red < blue)
|
||||
min = red;
|
||||
else
|
||||
min = blue;
|
||||
}
|
||||
|
||||
v = max;
|
||||
|
||||
if (max != 0.0)
|
||||
s = (max - min) / max;
|
||||
else
|
||||
s = 0.0;
|
||||
|
||||
if (s == 0.0)
|
||||
h = 0.0;
|
||||
else
|
||||
{
|
||||
delta = max - min;
|
||||
|
||||
if (red == max)
|
||||
h = (green - blue) / delta;
|
||||
else if (green == max)
|
||||
h = 2 + (blue - red) / delta;
|
||||
else if (blue == max)
|
||||
h = 4 + (red - green) / delta;
|
||||
|
||||
h /= 6.0;
|
||||
|
||||
if (h < 0.0)
|
||||
h += 1.0;
|
||||
else if (h > 1.0)
|
||||
h -= 1.0;
|
||||
}
|
||||
|
||||
*r = h;
|
||||
*g = s;
|
||||
*b = v;
|
||||
}
|
||||
|
||||
/* Computes the vertices of the saturation/value triangle */
|
||||
static void
|
||||
compute_triangle (GtkHSV *hsv,
|
||||
|
||||
+24
-20
@@ -20,19 +20,28 @@
|
||||
* {
|
||||
color: @fg_color;
|
||||
border-color: shade (@bg_color, 0.6);
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
GtkWindow, .button, .slider {
|
||||
background-color: @bg_color;
|
||||
}
|
||||
|
||||
*:prelight {
|
||||
background-color: shade (@bg_color, 1.05);
|
||||
color: shade (@fg_color, 1.3);
|
||||
}
|
||||
|
||||
*:selected {
|
||||
background-color: @selected_bg_color;
|
||||
color: @selected_fg_color;
|
||||
}
|
||||
|
||||
.expander, GtkTreeView.view.expander {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.expander:hover,
|
||||
GtkTreeView.view.expander:selected:hover {
|
||||
.expander:prelight,
|
||||
GtkTreeView.view.expander:selected:prelight {
|
||||
color: @text_color;
|
||||
}
|
||||
|
||||
@@ -46,16 +55,6 @@ GtkTreeView.view.expander:selected:hover {
|
||||
color: shade (@bg_color, 0.7);
|
||||
}
|
||||
|
||||
.entry:selected {
|
||||
background-color: shade (@bg_color, 0.9);
|
||||
color: @fg_color;
|
||||
}
|
||||
|
||||
.entry:selected:focused {
|
||||
background-color: @selected_bg_color;
|
||||
color: @selected_fg_color;
|
||||
}
|
||||
|
||||
.view {
|
||||
border-width: 0;
|
||||
border-radius: 0;
|
||||
@@ -73,23 +72,23 @@ GtkTreeView.view.expander:selected:hover {
|
||||
}
|
||||
|
||||
.view column:sorted row,
|
||||
.view column:sorted row:hover {
|
||||
.view column:sorted row:prelight {
|
||||
background-color: shade (@bg_color, 0.85);
|
||||
}
|
||||
|
||||
.view column:sorted row:nth-child(odd),
|
||||
.view column:sorted row:nth-child(odd):hover {
|
||||
.view column:sorted row:nth-child(odd):prelight {
|
||||
background-color: shade (@bg_color, 0.8);
|
||||
}
|
||||
|
||||
.view row,
|
||||
.view row:hover {
|
||||
.view row:prelight {
|
||||
background-color: @base_color;
|
||||
color: @text_color;
|
||||
}
|
||||
|
||||
.view row:nth-child(odd),
|
||||
.view row:nth-child(odd):hover {
|
||||
.view row:nth-child(odd):prelight {
|
||||
background-color: shade (@base_color, 0.93);
|
||||
}
|
||||
|
||||
@@ -145,9 +144,8 @@ GtkTreeView.view.expander:selected:hover {
|
||||
border-style: inset;
|
||||
}
|
||||
|
||||
.spinbutton.button:hover,
|
||||
.button:hover,
|
||||
.slider:hover {
|
||||
.button:prelight,
|
||||
.slider:prelight {
|
||||
background-color: @selected_bg_color;
|
||||
color: @selected_fg_color;
|
||||
border-color: shade (@selected_bg_color, 0.7);
|
||||
@@ -364,3 +362,9 @@ GtkCalendar.button:hover {
|
||||
border-width: 0;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.press-and-hold {
|
||||
background-color: alpha (@bg_color, 0.5);
|
||||
color: alpha (lighter (@selected_bg_color), 0.8);
|
||||
border-width: 10;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@
|
||||
#include <gtk/gtkfontchooserdialog.h>
|
||||
#include <gtk/gtkfontchooserwidget.h>
|
||||
#include <gtk/gtkframe.h>
|
||||
#include <gtk/gtkgesturesinterpreter.h>
|
||||
#include <gtk/gtkgradient.h>
|
||||
#include <gtk/gtkgrid.h>
|
||||
#include <gtk/gtkiconfactory.h>
|
||||
|
||||
+6
-9
@@ -227,6 +227,8 @@ gtk_app_chooser_widget_set_show_other
|
||||
gtk_app_chooser_widget_set_show_recommended
|
||||
gtk_application_add_accelerator
|
||||
gtk_application_add_window
|
||||
gtk_application_end_session
|
||||
gtk_application_end_session_style_get_type
|
||||
gtk_application_get_app_menu
|
||||
gtk_application_get_menubar
|
||||
gtk_application_get_type
|
||||
@@ -603,14 +605,13 @@ gtk_color_button_set_color
|
||||
gtk_color_button_set_rgba
|
||||
gtk_color_button_set_title
|
||||
gtk_color_button_set_use_alpha
|
||||
gtk_color_chooser_add_palette
|
||||
gtk_color_chooser_dialog_get_type
|
||||
gtk_color_chooser_dialog_new
|
||||
gtk_color_chooser_get_rgba
|
||||
gtk_color_chooser_get_use_alpha
|
||||
gtk_color_chooser_get_color
|
||||
gtk_color_chooser_get_show_alpha
|
||||
gtk_color_chooser_get_type
|
||||
gtk_color_chooser_set_rgba
|
||||
gtk_color_chooser_set_use_alpha
|
||||
gtk_color_chooser_set_color
|
||||
gtk_color_chooser_set_show_alpha
|
||||
gtk_color_chooser_widget_get_type
|
||||
gtk_color_chooser_widget_new
|
||||
gtk_color_selection_dialog_get_color_selection
|
||||
@@ -2367,8 +2368,6 @@ gtk_scrollbar_new
|
||||
gtk_scrolled_window_add_with_viewport
|
||||
gtk_scrolled_window_get_hadjustment
|
||||
gtk_scrolled_window_get_hscrollbar
|
||||
gtk_scrolled_window_get_kinetic_scrolling
|
||||
gtk_scrolled_window_get_capture_button_press
|
||||
gtk_scrolled_window_get_min_content_height
|
||||
gtk_scrolled_window_get_min_content_width
|
||||
gtk_scrolled_window_get_placement
|
||||
@@ -2379,8 +2378,6 @@ gtk_scrolled_window_get_vadjustment
|
||||
gtk_scrolled_window_get_vscrollbar
|
||||
gtk_scrolled_window_new
|
||||
gtk_scrolled_window_set_hadjustment
|
||||
gtk_scrolled_window_set_kinetic_scrolling
|
||||
gtk_scrolled_window_set_capture_button_press
|
||||
gtk_scrolled_window_set_min_content_height
|
||||
gtk_scrolled_window_set_min_content_width
|
||||
gtk_scrolled_window_set_placement
|
||||
|
||||
+168
-4
@@ -110,6 +110,12 @@
|
||||
* property) and offers various functionality related to the session
|
||||
* life-cycle.
|
||||
*
|
||||
* An application can be informed when the session is about to end
|
||||
* by connecting to the #GtkApplication::quit signal.
|
||||
*
|
||||
* An application can request the session to be ended by calling
|
||||
* gtk_application_end_session().
|
||||
*
|
||||
* An application can block various ways to end the session with
|
||||
* the gtk_application_inhibit() function. Typical use cases for
|
||||
* this kind of inhibiting are long-running, uninterruptible operations,
|
||||
@@ -122,6 +128,7 @@
|
||||
enum {
|
||||
WINDOW_ADDED,
|
||||
WINDOW_REMOVED,
|
||||
QUIT,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -676,6 +683,13 @@ gtk_application_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_quit (GtkApplication *app)
|
||||
{
|
||||
/* we are asked to quit, so don't linger */
|
||||
g_application_set_inactivity_timeout (G_APPLICATION (app), 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_finalize (GObject *object)
|
||||
{
|
||||
@@ -706,6 +720,7 @@ gtk_application_class_init (GtkApplicationClass *class)
|
||||
|
||||
class->window_added = gtk_application_window_added;
|
||||
class->window_removed = gtk_application_window_removed;
|
||||
class->quit = gtk_application_quit;
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkApplicationPrivate));
|
||||
|
||||
@@ -744,10 +759,38 @@ gtk_application_class_init (GtkApplicationClass *class)
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, GTK_TYPE_WINDOW);
|
||||
|
||||
/**
|
||||
* GtkApplication::quit:
|
||||
* @application: the #GtkApplication
|
||||
*
|
||||
* Emitted when the session manager wants the application to quit
|
||||
* (generally because the user is logging out). The application
|
||||
* should exit as soon as possible after receiving this signal; if
|
||||
* it does not, the session manager may choose to forcibly kill it.
|
||||
*
|
||||
* Normally, an application would only be sent a ::quit if there
|
||||
* are no inhibitors (see gtk_application_inhibit()).
|
||||
* However, this is not guaranteed; in some situations the
|
||||
* session manager may decide to end the session without giving
|
||||
* applications a chance to object.
|
||||
*
|
||||
* To receive this signal, you need to set the
|
||||
* #GtkApplication:register-session property
|
||||
* when creating the application object.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
gtk_application_signals[QUIT] =
|
||||
g_signal_new ("quit", GTK_TYPE_APPLICATION, G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GtkApplicationClass, quit),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkApplication:register-session:
|
||||
*
|
||||
* Set this property to %TRUE to register with the session manager.
|
||||
* Set this property to %TRUE to register with the session manager
|
||||
* and receive the #GtkApplication::quit signal when the session
|
||||
* is about to end.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
@@ -1189,13 +1232,13 @@ client_proxy_signal (GDBusProxy *proxy,
|
||||
g_debug ("Received EndSession");
|
||||
gtk_application_quit_response (app, TRUE, NULL);
|
||||
unregister_client (app);
|
||||
g_application_quit (G_APPLICATION (app));
|
||||
g_signal_emit (app, gtk_application_signals[QUIT], 0);
|
||||
}
|
||||
else if (strcmp (signal_name, "Stop") == 0)
|
||||
{
|
||||
g_debug ("Received Stop");
|
||||
unregister_client (app);
|
||||
g_application_quit (G_APPLICATION (app));
|
||||
g_signal_emit (app, gtk_application_signals[QUIT], 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1456,6 +1499,67 @@ gtk_application_is_inhibited (GtkApplication *application,
|
||||
return inhibited;
|
||||
}
|
||||
|
||||
/**
|
||||
* GtkApplicationEndSessionStyle:
|
||||
* @GTK_APPLICATION_LOGOUT: End the session by logging out
|
||||
* @GTK_APPLICATION_REBOOT: Restart the computer
|
||||
* @GTK_APPLICATION_SHUTDOWN: Shut the computer down
|
||||
*
|
||||
* Different ways to end a user session, for use with
|
||||
* gtk_application_end_session().
|
||||
*/
|
||||
|
||||
/**
|
||||
* gtk_application_end_session:
|
||||
* @application: the #GtkApplication
|
||||
* @style: the desired kind of session end
|
||||
* @request_confirmation: whether or not the user should get a chance
|
||||
* to confirm the action
|
||||
*
|
||||
* Requests that the session manager end the current session.
|
||||
* @style indicates how the session should be ended, and
|
||||
* @request_confirmation indicates whether or not the user should be
|
||||
* given a chance to confirm the action. Both of these parameters are
|
||||
* merely hints though; the session manager may choose to ignore them.
|
||||
*
|
||||
* Return value: %TRUE if the request was sent; %FALSE if it could not
|
||||
* be sent (eg, because it could not connect to the session manager)
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
gboolean
|
||||
gtk_application_end_session (GtkApplication *application,
|
||||
GtkApplicationEndSessionStyle style,
|
||||
gboolean request_confirmation)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_APPLICATION (application), FALSE);
|
||||
g_return_val_if_fail (!g_application_get_is_remote (G_APPLICATION (application)), FALSE);
|
||||
g_return_val_if_fail (application->priv->sm_proxy != NULL, FALSE);
|
||||
|
||||
switch (style)
|
||||
{
|
||||
case GTK_APPLICATION_LOGOUT:
|
||||
g_dbus_proxy_call (application->priv->sm_proxy,
|
||||
"Logout",
|
||||
g_variant_new ("(u)", request_confirmation ? 0 : 1),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
G_MAXINT,
|
||||
NULL, NULL, NULL);
|
||||
break;
|
||||
case GTK_APPLICATION_REBOOT:
|
||||
case GTK_APPLICATION_SHUTDOWN:
|
||||
g_dbus_proxy_call (application->priv->sm_proxy,
|
||||
"Shutdown",
|
||||
NULL,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
G_MAXINT,
|
||||
NULL, NULL, NULL);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#elif defined(GDK_WINDOWING_QUARTZ)
|
||||
|
||||
/* OS X implementation copied from EggSMClient, but simplified since
|
||||
@@ -1468,7 +1572,7 @@ idle_will_quit (gpointer data)
|
||||
GtkApplication *app = data;
|
||||
|
||||
if (app->priv->quit_inhibit == 0)
|
||||
g_application_quit (G_APPLICATION (app));
|
||||
g_signal_emit (app, gtk_application_signals[QUIT], 0);
|
||||
else
|
||||
{
|
||||
GtkApplicationQuartzInhibitor *inhibitor;
|
||||
@@ -1579,6 +1683,58 @@ gtk_application_is_inhibited (GtkApplication *application,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_application_end_session (GtkApplication *application,
|
||||
GtkApplicationEndSessionStyle style,
|
||||
gboolean request_confirmation)
|
||||
{
|
||||
static const ProcessSerialNumber loginwindow_psn = { 0, kSystemProcess };
|
||||
AppleEvent event = { typeNull, NULL };
|
||||
AppleEvent reply = { typeNull, NULL };
|
||||
AEAddressDesc target;
|
||||
AEEventID id;
|
||||
OSErr err;
|
||||
|
||||
switch (style)
|
||||
{
|
||||
case GTK_APPLICATION_LOGOUT:
|
||||
id = request_confirmation ? kAELogOut : kAEReallyLogOut;
|
||||
break;
|
||||
case GTK_APPLICATION_REBOOT:
|
||||
id = request_confirmation ? kAEShowRestartDialog : kAERestart;
|
||||
break;
|
||||
case GTK_APPLICATION_SHUTDOWN:
|
||||
id = request_confirmation ? kAEShowShutdownDialog : kAEShutDown;
|
||||
break;
|
||||
}
|
||||
|
||||
err = AECreateDesc (typeProcessSerialNumber, &loginwindow_psn,
|
||||
sizeof (loginwindow_psn), &target);
|
||||
if (err != noErr)
|
||||
{
|
||||
g_warning ("Could not create descriptor for loginwindow: %d", err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
err = AECreateAppleEvent (kCoreEventClass, id, &target,
|
||||
kAutoGenerateReturnID, kAnyTransactionID,
|
||||
&event);
|
||||
AEDisposeDesc (&target);
|
||||
if (err != noErr)
|
||||
{
|
||||
g_warning ("Could not create logout AppleEvent: %d", err);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
err = AESend (&event, &reply, kAENoReply, kAENormalPriority,
|
||||
kAEDefaultTimeout, NULL, NULL);
|
||||
AEDisposeDesc (&event);
|
||||
if (err == noErr)
|
||||
AEDisposeDesc (&reply);
|
||||
|
||||
return err == noErr;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Trivial implementation.
|
||||
@@ -1609,4 +1765,12 @@ gtk_application_is_inhibited (GtkApplication *application,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_application_end_session (GtkApplication *application,
|
||||
GtkApplicationEndSessionStyle style,
|
||||
gboolean request_confirmation)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+13
-1
@@ -59,8 +59,10 @@ struct _GtkApplicationClass
|
||||
void (*window_removed) (GtkApplication *application,
|
||||
GtkWindow *window);
|
||||
|
||||
void (*quit) (GtkApplication *application);
|
||||
|
||||
/*< private >*/
|
||||
gpointer padding[12];
|
||||
gpointer padding[11];
|
||||
};
|
||||
|
||||
GType gtk_application_get_type (void) G_GNUC_CONST;
|
||||
@@ -108,6 +110,16 @@ void gtk_application_uninhibit (GtkApplication
|
||||
gboolean gtk_application_is_inhibited (GtkApplication *application,
|
||||
GtkApplicationInhibitFlags flags);
|
||||
|
||||
typedef enum {
|
||||
GTK_APPLICATION_LOGOUT,
|
||||
GTK_APPLICATION_REBOOT,
|
||||
GTK_APPLICATION_SHUTDOWN
|
||||
} GtkApplicationEndSessionStyle;
|
||||
|
||||
gboolean gtk_application_end_session (GtkApplication *application,
|
||||
GtkApplicationEndSessionStyle style,
|
||||
gboolean request_confirmation);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_APPLICATION_H__ */
|
||||
|
||||
+7
-32
@@ -124,8 +124,6 @@ static gint gtk_button_button_press (GtkWidget * widget,
|
||||
GdkEventButton * event);
|
||||
static gint gtk_button_button_release (GtkWidget * widget,
|
||||
GdkEventButton * event);
|
||||
static gboolean gtk_button_touch (GtkWidget *widget,
|
||||
GdkEventTouch *event);
|
||||
static gint gtk_button_grab_broken (GtkWidget * widget,
|
||||
GdkEventGrabBroken * event);
|
||||
static gint gtk_button_key_release (GtkWidget * widget, GdkEventKey * event);
|
||||
@@ -211,7 +209,6 @@ gtk_button_class_init (GtkButtonClass *klass)
|
||||
widget_class->draw = gtk_button_draw;
|
||||
widget_class->button_press_event = gtk_button_button_press;
|
||||
widget_class->button_release_event = gtk_button_button_release;
|
||||
widget_class->touch_event = gtk_button_touch;
|
||||
widget_class->grab_broken_event = gtk_button_grab_broken;
|
||||
widget_class->key_release_event = gtk_button_key_release;
|
||||
widget_class->enter_notify_event = gtk_button_enter_notify;
|
||||
@@ -1434,10 +1431,9 @@ gtk_button_realize (GtkWidget *widget)
|
||||
attributes.wclass = GDK_INPUT_ONLY;
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_TOUCH_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK);
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK);
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||
|
||||
@@ -1817,7 +1813,8 @@ gtk_button_button_press (GtkWidget *widget,
|
||||
GtkButton *button;
|
||||
GtkButtonPrivate *priv;
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS)
|
||||
if (event->type == GDK_BUTTON_PRESS ||
|
||||
event->type == GDK_TOUCH_PRESS)
|
||||
{
|
||||
button = GTK_BUTTON (widget);
|
||||
priv = button->priv;
|
||||
@@ -1847,28 +1844,6 @@ gtk_button_button_release (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_button_touch (GtkWidget *widget,
|
||||
GdkEventTouch *event)
|
||||
{
|
||||
GtkButton *button = GTK_BUTTON (widget);
|
||||
GtkButtonPrivate *priv = button->priv;
|
||||
|
||||
if (event->type == GDK_TOUCH_BEGIN)
|
||||
{
|
||||
if (priv->focus_on_click && !gtk_widget_has_focus (widget))
|
||||
gtk_widget_grab_focus (widget);
|
||||
|
||||
g_signal_emit (button, button_signals[PRESSED], 0);
|
||||
}
|
||||
else if (event->type == GDK_TOUCH_END)
|
||||
{
|
||||
g_signal_emit (button, button_signals[RELEASED], 0);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_button_grab_broken (GtkWidget *widget,
|
||||
GdkEventGrabBroken *event)
|
||||
@@ -1972,8 +1947,8 @@ touch_release_in_button (GtkButton *button)
|
||||
if (!event)
|
||||
return FALSE;
|
||||
|
||||
if (event->type != GDK_TOUCH_END ||
|
||||
event->touch.window != priv->event_window)
|
||||
if (event->type != GDK_TOUCH_RELEASE ||
|
||||
event->button.window != priv->event_window)
|
||||
{
|
||||
gdk_event_free (event);
|
||||
return FALSE;
|
||||
|
||||
@@ -276,7 +276,7 @@ scale_round (gdouble value, gdouble scale)
|
||||
return (guint)value;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gchar *
|
||||
accessible_color_name (GdkRGBA *color)
|
||||
{
|
||||
if (color->alpha < 1.0)
|
||||
@@ -510,7 +510,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
|
||||
gtk_box_pack_end (GTK_BOX (cc->priv->palette), label, FALSE, TRUE, 0);
|
||||
|
||||
cc->priv->button = button = gtk_color_swatch_new ();
|
||||
gtk_widget_set_name (button, "add-color-button");
|
||||
atk_obj = gtk_widget_get_accessible (button);
|
||||
atk_object_set_role (atk_obj, ATK_ROLE_PUSH_BUTTON);
|
||||
atk_object_set_description (atk_obj, _("Create custom color"));
|
||||
|
||||
+13
-81
@@ -44,8 +44,6 @@ struct _GtkColorSwatchPrivate
|
||||
guint contains_pointer : 1;
|
||||
guint use_alpha : 1;
|
||||
guint selectable : 1;
|
||||
|
||||
GdkWindow *event_window;
|
||||
};
|
||||
|
||||
enum
|
||||
@@ -74,8 +72,11 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
GtkColorSwatchPrivate);
|
||||
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE);
|
||||
gtk_widget_set_has_window (GTK_WIDGET (swatch), FALSE);
|
||||
|
||||
gtk_widget_set_events (GTK_WIDGET (swatch), GDK_BUTTON_PRESS_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_EXPOSURE_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK);
|
||||
swatch->priv->use_alpha = TRUE;
|
||||
swatch->priv->selectable = TRUE;
|
||||
}
|
||||
@@ -375,8 +376,6 @@ swatch_enter_notify (GtkWidget *widget,
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
swatch->priv->contains_pointer = TRUE;
|
||||
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_PRELIGHT, FALSE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -386,8 +385,6 @@ swatch_leave_notify (GtkWidget *widget,
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
swatch->priv->contains_pointer = FALSE;
|
||||
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_PRELIGHT);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -513,93 +510,32 @@ swatch_button_release (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_map (GtkWidget *widget)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->map (widget);
|
||||
|
||||
if (swatch->priv->event_window)
|
||||
gdk_window_show (swatch->priv->event_window);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_unmap (GtkWidget *widget)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
|
||||
if (swatch->priv->event_window)
|
||||
gdk_window_hide (swatch->priv->event_window);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
GtkAllocation allocation;
|
||||
GdkWindow *window;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gtk_widget_set_realized (widget, TRUE);
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = allocation.x;
|
||||
attributes.y = allocation.y;
|
||||
attributes.width = allocation.width;
|
||||
attributes.height = allocation.height;
|
||||
attributes.wclass = GDK_INPUT_ONLY;
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK |
|
||||
GDK_LEAVE_NOTIFY_MASK);
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
window = gtk_widget_get_parent_window (widget);
|
||||
window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (window, widget);
|
||||
gtk_widget_set_window (widget, window);
|
||||
g_object_ref (window);
|
||||
|
||||
swatch->priv->event_window =
|
||||
gdk_window_new (window,
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (swatch->priv->event_window, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
|
||||
if (swatch->priv->event_window)
|
||||
{
|
||||
gdk_window_set_user_data (swatch->priv->event_window, NULL);
|
||||
gdk_window_destroy (swatch->priv->event_window);
|
||||
swatch->priv->event_window = NULL;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_color_swatch_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
swatch_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
|
||||
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
if (gtk_widget_get_realized (widget))
|
||||
gdk_window_move_resize (swatch->priv->event_window,
|
||||
allocation->x,
|
||||
allocation->y,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -690,10 +626,6 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
|
||||
widget_class->enter_notify_event = swatch_enter_notify;
|
||||
widget_class->leave_notify_event = swatch_leave_notify;
|
||||
widget_class->realize = swatch_realize;
|
||||
widget_class->unrealize = swatch_unrealize;
|
||||
widget_class->map = swatch_map;
|
||||
widget_class->unmap = swatch_unmap;
|
||||
widget_class->size_allocate = swatch_size_allocate;
|
||||
|
||||
signals[ACTIVATE] =
|
||||
g_signal_new ("activate",
|
||||
|
||||
+80
-53
@@ -483,6 +483,11 @@ static void gtk_entry_toggle_overwrite (GtkEntry *entry);
|
||||
static void gtk_entry_select_all (GtkEntry *entry);
|
||||
static void gtk_entry_real_activate (GtkEntry *entry);
|
||||
static gboolean gtk_entry_popup_menu (GtkWidget *widget);
|
||||
static gboolean gtk_entry_press_and_hold (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static void keymap_direction_changed (GdkKeymap *keymap,
|
||||
GtkEntry *entry);
|
||||
@@ -546,7 +551,9 @@ static void gtk_entry_paste (GtkEntry *entry,
|
||||
GdkAtom selection);
|
||||
static void gtk_entry_update_primary_selection (GtkEntry *entry);
|
||||
static void gtk_entry_do_popup (GtkEntry *entry,
|
||||
GdkEventButton *event);
|
||||
GdkDevice *device,
|
||||
guint32 _time,
|
||||
guint button);
|
||||
static gboolean gtk_entry_mnemonic_activate (GtkWidget *widget,
|
||||
gboolean group_cycling);
|
||||
static void gtk_entry_grab_notify (GtkWidget *widget,
|
||||
@@ -705,6 +712,7 @@ gtk_entry_class_init (GtkEntryClass *class)
|
||||
widget_class->drag_data_delete = gtk_entry_drag_data_delete;
|
||||
|
||||
widget_class->popup_menu = gtk_entry_popup_menu;
|
||||
widget_class->press_and_hold = gtk_entry_press_and_hold;
|
||||
|
||||
class->move_cursor = gtk_entry_move_cursor;
|
||||
class->insert_at_cursor = gtk_entry_insert_at_cursor;
|
||||
@@ -3528,41 +3536,21 @@ get_progress_area (GtkWidget *widget,
|
||||
GtkEntry *entry = GTK_ENTRY (widget);
|
||||
GtkEntryPrivate *private = entry->priv;
|
||||
GtkStyleContext *context;
|
||||
GtkBorder margin, border, entry_borders;
|
||||
gint frame_width, text_area_width, text_area_height;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
_gtk_entry_get_borders (entry, &entry_borders);
|
||||
get_text_area_size (entry,
|
||||
NULL, NULL,
|
||||
&text_area_width, &text_area_height);
|
||||
get_frame_size (entry, FALSE,
|
||||
NULL, NULL,
|
||||
&frame_width, NULL);
|
||||
GtkBorder margin;
|
||||
|
||||
get_frame_size (GTK_ENTRY (widget), FALSE, NULL, NULL, width, height);
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
*width = text_area_width + entry_borders.left + entry_borders.right;
|
||||
*height = text_area_height + entry_borders.top + entry_borders.bottom;
|
||||
|
||||
/* if the text area got resized by a subclass, subtract the left/right
|
||||
* border width, so that the progress bar won't extend over the resized
|
||||
* text area.
|
||||
*/
|
||||
if (frame_width > *width)
|
||||
if (!private->interior_focus)
|
||||
{
|
||||
gtk_style_context_get_border (context, 0, &border);
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (entry)) == GTK_TEXT_DIR_RTL)
|
||||
{
|
||||
*x = (frame_width - *width) + border.left;
|
||||
*width -= border.left;
|
||||
}
|
||||
else
|
||||
{
|
||||
*width -= border.right;
|
||||
}
|
||||
*x -= private->focus_width;
|
||||
*y -= private->focus_width;
|
||||
*width += 2 * private->focus_width;
|
||||
*height += 2 * private->focus_width;
|
||||
}
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_entry_prepare_context_for_progress (entry, context);
|
||||
gtk_style_context_get_margin (context, 0, &margin);
|
||||
|
||||
@@ -3848,7 +3836,8 @@ gtk_entry_button_press (GtkWidget *widget,
|
||||
|
||||
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
|
||||
{
|
||||
gtk_entry_do_popup (entry, event);
|
||||
gtk_entry_do_popup (entry, event->device,
|
||||
event->time, event->button);
|
||||
priv->button = 0; /* Don't wait for release, since the menu will gtk_grab_add */
|
||||
priv->device = NULL;
|
||||
|
||||
@@ -5898,14 +5887,12 @@ gtk_entry_draw_cursor (GtkEntry *entry,
|
||||
gboolean block_at_line_end;
|
||||
PangoLayout *layout;
|
||||
const char *text;
|
||||
gint x, y;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
layout = gtk_entry_ensure_layout (entry, TRUE);
|
||||
text = pango_layout_get_text (layout);
|
||||
cursor_index = g_utf8_offset_to_pointer (text, priv->current_pos + priv->preedit_cursor) - text;
|
||||
get_layout_position (entry, &x, &y);
|
||||
|
||||
if (!priv->overwrite_mode)
|
||||
block = FALSE;
|
||||
@@ -5916,16 +5903,19 @@ gtk_entry_draw_cursor (GtkEntry *entry,
|
||||
if (!block)
|
||||
{
|
||||
gtk_render_insertion_cursor (context, cr,
|
||||
x, y,
|
||||
- priv->scroll_offset, 0,
|
||||
layout, cursor_index, priv->resolved_dir);
|
||||
}
|
||||
else /* overwrite_mode */
|
||||
{
|
||||
GdkRGBA cursor_color;
|
||||
GdkRectangle rect;
|
||||
gint x, y;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
get_layout_position (entry, &x, &y);
|
||||
|
||||
rect.x = PANGO_PIXELS (cursor_rect.x) + x;
|
||||
rect.y = PANGO_PIXELS (cursor_rect.y) + y;
|
||||
rect.width = PANGO_PIXELS (cursor_rect.width);
|
||||
@@ -8803,15 +8793,17 @@ popup_targets_received (GtkClipboard *clipboard,
|
||||
info_entry_priv->popup_menu);
|
||||
|
||||
|
||||
if (info->device)
|
||||
if (gdk_device_get_source (info->device) != GDK_SOURCE_KEYBOARD)
|
||||
gtk_menu_popup_for_device (GTK_MENU (info_entry_priv->popup_menu),
|
||||
info->device, NULL, NULL, NULL, NULL, NULL,
|
||||
info->button, info->time);
|
||||
else
|
||||
{
|
||||
gtk_menu_popup (GTK_MENU (info_entry_priv->popup_menu), NULL, NULL,
|
||||
popup_position_func, entry,
|
||||
0, gtk_get_current_event_time ());
|
||||
gtk_menu_popup_for_device (GTK_MENU (info_entry_priv->popup_menu),
|
||||
info->device, NULL, NULL,
|
||||
popup_position_func,
|
||||
entry, NULL,
|
||||
0, info->time);
|
||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (info_entry_priv->popup_menu), FALSE);
|
||||
}
|
||||
}
|
||||
@@ -8819,10 +8811,12 @@ popup_targets_received (GtkClipboard *clipboard,
|
||||
g_object_unref (entry);
|
||||
g_slice_free (PopupInfo, info);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_entry_do_popup (GtkEntry *entry,
|
||||
GdkEventButton *event)
|
||||
GdkDevice *device,
|
||||
guint32 _time,
|
||||
guint button)
|
||||
{
|
||||
PopupInfo *info = g_slice_new (PopupInfo);
|
||||
|
||||
@@ -8831,19 +8825,10 @@ gtk_entry_do_popup (GtkEntry *entry,
|
||||
* we get them, then we actually pop up the menu.
|
||||
*/
|
||||
info->entry = g_object_ref (entry);
|
||||
|
||||
if (event)
|
||||
{
|
||||
info->button = event->button;
|
||||
info->time = event->time;
|
||||
info->device = event->device;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->button = 0;
|
||||
info->time = gtk_get_current_event_time ();
|
||||
info->device = NULL;
|
||||
}
|
||||
|
||||
info->button = button;
|
||||
info->time = _time;
|
||||
info->device = device;
|
||||
|
||||
gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_CLIPBOARD),
|
||||
gdk_atom_intern_static_string ("TARGETS"),
|
||||
@@ -8854,7 +8839,49 @@ gtk_entry_do_popup (GtkEntry *entry,
|
||||
static gboolean
|
||||
gtk_entry_popup_menu (GtkWidget *widget)
|
||||
{
|
||||
gtk_entry_do_popup (GTK_ENTRY (widget), NULL);
|
||||
gtk_entry_do_popup (GTK_ENTRY (widget),
|
||||
gtk_get_current_event_device (),
|
||||
gtk_get_current_event_time (),
|
||||
0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_entry_press_and_hold (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
if (action == GTK_PRESS_AND_HOLD_TRIGGER)
|
||||
gtk_entry_do_popup (GTK_ENTRY (widget),
|
||||
device, GDK_CURRENT_TIME, 1);
|
||||
else if (action == GTK_PRESS_AND_HOLD_QUERY)
|
||||
{
|
||||
GtkEntryPrivate *priv;
|
||||
GdkDevice *source_device;
|
||||
GdkEvent *event;
|
||||
|
||||
priv = GTK_ENTRY (widget)->priv;
|
||||
event = gtk_get_current_event ();
|
||||
|
||||
if (!event)
|
||||
return FALSE;
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH ||
|
||||
(event->type != GDK_BUTTON_PRESS &&
|
||||
event->type != GDK_TOUCH_PRESS) ||
|
||||
event->button.window != priv->text_area)
|
||||
{
|
||||
gdk_event_free (event);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_event_free (event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -932,6 +932,78 @@ typedef enum {
|
||||
GTK_BORDER_STYLE_RIDGE
|
||||
} GtkBorderStyle;
|
||||
|
||||
/**
|
||||
* GtkCapturedEventFlags:
|
||||
* @GTK_CAPTURED_EVENT_NONE: Event goes uncaptured
|
||||
* @GTK_CAPTURED_EVENT_HANDLED: The event was handled
|
||||
* @GTK_CAPTURED_EVENT_STORE: Store for later propagation, see
|
||||
* gtk_widget_release_captured_events()
|
||||
*
|
||||
* Describes how an event in the #GtkWidget::captured-event handler
|
||||
* is handled.
|
||||
*/
|
||||
typedef enum {
|
||||
GTK_CAPTURED_EVENT_NONE = 0,
|
||||
GTK_CAPTURED_EVENT_HANDLED = 1 << 0,
|
||||
GTK_CAPTURED_EVENT_STORE = 1 << 1
|
||||
} GtkCapturedEventFlags;
|
||||
|
||||
/**
|
||||
* GtkKineticScrollingFlags:
|
||||
* @GTK_KINETIC_SCROLLING_NONE: No kinetic scrolling.
|
||||
* @GTK_KINETIC_SCROLLING_ENABLED: Kinetic scrolling is enabled.
|
||||
* @GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS: The first button
|
||||
* press is captured by the scrolled window, and then replayed
|
||||
* if the button press is meant to go to the child widget. This
|
||||
* flag should be enabled if the child widget(s) perform
|
||||
* non-reversible actions on #GtkWidget::button-press-event.
|
||||
* If the widget does not do so, and handles
|
||||
* #GtkWidget::grab-broken-event, it might be better off without
|
||||
* this flag.
|
||||
*
|
||||
* Describes the kinetic scrolling behavior of a #GtkScrolledWindow
|
||||
*/
|
||||
typedef enum {
|
||||
GTK_KINETIC_SCROLLING_NONE = 0,
|
||||
GTK_KINETIC_SCROLLING_ENABLED = 1 << 0,
|
||||
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS = 1 << 1
|
||||
} GtkKineticScrollingFlags;
|
||||
|
||||
/**
|
||||
* GtkGestureType:
|
||||
* @GTK_GESTURE_SWIPE_RIGHT: A swipe from left to right
|
||||
* @GTK_GESTURE_SWIPE_LEFT: A swipe from right to left
|
||||
* @GTK_GESTURE_SWIPE_UP: A swipe from bottom to top
|
||||
* @GTK_GESTURE_SWIPE_DOWN: A swipe from top to bottom
|
||||
* @GTK_GESTURE_CIRCULAR_CLOCKWISE: A circular clockwise movement
|
||||
* @GTK_GESTURE_CIRCULAR_COUNTERCLOCKWISE: A circular counterclockwise movement
|
||||
*
|
||||
* Describes the stock gestures handled by GTK+.
|
||||
*/
|
||||
typedef enum {
|
||||
GTK_GESTURE_SWIPE_RIGHT = 1,
|
||||
GTK_GESTURE_SWIPE_LEFT,
|
||||
GTK_GESTURE_SWIPE_UP,
|
||||
GTK_GESTURE_SWIPE_DOWN,
|
||||
GTK_GESTURE_CIRCULAR_CLOCKWISE,
|
||||
GTK_GESTURE_CIRCULAR_COUNTERCLOCKWISE
|
||||
} GtkGestureType;
|
||||
|
||||
/**
|
||||
* GtkGestureFlags:
|
||||
* @GTK_GESTURE_FLAG_NONE: Gesture is interpreted as-is.
|
||||
* @GTK_GESTURE_FLAG_IGNORE_INITIAL_ORIENTATION:
|
||||
* The initial orientation is ignored in comparisons,
|
||||
* so the gesture doesn't have a sense of direction,
|
||||
* this is useful for i.e. circular strokes.
|
||||
*
|
||||
* Flags accepted by gtk_gesture_new()
|
||||
*/
|
||||
typedef enum {
|
||||
GTK_GESTURE_FLAG_NONE = 0,
|
||||
GTK_GESTURE_FLAG_IGNORE_INITIAL_ORIENTATION = 1 << 1
|
||||
} GtkGestureFlags;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,121 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2011 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __GTK_GESTURES_INTERPRETER_H__
|
||||
#define __GTK_GESTURES_INTERPRETER_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_GESTURE (gtk_gesture_get_type ())
|
||||
#define GTK_TYPE_GESTURE_STROKE (gtk_gesture_stroke_get_type ())
|
||||
|
||||
#define GTK_TYPE_GESTURES_INTERPRETER (gtk_gestures_interpreter_get_type ())
|
||||
#define GTK_GESTURES_INTERPRETER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GTK_TYPE_GESTURES_INTERPRETER, GtkGesturesInterpreter))
|
||||
#define GTK_GESTURES_INTERPRETER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GTK_TYPE_GESTURES_INTERPRETER, GtkGesturesInterpreterClass))
|
||||
#define GTK_IS_GESTURES_INTERPRETER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GTK_TYPE_GESTURES_INTERPRETER))
|
||||
#define GTK_IS_GESTURES_INTERPRETER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GTK_TYPE_GESTURES_INTERPRETER))
|
||||
#define GTK_GESTURES_INTERPRETER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GTK_TYPE_GESTURES_INTERPRETER, GtkGesturesInterpreterClass))
|
||||
|
||||
typedef struct _GtkGestureStroke GtkGestureStroke;
|
||||
typedef struct _GtkGesture GtkGesture;
|
||||
|
||||
typedef struct _GtkGesturesInterpreter GtkGesturesInterpreter;
|
||||
typedef struct _GtkGesturesInterpreterClass GtkGesturesInterpreterClass;
|
||||
|
||||
struct _GtkGesturesInterpreter
|
||||
{
|
||||
GObject parent_object;
|
||||
gpointer priv;
|
||||
};
|
||||
|
||||
struct _GtkGesturesInterpreterClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* events_vectorized) (GtkGesturesInterpreter *interpreter,
|
||||
GtkGesture *gesture);
|
||||
|
||||
void (* gesture_detected) (GtkGesturesInterpreter *interpreter,
|
||||
guint gesture_id,
|
||||
gdouble confidence);
|
||||
};
|
||||
|
||||
/* Gesture stroke */
|
||||
GType gtk_gesture_stroke_get_type (void) G_GNUC_CONST;
|
||||
GtkGestureStroke * gtk_gesture_stroke_new (void);
|
||||
GtkGestureStroke * gtk_gesture_stroke_copy (const GtkGestureStroke *stroke);
|
||||
void gtk_gesture_stroke_free (GtkGestureStroke *stroke);
|
||||
void gtk_gesture_stroke_append_vector (GtkGestureStroke *stroke,
|
||||
gdouble angle,
|
||||
guint length);
|
||||
|
||||
guint gtk_gesture_stroke_get_n_vectors (const GtkGestureStroke *stroke);
|
||||
gboolean gtk_gesture_stroke_get_vector (const GtkGestureStroke *stroke,
|
||||
guint n_vector,
|
||||
gdouble *angle,
|
||||
guint *length,
|
||||
gdouble *relative_length);
|
||||
/* Gesture */
|
||||
GType gtk_gesture_get_type (void) G_GNUC_CONST;
|
||||
GtkGesture * gtk_gesture_new (const GtkGestureStroke *stroke,
|
||||
GtkGestureFlags flags);
|
||||
void gtk_gesture_add_stroke (GtkGesture *gesture,
|
||||
const GtkGestureStroke *stroke,
|
||||
gint dx,
|
||||
gint dy);
|
||||
GtkGesture * gtk_gesture_copy (const GtkGesture *gesture);
|
||||
void gtk_gesture_free (GtkGesture *gesture);
|
||||
|
||||
GtkGestureFlags gtk_gesture_get_flags (const GtkGesture *gesture);
|
||||
guint gtk_gesture_get_n_strokes (const GtkGesture *gesture);
|
||||
const GtkGestureStroke * gtk_gesture_get_stroke (const GtkGesture *gesture,
|
||||
guint n_stroke,
|
||||
gint *dx,
|
||||
gint *dy);
|
||||
|
||||
guint gtk_gesture_register (const GtkGesture *gesture);
|
||||
guint gtk_gesture_register_static (const GtkGesture *gesture);
|
||||
const GtkGesture * gtk_gesture_lookup (guint gesture_id);
|
||||
|
||||
/* Gestures interpreter */
|
||||
GType gtk_gestures_interpreter_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkGesturesInterpreter * gtk_gestures_interpreter_new (void);
|
||||
|
||||
gboolean gtk_gestures_interpreter_add_gesture (GtkGesturesInterpreter *interpreter,
|
||||
guint gesture_id);
|
||||
void gtk_gestures_interpreter_remove_gesture (GtkGesturesInterpreter *interpreter,
|
||||
guint gesture_id);
|
||||
|
||||
guint gtk_gestures_interpreter_get_n_active_strokes (GtkGesturesInterpreter *interpreter);
|
||||
|
||||
gboolean gtk_gestures_interpreter_feed_event (GtkGesturesInterpreter *interpreter,
|
||||
GdkEvent *event);
|
||||
gboolean gtk_gestures_interpreter_finish (GtkGesturesInterpreter *interpreter,
|
||||
guint *gesture_id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_GESTURES_INTERPRETER_H__ */
|
||||
+56
-13
@@ -437,6 +437,11 @@ static void gtk_label_hierarchy_changed (GtkWidget *widget,
|
||||
static void gtk_label_screen_changed (GtkWidget *widget,
|
||||
GdkScreen *old_screen);
|
||||
static gboolean gtk_label_popup_menu (GtkWidget *widget);
|
||||
static gboolean gtk_label_press_and_hold (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static void gtk_label_create_window (GtkLabel *label);
|
||||
static void gtk_label_destroy_window (GtkLabel *label);
|
||||
@@ -490,7 +495,9 @@ static void gtk_label_move_cursor (GtkLabel *label,
|
||||
static void gtk_label_copy_clipboard (GtkLabel *label);
|
||||
static void gtk_label_select_all (GtkLabel *label);
|
||||
static void gtk_label_do_popup (GtkLabel *label,
|
||||
GdkEventButton *event);
|
||||
GdkDevice *device,
|
||||
guint32 _time,
|
||||
guint button);
|
||||
static gint gtk_label_move_forward_word (GtkLabel *label,
|
||||
gint start);
|
||||
static gint gtk_label_move_backward_word (GtkLabel *label,
|
||||
@@ -585,6 +592,7 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
widget_class->drag_data_get = gtk_label_drag_data_get;
|
||||
widget_class->grab_focus = gtk_label_grab_focus;
|
||||
widget_class->popup_menu = gtk_label_popup_menu;
|
||||
widget_class->press_and_hold = gtk_label_press_and_hold;
|
||||
widget_class->focus = gtk_label_focus;
|
||||
widget_class->get_request_mode = gtk_label_get_request_mode;
|
||||
widget_class->get_preferred_width = gtk_label_get_preferred_width;
|
||||
@@ -4638,7 +4646,8 @@ gtk_label_button_press (GtkWidget *widget,
|
||||
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
|
||||
{
|
||||
info->link_clicked = 1;
|
||||
gtk_label_do_popup (label, event);
|
||||
gtk_label_do_popup (label, event->device,
|
||||
event->time, event->button);
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->button == GDK_BUTTON_PRIMARY)
|
||||
@@ -4656,7 +4665,8 @@ gtk_label_button_press (GtkWidget *widget,
|
||||
|
||||
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
|
||||
{
|
||||
gtk_label_do_popup (label, event);
|
||||
gtk_label_do_popup (label, event->device,
|
||||
event->time, event->button);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -4921,6 +4931,8 @@ gtk_label_motion (GtkWidget *widget,
|
||||
if ((event->state & GDK_BUTTON1_MASK) == 0)
|
||||
return FALSE;
|
||||
|
||||
gdk_event_request_motions (event);
|
||||
|
||||
if (info->in_drag)
|
||||
{
|
||||
if (gtk_drag_check_threshold (widget,
|
||||
@@ -6170,14 +6182,43 @@ copy_link_activate_cb (GtkMenuItem *menu_item,
|
||||
static gboolean
|
||||
gtk_label_popup_menu (GtkWidget *widget)
|
||||
{
|
||||
gtk_label_do_popup (GTK_LABEL (widget), NULL);
|
||||
gtk_label_do_popup (GTK_LABEL (widget),
|
||||
gtk_get_current_event_device (),
|
||||
gtk_get_current_event_time (),
|
||||
0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_label_press_and_hold (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
if (action == GTK_PRESS_AND_HOLD_TRIGGER)
|
||||
gtk_label_do_popup (GTK_LABEL (widget),
|
||||
device, GDK_CURRENT_TIME, 1);
|
||||
else if (action == GTK_PRESS_AND_HOLD_QUERY)
|
||||
{
|
||||
GdkDevice *source_device;
|
||||
GdkEvent *event;
|
||||
|
||||
event = gtk_get_current_event ();
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_label_do_popup (GtkLabel *label,
|
||||
GdkEventButton *event)
|
||||
GdkDevice *device,
|
||||
guint32 _time,
|
||||
guint button)
|
||||
{
|
||||
GtkLabelPrivate *priv = label->priv;
|
||||
GtkWidget *menuitem;
|
||||
@@ -6199,7 +6240,7 @@ gtk_label_do_popup (GtkLabel *label,
|
||||
have_selection =
|
||||
priv->select_info->selection_anchor != priv->select_info->selection_end;
|
||||
|
||||
if (event)
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
if (priv->select_info->link_clicked)
|
||||
link = priv->select_info->active_link;
|
||||
@@ -6259,15 +6300,17 @@ gtk_label_do_popup (GtkLabel *label,
|
||||
|
||||
g_signal_emit (label, signals[POPULATE_POPUP], 0, menu);
|
||||
|
||||
if (event)
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||
NULL, NULL,
|
||||
event->button, event->time);
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
gtk_menu_popup_for_device (GTK_MENU (menu), device,
|
||||
NULL, NULL, NULL, NULL, NULL,
|
||||
button, _time);
|
||||
else
|
||||
{
|
||||
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
|
||||
popup_position_func, label,
|
||||
0, gtk_get_current_event_time ());
|
||||
gtk_menu_popup_for_device (GTK_MENU (menu),
|
||||
device, NULL, NULL,
|
||||
popup_position_func,
|
||||
label, NULL,
|
||||
0, _time);
|
||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -2171,13 +2171,12 @@ gtk_list_store_has_default_sort_func (GtkTreeSortable *sortable)
|
||||
* gtk_list_store_insert_with_values:
|
||||
* @list_store: A #GtkListStore
|
||||
* @iter: (out) (allow-none): An unset #GtkTreeIter to set to the new row, or %NULL
|
||||
* @position: position to insert the new row, or -1 to append after existing
|
||||
* rows
|
||||
* @position: position to insert the new row
|
||||
* @...: pairs of column number and value, terminated with -1
|
||||
*
|
||||
* Creates a new row at @position. @iter will be changed to point to this new
|
||||
* row. If @position is -1, or larger than the number of rows in the list, then
|
||||
* the new row will be appended to the list. The row will be filled with the
|
||||
* row. If @position is larger than the number of rows on the list, then the
|
||||
* new row will be appended to the list. The row will be filled with the
|
||||
* values given to this function.
|
||||
*
|
||||
* Calling
|
||||
|
||||
+44
-18
@@ -1332,23 +1332,18 @@ rewrite_event_for_window (GdkEvent *event,
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
rewrite_events_translate (event->any.window,
|
||||
new_window,
|
||||
&event->button.x, &event->button.y);
|
||||
break;
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_MOTION:
|
||||
rewrite_events_translate (event->any.window,
|
||||
new_window,
|
||||
&event->motion.x, &event->motion.y);
|
||||
break;
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
rewrite_events_translate (event->any.window,
|
||||
new_window,
|
||||
&event->touch.x, &event->touch.y);
|
||||
break;
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
case GDK_PROXIMITY_IN:
|
||||
@@ -1394,10 +1389,9 @@ rewrite_event_for_grabs (GdkEvent *event)
|
||||
case GDK_PROXIMITY_OUT:
|
||||
case GDK_KEY_PRESS:
|
||||
case GDK_KEY_RELEASE:
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
case GDK_TOUCH_PRESS:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
case GDK_TOUCH_MOTION:
|
||||
display = gdk_window_get_display (event->any.window);
|
||||
device = gdk_event_get_device (event);
|
||||
|
||||
@@ -1657,7 +1651,18 @@ gtk_main_do_event (GdkEvent *event)
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_2BUTTON_PRESS:
|
||||
case GDK_3BUTTON_PRESS:
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_TOUCH_PRESS:
|
||||
if ((event->type == GDK_BUTTON_PRESS ||
|
||||
event->type == GDK_TOUCH_PRESS) &&
|
||||
event->button.button == 1)
|
||||
{
|
||||
/* Handle press and hold on the grab widget before propagating up,
|
||||
* so a parent capturing events doesn't delay nor prevent a child
|
||||
* from doing the press-and-hold action.
|
||||
*/
|
||||
_gtk_widget_press_and_hold_check_start (grab_widget, &event->button);
|
||||
}
|
||||
|
||||
if (!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
|
||||
gtk_propagate_event (grab_widget, event);
|
||||
break;
|
||||
@@ -1708,9 +1713,20 @@ gtk_main_do_event (GdkEvent *event)
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_PROXIMITY_IN:
|
||||
case GDK_PROXIMITY_OUT:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_TOUCH_CANCEL:
|
||||
case GDK_TOUCH_MOTION:
|
||||
case GDK_TOUCH_RELEASE:
|
||||
case GDK_MULTITOUCH_ADDED:
|
||||
case GDK_MULTITOUCH_REMOVED:
|
||||
case GDK_MULTITOUCH_UPDATED:
|
||||
if ((event->type == GDK_BUTTON_RELEASE ||
|
||||
event->type == GDK_TOUCH_RELEASE) &&
|
||||
event->button.button == 1)
|
||||
_gtk_widget_press_and_hold_check_cancel (grab_widget, &event->button);
|
||||
else if (event->type == GDK_MOTION_NOTIFY ||
|
||||
event->type == GDK_TOUCH_MOTION)
|
||||
_gtk_widget_press_and_hold_check_threshold (grab_widget,
|
||||
&event->motion);
|
||||
|
||||
if (!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
|
||||
gtk_propagate_event (grab_widget, event);
|
||||
break;
|
||||
@@ -1722,7 +1738,7 @@ gtk_main_do_event (GdkEvent *event)
|
||||
gdk_event_get_device (event),
|
||||
event->any.window);
|
||||
if (gtk_widget_is_sensitive (grab_widget) &&
|
||||
!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
|
||||
!_gtk_propagate_captured_event (grab_widget, event, topmost_widget))
|
||||
gtk_widget_event (grab_widget, event);
|
||||
break;
|
||||
|
||||
@@ -1761,12 +1777,22 @@ gtk_main_do_event (GdkEvent *event)
|
||||
|| event->type == GDK_DRAG_ENTER
|
||||
|| event->type == GDK_GRAB_BROKEN
|
||||
|| event->type == GDK_MOTION_NOTIFY
|
||||
|| event->type == GDK_TOUCH_UPDATE
|
||||
|| event->type == GDK_TOUCH_MOTION
|
||||
|| event->type == GDK_SCROLL)
|
||||
{
|
||||
_gtk_tooltip_handle_event (event);
|
||||
}
|
||||
|
||||
/* Handle gestures for touch events */
|
||||
if (gdk_event_get_touch_id (event, NULL))
|
||||
{
|
||||
_gtk_widget_gesture_stroke (grab_widget, event);
|
||||
|
||||
if (event->type == GDK_BUTTON_RELEASE ||
|
||||
event->type == GDK_TOUCH_RELEASE)
|
||||
_gtk_widget_gesture_finish (grab_widget);
|
||||
}
|
||||
|
||||
tmp_list = current_events;
|
||||
current_events = g_list_remove_link (current_events, tmp_list);
|
||||
g_list_free_1 (tmp_list);
|
||||
|
||||
@@ -36,6 +36,7 @@ BOOLEAN:OBJECT,BOXED,BOXED
|
||||
BOOLEAN:OBJECT,OBJECT,OBJECT
|
||||
BOOLEAN:OBJECT,STRING,STRING
|
||||
BOOLEAN:OBJECT,ENUM
|
||||
BOOLEAN:OBJECT,ENUM,INT,INT
|
||||
BOOLEAN:INT
|
||||
BOOLEAN:INT,INT
|
||||
BOOLEAN:INT,INT,INT
|
||||
@@ -47,6 +48,7 @@ BOOLEAN:BOOLEAN,BOOLEAN,BOOLEAN
|
||||
BOOLEAN:STRING
|
||||
ENUM:ENUM
|
||||
ENUM:VOID
|
||||
FLAGS:BOXED
|
||||
INT:POINTER
|
||||
OBJECT:VOID
|
||||
STRING:DOUBLE
|
||||
@@ -109,6 +111,7 @@ VOID:STRING,STRING,STRING
|
||||
VOID:STRING,INT,POINTER
|
||||
VOID:STRING,UINT,FLAGS
|
||||
VOID:STRING,UINT,FLAGS,UINT
|
||||
VOID:UINT,DOUBLE
|
||||
VOID:UINT,FLAGS,BOXED
|
||||
VOID:UINT,UINT
|
||||
VOID:UINT,STRING
|
||||
|
||||
+31
-36
@@ -113,7 +113,6 @@
|
||||
#include "gtkdnd.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
#include "deprecated/gtktearoffmenuitem.h"
|
||||
|
||||
@@ -229,7 +228,8 @@ static void gtk_menu_scroll_to (GtkMenu *menu,
|
||||
gint offset);
|
||||
static void gtk_menu_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
static gboolean gtk_menu_captured_event (GtkWidget *widget,
|
||||
static GtkCapturedEventFlags
|
||||
gtk_menu_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
|
||||
|
||||
@@ -513,6 +513,7 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
widget_class->get_preferred_width = gtk_menu_get_preferred_width;
|
||||
widget_class->get_preferred_height = gtk_menu_get_preferred_height;
|
||||
widget_class->get_preferred_height_for_width = gtk_menu_get_preferred_height_for_width;
|
||||
widget_class->captured_event = gtk_menu_captured_event;
|
||||
|
||||
container_class->remove = gtk_menu_remove;
|
||||
container_class->get_child_property = gtk_menu_get_child_property;
|
||||
@@ -1064,8 +1065,6 @@ gtk_menu_init (GtkMenu *menu)
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (menu));
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENU);
|
||||
|
||||
_gtk_widget_set_captured_event_handler (GTK_WIDGET (menu), gtk_menu_captured_event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1679,7 +1678,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
|
||||
|
||||
/* if no item is selected, select the first one */
|
||||
if (!menu_shell->priv->active_menu_item &&
|
||||
source_device && gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
|
||||
source_device && gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
gtk_menu_shell_select_first (menu_shell, TRUE);
|
||||
|
||||
/* Once everything is set up correctly, map the toplevel */
|
||||
@@ -3374,7 +3373,7 @@ gtk_menu_button_press (GtkWidget *widget,
|
||||
return TRUE;
|
||||
|
||||
if (GTK_IS_MENU_ITEM (event_widget) &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH &&
|
||||
GTK_MENU_ITEM (event_widget)->priv->submenu != NULL &&
|
||||
!gtk_widget_is_drawable (GTK_MENU_ITEM (event_widget)->priv->submenu))
|
||||
menu->priv->ignore_button_release = TRUE;
|
||||
@@ -3647,7 +3646,7 @@ gtk_menu_motion_notify (GtkWidget *widget,
|
||||
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||
|
||||
if (GTK_IS_MENU (widget) &&
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
|
||||
{
|
||||
GtkMenuPrivate *priv = GTK_MENU(widget)->priv;
|
||||
|
||||
@@ -4115,7 +4114,7 @@ gtk_menu_enter_notify (GtkWidget *widget,
|
||||
menu_item = gtk_get_event_widget ((GdkEvent*) event);
|
||||
|
||||
if (GTK_IS_MENU (widget) &&
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
|
||||
{
|
||||
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
|
||||
|
||||
@@ -4124,7 +4123,7 @@ gtk_menu_enter_notify (GtkWidget *widget,
|
||||
event->x_root, event->y_root, TRUE, TRUE);
|
||||
}
|
||||
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN &&
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH &&
|
||||
GTK_IS_MENU_ITEM (menu_item))
|
||||
{
|
||||
GtkWidget *menu = gtk_widget_get_parent (menu_item);
|
||||
@@ -4197,7 +4196,7 @@ gtk_menu_leave_notify (GtkWidget *widget,
|
||||
|
||||
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
|
||||
gtk_menu_handle_scrolling (menu, event->x_root, event->y_root, FALSE, TRUE);
|
||||
|
||||
event_widget = gtk_get_event_widget ((GdkEvent*) event);
|
||||
@@ -4253,34 +4252,30 @@ pointer_on_menu_widget (GtkMenu *menu,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GtkCapturedEventFlags
|
||||
gtk_menu_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GdkDevice *source_device;
|
||||
gboolean retval = FALSE;
|
||||
GtkCapturedEventFlags flags;
|
||||
GtkMenuPrivate *priv;
|
||||
GtkMenu *menu;
|
||||
gdouble x_root, y_root;
|
||||
guint button;
|
||||
GdkModifierType state;
|
||||
|
||||
menu = GTK_MENU (widget);
|
||||
priv = menu->priv;
|
||||
flags = GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
if (!priv->upper_arrow_visible && !priv->lower_arrow_visible)
|
||||
return retval;
|
||||
return flags;
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
gdk_event_get_root_coords (event, &x_root, &y_root);
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_BUTTON_PRESS:
|
||||
if ((!gdk_event_get_button (event, &button) || button == 1) &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN &&
|
||||
pointer_on_menu_widget (menu, x_root, y_root))
|
||||
if (event->button.button == 1 &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH &&
|
||||
pointer_on_menu_widget (menu, event->button.x_root, event->button.y_root))
|
||||
{
|
||||
priv->drag_start_y = event->button.y_root;
|
||||
priv->initial_drag_offset = priv->scroll_offset;
|
||||
@@ -4291,27 +4286,26 @@ gtk_menu_captured_event (GtkWidget *widget,
|
||||
|
||||
priv->drag_already_pressed = TRUE;
|
||||
break;
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
if (priv->drag_scroll_started)
|
||||
{
|
||||
flags = GTK_CAPTURED_EVENT_HANDLED;
|
||||
priv->drag_scroll_started = FALSE;
|
||||
priv->drag_start_y = -1;
|
||||
priv->drag_already_pressed = FALSE;
|
||||
retval = TRUE;
|
||||
}
|
||||
break;
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_MOTION_NOTIFY:
|
||||
if ((!gdk_event_get_state (event, &state) || (state & GDK_BUTTON1_MASK)
|
||||
!= 0) &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
|
||||
if (event->motion.state & GDK_BUTTON1_MASK &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
{
|
||||
if (!priv->drag_already_pressed)
|
||||
{
|
||||
if (pointer_on_menu_widget (menu, x_root, y_root))
|
||||
if (pointer_on_menu_widget (menu,
|
||||
event->motion.x_root,
|
||||
event->motion.y_root))
|
||||
{
|
||||
priv->drag_start_y = y_root;
|
||||
priv->drag_start_y = event->motion.y_root;
|
||||
priv->initial_drag_offset = priv->scroll_offset;
|
||||
priv->drag_scroll_started = FALSE;
|
||||
}
|
||||
@@ -4321,7 +4315,8 @@ gtk_menu_captured_event (GtkWidget *widget,
|
||||
priv->drag_already_pressed = TRUE;
|
||||
}
|
||||
|
||||
if (priv->drag_start_y < 0 && !priv->drag_scroll_started)
|
||||
if (priv->drag_start_y < 0 &&
|
||||
!priv->drag_scroll_started)
|
||||
break;
|
||||
|
||||
if (priv->drag_scroll_started)
|
||||
@@ -4330,7 +4325,7 @@ gtk_menu_captured_event (GtkWidget *widget,
|
||||
GtkBorder arrow_border;
|
||||
gdouble y_diff;
|
||||
|
||||
y_diff = y_root - priv->drag_start_y;
|
||||
y_diff = event->motion.y_root - priv->drag_start_y;
|
||||
offset = priv->initial_drag_offset - y_diff;
|
||||
|
||||
view_height = gdk_window_get_height (gtk_widget_get_window (widget));
|
||||
@@ -4345,28 +4340,28 @@ gtk_menu_captured_event (GtkWidget *widget,
|
||||
offset = CLAMP (offset, 0, priv->requested_height - view_height);
|
||||
gtk_menu_scroll_to (menu, offset);
|
||||
|
||||
retval = TRUE;
|
||||
flags = GTK_CAPTURED_EVENT_HANDLED;
|
||||
}
|
||||
else if (gtk_drag_check_threshold (widget,
|
||||
0, priv->drag_start_y,
|
||||
0, y_root))
|
||||
0, event->motion.y_root))
|
||||
{
|
||||
priv->drag_scroll_started = TRUE;
|
||||
flags = GTK_CAPTURED_EVENT_HANDLED;
|
||||
gtk_menu_shell_deselect (GTK_MENU_SHELL (menu));
|
||||
retval = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GDK_ENTER_NOTIFY:
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
if (priv->drag_scroll_started)
|
||||
retval = TRUE;
|
||||
flags = GTK_CAPTURED_EVENT_HANDLED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+1
-1
@@ -1702,7 +1702,7 @@ gtk_real_menu_item_select (GtkMenuItem *menu_item)
|
||||
}
|
||||
|
||||
if ((!source_device ||
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN) &&
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH) &&
|
||||
priv->submenu &&
|
||||
(!gtk_widget_get_mapped (priv->submenu) ||
|
||||
GTK_MENU (priv->submenu)->priv->tearoff_active))
|
||||
|
||||
+1
-1
@@ -1088,7 +1088,7 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
|
||||
|
||||
source_device = gdk_event_get_source_device ((GdkEvent *) event);
|
||||
|
||||
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
|
||||
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
_gtk_menu_item_popup_submenu (menu_item, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
+27
-331
@@ -36,8 +36,6 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkdnd.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "a11y/gtkpanedaccessible.h"
|
||||
|
||||
/**
|
||||
@@ -100,17 +98,6 @@ enum {
|
||||
CHILD2
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWindow *pane_window;
|
||||
GdkDevice *device;
|
||||
GdkEventSequence *sequence;
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
GdkEvent *button_press_event;
|
||||
guint press_consumed : 1;
|
||||
} TouchInfo;
|
||||
|
||||
struct _GtkPanedPrivate
|
||||
{
|
||||
GtkPaned *first_paned;
|
||||
@@ -137,8 +124,6 @@ struct _GtkPanedPrivate
|
||||
|
||||
guint32 grab_time;
|
||||
|
||||
GArray *touches;
|
||||
|
||||
guint handle_prelit : 1;
|
||||
guint in_drag : 1;
|
||||
guint in_recursion : 1;
|
||||
@@ -270,8 +255,6 @@ static gboolean gtk_paned_toggle_handle_focus (GtkPaned *paned);
|
||||
static GType gtk_paned_child_type (GtkContainer *container);
|
||||
static void gtk_paned_grab_notify (GtkWidget *widget,
|
||||
gboolean was_grabbed);
|
||||
static gboolean gtk_paned_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPaned, gtk_paned, GTK_TYPE_CONTAINER,
|
||||
@@ -725,11 +708,6 @@ gtk_paned_init (GtkPaned *paned)
|
||||
priv->handle_pos.y = -1;
|
||||
|
||||
priv->drag_pos = -1;
|
||||
|
||||
priv->touches = g_array_sized_new (FALSE, FALSE,
|
||||
sizeof (TouchInfo), 2);
|
||||
|
||||
_gtk_widget_set_captured_event_handler (GTK_WIDGET (paned), gtk_paned_captured_event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -885,11 +863,9 @@ static void
|
||||
gtk_paned_finalize (GObject *object)
|
||||
{
|
||||
GtkPaned *paned = GTK_PANED (object);
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
|
||||
|
||||
gtk_paned_set_saved_focus (paned, NULL);
|
||||
gtk_paned_set_first_paned (paned, NULL);
|
||||
g_array_free (priv->touches, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (gtk_paned_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -1305,9 +1281,7 @@ gtk_paned_create_child_window (GtkPaned *paned,
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.event_mask = gtk_widget_get_events (widget) |
|
||||
GDK_EXPOSURE_MASK | GDK_TOUCH_MASK;
|
||||
|
||||
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
|
||||
if (child)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
@@ -1597,8 +1571,7 @@ gtk_paned_enter (GtkWidget *widget,
|
||||
GtkPaned *paned = GTK_PANED (widget);
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
|
||||
if (priv->in_drag &&
|
||||
priv->touches->len == 0)
|
||||
if (priv->in_drag)
|
||||
update_drag (paned, event->x, event->y);
|
||||
else
|
||||
{
|
||||
@@ -1620,8 +1593,7 @@ gtk_paned_leave (GtkWidget *widget,
|
||||
GtkPaned *paned = GTK_PANED (widget);
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
|
||||
if (priv->in_drag &&
|
||||
priv->touches->len == 0)
|
||||
if (priv->in_drag)
|
||||
update_drag (paned, event->x, event->y);
|
||||
else
|
||||
{
|
||||
@@ -1654,38 +1626,6 @@ gtk_paned_focus (GtkWidget *widget,
|
||||
return retval;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
start_drag (GtkPaned *paned,
|
||||
GdkDevice *device,
|
||||
int xpos,
|
||||
int ypos,
|
||||
guint time)
|
||||
{
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
|
||||
if (gdk_device_grab (device,
|
||||
priv->handle,
|
||||
GDK_OWNERSHIP_WINDOW, FALSE,
|
||||
GDK_BUTTON1_MOTION_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_TOUCH_MASK,
|
||||
NULL, time) != GDK_GRAB_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
priv->in_drag = TRUE;
|
||||
priv->grab_time = time;
|
||||
priv->grab_device = device;
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
priv->drag_pos = xpos;
|
||||
else
|
||||
priv->drag_pos = ypos;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_paned_button_press (GtkWidget *widget,
|
||||
GdkEventButton *event)
|
||||
@@ -1696,10 +1636,27 @@ gtk_paned_button_press (GtkWidget *widget,
|
||||
if (!priv->in_drag &&
|
||||
(event->window == priv->handle) && (event->button == GDK_BUTTON_PRIMARY))
|
||||
{
|
||||
if (!start_drag (paned, event->device,
|
||||
event->x, event->y, event->time))
|
||||
/* We need a server grab here, not gtk_grab_add(), since
|
||||
* we don't want to pass events on to the widget's children */
|
||||
if (gdk_device_grab (event->device,
|
||||
priv->handle,
|
||||
GDK_OWNERSHIP_WINDOW, FALSE,
|
||||
GDK_BUTTON1_MOTION_MASK
|
||||
| GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_ENTER_NOTIFY_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK,
|
||||
NULL, event->time) != GDK_GRAB_SUCCESS)
|
||||
return FALSE;
|
||||
|
||||
priv->in_drag = TRUE;
|
||||
priv->grab_time = event->time;
|
||||
priv->grab_device = event->device;
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
priv->drag_pos = event->x;
|
||||
else
|
||||
priv->drag_pos = event->y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1713,13 +1670,9 @@ gtk_paned_grab_broken (GtkWidget *widget,
|
||||
GtkPaned *paned = GTK_PANED (widget);
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
|
||||
if (event->grab_window != priv->handle &&
|
||||
gdk_event_get_device ((GdkEvent *) event) == priv->grab_device)
|
||||
{
|
||||
priv->in_drag = FALSE;
|
||||
priv->drag_pos = -1;
|
||||
priv->position_set = TRUE;
|
||||
}
|
||||
priv->in_drag = FALSE;
|
||||
priv->drag_pos = -1;
|
||||
priv->position_set = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1734,7 +1687,7 @@ stop_drag (GtkPaned *paned)
|
||||
priv->position_set = TRUE;
|
||||
|
||||
gdk_device_ungrab (priv->grab_device,
|
||||
gtk_get_current_event_time ());
|
||||
priv->grab_time);
|
||||
priv->grab_device = NULL;
|
||||
}
|
||||
|
||||
@@ -1809,263 +1762,6 @@ gtk_paned_motion (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
_gtk_paned_find_pane_window (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkPanedPrivate *priv = GTK_PANED (widget)->priv;
|
||||
GtkWidget *event_widget;
|
||||
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
|
||||
if (event_widget == widget)
|
||||
{
|
||||
if (event->any.window == priv->child1_window)
|
||||
return priv->child1_window;
|
||||
else if (event->any.window == priv->child2_window)
|
||||
return priv->child2_window;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
else if (event_widget == priv->child1 ||
|
||||
gtk_widget_is_ancestor (event_widget, priv->child1))
|
||||
return priv->child1_window;
|
||||
else if (event_widget == priv->child2 ||
|
||||
gtk_widget_is_ancestor (event_widget, priv->child2))
|
||||
return priv->child2_window;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static TouchInfo *
|
||||
_gtk_paned_find_touch (GtkPaned *paned,
|
||||
GdkDevice *device,
|
||||
GdkEventSequence *sequence,
|
||||
guint *index)
|
||||
{
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
TouchInfo *info;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < priv->touches->len; i++)
|
||||
{
|
||||
info = &g_array_index (priv->touches, TouchInfo, i);
|
||||
|
||||
if (info->device == device && info->sequence == sequence)
|
||||
{
|
||||
if (index)
|
||||
*index = i;
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_release_captured_event (GtkPaned *paned,
|
||||
TouchInfo *touch,
|
||||
gboolean emit)
|
||||
{
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
GtkWidget *event_widget, *child;
|
||||
|
||||
if (!touch->button_press_event)
|
||||
return;
|
||||
|
||||
event_widget = gtk_get_event_widget (touch->button_press_event);
|
||||
|
||||
if (touch->pane_window == priv->child1_window)
|
||||
child = priv->child1;
|
||||
else if (touch->pane_window == priv->child2_window)
|
||||
child = priv->child2;
|
||||
else
|
||||
return;
|
||||
|
||||
if (emit &&
|
||||
!_gtk_propagate_captured_event (event_widget,
|
||||
touch->button_press_event,
|
||||
child))
|
||||
gtk_propagate_event (event_widget, touch->button_press_event);
|
||||
|
||||
gdk_event_free (touch->button_press_event);
|
||||
touch->button_press_event = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_paned_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkPaned *paned = GTK_PANED (widget);
|
||||
GtkPanedPrivate *priv = paned->priv;
|
||||
GdkDevice *device, *source_device;
|
||||
GdkWindow *pane_window;
|
||||
TouchInfo new = { 0 }, *info;
|
||||
GdkEventSequence *sequence;
|
||||
guint index;
|
||||
gdouble event_x, event_y;
|
||||
gint x, y;
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
|
||||
/* We possibly deal with both pointer and touch events,
|
||||
* depending on the target window event mask, so assume
|
||||
* touch ID = 0 for pointer events to ease handling.
|
||||
*/
|
||||
sequence = gdk_event_get_event_sequence (event);
|
||||
|
||||
gdk_event_get_coords (event, &event_x, &event_y);
|
||||
|
||||
if (!source_device ||
|
||||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHSCREEN)
|
||||
return FALSE;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_BUTTON_PRESS:
|
||||
case GDK_TOUCH_BEGIN:
|
||||
if (priv->touches->len == 2)
|
||||
return FALSE;
|
||||
|
||||
pane_window = _gtk_paned_find_pane_window (widget, event);
|
||||
gtk_widget_translate_coordinates (gtk_get_event_widget (event),
|
||||
widget,
|
||||
(gint)event_x, (gint)event_y,
|
||||
&x, &y);
|
||||
|
||||
for (index = 0; index < priv->touches->len; index++)
|
||||
{
|
||||
info = &g_array_index (priv->touches, TouchInfo, index);
|
||||
|
||||
/* There was already a touch in this pane */
|
||||
if (info->pane_window == pane_window)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
new.device = device;
|
||||
new.sequence = sequence;
|
||||
new.pane_window = pane_window;
|
||||
new.x = x;
|
||||
new.y = y;
|
||||
g_array_append_val (priv->touches, new);
|
||||
|
||||
if (priv->touches->len == 1)
|
||||
{
|
||||
/* It's the first touch, store the event and set
|
||||
* a timeout in order to release the event if no
|
||||
* second touch happens timely.
|
||||
*/
|
||||
info = &g_array_index (priv->touches, TouchInfo, 0);
|
||||
info->button_press_event = gdk_event_copy (event);
|
||||
return TRUE;
|
||||
}
|
||||
else if (priv->touches->len == 2)
|
||||
{
|
||||
GtkWidget *event_widget;
|
||||
|
||||
/* It's the second touch, release (don't emit) the
|
||||
* held button/touch presses.
|
||||
*/
|
||||
for (index = 0; index < priv->touches->len; index++)
|
||||
{
|
||||
info = &g_array_index (priv->touches, TouchInfo, index);
|
||||
gtk_paned_release_captured_event (paned, info, FALSE);
|
||||
info->press_consumed = TRUE;
|
||||
}
|
||||
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
|
||||
if (event_widget == widget)
|
||||
{
|
||||
if (pane_window == priv->child2_window)
|
||||
{
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
event_x += priv->handle_pos.x + priv->handle_pos.width;
|
||||
else
|
||||
event_y += priv->handle_pos.y + priv->handle_pos.height;
|
||||
}
|
||||
}
|
||||
else
|
||||
gtk_widget_translate_coordinates (event_widget, widget,
|
||||
(gint)event_x, (gint)event_y,
|
||||
&x, &y);
|
||||
|
||||
start_drag (paned, device, x, y,
|
||||
event->button.time);
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
priv->drag_pos = x - priv->handle_pos.x;
|
||||
else
|
||||
priv->drag_pos = y - priv->handle_pos.y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
case GDK_TOUCH_END:
|
||||
info = _gtk_paned_find_touch (GTK_PANED (widget), device, sequence, &index);
|
||||
|
||||
if (info)
|
||||
{
|
||||
gboolean press_consumed;
|
||||
|
||||
if (priv->touches->len == 2)
|
||||
stop_drag (paned);
|
||||
|
||||
press_consumed = info->press_consumed;
|
||||
|
||||
/* Release the held button/touch press, if still queued */
|
||||
gtk_paned_release_captured_event (paned, info, TRUE);
|
||||
g_array_remove_index_fast (priv->touches, index);
|
||||
|
||||
if (press_consumed)
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
case GDK_MOTION_NOTIFY:
|
||||
case GDK_TOUCH_UPDATE:
|
||||
info = _gtk_paned_find_touch (GTK_PANED (widget), device, sequence, &index);
|
||||
|
||||
if (info)
|
||||
{
|
||||
gtk_widget_translate_coordinates (gtk_get_event_widget (event),
|
||||
widget,
|
||||
event_x, event_y,
|
||||
&x, &y);
|
||||
|
||||
/* If there is a single touch and this isn't a continuation
|
||||
* from a previous successful 2-touch operation, check
|
||||
* the threshold to let the child handle events.
|
||||
*/
|
||||
if (priv->touches->len == 1 &&
|
||||
gtk_drag_check_threshold (widget, info->x, info->y, x, y))
|
||||
{
|
||||
gtk_paned_release_captured_event (paned, info, TRUE);
|
||||
g_array_remove_index_fast (priv->touches, index);
|
||||
return FALSE;
|
||||
}
|
||||
else if (priv->touches->len == 2 && index == 1)
|
||||
{
|
||||
/* The device grab on priv->handle is in effect now,
|
||||
* so the event coordinates are already relative to
|
||||
* that window.
|
||||
*/
|
||||
update_drag (paned, event_x, event_y);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_paned_new:
|
||||
* @orientation: the paned's orientation.
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "gdk/gdk.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkenums.h"
|
||||
|
||||
|
||||
#if !defined G_OS_WIN32 && !(defined GDK_WINDOWING_QUARTZ && defined QUARTZ_RELOCATION)
|
||||
@@ -159,6 +160,22 @@ _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
|
||||
return continue_emission;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_captured_enum_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy)
|
||||
{
|
||||
gboolean continue_emission;
|
||||
GtkCapturedEventFlags flags;
|
||||
|
||||
flags = g_value_get_flags (handler_return);
|
||||
g_value_set_flags (return_accu, flags);
|
||||
continue_emission = (flags & GTK_CAPTURED_EVENT_HANDLED) == 0;
|
||||
|
||||
return continue_emission;
|
||||
}
|
||||
|
||||
GdkModifierType
|
||||
_gtk_replace_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType modifiers)
|
||||
|
||||
@@ -59,6 +59,10 @@ gboolean _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
gboolean _gtk_captured_enum_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
const GValue *handler_return,
|
||||
gpointer dummy);
|
||||
|
||||
GdkModifierType _gtk_replace_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType modifiers);
|
||||
|
||||
+6
-6
@@ -2554,7 +2554,7 @@ gtk_range_button_press (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (source != GDK_SOURCE_TOUCHSCREEN &&
|
||||
if (source != GDK_SOURCE_TOUCH &&
|
||||
priv->mouse_location == MOUSE_TROUGH &&
|
||||
event->button == GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
@@ -2562,16 +2562,16 @@ gtk_range_button_press (GtkWidget *widget,
|
||||
*/
|
||||
GtkScrollType scroll;
|
||||
gdouble click_value;
|
||||
|
||||
|
||||
click_value = coord_to_value (range,
|
||||
priv->orientation == GTK_ORIENTATION_VERTICAL ?
|
||||
event->y : event->x);
|
||||
|
||||
priv->trough_click_forward = click_value > gtk_adjustment_get_value (priv->adjustment);
|
||||
range_grab_add (range, device, MOUSE_TROUGH, event->button);
|
||||
|
||||
|
||||
scroll = range_get_scroll_for_grab (range);
|
||||
|
||||
|
||||
gtk_range_add_step_timer (range, scroll);
|
||||
|
||||
return TRUE;
|
||||
@@ -2606,7 +2606,7 @@ gtk_range_button_press (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
else if ((priv->mouse_location == MOUSE_TROUGH &&
|
||||
(source == GDK_SOURCE_TOUCHSCREEN || event->button == GDK_BUTTON_MIDDLE)) ||
|
||||
(source == GDK_SOURCE_TOUCH || event->button == GDK_BUTTON_MIDDLE)) ||
|
||||
priv->mouse_location == MOUSE_SLIDER)
|
||||
{
|
||||
gboolean need_value_update = FALSE;
|
||||
@@ -2616,7 +2616,7 @@ gtk_range_button_press (GtkWidget *widget,
|
||||
* On button 2 press and touch devices, we warp the slider to
|
||||
* mouse position, then begin the slider drag.
|
||||
*/
|
||||
if (event->button == GDK_BUTTON_MIDDLE || source == GDK_SOURCE_TOUCHSCREEN)
|
||||
if (event->button == GDK_BUTTON_MIDDLE || source == GDK_SOURCE_TOUCH)
|
||||
{
|
||||
gdouble slider_low_value, slider_high_value, new_value;
|
||||
|
||||
|
||||
+144
-200
@@ -41,7 +41,6 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkviewport.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "a11y/gtkscrolledwindowaccessible.h"
|
||||
|
||||
/**
|
||||
@@ -131,7 +130,6 @@
|
||||
#define MAX_OVERSHOOT_DISTANCE 50
|
||||
#define FRICTION_DECELERATION 0.003
|
||||
#define OVERSHOOT_INVERSE_ACCELERATION 0.003
|
||||
#define RELEASE_EVENT_TIMEOUT 1000
|
||||
|
||||
struct _GtkScrolledWindowPrivate
|
||||
{
|
||||
@@ -153,13 +151,12 @@ struct _GtkScrolledWindowPrivate
|
||||
gint min_content_height;
|
||||
|
||||
/* Kinetic scrolling */
|
||||
GdkEvent *button_press_event;
|
||||
GdkWindow *overshoot_window;
|
||||
GdkDevice *drag_device;
|
||||
guint kinetic_scrolling : 1;
|
||||
guint capture_button_press : 1;
|
||||
guint kinetic_scrolling_flags : 2;
|
||||
guint in_drag : 1;
|
||||
guint last_button_event_valid : 1;
|
||||
guint captured_event_id;
|
||||
|
||||
guint release_timeout_id;
|
||||
guint deceleration_id;
|
||||
@@ -229,8 +226,10 @@ static void gtk_scrolled_window_size_allocate (GtkWidget *widge
|
||||
GtkAllocation *allocation);
|
||||
static gboolean gtk_scrolled_window_scroll_event (GtkWidget *widget,
|
||||
GdkEventScroll *event);
|
||||
static gboolean gtk_scrolled_window_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
static GtkCapturedEventFlags
|
||||
gtk_scrolled_window_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer user_data);
|
||||
static gboolean gtk_scrolled_window_focus (GtkWidget *widget,
|
||||
GtkDirectionType direction);
|
||||
static void gtk_scrolled_window_add (GtkContainer *container,
|
||||
@@ -483,18 +482,20 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
||||
* GtkScrolledWindow:kinetic-scrolling:
|
||||
*
|
||||
* The kinetic scrolling behavior flags. Kinetic scrolling
|
||||
* only applies to devices with source %GDK_SOURCE_TOUCHSCREEN
|
||||
* only applies to devices with source %GDK_SOURCE_TOUCH
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_KINETIC_SCROLLING,
|
||||
g_param_spec_boolean ("kinetic-scrolling",
|
||||
P_("Kinetic Scrolling"),
|
||||
P_("Kinetic scrolling mode."),
|
||||
TRUE,
|
||||
GTK_PARAM_READABLE |
|
||||
GTK_PARAM_WRITABLE));
|
||||
g_param_spec_flags ("kinetic-scrolling",
|
||||
P_("Kinetic Scrolling"),
|
||||
P_("Kinetic scrolling mode."),
|
||||
GTK_TYPE_KINETIC_SCROLLING_FLAGS,
|
||||
GTK_KINETIC_SCROLLING_ENABLED |
|
||||
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS,
|
||||
GTK_PARAM_READABLE |
|
||||
GTK_PARAM_WRITABLE));
|
||||
/**
|
||||
* GtkScrolledWindow::scroll-child:
|
||||
* @scrolled_window: a #GtkScrolledWindow
|
||||
@@ -595,8 +596,9 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
|
||||
priv->min_content_width = -1;
|
||||
priv->min_content_height = -1;
|
||||
|
||||
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window, TRUE);
|
||||
gtk_scrolled_window_set_capture_button_press (scrolled_window, TRUE);
|
||||
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window,
|
||||
GTK_KINETIC_SCROLLING_ENABLED |
|
||||
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1108,35 +1110,40 @@ gtk_scrolled_window_get_shadow_type (GtkScrolledWindow *scrolled_window)
|
||||
/**
|
||||
* gtk_scrolled_window_set_kinetic_scrolling:
|
||||
* @scrolled_window: a #GtkScrolledWindow
|
||||
* @kinetic_scrolling: %TRUE to enable kinetic scrolling
|
||||
* @flags: flags to apply to kinetic scrolling
|
||||
*
|
||||
* Turns kinetic scrolling on or off.
|
||||
* Kinetic scrolling only applies to devices with source
|
||||
* %GDK_SOURCE_TOUCHSCREEN.
|
||||
* Specifies the kinetic scrolling behavior for @scrolled_window. Kinetic
|
||||
* scrolling only applies to devices with source %GDK_SOURCE_TOUCH.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
void
|
||||
gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
|
||||
gboolean kinetic_scrolling)
|
||||
gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
|
||||
GtkKineticScrollingFlags flags)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||
|
||||
priv = scrolled_window->priv;
|
||||
if (priv->kinetic_scrolling == kinetic_scrolling)
|
||||
if (priv->kinetic_scrolling_flags == flags)
|
||||
return;
|
||||
|
||||
priv->kinetic_scrolling = kinetic_scrolling;
|
||||
if (priv->kinetic_scrolling)
|
||||
priv->kinetic_scrolling_flags = flags;
|
||||
if (priv->kinetic_scrolling_flags & GTK_KINETIC_SCROLLING_ENABLED)
|
||||
{
|
||||
_gtk_widget_set_captured_event_handler (GTK_WIDGET (scrolled_window),
|
||||
gtk_scrolled_window_captured_event);
|
||||
priv->captured_event_id =
|
||||
g_signal_connect (scrolled_window, "captured-event",
|
||||
G_CALLBACK (gtk_scrolled_window_captured_event),
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gtk_widget_set_captured_event_handler (GTK_WIDGET (scrolled_window), NULL);
|
||||
if (priv->captured_event_id > 0)
|
||||
{
|
||||
g_signal_handler_disconnect (scrolled_window, priv->captured_event_id);
|
||||
priv->captured_event_id = 0;
|
||||
}
|
||||
if (priv->release_timeout_id)
|
||||
{
|
||||
g_source_remove (priv->release_timeout_id);
|
||||
@@ -1160,63 +1167,19 @@ gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
|
||||
* Return value: the scrolling behavior flags.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
gboolean
|
||||
**/
|
||||
GtkKineticScrollingFlags
|
||||
gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), FALSE);
|
||||
|
||||
return scrolled_window->priv->kinetic_scrolling;
|
||||
priv = scrolled_window->priv;
|
||||
|
||||
return priv->kinetic_scrolling_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrolled_window_set_capture_button_press:
|
||||
* @scrolled_window: a #GtkScrolledWindow
|
||||
* @capture_button_press: %TRUE to capture button presses
|
||||
*
|
||||
* Changes the behaviour of @scrolled_window wrt. to the initial
|
||||
* event that possibly starts kinetic scrolling. When @capture_button_press
|
||||
* is set to %TRUE, the event is captured by the scrolled window, and
|
||||
* then later replayed if it is meant to go to the child widget.
|
||||
*
|
||||
* This should be enabled if any child widgets perform non-reversible
|
||||
* actions on #GtkWidget::button-press-event. If they don't, and handle
|
||||
* additionally handle #GtkWidget::grab-broken-event, it might be better
|
||||
* to set @capture_button_press to %FALSE.
|
||||
*
|
||||
* This setting only has an effect if kinetic scrolling is enabled.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
void
|
||||
gtk_scrolled_window_set_capture_button_press (GtkScrolledWindow *scrolled_window,
|
||||
gboolean capture_button_press)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||
|
||||
scrolled_window->priv->capture_button_press = capture_button_press;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_scrolled_window_get_capture_button_press:
|
||||
* @scrolled_window: a #GtkScrolledWindow
|
||||
*
|
||||
* Return whether button presses are captured during kinetic
|
||||
* scrolling. See gtk_scrolled_window_set_capture_button_press().
|
||||
*
|
||||
* Returns: %TRUE if button presses are captured during kinetic scrolling
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
gboolean
|
||||
gtk_scrolled_window_get_capture_button_press (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window), FALSE);
|
||||
|
||||
return scrolled_window->priv->capture_button_press;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_scrolled_window_destroy (GtkWidget *widget)
|
||||
{
|
||||
@@ -1244,6 +1207,11 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
|
||||
priv->vscrollbar = NULL;
|
||||
}
|
||||
|
||||
if (priv->captured_event_id > 0)
|
||||
{
|
||||
g_signal_handler_disconnect (scrolled_window, priv->captured_event_id);
|
||||
priv->captured_event_id = 0;
|
||||
}
|
||||
if (priv->release_timeout_id)
|
||||
{
|
||||
g_source_remove (priv->release_timeout_id);
|
||||
@@ -1255,12 +1223,6 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
|
||||
priv->deceleration_id = 0;
|
||||
}
|
||||
|
||||
if (priv->button_press_event)
|
||||
{
|
||||
gdk_event_free (priv->button_press_event);
|
||||
priv->button_press_event = NULL;
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->destroy (widget);
|
||||
}
|
||||
|
||||
@@ -1316,7 +1278,7 @@ gtk_scrolled_window_set_property (GObject *object,
|
||||
break;
|
||||
case PROP_KINETIC_SCROLLING:
|
||||
gtk_scrolled_window_set_kinetic_scrolling (scrolled_window,
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_flags (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -1365,7 +1327,7 @@ gtk_scrolled_window_get_property (GObject *object,
|
||||
g_value_set_int (value, priv->min_content_height);
|
||||
break;
|
||||
case PROP_KINETIC_SCROLLING:
|
||||
g_value_set_boolean (value, priv->kinetic_scrolling);
|
||||
g_value_set_boolean (value, priv->kinetic_scrolling_flags);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -1465,6 +1427,7 @@ gtk_scrolled_window_draw (GtkWidget *widget,
|
||||
|
||||
if (priv->shadow_type != GTK_SHADOW_NONE)
|
||||
{
|
||||
GtkAllocation relative_allocation;
|
||||
gboolean scrollbars_within_bevel;
|
||||
|
||||
gtk_style_context_save (context);
|
||||
@@ -1900,7 +1863,9 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
gtk_style_context_get_border (context, state, &border);
|
||||
|
||||
gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
|
||||
gtk_widget_style_get (widget,
|
||||
"scrollbars-within-bevel", &scrollbars_within_bevel,
|
||||
NULL);
|
||||
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
gtk_style_context_restore (context);
|
||||
@@ -2428,36 +2393,18 @@ gtk_scrolled_window_start_deceleration (GtkScrolledWindow *scrolled_window)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_scrolled_window_release_captured_event (GtkScrolledWindow *scrolled_window)
|
||||
gtk_scrolled_window_release_captured_events (GtkScrolledWindow *scrolled_window)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
||||
|
||||
/* Cancel the scrolling and send the button press
|
||||
* event to the child widget
|
||||
*/
|
||||
if (!priv->button_press_event)
|
||||
return FALSE;
|
||||
gtk_device_grab_remove (GTK_WIDGET (scrolled_window), priv->drag_device);
|
||||
priv->drag_device = NULL;
|
||||
|
||||
if (priv->drag_device)
|
||||
{
|
||||
gtk_device_grab_remove (GTK_WIDGET (scrolled_window), priv->drag_device);
|
||||
priv->drag_device = NULL;
|
||||
}
|
||||
|
||||
if (priv->capture_button_press)
|
||||
{
|
||||
GtkWidget *event_widget;
|
||||
|
||||
event_widget = gtk_get_event_widget (priv->button_press_event);
|
||||
|
||||
if (!_gtk_propagate_captured_event (event_widget,
|
||||
priv->button_press_event,
|
||||
gtk_bin_get_child (GTK_BIN (scrolled_window))))
|
||||
gtk_propagate_event (event_widget, priv->button_press_event);
|
||||
|
||||
gdk_event_free (priv->button_press_event);
|
||||
priv->button_press_event = NULL;
|
||||
}
|
||||
if (priv->kinetic_scrolling_flags & GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS)
|
||||
gtk_widget_release_captured_events (GTK_WIDGET (scrolled_window), TRUE);
|
||||
|
||||
if (_gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL))
|
||||
gtk_scrolled_window_start_deceleration (scrolled_window);
|
||||
@@ -2502,21 +2449,25 @@ gtk_scrolled_window_calculate_velocity (GtkScrolledWindow *scrolled_window,
|
||||
|
||||
static gboolean
|
||||
gtk_scrolled_window_captured_button_release (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
GdkEvent *_event)
|
||||
{
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
||||
GtkWidget *child;
|
||||
GdkEventButton *event;
|
||||
gboolean overshoot;
|
||||
guint button;
|
||||
gdouble x_root, y_root;
|
||||
|
||||
if (gdk_event_get_button (event, &button) && button != 1)
|
||||
return FALSE;
|
||||
event = (GdkEventButton *)_event;
|
||||
|
||||
if (event->button != 1)
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
if (!child)
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
if (priv->drag_device != gdk_event_get_device (_event))
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
gtk_device_grab_remove (widget, priv->drag_device);
|
||||
priv->drag_device = NULL;
|
||||
@@ -2530,26 +2481,21 @@ gtk_scrolled_window_captured_button_release (GtkWidget *widget,
|
||||
overshoot = _gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL);
|
||||
|
||||
if (priv->in_drag)
|
||||
gdk_device_ungrab (gdk_event_get_device (event), gdk_event_get_time (event));
|
||||
gdk_device_ungrab (event->device, event->time);
|
||||
else
|
||||
{
|
||||
/* There hasn't been scrolling at all, so just let the
|
||||
* child widget handle the button press normally
|
||||
* child widget handle the events normally
|
||||
*/
|
||||
gtk_scrolled_window_release_captured_event (scrolled_window);
|
||||
if (priv->kinetic_scrolling_flags & GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS)
|
||||
gtk_widget_release_captured_events (widget, TRUE);
|
||||
|
||||
if (!overshoot)
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
}
|
||||
priv->in_drag = FALSE;
|
||||
|
||||
if (priv->button_press_event)
|
||||
{
|
||||
gdk_event_free (priv->button_press_event);
|
||||
priv->button_press_event = NULL;
|
||||
}
|
||||
|
||||
gtk_scrolled_window_calculate_velocity (scrolled_window, event);
|
||||
gtk_scrolled_window_calculate_velocity (scrolled_window, _event);
|
||||
|
||||
/* Zero out vector components without a visible scrollbar */
|
||||
if (!priv->hscrollbar_visible)
|
||||
@@ -2565,21 +2511,20 @@ gtk_scrolled_window_captured_button_release (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_event_get_root_coords (event, &x_root, &y_root);
|
||||
priv->last_button_event_x_root = x_root;
|
||||
priv->last_button_event_y_root = y_root;
|
||||
priv->last_button_event_x_root = event->x_root;
|
||||
priv->last_button_event_y_root = event->y_root;
|
||||
priv->last_button_event_valid = TRUE;
|
||||
}
|
||||
|
||||
if (priv->capture_button_press)
|
||||
return TRUE;
|
||||
if (priv->kinetic_scrolling_flags & GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS)
|
||||
return GTK_CAPTURED_EVENT_HANDLED;
|
||||
else
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
GdkEvent *_event)
|
||||
{
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
||||
@@ -2589,25 +2534,27 @@ gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
gdouble dx, dy;
|
||||
GdkModifierType state;
|
||||
gdouble x_root, y_root;
|
||||
GdkEventMotion *event;
|
||||
|
||||
gdk_event_get_state (event, &state);
|
||||
if (!(state & GDK_BUTTON1_MASK))
|
||||
return FALSE;
|
||||
event = (GdkEventMotion *)_event;
|
||||
|
||||
if (!(event->state & GDK_BUTTON1_MASK))
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
if (!child)
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
if (priv->drag_device != gdk_event_get_device (_event))
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
/* Check if we've passed the drag threshold */
|
||||
gdk_event_get_root_coords (event, &x_root, &y_root);
|
||||
if (!priv->in_drag)
|
||||
{
|
||||
if (gtk_drag_check_threshold (widget,
|
||||
priv->last_button_event_x_root,
|
||||
priv->last_button_event_y_root,
|
||||
x_root, y_root))
|
||||
event->x_root, event->y_root))
|
||||
{
|
||||
if (priv->release_timeout_id)
|
||||
{
|
||||
@@ -2619,7 +2566,7 @@ gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
priv->in_drag = TRUE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
return GTK_CAPTURED_EVENT_HANDLED;
|
||||
}
|
||||
|
||||
gdk_device_grab (priv->drag_device,
|
||||
@@ -2628,15 +2575,9 @@ gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
TRUE,
|
||||
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
|
||||
NULL,
|
||||
gdk_event_get_time (event));
|
||||
event->time);
|
||||
|
||||
priv->last_button_event_valid = FALSE;
|
||||
|
||||
if (priv->button_press_event)
|
||||
{
|
||||
gdk_event_free (priv->button_press_event);
|
||||
priv->button_press_event = NULL;
|
||||
}
|
||||
gtk_widget_release_captured_events (widget, FALSE);
|
||||
|
||||
_gtk_scrolled_window_get_overshoot (scrolled_window,
|
||||
&old_overshoot_x, &old_overshoot_y);
|
||||
@@ -2644,7 +2585,7 @@ gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
||||
if (hadjustment && priv->hscrollbar_visible)
|
||||
{
|
||||
dx = (priv->last_motion_event_x_root - x_root) + priv->unclamped_hadj_value;
|
||||
dx = (priv->last_motion_event_x_root - event->x_root) + priv->unclamped_hadj_value;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window, hadjustment,
|
||||
dx, TRUE, FALSE);
|
||||
}
|
||||
@@ -2652,7 +2593,7 @@ gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
||||
if (vadjustment && priv->vscrollbar_visible)
|
||||
{
|
||||
dy = (priv->last_motion_event_y_root - y_root) + priv->unclamped_vadj_value;
|
||||
dy = (priv->last_motion_event_y_root - event->y_root) + priv->unclamped_vadj_value;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window, vadjustment,
|
||||
dy, TRUE, FALSE);
|
||||
}
|
||||
@@ -2675,132 +2616,136 @@ gtk_scrolled_window_captured_motion_notify (GtkWidget *widget,
|
||||
_gtk_scrolled_window_allocate_overshoot_window (scrolled_window);
|
||||
}
|
||||
|
||||
gtk_scrolled_window_calculate_velocity (scrolled_window, event);
|
||||
gtk_scrolled_window_calculate_velocity (scrolled_window, _event);
|
||||
|
||||
return TRUE;
|
||||
return GTK_CAPTURED_EVENT_HANDLED;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GtkCapturedEventFlags
|
||||
gtk_scrolled_window_captured_button_press (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
GdkEvent *_event)
|
||||
{
|
||||
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
||||
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
|
||||
GtkWidget *child;
|
||||
GtkWidget *event_widget;
|
||||
GdkEventButton *event;
|
||||
GdkDevice *source_device;
|
||||
GdkInputSource source;
|
||||
gdouble x_root, y_root;
|
||||
guint button;
|
||||
guint timeout;
|
||||
|
||||
/* If scrollbars are not visible, we don't do kinetic scrolling */
|
||||
if (!priv->vscrollbar_visible && !priv->hscrollbar_visible)
|
||||
return FALSE;
|
||||
if (_event->type != GDK_BUTTON_PRESS)
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
source_device = gdk_event_get_source_device (_event);
|
||||
source = gdk_device_get_source (source_device);
|
||||
|
||||
if (source != GDK_SOURCE_TOUCHSCREEN)
|
||||
return FALSE;
|
||||
if (source != GDK_SOURCE_TOUCH)
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
event = (GdkEventButton *)_event;
|
||||
event_widget = gtk_get_event_widget (_event);
|
||||
|
||||
if (!priv->vscrollbar_visible &&
|
||||
!priv->hscrollbar_visible)
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
/* If there's another scrolled window between the widget
|
||||
* receiving the event and this capturing scrolled window,
|
||||
* let it handle the events.
|
||||
*/
|
||||
if (widget != gtk_widget_get_ancestor (event_widget, GTK_TYPE_SCROLLED_WINDOW))
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
/* Check whether the button press is close to the previous one,
|
||||
* take that as a shortcut to get the child widget handle events
|
||||
*/
|
||||
gdk_event_get_root_coords (event, &x_root, &y_root);
|
||||
if (priv->last_button_event_valid &&
|
||||
ABS (x_root - priv->last_button_event_x_root) < TOUCH_BYPASS_CAPTURED_THRESHOLD &&
|
||||
ABS (y_root - priv->last_button_event_y_root) < TOUCH_BYPASS_CAPTURED_THRESHOLD)
|
||||
ABS (event->x_root - priv->last_button_event_x_root) < TOUCH_BYPASS_CAPTURED_THRESHOLD &&
|
||||
ABS (event->y_root - priv->last_button_event_y_root) < TOUCH_BYPASS_CAPTURED_THRESHOLD)
|
||||
{
|
||||
priv->last_button_event_valid = FALSE;
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
}
|
||||
|
||||
priv->last_button_event_x_root = priv->last_motion_event_x_root = x_root;
|
||||
priv->last_button_event_y_root = priv->last_motion_event_y_root = y_root;
|
||||
priv->last_motion_event_time = gdk_event_get_time (event);
|
||||
priv->last_button_event_x_root = priv->last_motion_event_x_root = event->x_root;
|
||||
priv->last_button_event_y_root = priv->last_motion_event_y_root = event->y_root;
|
||||
priv->last_motion_event_time = event->time;
|
||||
priv->last_button_event_valid = TRUE;
|
||||
|
||||
if (gdk_event_get_button (event, &button) && button != 1)
|
||||
return FALSE;
|
||||
if (event->button != 1)
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
if (!child)
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
if (priv->hscrollbar == event_widget || priv->vscrollbar == event_widget)
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
|
||||
priv->drag_device = gdk_event_get_device (event);
|
||||
priv->drag_device = gdk_event_get_device (_event);
|
||||
gtk_device_grab_add (widget, priv->drag_device, TRUE);
|
||||
|
||||
gtk_scrolled_window_cancel_deceleration (scrolled_window);
|
||||
|
||||
g_object_get (gtk_widget_get_settings (GTK_WIDGET (widget)),
|
||||
"gtk-press-and-hold-timeout", &timeout,
|
||||
NULL);
|
||||
|
||||
/* Only set the timeout if we're going to store an event */
|
||||
if (priv->capture_button_press)
|
||||
if (priv->kinetic_scrolling_flags & GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS)
|
||||
priv->release_timeout_id =
|
||||
gdk_threads_add_timeout (RELEASE_EVENT_TIMEOUT,
|
||||
(GSourceFunc) gtk_scrolled_window_release_captured_event,
|
||||
gdk_threads_add_timeout (timeout,
|
||||
(GSourceFunc) gtk_scrolled_window_release_captured_events,
|
||||
scrolled_window);
|
||||
|
||||
priv->in_drag = FALSE;
|
||||
|
||||
if (priv->capture_button_press)
|
||||
if (priv->kinetic_scrolling_flags & GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS)
|
||||
{
|
||||
/* Store the button press event in
|
||||
* case we need to propagate it later
|
||||
*/
|
||||
priv->button_press_event = gdk_event_copy (event);
|
||||
return TRUE;
|
||||
return GTK_CAPTURED_EVENT_HANDLED | GTK_CAPTURED_EVENT_STORE;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return GTK_CAPTURED_EVENT_NONE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static GtkCapturedEventFlags
|
||||
gtk_scrolled_window_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event)
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean retval = FALSE;
|
||||
GtkCapturedEventFlags flags = GTK_CAPTURED_EVENT_NONE;
|
||||
GtkScrolledWindowPrivate *priv = GTK_SCROLLED_WINDOW (widget)->priv;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_TOUCH_BEGIN:
|
||||
case GDK_BUTTON_PRESS:
|
||||
retval = gtk_scrolled_window_captured_button_press (widget, event);
|
||||
flags = gtk_scrolled_window_captured_button_press (widget, event);
|
||||
break;
|
||||
case GDK_TOUCH_END:
|
||||
case GDK_BUTTON_RELEASE:
|
||||
if (priv->drag_device)
|
||||
retval = gtk_scrolled_window_captured_button_release (widget, event);
|
||||
flags = gtk_scrolled_window_captured_button_release (widget, event);
|
||||
else
|
||||
priv->last_button_event_valid = FALSE;
|
||||
break;
|
||||
case GDK_TOUCH_UPDATE:
|
||||
case GDK_MOTION_NOTIFY:
|
||||
if (priv->drag_device)
|
||||
retval = gtk_scrolled_window_captured_motion_notify (widget, event);
|
||||
flags = gtk_scrolled_window_captured_motion_notify (widget, event);
|
||||
break;
|
||||
case GDK_LEAVE_NOTIFY:
|
||||
case GDK_ENTER_NOTIFY:
|
||||
if (priv->in_drag &&
|
||||
event->crossing.mode != GDK_CROSSING_GRAB)
|
||||
retval = TRUE;
|
||||
flags = GTK_CAPTURED_EVENT_HANDLED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return flags;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -3256,8 +3201,7 @@ gtk_scrolled_window_realize (GtkWidget *widget)
|
||||
attributes.height = allocation.height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK |
|
||||
GDK_BUTTON_MOTION_MASK | GDK_TOUCH_MASK;
|
||||
attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
|
||||
@@ -117,13 +117,9 @@ void gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *sc
|
||||
gint gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window);
|
||||
void gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
|
||||
gint height);
|
||||
void gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
|
||||
gboolean kinetic_scrolling);
|
||||
gboolean gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window);
|
||||
|
||||
void gtk_scrolled_window_set_capture_button_press (GtkScrolledWindow *scrolled_window,
|
||||
gboolean capture_button_press);
|
||||
gboolean gtk_scrolled_window_get_capture_button_press (GtkScrolledWindow *scrolled_window);
|
||||
void gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
|
||||
GtkKineticScrollingFlags flags);
|
||||
GtkKineticScrollingFlags gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window);
|
||||
|
||||
gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
|
||||
|
||||
|
||||
+54
-4
@@ -32,8 +32,10 @@
|
||||
#include "gtkwidget.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkcssproviderprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtksymboliccolor.h"
|
||||
#include "gtkanimationdescription.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkversion.h"
|
||||
|
||||
@@ -97,9 +99,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#define DEFAULT_TIMEOUT_INITIAL 200
|
||||
#define DEFAULT_TIMEOUT_REPEAT 20
|
||||
#define DEFAULT_TIMEOUT_EXPAND 500
|
||||
#define DEFAULT_TIMEOUT_INITIAL 200
|
||||
#define DEFAULT_TIMEOUT_REPEAT 20
|
||||
#define DEFAULT_TIMEOUT_EXPAND 500
|
||||
#define DEFAULT_TIMEOUT_PRESS_AND_HOLD 800
|
||||
|
||||
typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue;
|
||||
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
|
||||
@@ -207,7 +210,8 @@ enum {
|
||||
PROP_IM_PREEDIT_STYLE,
|
||||
PROP_IM_STATUS_STYLE,
|
||||
PROP_SHELL_SHOWS_APP_MENU,
|
||||
PROP_SHELL_SHOWS_MENUBAR
|
||||
PROP_SHELL_SHOWS_MENUBAR,
|
||||
PROP_PRESS_AND_HOLD_TIMEOUT
|
||||
};
|
||||
|
||||
/* --- prototypes --- */
|
||||
@@ -1353,6 +1357,24 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
NULL);
|
||||
g_assert (result == PROP_SHELL_SHOWS_MENUBAR);
|
||||
|
||||
/**
|
||||
* GtkSettings:gtk-press-and-hold-timeout:
|
||||
*
|
||||
* The amount of time, in milliseconds, a button has to be pressed
|
||||
* before the press-and-hold signal with the trigger action is emitted.
|
||||
*
|
||||
* Since: 3.2
|
||||
*/
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_int ("gtk-press-and-hold-timeout",
|
||||
P_("Press And Hold Timeout"),
|
||||
P_("Timeout before press-and-hold action activates"),
|
||||
0, G_MAXINT,
|
||||
DEFAULT_TIMEOUT_PRESS_AND_HOLD,
|
||||
GTK_PARAM_READWRITE),
|
||||
NULL);
|
||||
g_assert (result == PROP_PRESS_AND_HOLD_TIMEOUT);
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkSettingsPrivate));
|
||||
}
|
||||
|
||||
@@ -1482,6 +1504,34 @@ gtk_settings_style_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
path,
|
||||
state,
|
||||
lookup);
|
||||
|
||||
/* Set animation for press and hold */
|
||||
if (gtk_widget_path_iter_has_class (path, 0, GTK_STYLE_CLASS_PRESS_AND_HOLD))
|
||||
{
|
||||
GtkAnimationDescription *anim_desc;
|
||||
static GValue anim_value = { 0 };
|
||||
GtkStyleProperty *prop;
|
||||
gint duration;
|
||||
|
||||
if (!G_IS_VALUE (&anim_value))
|
||||
{
|
||||
g_object_get (settings,
|
||||
"gtk-press-and-hold-timeout", &duration,
|
||||
NULL);
|
||||
|
||||
anim_desc = _gtk_animation_description_new (duration,
|
||||
GTK_TIMELINE_PROGRESS_LINEAR,
|
||||
FALSE);
|
||||
g_value_init (&anim_value, GTK_TYPE_ANIMATION_DESCRIPTION);
|
||||
g_value_take_boxed (&anim_value, anim_desc);
|
||||
}
|
||||
|
||||
prop = _gtk_style_property_lookup ("transition");
|
||||
|
||||
_gtk_css_lookup_set (lookup,
|
||||
_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (prop)),
|
||||
NULL, &anim_value);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -648,6 +648,13 @@ struct _GtkStyleContextClass
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_RIGHT "right"
|
||||
|
||||
/**
|
||||
* GTK_STYLE_CLASS_PRESS_AND_HOLD:
|
||||
*
|
||||
* A CSS class for the press and hold activity indicator.
|
||||
*/
|
||||
#define GTK_STYLE_CLASS_PRESS_AND_HOLD "press-and-hold"
|
||||
|
||||
/* Predefined set of widget regions */
|
||||
|
||||
/**
|
||||
|
||||
+57
-26
@@ -378,6 +378,11 @@ static void gtk_text_view_drag_data_received (GtkWidget *widget,
|
||||
guint time);
|
||||
|
||||
static gboolean gtk_text_view_popup_menu (GtkWidget *widget);
|
||||
static gboolean gtk_text_view_press_and_hold (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
static void gtk_text_view_move_cursor (GtkTextView *text_view,
|
||||
GtkMovementStep step,
|
||||
@@ -463,7 +468,9 @@ static void gtk_text_view_set_virtual_cursor_pos (GtkTextView *text_view,
|
||||
gint y);
|
||||
|
||||
static void gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
GdkEventButton *event);
|
||||
GdkDevice *device,
|
||||
guint32 _time,
|
||||
guint button);
|
||||
|
||||
static void cancel_pending_scroll (GtkTextView *text_view);
|
||||
static void gtk_text_view_queue_scroll (GtkTextView *text_view,
|
||||
@@ -631,7 +638,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
|
||||
widget_class->drag_data_received = gtk_text_view_drag_data_received;
|
||||
|
||||
widget_class->popup_menu = gtk_text_view_popup_menu;
|
||||
|
||||
widget_class->press_and_hold = gtk_text_view_press_and_hold;
|
||||
|
||||
container_class->add = gtk_text_view_add;
|
||||
container_class->remove = gtk_text_view_remove;
|
||||
container_class->forall = gtk_text_view_forall;
|
||||
@@ -4556,7 +4564,8 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
|
||||
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
|
||||
{
|
||||
gtk_text_view_do_popup (text_view, event);
|
||||
gtk_text_view_do_popup (text_view, event->device,
|
||||
event->time, event->button);
|
||||
return TRUE;
|
||||
}
|
||||
else if (event->button == GDK_BUTTON_PRIMARY)
|
||||
@@ -8320,16 +8329,18 @@ popup_targets_received (GtkClipboard *clipboard,
|
||||
signals[POPULATE_POPUP],
|
||||
0,
|
||||
priv->popup_menu);
|
||||
|
||||
if (info->device)
|
||||
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
|
||||
info->device, NULL, NULL, NULL, NULL, NULL,
|
||||
info->button, info->time);
|
||||
|
||||
if (gdk_device_get_source (info->device) != GDK_SOURCE_KEYBOARD)
|
||||
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
|
||||
info->device, NULL, NULL, NULL, NULL, NULL,
|
||||
info->button, info->time);
|
||||
else
|
||||
{
|
||||
gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
|
||||
popup_position_func, text_view,
|
||||
0, gtk_get_current_event_time ());
|
||||
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
|
||||
info->device, NULL, NULL,
|
||||
popup_position_func,
|
||||
text_view, NULL,
|
||||
0, info->time);
|
||||
gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->popup_menu), FALSE);
|
||||
}
|
||||
}
|
||||
@@ -8340,7 +8351,9 @@ popup_targets_received (GtkClipboard *clipboard,
|
||||
|
||||
static void
|
||||
gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
GdkEventButton *event)
|
||||
GdkDevice *device,
|
||||
guint32 _time,
|
||||
guint button)
|
||||
{
|
||||
PopupInfo *info = g_new (PopupInfo, 1);
|
||||
|
||||
@@ -8349,19 +8362,9 @@ gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
* we get them, then we actually pop up the menu.
|
||||
*/
|
||||
info->text_view = g_object_ref (text_view);
|
||||
|
||||
if (event)
|
||||
{
|
||||
info->button = event->button;
|
||||
info->time = event->time;
|
||||
info->device = event->device;
|
||||
}
|
||||
else
|
||||
{
|
||||
info->button = 0;
|
||||
info->time = gtk_get_current_event_time ();
|
||||
info->device = NULL;
|
||||
}
|
||||
info->button = button;
|
||||
info->time = _time;
|
||||
info->device = device;
|
||||
|
||||
gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (text_view),
|
||||
GDK_SELECTION_CLIPBOARD),
|
||||
@@ -8373,7 +8376,35 @@ gtk_text_view_do_popup (GtkTextView *text_view,
|
||||
static gboolean
|
||||
gtk_text_view_popup_menu (GtkWidget *widget)
|
||||
{
|
||||
gtk_text_view_do_popup (GTK_TEXT_VIEW (widget), NULL);
|
||||
gtk_text_view_do_popup (GTK_TEXT_VIEW (widget),
|
||||
gtk_get_current_event_device (),
|
||||
gtk_get_current_event_time (),
|
||||
0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_text_view_press_and_hold (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
if (action == GTK_PRESS_AND_HOLD_TRIGGER)
|
||||
gtk_text_view_do_popup (GTK_TEXT_VIEW (widget), device,
|
||||
GDK_CURRENT_TIME, 1);
|
||||
else if (action == GTK_PRESS_AND_HOLD_QUERY)
|
||||
{
|
||||
GdkDevice *source_device;
|
||||
GdkEvent *event;
|
||||
|
||||
event = gtk_get_current_event ();
|
||||
source_device = gdk_event_get_source_device (event);
|
||||
|
||||
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
+61
-2
@@ -36,8 +36,6 @@
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gtkthemingbackgroundprivate.h"
|
||||
|
||||
#include "fallback-c89.c"
|
||||
|
||||
/**
|
||||
* SECTION:gtkthemingengine
|
||||
* @Short_description: Theming renderers
|
||||
@@ -2794,6 +2792,63 @@ render_spinner (GtkThemingEngine *engine,
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
render_press_and_hold (GtkThemingEngine *engine,
|
||||
cairo_t *cr,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
{
|
||||
gdouble progress, radius, border_width;
|
||||
GdkRGBA color, bg_color;
|
||||
GtkStateFlags flags;
|
||||
GtkBorder border;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
if (!gtk_theming_engine_state_is_running (engine,
|
||||
GTK_STATE_FLAG_ACTIVE,
|
||||
&progress))
|
||||
progress = 0;
|
||||
|
||||
flags = gtk_theming_engine_get_state (engine);
|
||||
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
|
||||
gtk_theming_engine_get_color (engine, flags, &color);
|
||||
gtk_theming_engine_get_border (engine, flags, &border);
|
||||
|
||||
border_width = (gdouble) MAX (MAX (border.top, border.bottom),
|
||||
MAX (border.left, border.right));
|
||||
|
||||
radius = MIN (width, height) / 2;
|
||||
|
||||
if (border_width == 0 ||
|
||||
border_width >= radius - border_width)
|
||||
border_width = MAX (1, radius / 4);
|
||||
|
||||
cairo_set_line_width (cr, border_width);
|
||||
radius -= border_width;
|
||||
|
||||
/* Arcs start from the negative Y axis */
|
||||
cairo_arc (cr,
|
||||
width / 2, height / 2,
|
||||
radius,
|
||||
- G_PI_2, - G_PI_2 + (2 * G_PI));
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, &bg_color);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_arc (cr,
|
||||
width / 2, height / 2,
|
||||
radius,
|
||||
- G_PI_2,
|
||||
- G_PI_2 + (2 * G_PI * progress));
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_theming_engine_render_activity (GtkThemingEngine *engine,
|
||||
cairo_t *cr,
|
||||
@@ -2806,6 +2861,10 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
|
||||
{
|
||||
render_spinner (engine, cr, x, y, width, height);
|
||||
}
|
||||
else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_PRESS_AND_HOLD))
|
||||
{
|
||||
render_press_and_hold (engine, cr, x, y, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_theming_engine_render_background (engine, cr, x, y, width, height);
|
||||
|
||||
+36
-36
@@ -368,14 +368,14 @@ gtk_timeline_run_frame (GtkTimeline *timeline)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_new:
|
||||
/**
|
||||
* gtk_timeline_new:
|
||||
* @duration: duration in milliseconds for the timeline
|
||||
*
|
||||
* Creates a new #GtkTimeline with the specified number of frames.
|
||||
*
|
||||
* Return Value: the newly created #GtkTimeline
|
||||
*/
|
||||
**/
|
||||
GtkTimeline *
|
||||
_gtk_timeline_new (guint duration)
|
||||
{
|
||||
@@ -394,12 +394,12 @@ _gtk_timeline_new_for_screen (guint duration,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_start:
|
||||
/**
|
||||
* gtk_timeline_start:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Runs the timeline from the current frame.
|
||||
*/
|
||||
**/
|
||||
void
|
||||
_gtk_timeline_start (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -441,12 +441,12 @@ _gtk_timeline_start (GtkTimeline *timeline)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_pause:
|
||||
/**
|
||||
* gtk_timeline_pause:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Pauses the timeline.
|
||||
*/
|
||||
**/
|
||||
void
|
||||
_gtk_timeline_pause (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -465,12 +465,12 @@ _gtk_timeline_pause (GtkTimeline *timeline)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_rewind:
|
||||
/**
|
||||
* gtk_timeline_rewind:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Rewinds the timeline.
|
||||
*/
|
||||
**/
|
||||
void
|
||||
_gtk_timeline_rewind (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -495,14 +495,14 @@ _gtk_timeline_rewind (GtkTimeline *timeline)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_is_running:
|
||||
/**
|
||||
* gtk_timeline_is_running:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Returns whether the timeline is running or not.
|
||||
*
|
||||
* Return Value: %TRUE if the timeline is running
|
||||
*/
|
||||
**/
|
||||
gboolean
|
||||
_gtk_timeline_is_running (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -515,14 +515,14 @@ _gtk_timeline_is_running (GtkTimeline *timeline)
|
||||
return (priv->source_id != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_get_elapsed_time:
|
||||
/**
|
||||
* gtk_timeline_get_elapsed_time:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Returns the elapsed time since the last GtkTimeline::frame signal
|
||||
*
|
||||
* Return Value: elapsed time in milliseconds since the last frame
|
||||
*/
|
||||
**/
|
||||
guint
|
||||
_gtk_timeline_get_elapsed_time (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -534,14 +534,14 @@ _gtk_timeline_get_elapsed_time (GtkTimeline *timeline)
|
||||
return priv->elapsed_time;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_get_fps:
|
||||
/**
|
||||
* gtk_timeline_get_fps:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Returns the number of frames per second.
|
||||
*
|
||||
* Return Value: frames per second
|
||||
*/
|
||||
**/
|
||||
guint
|
||||
_gtk_timeline_get_fps (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -553,14 +553,14 @@ _gtk_timeline_get_fps (GtkTimeline *timeline)
|
||||
return priv->fps;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_set_fps:
|
||||
/**
|
||||
* gtk_timeline_set_fps:
|
||||
* @timeline: A #GtkTimeline
|
||||
* @fps: frames per second
|
||||
*
|
||||
* Sets the number of frames per second that
|
||||
* the timeline will play.
|
||||
*/
|
||||
**/
|
||||
void
|
||||
_gtk_timeline_set_fps (GtkTimeline *timeline,
|
||||
guint fps)
|
||||
@@ -585,15 +585,15 @@ _gtk_timeline_set_fps (GtkTimeline *timeline,
|
||||
g_object_notify (G_OBJECT (timeline), "fps");
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_get_loop:
|
||||
/**
|
||||
* gtk_timeline_get_loop:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Returns whether the timeline loops to the
|
||||
* beginning when it has reached the end.
|
||||
*
|
||||
* Return Value: %TRUE if the timeline loops
|
||||
*/
|
||||
**/
|
||||
gboolean
|
||||
_gtk_timeline_get_loop (GtkTimeline *timeline)
|
||||
{
|
||||
@@ -605,14 +605,14 @@ _gtk_timeline_get_loop (GtkTimeline *timeline)
|
||||
return priv->loop;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_set_loop:
|
||||
/**
|
||||
* gtk_timeline_set_loop:
|
||||
* @timeline: A #GtkTimeline
|
||||
* @loop: %TRUE to make the timeline loop
|
||||
*
|
||||
* Sets whether the timeline loops to the beginning
|
||||
* when it has reached the end.
|
||||
*/
|
||||
**/
|
||||
void
|
||||
_gtk_timeline_set_loop (GtkTimeline *timeline,
|
||||
gboolean loop)
|
||||
@@ -659,13 +659,13 @@ _gtk_timeline_get_duration (GtkTimeline *timeline)
|
||||
return priv->duration;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_set_direction:
|
||||
/**
|
||||
* gtk_timeline_set_direction:
|
||||
* @timeline: A #GtkTimeline
|
||||
* @direction: direction
|
||||
*
|
||||
* Sets the direction of the timeline.
|
||||
*/
|
||||
**/
|
||||
void
|
||||
_gtk_timeline_set_direction (GtkTimeline *timeline,
|
||||
GtkTimelineDirection direction)
|
||||
@@ -678,14 +678,14 @@ _gtk_timeline_set_direction (GtkTimeline *timeline,
|
||||
priv->direction = direction;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_timeline_get_direction:
|
||||
/**
|
||||
* gtk_timeline_get_direction:
|
||||
* @timeline: A #GtkTimeline
|
||||
*
|
||||
* Returns the direction of the timeline.
|
||||
*
|
||||
* Return Value: direction
|
||||
*/
|
||||
**/
|
||||
GtkTimelineDirection
|
||||
_gtk_timeline_get_direction (GtkTimeline *timeline)
|
||||
{
|
||||
|
||||
+2
-1
@@ -1560,7 +1560,8 @@ tooltips_enabled (GdkEvent *event)
|
||||
"gtk-enable-tooltips", &enabled,
|
||||
NULL);
|
||||
|
||||
if (enabled && source != GDK_SOURCE_TOUCHSCREEN)
|
||||
if (enabled &&
|
||||
source != GDK_SOURCE_TOUCH)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
||||
+2
-2
@@ -11930,7 +11930,7 @@ _gtk_tree_view_reset_header_styles (GtkTreeView *tree_view)
|
||||
GtkTreeViewColumn *column = columns->data;
|
||||
GtkWidget *header_widget;
|
||||
|
||||
if (!gtk_tree_view_column_get_visible (column))
|
||||
if (gtk_tree_view_column_get_visible (column))
|
||||
continue;
|
||||
|
||||
header_widget = gtk_tree_view_column_get_widget (column);
|
||||
@@ -15761,7 +15761,7 @@ gtk_tree_view_get_hover_selection (GtkTreeView *tree_view)
|
||||
* @tree_view: a #GtkTreeView
|
||||
* @expand: %TRUE to enable hover selection mode
|
||||
*
|
||||
* Enables or disables the hover expansion mode of @tree_view.
|
||||
* Enables of disables the hover expansion mode of @tree_view.
|
||||
* Hover expansion makes rows expand or collapse if the pointer
|
||||
* moves over them.
|
||||
*
|
||||
|
||||
@@ -2499,8 +2499,8 @@ gtk_tree_view_column_get_expand (GtkTreeViewColumn *tree_column)
|
||||
* @tree_column: A #GtkTreeViewColumn.
|
||||
* @clickable: %TRUE if the header is active.
|
||||
*
|
||||
* Sets the header to be active if @clickable is %TRUE. When the header is
|
||||
* active, then it can take keyboard focus, and can be clicked.
|
||||
* Sets the header to be active if @active is %TRUE. When the header is active,
|
||||
* then it can take keyboard focus, and can be clicked.
|
||||
**/
|
||||
void
|
||||
gtk_tree_view_column_set_clickable (GtkTreeViewColumn *tree_column,
|
||||
|
||||
@@ -966,10 +966,6 @@ cb_proxy_post_activate (GtkActionGroup *group,
|
||||
* with @manager. Actions in earlier groups hide actions with the same
|
||||
* name in later groups.
|
||||
*
|
||||
* If @pos is larger than the number of action groups in @manager, or
|
||||
* negative, @action_group will be inserted at the end of the internal
|
||||
* list.
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
void
|
||||
|
||||
+2
-2
@@ -343,7 +343,7 @@ viewport_get_view_allocation (GtkViewport *viewport,
|
||||
}
|
||||
|
||||
view_allocation->x += padding.left;
|
||||
view_allocation->y += padding.top;
|
||||
view_allocation->y += padding.right;
|
||||
view_allocation->width = MAX (1, allocation.width - padding.left - padding.right - border_width * 2);
|
||||
view_allocation->height = MAX (1, allocation.height - padding.top - padding.bottom - border_width * 2);
|
||||
|
||||
@@ -684,7 +684,7 @@ gtk_viewport_realize (GtkWidget *widget)
|
||||
event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
|
||||
/* We select on button_press_mask so that button 4-5 scrolls are trapped.
|
||||
*/
|
||||
attributes.event_mask = event_mask | GDK_BUTTON_PRESS_MASK | GDK_TOUCH_MASK;
|
||||
attributes.event_mask = event_mask | GDK_BUTTON_PRESS_MASK;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL;
|
||||
|
||||
|
||||
+793
-105
File diff suppressed because it is too large
Load Diff
+29
-5
@@ -49,6 +49,13 @@ typedef enum
|
||||
GTK_WIDGET_HELP_WHATS_THIS
|
||||
} GtkWidgetHelpType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GTK_PRESS_AND_HOLD_QUERY,
|
||||
GTK_PRESS_AND_HOLD_TRIGGER,
|
||||
GTK_PRESS_AND_HOLD_CANCEL
|
||||
} GtkPressAndHoldAction;
|
||||
|
||||
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
|
||||
* Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
|
||||
*/
|
||||
@@ -425,8 +432,20 @@ struct _GtkWidgetClass
|
||||
|
||||
void (* style_updated) (GtkWidget *widget);
|
||||
|
||||
gboolean (* touch_event) (GtkWidget *widget,
|
||||
GdkEventTouch *event);
|
||||
GtkCapturedEventFlags (* captured_event) (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
|
||||
gboolean (* press_and_hold) (GtkWidget *widget,
|
||||
GdkDevice *device,
|
||||
GtkPressAndHoldAction action,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
gboolean (* multitouch_event) (GtkWidget *widget,
|
||||
GdkEventMultiTouch *event);
|
||||
|
||||
void (* gesture) (GtkWidget *widget,
|
||||
guint gesture_id);
|
||||
|
||||
/*< private >*/
|
||||
|
||||
@@ -436,9 +455,6 @@ struct _GtkWidgetClass
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*_gtk_reserved4) (void);
|
||||
void (*_gtk_reserved5) (void);
|
||||
void (*_gtk_reserved6) (void);
|
||||
void (*_gtk_reserved7) (void);
|
||||
};
|
||||
|
||||
struct _GtkWidgetAuxInfo
|
||||
@@ -894,6 +910,14 @@ GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget);
|
||||
GdkModifierType gtk_widget_get_modifier_mask (GtkWidget *widget,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
void gtk_widget_release_captured_events (GtkWidget *widget,
|
||||
gboolean emit);
|
||||
|
||||
/* Gestures */
|
||||
void gtk_widget_enable_gesture (GtkWidget *widget,
|
||||
guint gesture_id);
|
||||
void gtk_widget_disable_gesture (GtkWidget *widget,
|
||||
guint gesture_id);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+11
-4
@@ -167,14 +167,21 @@ GtkStyle * _gtk_widget_get_style (GtkWidget *widget);
|
||||
void _gtk_widget_set_style (GtkWidget *widget,
|
||||
GtkStyle *style);
|
||||
|
||||
typedef gboolean (*GtkCapturedEventHandler) (GtkWidget *widget, GdkEvent *event);
|
||||
|
||||
void _gtk_widget_set_captured_event_handler (GtkWidget *widget,
|
||||
GtkCapturedEventHandler handler);
|
||||
|
||||
gboolean _gtk_widget_captured_event (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
|
||||
gboolean _gtk_widget_press_and_hold_check_start (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
gboolean _gtk_widget_press_and_hold_check_cancel (GtkWidget *widget,
|
||||
GdkEventButton *event);
|
||||
gboolean _gtk_widget_press_and_hold_check_threshold (GtkWidget *widget,
|
||||
GdkEventMotion *event);
|
||||
|
||||
void _gtk_widget_gesture_stroke (GtkWidget *widget,
|
||||
GdkEvent *event);
|
||||
void _gtk_widget_gesture_finish (GtkWidget *widget);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_WIDGET_PRIVATE_H__ */
|
||||
|
||||
+2
-2
@@ -2662,7 +2662,7 @@ gtk_window_set_attached_to (GtkWindow *window,
|
||||
{
|
||||
_gtk_widget_add_attached_window (priv->attach_widget, window);
|
||||
|
||||
g_object_ref (priv->attach_widget);
|
||||
g_object_ref_sink (priv->attach_widget);
|
||||
}
|
||||
|
||||
/* Update the style, as the widget path might change. */
|
||||
@@ -4520,7 +4520,7 @@ gtk_window_move (GtkWindow *window,
|
||||
/**
|
||||
* gtk_window_get_position:
|
||||
* @window: a #GtkWindow
|
||||
* @root_x: (out) (allow-none): return location for X coordinate of
|
||||
* @root_x: (out) (allow-none): eturn location for X coordinate of
|
||||
* gravity-determined reference point, or %NULL
|
||||
* @root_y: (out) (allow-none): return location for Y coordinate of
|
||||
* gravity-determined reference point, or %NULL
|
||||
|
||||
@@ -143,6 +143,10 @@ TEST_PROGS += regression-tests
|
||||
regression_tests_SOURCES = regression-tests.c
|
||||
regression_tests_LDADD = $(progs_ldadd)
|
||||
|
||||
TEST_PROGS += gestures
|
||||
gestures_SOURCES = gestures.c
|
||||
gestures_LDADD = $(progs_ldadd)
|
||||
|
||||
EXTRA_DIST += \
|
||||
file-chooser-test-dir/empty \
|
||||
file-chooser-test-dir/text.txt
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
/* gestures tests.
|
||||
*
|
||||
* Copyright (C) 2011 Carlos Garnacho <carlos@lanedo.com>
|
||||
* Authors: Carlos Garnacho <carlos@lanedo.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser 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.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
gesture_detected_cb (GtkGesturesInterpreter *interpreter,
|
||||
guint gesture_id,
|
||||
gdouble confidence,
|
||||
gpointer user_data)
|
||||
{
|
||||
gdouble *confidence_ret = user_data;
|
||||
|
||||
*confidence_ret = confidence;
|
||||
}
|
||||
|
||||
static void
|
||||
append_event_to_interpreter (GtkGesturesInterpreter *interpreter,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GdkDeviceManager *device_manager;
|
||||
GdkDevice *client_pointer;
|
||||
GdkDisplay *display;
|
||||
GdkEvent *event;
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
device_manager = gdk_display_get_device_manager (display);
|
||||
client_pointer = gdk_device_manager_get_client_pointer (device_manager);
|
||||
|
||||
event = gdk_event_new (GDK_MOTION_NOTIFY);
|
||||
event->motion.x = x;
|
||||
event->motion.y = y;
|
||||
event->motion.x_root = x;
|
||||
event->motion.y_root = y;
|
||||
gdk_event_set_device (event, client_pointer);
|
||||
gdk_event_set_source_device (event, client_pointer);
|
||||
|
||||
gtk_gestures_interpreter_feed_event (interpreter, event);
|
||||
gdk_event_free (event);
|
||||
}
|
||||
|
||||
static void
|
||||
test_empty_interpreter (void)
|
||||
{
|
||||
GtkGesturesInterpreter *interpreter;
|
||||
gboolean gesture_detected;
|
||||
gdouble confidence = 0;
|
||||
|
||||
interpreter = gtk_gestures_interpreter_new ();
|
||||
g_signal_connect (interpreter, "gesture-detected",
|
||||
G_CALLBACK (gesture_detected_cb),
|
||||
&confidence);
|
||||
|
||||
/* Feed some events */
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 100);
|
||||
append_event_to_interpreter (interpreter, 0, 100);
|
||||
|
||||
gesture_detected = gtk_gestures_interpreter_finish (interpreter, NULL);
|
||||
|
||||
g_assert (gesture_detected == FALSE);
|
||||
g_assert_cmpfloat (confidence, ==, 0);
|
||||
|
||||
g_object_unref (interpreter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_equality (void)
|
||||
{
|
||||
GtkGesturesInterpreter *interpreter;
|
||||
gboolean gesture_detected;
|
||||
gdouble confidence = 0;
|
||||
guint gesture_id;
|
||||
|
||||
interpreter = gtk_gestures_interpreter_new ();
|
||||
g_signal_connect (interpreter, "gesture-detected",
|
||||
G_CALLBACK (gesture_detected_cb),
|
||||
&confidence);
|
||||
|
||||
gtk_gestures_interpreter_add_gesture (interpreter,
|
||||
GTK_GESTURE_SWIPE_RIGHT);
|
||||
|
||||
/* Feed the events */
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 0);
|
||||
|
||||
gesture_detected = gtk_gestures_interpreter_finish (interpreter, &gesture_id);
|
||||
|
||||
g_assert (gesture_detected != FALSE);
|
||||
g_assert_cmpuint (gesture_id, ==, GTK_GESTURE_SWIPE_RIGHT);
|
||||
g_assert_cmpfloat (confidence, ==, 1);
|
||||
|
||||
g_object_unref (interpreter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_events_ubiquity (void)
|
||||
{
|
||||
GtkGesturesInterpreter *interpreter;
|
||||
gboolean gesture_detected;
|
||||
gdouble confidence = 0;
|
||||
guint gesture_id;
|
||||
|
||||
interpreter = gtk_gestures_interpreter_new ();
|
||||
g_signal_connect (interpreter, "gesture-detected",
|
||||
G_CALLBACK (gesture_detected_cb),
|
||||
&confidence);
|
||||
|
||||
gtk_gestures_interpreter_add_gesture (interpreter,
|
||||
GTK_GESTURE_SWIPE_RIGHT);
|
||||
|
||||
/* Feed the events, huge scale */
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
append_event_to_interpreter (interpreter, 1000, 0);
|
||||
|
||||
gesture_detected = gtk_gestures_interpreter_finish (interpreter, &gesture_id);
|
||||
|
||||
g_assert (gesture_detected != FALSE);
|
||||
g_assert_cmpuint (gesture_id, ==, GTK_GESTURE_SWIPE_RIGHT);
|
||||
g_assert_cmpfloat (confidence, ==, 1);
|
||||
|
||||
/* Feed other events, displaced somewhere, and
|
||||
* at a different scale, it's the X displacement
|
||||
* to the right what counts.
|
||||
*/
|
||||
append_event_to_interpreter (interpreter, 500, 120);
|
||||
append_event_to_interpreter (interpreter, 600, 120);
|
||||
|
||||
gesture_detected = gtk_gestures_interpreter_finish (interpreter, &gesture_id);
|
||||
|
||||
g_assert (gesture_detected != FALSE);
|
||||
g_assert_cmpuint (gesture_id, ==, GTK_GESTURE_SWIPE_RIGHT);
|
||||
g_assert_cmpfloat (confidence, ==, 1);
|
||||
|
||||
g_object_unref (interpreter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_opposite_gesture (void)
|
||||
{
|
||||
GtkGesturesInterpreter *interpreter;
|
||||
gboolean gesture_detected;
|
||||
gdouble confidence = 1;
|
||||
|
||||
interpreter = gtk_gestures_interpreter_new ();
|
||||
g_signal_connect (interpreter, "gesture-detected",
|
||||
G_CALLBACK (gesture_detected_cb),
|
||||
&confidence);
|
||||
|
||||
gtk_gestures_interpreter_add_gesture (interpreter,
|
||||
GTK_GESTURE_SWIPE_RIGHT);
|
||||
|
||||
/* Feed the events, swipe to left */
|
||||
append_event_to_interpreter (interpreter, 100, 0);
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
|
||||
gesture_detected = gtk_gestures_interpreter_finish (interpreter, NULL);
|
||||
|
||||
g_assert (gesture_detected == FALSE);
|
||||
g_assert_cmpfloat (confidence, ==, 0);
|
||||
|
||||
g_object_unref (interpreter);
|
||||
}
|
||||
|
||||
static void
|
||||
test_ignore_initial_orientation (void)
|
||||
{
|
||||
GtkGesturesInterpreter *interpreter;
|
||||
gdouble initial_confidence, conf;
|
||||
gdouble confidence = 1;
|
||||
|
||||
interpreter = gtk_gestures_interpreter_new ();
|
||||
g_signal_connect (interpreter, "gesture-detected",
|
||||
G_CALLBACK (gesture_detected_cb),
|
||||
&confidence);
|
||||
|
||||
/* Use a circular gesture, which ignores initial orientation.
|
||||
* Stroke square rectangles at different orientations, which should
|
||||
* yield the same (lack of) confidence about the stroke.
|
||||
*/
|
||||
gtk_gestures_interpreter_add_gesture (interpreter,
|
||||
GTK_GESTURE_CIRCULAR_CLOCKWISE);
|
||||
|
||||
/* First rectangle */
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 100);
|
||||
append_event_to_interpreter (interpreter, 0, 100);
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
|
||||
gtk_gestures_interpreter_finish (interpreter, NULL);
|
||||
initial_confidence = confidence;
|
||||
|
||||
/* Second rectangle, completely flipped over */
|
||||
append_event_to_interpreter (interpreter, 100, 100);
|
||||
append_event_to_interpreter (interpreter, 0, 100);
|
||||
append_event_to_interpreter (interpreter, 0, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 100);
|
||||
|
||||
gtk_gestures_interpreter_finish (interpreter, NULL);
|
||||
conf = confidence;
|
||||
|
||||
g_assert_cmpfloat (initial_confidence, ==, conf);
|
||||
|
||||
/* Third rectangle, 45º degrees rotation, different scale */
|
||||
append_event_to_interpreter (interpreter, 50, 0);
|
||||
append_event_to_interpreter (interpreter, 100, 50);
|
||||
append_event_to_interpreter (interpreter, 50, 100);
|
||||
append_event_to_interpreter (interpreter, 0, 50);
|
||||
append_event_to_interpreter (interpreter, 50, 0);
|
||||
|
||||
gtk_gestures_interpreter_finish (interpreter, NULL);
|
||||
conf = confidence;
|
||||
|
||||
g_assert_cmpfloat (initial_confidence, ==, conf);
|
||||
|
||||
g_object_unref (interpreter);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
gtk_test_init (&argc, &argv, NULL);
|
||||
|
||||
g_test_add_func ("/gestures/empty-interpreter", test_empty_interpreter);
|
||||
g_test_add_func ("/gestures/equality", test_equality);
|
||||
g_test_add_func ("/gestures/events-ubiquity", test_events_ubiquity);
|
||||
g_test_add_func ("/gestures/opposite-gesture", test_opposite_gesture);
|
||||
g_test_add_func ("/gestures/ignore-initial-orientation", test_ignore_initial_orientation);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
+628
-768
File diff suppressed because it is too large
Load Diff
+1520
-1726
File diff suppressed because it is too large
Load Diff
+9
-8
@@ -18,8 +18,8 @@ msgstr ""
|
||||
"Project-Id-Version: gtk+-properties.master\n"
|
||||
"Report-Msgid-Bugs-To: http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%"
|
||||
"2b&keywords=I18N+L10N&component=general\n"
|
||||
"POT-Creation-Date: 2012-02-20 14:18+0000\n"
|
||||
"PO-Revision-Date: 2012-02-23 12:39+0100\n"
|
||||
"POT-Creation-Date: 2012-02-17 16:04+0000\n"
|
||||
"PO-Revision-Date: 2012-02-17 18:02+0100\n"
|
||||
"Last-Translator: Daniel Mustieles <daniel.mustieles@gmail.com>\n"
|
||||
"Language-Team: Español <gnome-es-list@gnome.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -439,7 +439,7 @@ msgstr "Documentadores"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:455
|
||||
msgid "List of people documenting the program"
|
||||
msgstr "Lista de personas documentando el programa"
|
||||
msgstr "Lista de gente documentando el programa"
|
||||
|
||||
#: ../gtk/gtkaboutdialog.c:471
|
||||
msgid "Artists"
|
||||
@@ -2492,7 +2492,7 @@ msgstr "Color actual como GdkRGBA"
|
||||
msgid "Whether alpha should be shown"
|
||||
msgstr "Indica si se debe mostrar el alfa"
|
||||
|
||||
#: ../gtk/gtkcolorchooserdialog.c:234 ../gtk/gtkcolorchooserwidget.c:667
|
||||
#: ../gtk/gtkcolorchooserdialog.c:234 ../gtk/gtkcolorchooserwidget.c:666
|
||||
msgid "Show editor"
|
||||
msgstr "Mostrar editor"
|
||||
|
||||
@@ -2500,19 +2500,20 @@ msgstr "Mostrar editor"
|
||||
msgid "Scale type"
|
||||
msgstr "Tipo de escala"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:709
|
||||
#: ../gtk/gtkcolorswatch.c:601
|
||||
msgid "RGBA Color"
|
||||
msgstr "Color RGBA"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:709
|
||||
#: ../gtk/gtkcolorswatch.c:601
|
||||
msgid "Color as RGBA"
|
||||
msgstr "Color como RGBA"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:712 ../gtk/gtklabel.c:797
|
||||
#: ../gtk/gtkcolorswatch.c:604 ../gtk/gtklabel.c:797
|
||||
msgid "Selectable"
|
||||
msgstr "Seleccionable"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:712
|
||||
#: ../gtk/gtkcolorswatch.c:604
|
||||
#| msgid "Whether the tab is detachable"
|
||||
msgid "Whether the swatch is selectable"
|
||||
msgstr "Indica si la muestra es seleccionable"
|
||||
|
||||
|
||||
+15
-19
@@ -24,8 +24,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: gtk+-master-po-properties-gl-77816____.merged\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2012-02-21 12:07+0100\n"
|
||||
"PO-Revision-Date: 2012-02-21 12:07+0100\n"
|
||||
"POT-Creation-Date: 2012-02-16 14:57+0100\n"
|
||||
"PO-Revision-Date: 2012-02-16 14:58+0100\n"
|
||||
"Last-Translator: Fran Dieguez <frandieguez@gnome.org>\n"
|
||||
"Language-Team: Galician <gnome-l10n-gl@gnome.org>\n"
|
||||
"Language: gl\n"
|
||||
@@ -946,27 +946,27 @@ msgstr "Texto predeterminado do widget"
|
||||
msgid "The default text appearing when there are no applications"
|
||||
msgstr "O texto predeterminado que aparece cando non hai aplicativos"
|
||||
|
||||
#: ../gtk/gtkapplication.c:761
|
||||
#: ../gtk/gtkapplication.c:799
|
||||
msgid "Register session"
|
||||
msgstr "Rexistrar sesión"
|
||||
|
||||
#: ../gtk/gtkapplication.c:762
|
||||
#: ../gtk/gtkapplication.c:800
|
||||
msgid "Register with the session manager"
|
||||
msgstr "Rexistrar co xestor de sesións"
|
||||
|
||||
#: ../gtk/gtkapplication.c:767
|
||||
#: ../gtk/gtkapplication.c:805
|
||||
msgid "Application menu"
|
||||
msgstr "Menú de aplicativo"
|
||||
|
||||
#: ../gtk/gtkapplication.c:768
|
||||
#: ../gtk/gtkapplication.c:806
|
||||
msgid "The GMenuModel for the application menu"
|
||||
msgstr "O GMenModel para o menú de aplicativos"
|
||||
|
||||
#: ../gtk/gtkapplication.c:774
|
||||
#: ../gtk/gtkapplication.c:812
|
||||
msgid "Menubar"
|
||||
msgstr "Barra de menú"
|
||||
|
||||
#: ../gtk/gtkapplication.c:775
|
||||
#: ../gtk/gtkapplication.c:813
|
||||
msgid "The GMenuModel for the menubar"
|
||||
msgstr "O GMenuModel para a barra de menú"
|
||||
|
||||
@@ -2486,7 +2486,7 @@ msgstr "Cor actual, como un GdkRGBA"
|
||||
msgid "Whether alpha should be shown"
|
||||
msgstr "Indica se se debe mostrar o alfa"
|
||||
|
||||
#: ../gtk/gtkcolorchooserdialog.c:234 ../gtk/gtkcolorchooserwidget.c:667
|
||||
#: ../gtk/gtkcolorchooserdialog.c:234 ../gtk/gtkcolorchooserwidget.c:666
|
||||
msgid "Show editor"
|
||||
msgstr "Mostrar editor"
|
||||
|
||||
@@ -2494,22 +2494,14 @@ msgstr "Mostrar editor"
|
||||
msgid "Scale type"
|
||||
msgstr "Tipo de escala"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:709
|
||||
#: ../gtk/gtkcolorswatch.c:589
|
||||
msgid "RGBA Color"
|
||||
msgstr "Cor RGBA"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:709
|
||||
#: ../gtk/gtkcolorswatch.c:589
|
||||
msgid "Color as RGBA"
|
||||
msgstr "Core como RGBA"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:712 ../gtk/gtklabel.c:797
|
||||
msgid "Selectable"
|
||||
msgstr "Seleccionábel"
|
||||
|
||||
#: ../gtk/gtkcolorswatch.c:712
|
||||
msgid "Whether the swatch is selectable"
|
||||
msgstr "Indica se a mostra é seleccionábel"
|
||||
|
||||
#: ../gtk/deprecated/gtkcolorsel.c:324
|
||||
msgid "Has Opacity Control"
|
||||
msgstr "Ten un control de opacidade"
|
||||
@@ -3928,6 +3920,10 @@ msgstr "Modo de axuste de liña"
|
||||
msgid "If wrap is set, controls how linewrapping is done"
|
||||
msgstr "Se se estabelece o axuste, controla como se fai o axuste de liña"
|
||||
|
||||
#: ../gtk/gtklabel.c:797
|
||||
msgid "Selectable"
|
||||
msgstr "Seleccionábel"
|
||||
|
||||
#: ../gtk/gtklabel.c:798
|
||||
msgid "Whether the label text can be selected with the mouse"
|
||||
msgstr "Indica se o texto da etiqueta pode ser seleccionado co rato"
|
||||
|
||||
+1553
-1795
File diff suppressed because it is too large
Load Diff
+1549
-1791
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user