Compare commits
77 Commits
multitouch
...
3.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cfbbb5d076 | ||
|
|
6f3cdac015 | ||
|
|
b763e2cdaa | ||
|
|
456b19a35a | ||
|
|
6ad897819c | ||
|
|
b256211737 | ||
|
|
4651571ec3 | ||
|
|
a6179ec639 | ||
|
|
b4565e127a | ||
|
|
31df36cbfe | ||
|
|
cd0a5fef30 | ||
|
|
6a5e53a34a | ||
|
|
0dde424db3 | ||
|
|
fcd5e44e15 | ||
|
|
73b34cbe18 | ||
|
|
b463530a72 | ||
|
|
a53a30c7f8 | ||
|
|
988f374151 | ||
|
|
96e95d0a9f | ||
|
|
b4b8a969f4 | ||
|
|
b4120d6f25 | ||
|
|
9a16a83c95 | ||
|
|
e9dfc997a0 | ||
|
|
0f6ec6e76d | ||
|
|
5deb446b50 | ||
|
|
e0d2525a52 | ||
|
|
73d9ee0e62 | ||
|
|
9d900681d7 | ||
|
|
9d2963f469 | ||
|
|
a8b315f41f | ||
|
|
273283db92 | ||
|
|
ef9a92d225 | ||
|
|
7b06b81306 | ||
|
|
1481aac73f | ||
|
|
b246dc21c6 | ||
|
|
0fd83a217b | ||
|
|
b292ecef1f | ||
|
|
f4dfcefbd5 | ||
|
|
194303fc8f | ||
|
|
e5b30eecaf | ||
|
|
f5cc6dbdfa | ||
|
|
b433772b03 | ||
|
|
4e99d8d090 | ||
|
|
0594d4e349 | ||
|
|
756c3a09af | ||
|
|
1d3fc6c0c0 | ||
|
|
a3344ef699 | ||
|
|
68135b53fc | ||
|
|
436547a80e | ||
|
|
9aa26f0d64 | ||
|
|
48791fd514 | ||
|
|
32ec6ad073 | ||
|
|
296c534663 | ||
|
|
cb35b3166e | ||
|
|
7276fbc1d1 | ||
|
|
31863fc1b4 | ||
|
|
f46c1b76d8 | ||
|
|
eaecf396bf | ||
|
|
a628761838 | ||
|
|
126adb6ef3 | ||
|
|
932ad8ad29 | ||
|
|
bcfb7a6cdd | ||
|
|
a9b9699bde | ||
|
|
51b11b36a4 | ||
|
|
59a015fb85 | ||
|
|
bba6657bb5 | ||
|
|
5e41964965 | ||
|
|
04c42b6e53 | ||
|
|
e248c6812e | ||
|
|
ff6983e400 | ||
|
|
1edd94a950 | ||
|
|
a93793dca3 | ||
|
|
483d8f3446 | ||
|
|
58e1481d38 | ||
|
|
64a7fc279c | ||
|
|
e35e112ea9 | ||
|
|
4fa78201a1 |
@@ -63,6 +63,10 @@ gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-waylan
|
||||
rm -f $@ && \
|
||||
cp gdk-3.0.pc $@
|
||||
|
||||
gtk+-*-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc
|
||||
rm -f $@ && \
|
||||
cp gtk+-3.0-uninstalled.pc $@
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc
|
||||
|
||||
@@ -80,6 +84,8 @@ DISTCLEANFILES = \
|
||||
gdk-3.0.pc \
|
||||
gdk-x11-3.0.pc \
|
||||
gail-3.0.pc \
|
||||
gtk+-3.0-uninstalled.pc \
|
||||
gail-3.0-uninstalled.pc \
|
||||
config.lt
|
||||
|
||||
distclean-local:
|
||||
|
||||
@@ -10,7 +10,7 @@ TEST_PROGS =
|
||||
### testing rules
|
||||
|
||||
# Xvfb based test rules
|
||||
XVFB = Xvfb -ac -noreset -screen 0 1024x768x16
|
||||
XVFB = Xvfb -ac -noreset -screen 0 800x600x16
|
||||
XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
|
||||
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 \
|
||||
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 \
|
||||
@@ -29,7 +29,7 @@ endif
|
||||
XVFB_START = \
|
||||
${XVFB} -help 2>/dev/null 1>&2 \
|
||||
&& XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
|
||||
&& { ${XVFB} :$$XID -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
|
||||
&& { ${XVFB} :$$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
|
||||
trap "kill -15 $$! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } \
|
||||
|| { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \
|
||||
&& DISPLAY=:$$XID && export DISPLAY
|
||||
|
||||
333
NEWS
@@ -1,321 +1,37 @@
|
||||
Overview of Changes in GTK+ 3.3.14
|
||||
==================================
|
||||
|
||||
* Theming
|
||||
- Fixes for border handling in GtkEntry,
|
||||
GtkCellRendererText, GtkComboBox
|
||||
- Parse values more carefully, supporting
|
||||
percentages, angles
|
||||
- Implement CSS linear-gradient syntax
|
||||
- Support background-size
|
||||
- Support a gtk.gresource file in themes
|
||||
|
||||
* Bugs fixed
|
||||
543520 Cups custom options are not sent properly
|
||||
649121 Crash in GtkAppChooserDialog packagekit button
|
||||
669176 Regression: atk-add-key-event-listener doesn't work
|
||||
|
||||
* Updated translations
|
||||
Galician
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.10
|
||||
==================================
|
||||
|
||||
* GtkApplication:
|
||||
- Move application menu handling over from GIO
|
||||
- Fix resize grip positioning in GtkApplicationWindow
|
||||
|
||||
* Wayland:
|
||||
- Make combo boxes work
|
||||
- Make key modifiers work like on X11
|
||||
- Make mouse buttons work correctly
|
||||
|
||||
* Quartz:
|
||||
- Make key modifiers work more like they do on X11
|
||||
|
||||
* Printing:
|
||||
- Fix handling of custom cups options
|
||||
|
||||
* Accessibility:
|
||||
- Bring key snooping support back for now
|
||||
|
||||
* Translation updates:
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.8
|
||||
Overview of Changes in GTK+ 3.2.2
|
||||
=================================
|
||||
|
||||
* GtkApplication:
|
||||
- Supports logout notification and inhibiting
|
||||
- Buttons, toolbuttons and switches can now be connected
|
||||
to GActions
|
||||
|
||||
* GtkSpinButton no longer allows to change the value
|
||||
when not editable
|
||||
|
||||
* GtkLabel link support has been rewritten to be be
|
||||
more robust
|
||||
|
||||
* GtkBuilder:
|
||||
- Supports the 'id' in GtkComboBoxText
|
||||
- Can parse GVariant-valued properties
|
||||
- Support loading from a GResource
|
||||
|
||||
* GtkImage:
|
||||
- Support loading from a GResource
|
||||
|
||||
* GtkUIManager:
|
||||
- Support loading from a GResource
|
||||
|
||||
* Accessibility:
|
||||
- key snooping support has been removed
|
||||
|
||||
* Wayland backend:
|
||||
- Cursor handling updates
|
||||
- Look for cursors in the 'weston' directory
|
||||
- Make resize grips work
|
||||
- Implement device grabs
|
||||
- Implement window geometry hints
|
||||
- Set surface type based on window type hint
|
||||
- Add basic clipboard and selection implementations
|
||||
- Implement client-side keyboard repeat
|
||||
- Update GdkWindow focus state to match reality
|
||||
|
||||
* Theming:
|
||||
- Improved CSS compliance for selector matching
|
||||
- Improved CSS compliance for value resolution,
|
||||
including full support for 'inherit', 'initial',
|
||||
'currentColor', 'none'
|
||||
- Support border-style properties
|
||||
- 'window-unfocused' has been renamed to 'backdrop'
|
||||
|
||||
* New deprecations:
|
||||
- GdkColor
|
||||
- GtkButton::inner-border
|
||||
|
||||
* Miscellaneous:
|
||||
- Turn default theme css files and dnd cursors into
|
||||
GResources
|
||||
|
||||
* Bugs fixed:
|
||||
543520 Cups custom options are not sent properly
|
||||
612396 ...default of entry-text-column for GtkComboBoxText
|
||||
613728 Rationalize GtkTreeView focus
|
||||
620240 GNOME Drag & Drop broken for remote X sessions
|
||||
629878 Missing "Back" and "Forward" icons for Firefox
|
||||
631414 Add symbolic constants for event emission control
|
||||
639875 crashes when unparenting a tab from a window...
|
||||
657367 GtkAction: Hold a reference to proxy widgets
|
||||
659516 gtk_css_provider_to_string lacks "since" tag
|
||||
660139 GtkGrid gives Gtk-Warnings about negative sizes when empty
|
||||
660309 check x11 backend when create xim module
|
||||
663479 "Finishing" ("Completion") and "Advanced" tabs are empty
|
||||
665015 "Widget (%s) has more than one label" unwanted warnings
|
||||
666103 Should be able to match the parent where a dropdown menu...
|
||||
666600 allocate the CSS border and deprecate GtkButton-inner-border
|
||||
666685 SIGSEGV in _gtk_tree_selection_internal_select_node
|
||||
666710 Fix compose sequences disabling other sequences
|
||||
666842 [patch] "sticky" window state reported wrongly on X11
|
||||
667018 Fix compilation on Windows
|
||||
667229 gtkspinbutton: Respect value of inherited 'editable' property
|
||||
667394 Gtk(Tool)Button: add an 'action-name' property
|
||||
667473 gdk_rgba_free (NULL)
|
||||
667485 gdk_rgba_parse error checking
|
||||
667534 Non-XInput2 build fix
|
||||
667546 GApplication doc mentions g_application_set_app_menu
|
||||
667628 GtkWindow:application property should have G_PARAM_CONSTRUCT
|
||||
667695 GAction leaked in examples/plugman.c
|
||||
667705 fix up GtkApplication on OS X
|
||||
666921 Fix the _NET_SUPPORTING_WM_CHECK window fetch to be spec...
|
||||
|
||||
* Translation updates:
|
||||
Arabic
|
||||
Bulgarian
|
||||
Finnish
|
||||
Hebrew
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.6
|
||||
=================================
|
||||
|
||||
* GtkApplication has grown support for exporting application
|
||||
menus and menubars on the bus, as a GMenuModel. The
|
||||
new GtkApplicationWindow toplevel automatically
|
||||
displays these menu models when needed.
|
||||
|
||||
* GtkSpinButtons have received a long-overdue face-lift
|
||||
to make them easier to use with both mouse and touch.
|
||||
|
||||
* GtkScale has gained a has-origin property to request
|
||||
filled-in drawing of the trough.
|
||||
|
||||
* GtkWindow can now request that the window manager hide
|
||||
the titlebar when the window is maximized.
|
||||
|
||||
* The GtkTreeView accessibility support and the core
|
||||
treeview code have been extensively refactored;
|
||||
performance should be much improved. But watch out
|
||||
for regressions.
|
||||
|
||||
* The GtkFileChooser entry completion code has been
|
||||
extensively refactored; it now uses GtkEntryCompletion
|
||||
|
||||
* Excessive dependencies have been culled from Requires:
|
||||
lines in pc files. Dependent modules may have to declare
|
||||
dependencies that they were getting 'for free' in the past.
|
||||
|
||||
* Theming improvements:
|
||||
- The background-clip and background-origin CSS properties
|
||||
have been implemented
|
||||
|
||||
* Win32 improvements:
|
||||
- Theming of column headers, radio buttons and menuitems,
|
||||
notebook tabs, etc has been fixed
|
||||
- Menus, tooltips, and other popups show above the task bar
|
||||
|
||||
* Wayland:
|
||||
- The Wayland backend has been updated to the current Wayland API
|
||||
|
||||
* Bugs fixed:
|
||||
603823 Print to File suggests ".ps" as filename...
|
||||
640317 gtk_draw_insertion_cursor should be moved to gtk_render
|
||||
646461 Leak in gtkfilechooserbutton.c: model_free_row_data
|
||||
650943 Clicking resize grip causes strange mouse grabbing beh...
|
||||
661428 Allow themes to know when a toplevel window appears un...
|
||||
662814 Request for way to tell gtk_recent_manager_add_item_qu...
|
||||
664137 Crash in Audacious audio player when browsing the add ...
|
||||
664456 segfault on arrow keypress in empty GtkIconView
|
||||
664467 prop-editor is broken for GdkColor properties
|
||||
664469 color button doesn't notify "color" and "alpha" when c...
|
||||
664537 GtkCssProvider: don't segfault when CSS file is not found
|
||||
664640 CUPS authentication does not work
|
||||
665140 Draw the scale split
|
||||
665326 FTBFS: missing Xi/Pango/Fc for gtk-query-immodules-3.0
|
||||
665616 Add hide-titlebar-when-maximized setting
|
||||
665741 Crashes in treeview when pressing End key.
|
||||
665999 Introspection wrong for GDK_INPUT_ONLY vs GDK_INPUT_OUTPUT
|
||||
666242 Separators in menuitem are not vertically aligned
|
||||
641999 Consider adding a workarea API
|
||||
657578 Toggling the state of a GtkCheckButton causes accessible...
|
||||
659445 Accessible event.any_data is incorrect for text-removed...
|
||||
663573 Rework GtkFileChooserEntry
|
||||
666392 widget: Flip the sensitive flag even if the state doesn't...
|
||||
666552 Layered region is leaked in GdkWindow
|
||||
|
||||
* Updated translations
|
||||
Breton
|
||||
Kazakh
|
||||
Russian
|
||||
Slovak
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.4
|
||||
=================================
|
||||
|
||||
* The beagle search backend has been dropped
|
||||
|
||||
* Stop using GDK/GTK_DISABLE_DEPRECATED guards for deprecated
|
||||
functions; instead use function attributes
|
||||
|
||||
* Make GtkCellRendererAccel support naked keyvals, so it can
|
||||
be used in gnome-control-center
|
||||
|
||||
* GDK changes
|
||||
- Make the Mod1 == Alt assumption official
|
||||
- The Broadway backend has initial support for V7+ websockets
|
||||
|
||||
* GtkApplication no longer uses gtk_main internally
|
||||
|
||||
* GtkNotebook now destroys its action widgets, instead of leaking them
|
||||
|
||||
* Theming improvements:
|
||||
- Background images can now be tiled instead of stretched,
|
||||
using the background-repeat CSS property
|
||||
- Unfocused windows can be themed differently, using
|
||||
the 'window-unfocused' state flag
|
||||
|
||||
* Accessibility improvements:
|
||||
- Much better treeview performance
|
||||
- Completely ignore invisible columns in treeviews
|
||||
- Many a11y/treeview-related crashes fixed
|
||||
- Combo box keybindings are reported again
|
||||
- Textview respects display lines again
|
||||
|
||||
* OS X improvements:
|
||||
- Improved handling of motion events and event state
|
||||
- Handle recursive CFRunLoops
|
||||
- More fixes to accel handling
|
||||
|
||||
* Win32 improvements:
|
||||
- Many fixes, making this the first version of GTK+ 3 that
|
||||
works well on Windows
|
||||
|
||||
* Bugs fixed:
|
||||
84314 gdk_display_sync() and gdk_flush()
|
||||
142874 use of SetWindowLong in gdkwindow-win32.c causes incorrect...
|
||||
169811 configure_event and window-state-event are not emitted con...
|
||||
171456 "Keep Above" option in Gimp broken on Win32
|
||||
324254 Realizing a top-level window widget early positions it at 0,0
|
||||
516822 gtk_window_fullscreen does not resize correctly if removing...
|
||||
542777 Scroll-Wheel doesn't scroll (Win)
|
||||
552041 Windows' System Menu from taskbar is buggy
|
||||
603559 gtk should handle missing immodules better
|
||||
604156 gtk_window_set_modal() freezes application completely
|
||||
606727 Can't bind keys on numerical keypad with numlock on
|
||||
612359 Dialog positioning hints fail on Windows 7
|
||||
616544 win32 drag and drop (DnD) broken for GTK+ 3
|
||||
628049 Native windows don't work very well
|
||||
631384 Images pasted from clipboard are shifted/wrapped
|
||||
647460 typo in msw_style.c?
|
||||
652239 win32: resurect Windows clipboard selection notification
|
||||
658841 Ensure native window in gdk_win32_drawable_get_handle()...
|
||||
658842 Fix win32 _gdk_windowing_window_at_pointer - port to gtk3
|
||||
659151 Cannot obtain accessible keybinding for comboboxes
|
||||
659257 Gtk-WARNING **: GtkRecentChooserWidget 0x80da890 is mapped...
|
||||
658772 Directory paths for resource directories are hard-coded
|
||||
661858 Add annotations for some GtkRadio* constructors
|
||||
661859 Add annotations for some GtkSymbolicColor constructors
|
||||
661997 Gtk crashes when changing the TreeView model while rubber...
|
||||
662160 gtk_print_operation_cancel fails
|
||||
662628 Add keyboard brightness to keyname-table.h
|
||||
662177 Toolbar returns invalid paths for toolbar items
|
||||
662670 Pressing "Enter" in print dialog box will not cause printing
|
||||
662691 menuitem: Always treat submenus as popup
|
||||
662755 Keycode support in GtkCellRendererAccel broken
|
||||
662839 Fix XIGrabKeycode usage
|
||||
662870 Fix introspection annotations for GtkRadioToolButton
|
||||
662953 x11: Fix window manager change detection
|
||||
663073 gtk_dialog_new_with_buttons should be G_GNUC_NULL_TERMINATED
|
||||
663138 iconview: layout items immediately when setting a GtkTreeModel
|
||||
663182 Dragging any item on OS X crashes Banshee
|
||||
663345 'from gi.repository import Gtk' fails in jhbuild
|
||||
663396 With multiple master devices, right clicking may show popup...
|
||||
663522 css: start background-repeat
|
||||
663605 Fix event->state of many event types on quartz
|
||||
663694 GtkTreeViewAccessibleCellInfo are leaked
|
||||
663761 gtk: Fix GtkCellRenderer ignoring keycodes
|
||||
663825 calling gtk_progress_bar_set_fraction with a fraction > 1.0...
|
||||
663856 Make option-foo accelerators use the right symbol
|
||||
663994 GtkTextView no longer reports the correct line text to ATs...
|
||||
664021 GtkSpinButton: Clarify clamping behavior in gtk_spin_button...
|
||||
664027 Build fails with undefined reference to `gdk_keymap_get_mod...
|
||||
664132 gdk_cairo_region_create_from_surface broken on PPC...
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
British English
|
||||
Japanese
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.3.2
|
||||
Overview of Changes in GTK+ 3.2.1
|
||||
=================================
|
||||
|
||||
* GtkCellRendererAccel can show virtual modifiers
|
||||
|
||||
* Theming improvements:
|
||||
- CSS: 'transparent' can be used a color
|
||||
- Improved notebook tab rendering
|
||||
- Support opacity and rounded corners for tooltips
|
||||
* CSS improvements:
|
||||
- 'transparent' can be used a color
|
||||
|
||||
* OS X improvements:
|
||||
- Disable mnemonics
|
||||
@@ -341,42 +57,15 @@ Overview of Changes in GTK+ 3.3.2
|
||||
659655 3 errors in Spanish translation of gtk+
|
||||
660687 roxterm X crashes with accessibility enabled
|
||||
660730 Use of "struct stat" breaks Windows
|
||||
659602 Provide an abstraction for the platform's use...
|
||||
659406 Abstract what triggers a context menu
|
||||
660619 __SIZEOF_INT__ and __SIZEOF_POINTER__ may not be defined
|
||||
599617 a modern tooltip look
|
||||
628936 gtk build fails because of objective-c elements
|
||||
631167 GtkComboBox with has-entry=true should not require...
|
||||
651818 Crash in gtk_app_chooser_refresh()
|
||||
659672 gtk_tree_view_column_dispose() does not remove from tree...
|
||||
660139 GtkGrid gives Gtk-Warnings about negative sizes...
|
||||
660833 all: add an 'only-child' pseudo-class selector
|
||||
661032 out-of-tree builds result in broken gtk-doc documentation
|
||||
661089 gtkfontbutton.c will not compile on Solaris
|
||||
661780 GTK_STOCK_INDENT references wrong images
|
||||
661835 GMountOperation on OpenBSD: remove the need for kvm(3)
|
||||
662024 tests/css/parser/selector.errors missing from EXTRA_DIST
|
||||
662132 --sync
|
||||
662177 Toolbar returns invalid paths for toolbar items
|
||||
662230 treemodel: document gtk_tree_path_free() as allow-none
|
||||
662308 Scrollbars seem to unconditionally reserve a space...
|
||||
662467 tooltip: only update shape if the window is realized
|
||||
662481 Clean up the gtkprivate directory redefinition mess
|
||||
662629 notebook: update tab area allocation when switching page
|
||||
|
||||
* Translation updates
|
||||
Brazilian Portuguese
|
||||
British English
|
||||
Catalan (Valencian)
|
||||
Czech
|
||||
Dutch
|
||||
Esperanto
|
||||
Japanese
|
||||
Galician
|
||||
Latvian
|
||||
Serbian
|
||||
Spanish
|
||||
Simplified Chinese
|
||||
Traditional Chinese
|
||||
Vietnamese
|
||||
|
||||
|
||||
@@ -27,11 +27,6 @@ Installation
|
||||
See the file 'INSTALL'
|
||||
|
||||
|
||||
Release notes for 3.4
|
||||
=====================
|
||||
|
||||
* The -uninstalled variants of the pkg-config files have been dropped.
|
||||
|
||||
Release notes for 3.2
|
||||
=====================
|
||||
|
||||
|
||||
@@ -565,9 +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.WindowState.gschema.xml $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
echo "Compiling gsettings XML Files..."
|
||||
echo "Compiling gsettings XML File(s)..."
|
||||
|
||||
$(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
|
||||
|
||||
@@ -590,7 +588,7 @@ $(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles>msvc_recommended_pragmas.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;G_ENABLE_DEBUG;$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -91,7 +91,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@@ -114,7 +114,7 @@
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;G_ENABLE_DEBUG;$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
@@ -136,7 +136,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
||||
@@ -202,7 +202,6 @@
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\textscroll.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\textview.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\toolpalette.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\transparent.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\tree_store.c" />
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\ui_manager.c" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -125,9 +125,6 @@
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\toolpalette.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\transparent.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\demos\gtk-demo\tree_store.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES"
|
||||
PreprocessorDefinitions="HAVE_CONFIG_H;G_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;ATK_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES"
|
||||
ForcedIncludeFiles="msvc_recommended_pragmas.h"
|
||||
/>
|
||||
<Tool
|
||||
@@ -339,8 +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.WindowState.gschema.xml $(OutDir)\share\glib-2.0\schemas

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

|
||||
echo "Compiling gsettings XML File(s)..."

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

|
||||
"
|
||||
/>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gtk"
|
||||
PreprocessorDefinitions="_DEBUG;G_ENABLE_DEBUG;$(GtkDefines)"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -63,7 +63,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
|
||||
PreprocessorDefinitions="$(GtkDefines)"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -96,7 +96,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
|
||||
PreprocessorDefinitions="_DEBUG;G_ENABLE_DEBUG;$(GtkDefines)"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -128,7 +128,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
|
||||
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
|
||||
PreprocessorDefinitions="$(GtkDefines)"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
|
||||
@@ -198,7 +198,6 @@
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\textscroll.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\textview.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\toolpalette.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\transparent.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\tree_store.c" />
|
||||
<File RelativePath="..\..\..\demos\gtk-demo\ui_manager.c" />
|
||||
</Filter>
|
||||
|
||||
103
configure.ac
@@ -9,9 +9,9 @@
|
||||
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [3])
|
||||
m4_define([gtk_micro_version], [15])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_minor_version], [2])
|
||||
m4_define([gtk_micro_version], [2])
|
||||
m4_define([gtk_interface_age], [2])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
m4_define([gtk_version],
|
||||
@@ -39,11 +39,11 @@ 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.14])
|
||||
m4_define([glib_required_version], [2.29.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])
|
||||
m4_define([gdk_pixbuf_required_version], [2.25.2])
|
||||
m4_define([gdk_pixbuf_required_version], [2.23.5])
|
||||
m4_define([introspection_required_version], [0.10.1])
|
||||
GLIB_REQUIRED_VERSION=glib_required_version
|
||||
PANGO_REQUIRED_VERSION=pango_required_version
|
||||
@@ -165,6 +165,9 @@ case $host in
|
||||
*-*-linux*)
|
||||
os_linux=yes
|
||||
;;
|
||||
*-*-openbsd*)
|
||||
os_openbsd=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl
|
||||
@@ -263,27 +266,27 @@ AC_ARG_ENABLE(xkb,
|
||||
[enable_xkb="maybe"])
|
||||
AC_ARG_ENABLE(xinerama,
|
||||
[AS_HELP_STRING([--enable-xinerama],
|
||||
[support Xinerama extension [default=maybe]])],,
|
||||
[support Xinerama extension if available [default=maybe]])],,
|
||||
[enable_xinerama="maybe"])
|
||||
AC_ARG_ENABLE(xinput,
|
||||
[AS_HELP_STRING([--enable-xinput],
|
||||
[support XInput extension [default=yes]])],,
|
||||
[support XInput extension if available [default=yes]])],,
|
||||
[enable_xinput="maybe"])
|
||||
AC_ARG_ENABLE(xrandr,
|
||||
[AS_HELP_STRING([--enable-xrandr],
|
||||
[support XRandR extension [default=maybe]])],,
|
||||
[support XRandR extension if available [default=maybe]])],,
|
||||
[enable_xrandr="maybe"])
|
||||
AC_ARG_ENABLE(xfixes,
|
||||
[AS_HELP_STRING([--enable-xfixes],
|
||||
[support XFixes extension [default=maybe]])],,
|
||||
[support XFixes extension if available [default=maybe]])],,
|
||||
[enable_xfixes="maybe"])
|
||||
AC_ARG_ENABLE(xcomposite,
|
||||
[AS_HELP_STRING([--enable-xcomposite],
|
||||
[support X Composite extension [default=maybe]])],,
|
||||
[support X Composite extension if available [default=maybe]])],,
|
||||
[enable_xcomposite="maybe"])
|
||||
AC_ARG_ENABLE(xdamage,
|
||||
[AS_HELP_STRING([--enable-xdamage],
|
||||
[support X Damage extension [default=maybe]])],,
|
||||
[support X Damage extension if available [default=maybe]])],,
|
||||
[enable_xdamage="maybe"])
|
||||
|
||||
AC_ARG_ENABLE(x11-backend,
|
||||
@@ -406,7 +409,7 @@ fi
|
||||
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
|
||||
GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
|
||||
GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES"
|
||||
else
|
||||
if test "x$enable_debug" = "xno"; then
|
||||
GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
|
||||
@@ -444,6 +447,8 @@ if test "x$GCC" = "xyes"; then
|
||||
fi
|
||||
changequote([,])dnl
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES -DATK_DISABLE_SINGLE_INCLUDES"
|
||||
|
||||
# Ensure MSVC-compatible struct packing convention is used when
|
||||
# compiling for Win32 with gcc.
|
||||
# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
|
||||
@@ -495,8 +500,6 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
|
||||
|
||||
PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
|
||||
|
||||
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
|
||||
|
||||
if test "$os_win32" != yes; then
|
||||
# libtool option to control which symbols are exported
|
||||
# right now, symbols starting with _ are not exported
|
||||
@@ -687,11 +690,23 @@ esac
|
||||
# Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
|
||||
#
|
||||
|
||||
GLIB_PACKAGES="gobject-2.0 gio-2.0 gmodule-no-export-2.0"
|
||||
|
||||
AM_PATH_GLIB_2_0(glib_required_version, :,
|
||||
AC_MSG_ERROR([
|
||||
*** GLIB glib_required_version or better is required. The latest version of
|
||||
*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
|
||||
gobject gmodule-no-export)
|
||||
gobject gmodule-no-export gthread)
|
||||
|
||||
# See if it's safe to turn G_DISABLE_DEPRECATED on.
|
||||
GLIB_VERSION_MAJOR_MINOR=`$PKG_CONFIG --modversion glib-2.0 | sed "s/\.@<:@^.@:>@*\$//"`
|
||||
GLIB_REQUIRED_VERSION_MAJOR_MINOR=`echo glib_required_version | sed "s/\.@<:@^.@:>@*\$//"`
|
||||
if test "x$GLIB_VERSION_MAJOR_MINOR" = "x$GLIB_REQUIRED_VERSION_MAJOR_MINOR"; then
|
||||
CFLAGS="-DG_DISABLE_DEPRECATED $CFLAGS"
|
||||
fi
|
||||
|
||||
CFLAGS="-DGDK_PIXBUF_DISABLE_DEPRECATED $CFLAGS"
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
|
||||
@@ -935,7 +950,7 @@ if test "x$enable_x11_backend" = xyes; then
|
||||
have_base_x_pc=true
|
||||
X_PACKAGES="$X_PACKAGES x11 xext"
|
||||
x_libs="`$PKG_CONFIG --libs x11 xext`"
|
||||
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext` -DXINPUT2_1_USE_UNSTABLE_PROTOCOL -DXINPUT2_2_USE_UNSTABLE_PROTOCOL"
|
||||
X_CFLAGS="`$PKG_CONFIG --cflags x11 xext`"
|
||||
|
||||
# Strip out any .la files that pkg-config might give us (this happens
|
||||
# with -uninstalled.pc files)
|
||||
@@ -1118,7 +1133,6 @@ if test "x$enable_x11_backend" = xyes; then
|
||||
[Define to 1 if XFree XInput should be used])
|
||||
|
||||
X_PACKAGES="$X_PACKAGES xi"
|
||||
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xi"
|
||||
|
||||
AC_CHECK_HEADER(X11/extensions/XInput2.h,
|
||||
have_xinput2=yes
|
||||
@@ -1126,10 +1140,6 @@ if test "x$enable_x11_backend" = xyes; then
|
||||
AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]),
|
||||
X_EXTENSIONS="$X_EXTENSIONS XInput")
|
||||
|
||||
gtk_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -lXi"
|
||||
AC_CHECK_FUNC(XIAllowTouchEvents, AC_DEFINE(XINPUT_2_2, 1, [Define to 1 if XInput 2.2 is available]))
|
||||
LIBS="$gtk_save_LIBS"
|
||||
else
|
||||
AC_DEFINE(XINPUT_NONE, 1,
|
||||
[Define to 1 if no XInput should be used])
|
||||
@@ -1260,24 +1270,20 @@ fi
|
||||
CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 cairo cairo-gobject"
|
||||
GDK_PRIVATE_PACKAGES="$GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends"
|
||||
if test "x$enable_x11_backend" = xyes; then
|
||||
GDK_PRIVATE_PACKAGES="$GDK_PRIVATE_PACKAGES pangoft2"
|
||||
fi
|
||||
GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject"
|
||||
|
||||
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES $GDK_PRIVATE_PACKAGES` $MATH_LIB"
|
||||
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PACKAGES $GDK_PRIVATE_PACKAGES` $GDK_EXTRA_CFLAGS"
|
||||
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES` $MATH_LIB"
|
||||
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS"
|
||||
#
|
||||
# If we aren't writing explicit dependencies, then don't put the extra libraries we need
|
||||
# into the pkg-config files
|
||||
#
|
||||
if test $enable_explicit_deps != yes ; then
|
||||
GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 cairo-gobject"
|
||||
GDK_EXTRA_LIBS=
|
||||
fi
|
||||
|
||||
AC_SUBST(GDK_PACKAGES)
|
||||
AC_SUBST(GDK_PRIVATE_PACKAGES)
|
||||
AC_SUBST(GDK_EXTRA_LIBS)
|
||||
AC_SUBST(GDK_EXTRA_CFLAGS)
|
||||
AC_SUBST(GDK_DEP_LIBS)
|
||||
@@ -1314,15 +1320,17 @@ else
|
||||
fi
|
||||
|
||||
GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0"
|
||||
GTK_PRIVATE_PACKAGES=""
|
||||
if test "x$enable_x11_backend" = xyes; then
|
||||
GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
|
||||
GTK_PACKAGES="$GTK_PACKAGES pangoft2"
|
||||
fi
|
||||
GTK_EXTRA_LIBS=
|
||||
if test x"$os_openbsd" = xyes; then
|
||||
GTK_EXTRA_LIBS="$GTK_EXTRA_LIBS -lkvm"
|
||||
fi
|
||||
|
||||
GTK_EXTRA_CFLAGS=
|
||||
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES $GTK_PRIVATE_PACKAGES` $GTK_EXTRA_LIBS $MATH_LIB"
|
||||
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PACKAGES $GTK_PACKAGES $GTK_PRIVATE_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
|
||||
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $MATH_LIB"
|
||||
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES $GTK_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
|
||||
|
||||
if test x"$os_win32" = xyes; then
|
||||
GTK_EXTRA_CFLAGS="$msnative_struct"
|
||||
@@ -1334,7 +1342,6 @@ PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
|
||||
CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
|
||||
|
||||
AC_SUBST(GTK_PACKAGES)
|
||||
AC_SUBST(GTK_PRIVATE_PACKAGES)
|
||||
AC_SUBST(GTK_EXTRA_LIBS)
|
||||
AC_SUBST(GTK_EXTRA_CFLAGS)
|
||||
AC_SUBST(GTK_DEP_LIBS)
|
||||
@@ -1503,9 +1510,6 @@ if test "x$enable_test_print_backend" != "xno" ; then
|
||||
fi
|
||||
AM_CONDITIONAL(TEST_PRINT_BACKEND, test "x$enable_test_print_backend" != "xno")
|
||||
|
||||
if test "$os_win32" = "yes"; then
|
||||
AC_CHECK_TYPES([IPrintDialogCallback],[],[],[[#include <windows.h>]])
|
||||
fi
|
||||
|
||||
################################################################
|
||||
# Strip -export-dynamic from the link lines of various libraries
|
||||
@@ -1533,13 +1537,6 @@ fi
|
||||
|
||||
GLIB_GSETTINGS
|
||||
|
||||
#############
|
||||
# Resources #
|
||||
#############
|
||||
|
||||
GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
|
||||
AC_SUBST(GLIB_COMPILE_RESOURCES)
|
||||
|
||||
##################################################
|
||||
# GObject introspection
|
||||
##################################################
|
||||
@@ -1676,20 +1673,6 @@ AC_CONFIG_COMMANDS([gdk/gdkconfig.h], [
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* These macros are used to mark deprecated functions in GDK and
|
||||
* GTK+ headers, and thus have to be exposed in installed headers.
|
||||
* But please do *not* use them in other projects. Instead, use
|
||||
* G_DEPRECATED or define your own wrappers around it.
|
||||
*/
|
||||
|
||||
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
#define GDK_DEPRECATED
|
||||
#define GDK_DEPRECATED_FOR(f)
|
||||
#else
|
||||
#define GDK_DEPRECATED G_DEPRECATED
|
||||
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
|
||||
#endif
|
||||
|
||||
_______EOF
|
||||
|
||||
cat >>$outfile <<_______EOF
|
||||
@@ -1745,6 +1728,8 @@ gdk-3.0.pc
|
||||
gtk+-3.0.pc
|
||||
gtk+-unix-print-3.0.pc
|
||||
gail-3.0.pc
|
||||
gtk+-3.0-uninstalled.pc
|
||||
gail-3.0-uninstalled.pc
|
||||
m4macros/Makefile
|
||||
po/Makefile.in
|
||||
po-properties/Makefile.in
|
||||
@@ -1752,14 +1737,12 @@ demos/Makefile
|
||||
demos/gtk-demo/Makefile
|
||||
demos/gtk-demo/geninclude.pl
|
||||
demos/pixbuf-demo/Makefile
|
||||
demos/widget-factory/Makefile
|
||||
examples/Makefile
|
||||
tests/Makefile
|
||||
tests/a11y/Makefile
|
||||
tests/css/Makefile
|
||||
tests/css/parser/Makefile
|
||||
tests/reftests/Makefile
|
||||
tests/visuals/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
docs/reference/gdk/Makefile
|
||||
|
||||
18
debian/README.debian
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
libgtk1 for Debian
|
||||
----------------------
|
||||
|
||||
The GIMP Tool Kit (gtk) is a set of widgets to help you program
|
||||
programs for the X Windowing System easily and powerfully.
|
||||
|
||||
gtk is the moving force behind The GNU Image Manipulation Program (The
|
||||
GIMP) -- the number one freely-available image editing and creation
|
||||
program available.
|
||||
|
||||
gtk is rapidly under development, and the source tree has officially
|
||||
been separated from The GIMP now, as other teams of programmers
|
||||
are beginning to write software using its great widget set -- like
|
||||
GNOME, a desktop interface for X, and gzilla, a freely available
|
||||
web browser for X.
|
||||
|
||||
Ben Gertzfield <che@debian.org>, Mon, 29 Sep 1997 13:11:45 -0700
|
||||
|
||||
62
debian/build
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# Adjust debian/changelog and build a new
|
||||
# Debian package of a CVS archive.
|
||||
|
||||
# Written 17 November 1998 by Ben Gertzfield
|
||||
# <che@debian.org>
|
||||
|
||||
# This work is released under the GNU
|
||||
# General Public License, version 2 or
|
||||
# later.
|
||||
|
||||
use strict;
|
||||
use diagnostics;
|
||||
use File::Copy;
|
||||
|
||||
my $maintainer = 'Ben Gertzfield <che@debian.org>';
|
||||
|
||||
my @date = localtime;
|
||||
|
||||
my $datestr = sprintf("%d%.2d%.2d", $date[5] + 1900, $date[4] + 1, $date[3]);
|
||||
my $revision = '01';
|
||||
|
||||
open (CHANGELOG, 'debian/changelog') or die "Couldn't open debian/changelog: $!\n";
|
||||
|
||||
$_ = <CHANGELOG>;
|
||||
chomp;
|
||||
|
||||
close CHANGELOG;
|
||||
|
||||
my ($package, $last_date, $last_revision) = /^(.*?) \((.*?)\.(.*)?\)/;
|
||||
|
||||
if ($last_date eq $datestr) {
|
||||
$revision = sprintf("%.2d", $last_revision + 1);
|
||||
}
|
||||
|
||||
my $new_version = "$datestr.$revision";
|
||||
|
||||
copy('debian/changelog', 'debian/changelog.old') or die "Couldn't copy debian/changelog to debian/changelog.old: $!\n";
|
||||
|
||||
open(NEWCHANGELOG, ">debian/changelog") or die "Couldn't open debian/changelog for writing: $!\n";
|
||||
|
||||
print NEWCHANGELOG "$package ($new_version) unstable; urgency=low\n\n * CVS snapshot build at " . scalar localtime() . "\n\n -- $maintainer " . `date -R` . "\n";
|
||||
|
||||
open(OLDCHANGELOG, "debian/changelog.old") or die "Couldn't open debian/changelog.old: $!\n";
|
||||
|
||||
while (<OLDCHANGELOG>) {
|
||||
print NEWCHANGELOG;
|
||||
}
|
||||
|
||||
close OLDCHANGELOG;
|
||||
close NEWCHANGELOG;
|
||||
|
||||
unlink('debian/changelog.old') or die "Couldn't unlink debian/changelog.old: $!\n";
|
||||
|
||||
open(NEWVERSION, '>debian/version') or die "Couldn't open debian/version for writing: $!\n";
|
||||
print NEWVERSION "$new_version\n";
|
||||
close NEWVERSION;
|
||||
|
||||
system('dpkg-buildpackage -b -rfakeroot -us -uc');
|
||||
unlink 'debian/version' or die "Couldn't unlink debian/version: $!\n";
|
||||
|
||||
10
debian/changelog
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
gtk+-cvs (19981116.01) unstable; urgency=low
|
||||
|
||||
* First test build from CVS
|
||||
|
||||
-- Ben Gertzfield <che@debian.org> Tue, 17 Nov 1998 12:02:13 -0800
|
||||
|
||||
Local variables:
|
||||
mode: debian-changelog
|
||||
add-log-mailing-address: "che@debian.org"
|
||||
End:
|
||||
81
debian/control
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
Source: gtk+-cvs
|
||||
Priority: extra
|
||||
Section: libs
|
||||
Maintainer: Ben Gertzfield <che@debian.org>
|
||||
Standards-Version: 2.4.0.0
|
||||
|
||||
Package: libgtk-cvs-1.1
|
||||
Architecture: any
|
||||
Section: libs
|
||||
Depends: ${shlibs:Depends}
|
||||
Conflicts: libgtk-dev (<< 1:1.0.2), libgtk1.1
|
||||
Description: CVS build of the GIMP Toolkit set of widgets for X
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
The GIMP Toolkit is a freely available set of widgets for X.
|
||||
GTK is easy to use, and has been implemented in such projects as
|
||||
The GNU Image Manipulation Program (The GIMP), GNOME, a GNU
|
||||
desktop set of utilities for X, and gzilla, a GNU web-browser.
|
||||
.
|
||||
This is the unstable 1.1 branch of GTK. It is not intended for use
|
||||
with stable projects!
|
||||
|
||||
Package: libgtk-cvs-dev
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: libgtk-cvs-1.1 (=${Source-Version}), libglib-cvs-dev
|
||||
Suggests: libgtk-cvs-doc
|
||||
Provides: libgtk1.1-dev
|
||||
Replaces: libgtk1.1-dev
|
||||
Conflicts: libgtk-dev, libgtk1 (<< 1:1.0.4), libgtk1.1-dev
|
||||
Description: CVS build of development files for the GIMP Toolkit
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
This package contains the header files and static libraries for the
|
||||
GIMP Toolkit set of widgets for X.
|
||||
.
|
||||
This is the unstable, 1.1 branch of GTK+. This is not intended for
|
||||
use with stable releases of programs!
|
||||
.
|
||||
Install this package if you wish to develop your own X programs using
|
||||
the GIMP Toolkit 1.1, or if you wish to compile your own plug-ins for
|
||||
The GIMP.
|
||||
|
||||
Package: libgtk-cvs-doc
|
||||
Architecture: all
|
||||
Section: doc
|
||||
Conflicts: libgtk-dev (<< 1:0.99.4), libgtk-doc, libgtk1.1-doc
|
||||
Description: CVS build of documentation for the GIMP Toolkit
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
This package contains lots of info-files, HTML docs, FAQs, and
|
||||
other handy documentation about the GIMP Toolkit set of widgets
|
||||
for X.
|
||||
.
|
||||
This package documents the unstable 1.1 release of the GIMP Toolkit.
|
||||
.
|
||||
Install this package if you want to have lots of info about the
|
||||
GIMP toolkit when you're programming.
|
||||
|
||||
Package: libgtk-cvs-dbg
|
||||
Architecture: any
|
||||
Section: devel
|
||||
Depends: libgtk-cvs-1.1 (= ${Source-Version}), libgtk-cvs-dev (= ${Source-Version})
|
||||
Suggests: libgtk-cvs-doc
|
||||
Conflicts: libgtk1.1-dbg
|
||||
Description: CVS build of debugging files for the GIMP Toolkit
|
||||
**THIS IS NOT AN OFFICIAL DEBIAN PACKAGE! THIS IS AN AUTOMATED CVS
|
||||
BUILD OF THE GTK+ LIBRARIES! BEWARE! IT MAY NOT WORK!**
|
||||
.
|
||||
This package contains the debugging static libraries for the
|
||||
GIMP Toolkit set of widgets for X.
|
||||
.
|
||||
This is the unstable, 1.1 branch of GTK+. This is not intended for
|
||||
use with stable releases of programs!
|
||||
.
|
||||
Install this package if you wish to debug your own X programs using
|
||||
the GIMP Toolkit 1.1, or if you wish to debug your own plug-ins for
|
||||
The GIMP.
|
||||
8
debian/copyright
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
This package was debianized by Ben Gertzfield <che@debian.org> on
|
||||
Tue, 17 Nov 1998 12:07:17 -0800
|
||||
|
||||
It was produced from the CVS repository at cvs.gimp.org.
|
||||
|
||||
It may be redistributed under the terms of the GNU LGPL, Version 2 or
|
||||
later, found on Debian systems in the file /usr/doc/copyright/LGPL.
|
||||
|
||||
9
debian/libgtk-cvs-dev.files
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
usr/lib/libgdk.so
|
||||
usr/lib/libgdk.a
|
||||
usr/lib/libgtk.so
|
||||
usr/lib/libgtk.a
|
||||
usr/include/gdk/
|
||||
usr/include/gtk/
|
||||
usr/bin/gtk-config
|
||||
usr/man/man1/gtk-config.1
|
||||
usr/share/aclocal/gtk.m4
|
||||
5
debian/libgtk-cvs-dev.postinst
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
6
debian/libgtk-cvs-dev.prerm
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
|
||||
#DEBHELPER#
|
||||
8
debian/libgtk-cvs-doc.files
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
usr/info/gdk.info
|
||||
usr/info/gtk.info
|
||||
usr/info/gtk.info-1
|
||||
usr/info/gtk.info-2
|
||||
usr/info/gtk.info-3
|
||||
usr/info/gtk.info-4
|
||||
usr/info/gtk.info-5
|
||||
|
||||
11
debian/libgtk-cvs-doc.postinst
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
install-info --quiet --description="The GIMP Toolkit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gtk.info.gz
|
||||
|
||||
install-info --quiet --description="The GIMP Drawing Kit." \
|
||||
--section "The GIMP" "The GIMP" /usr/info/gdk.info.gz
|
||||
|
||||
#DEBHELPER#
|
||||
7
debian/libgtk-cvs-doc.prerm
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
install-info --quiet --remove gtk
|
||||
install-info --quiet --remove gdk
|
||||
|
||||
#DEBHELPER#
|
||||
7
debian/postinst
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
ldconfig
|
||||
|
||||
#DEBHELPER#
|
||||
160
debian/rules
vendored
Executable file
@@ -0,0 +1,160 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# debian/rules file for gtk+ Debian package
|
||||
# written April 1998 by Ben Gertzfield <che@debian.org
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
./autogen.sh --prefix=/usr --with-xinput=xfree
|
||||
$(MAKE)
|
||||
cd docs && make distdocs
|
||||
cd ..
|
||||
touch build-stamp
|
||||
|
||||
build-dbg: build-dbg-stamp
|
||||
build-dbg-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --with-xinput=xfree --enable-debug=yes
|
||||
$(MAKE)
|
||||
touch build-dbg-stamp
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
cd docs
|
||||
-$(MAKE) maintainer-clean
|
||||
cd ..
|
||||
-$(MAKE) distclean
|
||||
find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
|
||||
dh_clean
|
||||
|
||||
clean-dbg:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp build-dbg-stamp install-stamp install-dbg-stamp
|
||||
# Add here commands to clean up after the build process.
|
||||
-$(MAKE) clean
|
||||
cd docs
|
||||
-$(MAKE) maintainer-clean
|
||||
cd ..
|
||||
-$(MAKE) distclean
|
||||
find . -name '*.o' -o -name '_libs' -o -name '*.lo' -o -name '*.a' -o -name '.deps' | xargs rm -rf
|
||||
dh_clean -k
|
||||
|
||||
install: install-stamp
|
||||
install-stamp: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
$(MAKE) prefix=`pwd`/debian/tmp/usr install
|
||||
touch install-stamp
|
||||
|
||||
install-dbg: install-dbg-stamp
|
||||
install-dbg-stamp: build-dbg
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
$(MAKE) prefix=`pwd`/debian/libgtk-cvs-dbg/usr install
|
||||
touch install-dbg-stamp
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install libgtk-cvs-doc
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install libgtk-cvs-dev libgtk-cvs-1.1 libgtk-cvs-dbg
|
||||
|
||||
libgtk-cvs-1.1: build
|
||||
dh_testdir -plibgtk-cvs-1.1
|
||||
dh_testroot -plibgtk-cvs-1.1
|
||||
dh_installdirs -plibgtk-cvs-1.1
|
||||
# Add here commands to install the files into debian/tmp
|
||||
rm -rf debian/tmp/usr/bin debian/tmp/usr/include debian/tmp/usr/info debian/tmp/usr/lib/glib debian/tmp/usr/share/aclocal debian/tmp/usr/man debian/tmp/usr/lib/*.la
|
||||
dh_installdocs -plibgtk-cvs-1.1
|
||||
dh_installchangelogs -plibgtk-cvs-1.1
|
||||
dh_strip -plibgtk-cvs-1.1
|
||||
dh_compress -plibgtk-cvs-1.1
|
||||
dh_fixperms -plibgtk-cvs-1.1
|
||||
dh_installdeb -plibgtk-cvs-1.1
|
||||
dh_shlibdeps -plibgtk-cvs-1.1
|
||||
dh_gencontrol -plibgtk-cvs-1.1
|
||||
dh_makeshlibs -plibgtk-cvs-1.1 -V 'libgtk-cvs-1.1 (='`cat debian/version`')'
|
||||
dh_md5sums -plibgtk-cvs-1.1
|
||||
dh_builddeb -plibgtk-cvs-1.1
|
||||
|
||||
libgtk-cvs-dev: build
|
||||
dh_testdir -plibgtk-cvs-dev
|
||||
dh_testroot -plibgtk-cvs-dev
|
||||
dh_clean -plibgtk-cvs-dev -k
|
||||
dh_installdirs -plibgtk-cvs-dev
|
||||
# Add here commands to install the files into debian/tmp
|
||||
dh_movefiles -plibgtk-cvs-dev
|
||||
cp gtk-config debian/tmp/usr/bin
|
||||
dh_installdocs -plibgtk-cvs-dev
|
||||
dh_installchangelogs -plibgtk-cvs-dev
|
||||
dh_strip -plibgtk-cvs-dev
|
||||
dh_compress -plibgtk-cvs-dev
|
||||
dh_fixperms -plibgtk-cvs-dev
|
||||
dh_installdeb -plibgtk-cvs-dev
|
||||
dh_shlibdeps -plibgtk-cvs-dev
|
||||
dh_gencontrol -plibgtk-cvs-dev
|
||||
dh_md5sums -plibgtk-cvs-dev
|
||||
dh_builddeb -plibgtk-cvs-dev
|
||||
|
||||
libgtk-cvs-doc:
|
||||
dh_testdir -plibgtk-cvs-doc
|
||||
dh_testroot -plibgtk-cvs-doc
|
||||
dh_clean -plibgtk-cvs-doc -k
|
||||
dh_installdirs -plibgtk-cvs-doc usr/doc/libgtk-cvs-doc/faq-html \
|
||||
usr/doc/libgtk-cvs-doc/tutorial-html usr/doc/libgtk-cvs-doc/italian-tutorial-html usr/doc/libgtk-cvs-doc/french-tutorial-html usr/doc/libgtk-cvs-doc/gdk-html
|
||||
dh_movefiles -plibgtk-cvs-doc
|
||||
cp docs/html/gtkfaq*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/faq-html
|
||||
cp docs/html/gtk_tut-*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
|
||||
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
|
||||
cp docs/html/gtk_tut.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/tutorial-html
|
||||
cp docs/html/gtk_tut_it*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/italian-tutorial-html
|
||||
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/italian-tutorial-html
|
||||
cp docs/html/gtk_tut_fr*.html debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/french-tutorial-html
|
||||
cp docs/html/*.gif debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/french-tutorial-html
|
||||
cp docs/html/gdk* debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/gdk-html
|
||||
cp docs/text/*.txt debian/libgtk-cvs-doc/usr/doc/libgtk-cvs-doc/
|
||||
|
||||
dh_installdocs -plibgtk-cvs-doc docs/{debugging,developers,styles,text_widget,widget_system,gtk-config,refcounting}.txt TODO NEWS
|
||||
dh_installchangelogs -plibgtk-cvs-doc
|
||||
dh_strip -plibgtk-cvs-doc
|
||||
dh_compress -plibgtk-cvs-doc
|
||||
dh_fixperms -plibgtk-cvs-doc
|
||||
dh_installdeb -plibgtk-cvs-doc
|
||||
dh_shlibdeps -plibgtk-cvs-doc
|
||||
dh_gencontrol -plibgtk-cvs-doc
|
||||
dh_md5sums -plibgtk-cvs-doc
|
||||
dh_builddeb -plibgtk-cvs-doc
|
||||
|
||||
libgtk-cvs-dbg: clean-dbg install-dbg
|
||||
dh_testdir -plibgtk-cvs-dbg
|
||||
dh_testroot -plibgtk-cvs-dbg
|
||||
dh_installdirs -plibgtk-cvs-dbg
|
||||
# Add here commands to install the files into debian/libgtk-cvs-dbg
|
||||
rm -rf debian/libgtk-cvs-dbg/usr/bin debian/libgtk-cvs-dbg/usr/include debian/libgtk-cvs-dbg/usr/info debian/libgtk-cvs-dbg/usr/lib/glib debian/libgtk-cvs-dbg/usr/man debian/libgtk-cvs-dbg/usr/share debian/libgtk-cvs-dbg/usr/lib/*.{la,so*}
|
||||
for file in `find debian/libgtk-cvs-dbg/usr/lib -name '*.a'` ; do \
|
||||
mv $$file debian/libgtk-cvs-dbg/usr/lib/`basename $$file .a`_g.a; \
|
||||
done
|
||||
dh_installdocs -plibgtk-cvs-dbg
|
||||
dh_installchangelogs -plibgtk-cvs-dbg
|
||||
dh_compress -plibgtk-cvs-dbg
|
||||
dh_fixperms -plibgtk-cvs-dbg
|
||||
dh_installdeb -plibgtk-cvs-dbg
|
||||
dh_shlibdeps -plibgtk-cvs-dbg
|
||||
dh_gencontrol -plibgtk-cvs-dbg
|
||||
dh_md5sums -plibgtk-cvs-dbg
|
||||
dh_builddeb -plibgtk-cvs-dbg
|
||||
|
||||
source diff:
|
||||
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary
|
||||
@@ -1,6 +1,6 @@
|
||||
## Makefile.am for gtk+/demos
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = gtk-demo widget-factory pixbuf-demo
|
||||
SUBDIRS = gtk-demo pixbuf-demo
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
||||
@@ -6,7 +6,6 @@ democodedir=$(datadir)/gtk-$(GTK_API_VERSION)/demo
|
||||
## These should be in the order you want them to appear in the
|
||||
## demo app, which means alphabetized by demo title, not filename
|
||||
demos = \
|
||||
application.c \
|
||||
appwindow.c \
|
||||
assistant.c \
|
||||
builder.c \
|
||||
@@ -29,7 +28,6 @@ demos = \
|
||||
links.c \
|
||||
list_store.c \
|
||||
menus.c \
|
||||
multitouch.c \
|
||||
offscreen_window.c \
|
||||
offscreen_window2.c \
|
||||
overlay.c \
|
||||
@@ -45,7 +43,6 @@ demos = \
|
||||
textview.c \
|
||||
textscroll.c \
|
||||
toolpalette.c \
|
||||
transparent.c \
|
||||
tree_store.c \
|
||||
ui_manager.c
|
||||
|
||||
@@ -67,24 +64,13 @@ LDADDS = \
|
||||
$(GTK_DEP_LIBS) \
|
||||
-lm
|
||||
|
||||
bin_PROGRAMS = gtk3-demo gtk3-demo-application
|
||||
bin_PROGRAMS = gtk3-demo
|
||||
|
||||
BUILT_SOURCES = demos.h application_resources.c
|
||||
BUILT_SOURCES = demos.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
$(IMAGEFILES) \
|
||||
demo.ui \
|
||||
application.gresource.xml \
|
||||
application.ui \
|
||||
menus.ui \
|
||||
gtk-logo-24.png \
|
||||
gtk-logo-48.png \
|
||||
org.gtk.Demo.gschema.xml
|
||||
|
||||
gsettings_SCHEMAS = \
|
||||
org.gtk.Demo.gschema.xml
|
||||
|
||||
@GSETTINGS_RULES@
|
||||
EXTRA_DIST += \
|
||||
$(IMAGEFILES) \
|
||||
demo.ui
|
||||
|
||||
demos.h: @REBUILD@ $(demos) geninclude.pl
|
||||
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
|
||||
@@ -99,17 +85,8 @@ gtk3_demo_DEPENDENCIES = $(DEPS)
|
||||
gtk3_demo_LDADD = $(LDADDS)
|
||||
gtk3_demo_LDFLAGS = -export-dynamic
|
||||
|
||||
gtk3_demo_application_SOURCES = \
|
||||
application-standalone.c \
|
||||
application_resources.c
|
||||
|
||||
gtk3_demo_application_LDADD = $(LDADDS)
|
||||
|
||||
application_resources.c: application.gresource.xml gtk-logo-24.png gtk-logo-48.png application.ui menus.ui
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $(srcdir)/application.gresource.xml
|
||||
|
||||
IMAGEFILES= alphatest.png \
|
||||
apple-red.png \
|
||||
apple-red.png \
|
||||
background.jpg \
|
||||
floppybuddy.gif \
|
||||
gnome-applets.png \
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#define STANDALONE
|
||||
|
||||
#include "application.c"
|
||||
@@ -1,479 +0,0 @@
|
||||
/* Application class
|
||||
*
|
||||
* Demonstrates a simple application.
|
||||
*
|
||||
* This examples uses GtkApplication, GtkApplicationWindow, GtkBuilder
|
||||
* as well as GMenu and GResource. Due to the way GtkApplication is structured,
|
||||
* it is run as a separate process.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef STANDALONE
|
||||
|
||||
static void
|
||||
show_action_dialog (GSimpleAction *action)
|
||||
{
|
||||
const gchar *name;
|
||||
GtkWidget *dialog;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"You activated action: \"%s\"",
|
||||
name);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
show_action_infobar (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer window)
|
||||
{
|
||||
GtkWidget *infobar;
|
||||
GtkWidget *message;
|
||||
gchar *text;
|
||||
const gchar *name;
|
||||
const gchar *value;
|
||||
|
||||
name = g_action_get_name (G_ACTION (action));
|
||||
value = g_variant_get_string (parameter, NULL);
|
||||
|
||||
message = g_object_get_data (G_OBJECT (window), "message");
|
||||
infobar = g_object_get_data (G_OBJECT (window), "infobar");
|
||||
text = g_strdup_printf ("You activated radio action: \"%s\".\n"
|
||||
"Current value: %s", name, value);
|
||||
gtk_label_set_text (GTK_LABEL (message), text);
|
||||
gtk_widget_show (infobar);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_action (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
show_action_dialog (action);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_toggle (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *state;
|
||||
|
||||
show_action_dialog (action);
|
||||
|
||||
state = g_action_get_state (G_ACTION (action));
|
||||
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_radio (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
show_action_infobar (action, parameter, user_data);
|
||||
|
||||
g_action_change_state (G_ACTION (action), parameter);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_about (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *window = user_data;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
const gchar *authors[] = {
|
||||
"Peter Mattis",
|
||||
"Spencer Kimball",
|
||||
"Josh MacDonald",
|
||||
"and many more...",
|
||||
NULL
|
||||
};
|
||||
|
||||
const gchar *documentors[] = {
|
||||
"Owen Taylor",
|
||||
"Tony Gale",
|
||||
"Matthias Clasen <mclasen@redhat.com>",
|
||||
"and many more...",
|
||||
NULL
|
||||
};
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-48.png", NULL);
|
||||
|
||||
gtk_show_about_dialog (GTK_WINDOW (window),
|
||||
"program-name", "GTK+ Code Demos",
|
||||
"version", g_strdup_printf ("%s,\nRunning against GTK+ %d.%d.%d",
|
||||
PACKAGE_VERSION,
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ()),
|
||||
"copyright", "(C) 1997-2009 The GTK+ Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK+ functions.",
|
||||
"authors", authors,
|
||||
"documenters", documentors,
|
||||
"logo", pixbuf,
|
||||
"title", "About GTK+ Code Demos",
|
||||
NULL);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_quit (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
GtkWidget *win;
|
||||
GList *list, *next;
|
||||
|
||||
list = gtk_application_get_windows (app);
|
||||
while (list)
|
||||
{
|
||||
win = list->data;
|
||||
next = list->next;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (win));
|
||||
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
register_stock_icons (void)
|
||||
{
|
||||
static gboolean registered = FALSE;
|
||||
|
||||
if (!registered)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkIconFactory *factory;
|
||||
GtkIconSet *icon_set;
|
||||
|
||||
static GtkStockItem items[] = {
|
||||
{ "demo-gtk-logo", "_GTK!", 0, 0, NULL }
|
||||
};
|
||||
|
||||
registered = TRUE;
|
||||
|
||||
gtk_stock_add (items, G_N_ELEMENTS (items));
|
||||
|
||||
factory = gtk_icon_factory_new ();
|
||||
gtk_icon_factory_add_default (factory);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_resource ("/logos/gtk-logo-24.png", NULL);
|
||||
|
||||
icon_set = gtk_icon_set_new_from_pixbuf (pixbuf);
|
||||
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
|
||||
gtk_icon_set_unref (icon_set);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
/* Drop our reference to the factory, GTK will hold a reference. */
|
||||
g_object_unref (factory);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_statusbar (GtkTextBuffer *buffer,
|
||||
GtkStatusbar *statusbar)
|
||||
{
|
||||
gchar *msg;
|
||||
gint row, col;
|
||||
gint count;
|
||||
GtkTextIter iter;
|
||||
|
||||
/* clear any previous message, underflow is allowed */
|
||||
gtk_statusbar_pop (statusbar, 0);
|
||||
|
||||
count = gtk_text_buffer_get_char_count (buffer);
|
||||
|
||||
gtk_text_buffer_get_iter_at_mark (buffer,
|
||||
&iter,
|
||||
gtk_text_buffer_get_insert (buffer));
|
||||
|
||||
row = gtk_text_iter_get_line (&iter);
|
||||
col = gtk_text_iter_get_line_offset (&iter);
|
||||
|
||||
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
|
||||
row, col, count);
|
||||
|
||||
gtk_statusbar_push (statusbar, 0, msg);
|
||||
|
||||
g_free (msg);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_set_callback (GtkTextBuffer *buffer,
|
||||
const GtkTextIter *new_location,
|
||||
GtkTextMark *mark,
|
||||
gpointer data)
|
||||
{
|
||||
update_statusbar (buffer, GTK_STATUSBAR (data));
|
||||
}
|
||||
|
||||
static void
|
||||
change_theme_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkSettings *settings = gtk_settings_get_default ();
|
||||
|
||||
g_object_set (G_OBJECT (settings),
|
||||
"gtk-application-prefer-dark-theme",
|
||||
g_variant_get_boolean (state),
|
||||
NULL);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_titlebar_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = user_data;
|
||||
|
||||
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window),
|
||||
g_variant_get_boolean (state));
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_radio_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "new", activate_action, NULL, NULL, NULL },
|
||||
{ "open", activate_action, NULL, NULL, NULL },
|
||||
{ "save", activate_action, NULL, NULL, NULL },
|
||||
{ "save-as", activate_action, NULL, NULL, NULL },
|
||||
{ "quit", activate_quit, NULL, NULL, NULL },
|
||||
{ "dark", activate_toggle, NULL, "false", change_theme_state }
|
||||
};
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "titlebar", activate_toggle, NULL, "false", change_titlebar_state },
|
||||
{ "shape", activate_radio, "s", "'oval'", change_radio_state },
|
||||
{ "bold", activate_toggle, NULL, "false", NULL },
|
||||
{ "about", activate_about, NULL, NULL, NULL },
|
||||
{ "file1", activate_action, NULL, NULL, NULL },
|
||||
{ "logo", activate_action, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
clicked_cb (GtkWidget *widget, GtkWidget *info)
|
||||
{
|
||||
gtk_widget_hide (info);
|
||||
}
|
||||
|
||||
static void
|
||||
startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *appmenu;
|
||||
GMenuModel *menubar;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/ui/menus.ui", NULL);
|
||||
|
||||
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
|
||||
menubar = (GMenuModel *)gtk_builder_get_object (builder, "menubar");
|
||||
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu);
|
||||
gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *window;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *contents;
|
||||
GtkWidget *status;
|
||||
GtkWidget *message;
|
||||
GtkWidget *button;
|
||||
GtkWidget *infobar;
|
||||
GtkWidget *menutool;
|
||||
GMenuModel *toolmenu;
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Application Class");
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "document-open");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_resource (builder, "/ui/application.ui", NULL);
|
||||
|
||||
grid = (GtkWidget *)gtk_builder_get_object (builder, "grid");
|
||||
contents = (GtkWidget *)gtk_builder_get_object (builder, "contents");
|
||||
status = (GtkWidget *)gtk_builder_get_object (builder, "status");
|
||||
message = (GtkWidget *)gtk_builder_get_object (builder, "message");
|
||||
button = (GtkWidget *)gtk_builder_get_object (builder, "button");
|
||||
infobar = (GtkWidget *)gtk_builder_get_object (builder, "infobar");
|
||||
menutool = (GtkWidget *)gtk_builder_get_object (builder, "menutool");
|
||||
toolmenu = (GMenuModel *)gtk_builder_get_object (builder, "toolmenu");
|
||||
|
||||
g_object_set_data (G_OBJECT (window), "message", message);
|
||||
g_object_set_data (G_OBJECT (window), "infobar", infobar);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menutool),
|
||||
gtk_menu_new_from_model (toolmenu));
|
||||
|
||||
gtk_widget_grab_focus (contents);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (clicked_cb), infobar);
|
||||
|
||||
/* Show text widget info in the statusbar */
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
|
||||
g_signal_connect_object (buffer, "changed",
|
||||
G_CALLBACK (update_statusbar), status, 0);
|
||||
g_signal_connect_object (buffer, "mark-set",
|
||||
G_CALLBACK (mark_set_callback), status, 0);
|
||||
|
||||
update_statusbar (buffer, GTK_STATUSBAR (status));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkApplication *app;
|
||||
GSettings *settings;
|
||||
GAction *action;
|
||||
|
||||
gtk_init (NULL, NULL);
|
||||
|
||||
register_stock_icons ();
|
||||
|
||||
app = gtk_application_new ("org.gtk.Demo", 0);
|
||||
settings = g_settings_new ("org.gtk.Demo");
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
|
||||
action = g_settings_create_action (settings, "color");
|
||||
|
||||
g_action_map_add_action (G_ACTION_MAP (app), action);
|
||||
|
||||
g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
|
||||
g_application_run (G_APPLICATION (app), 0, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !STANDALONE */
|
||||
|
||||
static gboolean name_seen;
|
||||
static GtkWidget *placeholder;
|
||||
|
||||
static void
|
||||
on_name_appeared (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
const gchar *name_owner,
|
||||
gpointer user_data)
|
||||
{
|
||||
name_seen = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_name_vanished (GDBusConnection *connection,
|
||||
const gchar *name,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (!name_seen)
|
||||
return;
|
||||
|
||||
if (placeholder)
|
||||
{
|
||||
gtk_widget_destroy (placeholder);
|
||||
g_object_unref (placeholder);
|
||||
placeholder = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_application (GtkWidget *toplevel)
|
||||
{
|
||||
static guint watch = 0;
|
||||
|
||||
if (watch == 0)
|
||||
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
|
||||
"org.gtk.Demo",
|
||||
0,
|
||||
on_name_appeared,
|
||||
on_name_vanished,
|
||||
NULL, NULL);
|
||||
|
||||
if (placeholder == NULL)
|
||||
{
|
||||
const gchar *command;
|
||||
GError *error = NULL;
|
||||
|
||||
if (g_file_test ("./gtk3-demo-application", G_FILE_TEST_IS_EXECUTABLE))
|
||||
command = "./gtk3-demo-application";
|
||||
else
|
||||
command = "gtk3-demo-application";
|
||||
|
||||
if (!g_spawn_command_line_async (command, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
placeholder = gtk_label_new ("");
|
||||
g_object_ref_sink (placeholder);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
|
||||
"org.gtk.Demo",
|
||||
"/org/gtk/Demo",
|
||||
"org.gtk.Actions",
|
||||
"Activate",
|
||||
g_variant_new ("(sava{sv})", "quit", NULL, NULL),
|
||||
NULL,
|
||||
0,
|
||||
G_MAXINT,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/logos">
|
||||
<file preprocess="to-pixdata">gtk-logo-24.png</file>
|
||||
<file preprocess="to-pixdata">gtk-logo-48.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/ui">
|
||||
<file preprocess="xml-stripblanks">application.ui</file>
|
||||
<file preprocess="xml-stripblanks">menus.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
@@ -1,104 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<child>
|
||||
<object class="GtkMenuToolButton" id="menutool">
|
||||
<property name="stock-id">gtk-open</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="quit">
|
||||
<property name="stock-id">gtk-quit</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem" id="sep"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="logo">
|
||||
<property name="stock-id">demo-gtk-logo</property>
|
||||
<property name="action-name">win.logo</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkInfoBar" id="infobar">
|
||||
<property name="no-show-all">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox" id="content_area">
|
||||
<child>
|
||||
<object class="GtkLabel" id="message">
|
||||
<property name="visible">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="halign">fill</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkBox" id="action_area">
|
||||
<child>
|
||||
<object class="GtkButton" id="button">
|
||||
<property name="visible">True</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="use-stock">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sw">
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="contents">
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="status">
|
||||
<property name="halign">fill</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<menu id="toolmenu">
|
||||
<item>
|
||||
<attribute name="label">File1</attribute>
|
||||
<attribute name="action">win.file1</attribute>
|
||||
</item>
|
||||
</menu>
|
||||
</interface>
|
||||
@@ -1,8 +1,6 @@
|
||||
/* Application window
|
||||
/* Application main window
|
||||
*
|
||||
* Demonstrates a typical application window with menubar, toolbar, statusbar.
|
||||
*
|
||||
* This example uses GtkUIManager and GtkActionGroup.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -31,14 +29,6 @@ activate_action (GtkAction *action)
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "HideTitlebar"))
|
||||
{
|
||||
gboolean value = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), value);
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
@@ -204,11 +194,6 @@ static GtkToggleActionEntry toggle_entries[] = {
|
||||
"Prefer Dark Theme", /* tooltip */
|
||||
G_CALLBACK (activate_action),
|
||||
FALSE }, /* is_active */
|
||||
{ "HideTitlebar", NULL,
|
||||
"_Hide Titlebar when maximized", NULL,
|
||||
"Hide Titlebar when maximized",
|
||||
G_CALLBACK (activate_action),
|
||||
FALSE }
|
||||
};
|
||||
static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries);
|
||||
|
||||
@@ -263,7 +248,6 @@ static const gchar *ui_info =
|
||||
" </menu>"
|
||||
" <menu action='PreferencesMenu'>"
|
||||
" <menuitem action='DarkTheme'/>"
|
||||
" <menuitem action='HideTitlebar'/>"
|
||||
" <menu action='ColorMenu'>"
|
||||
" <menuitem action='Red'/>"
|
||||
" <menuitem action='Green'/>"
|
||||
|
||||
@@ -23,14 +23,14 @@ apply_changes_gradually (gpointer data)
|
||||
if (fraction < 1.0)
|
||||
{
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), fraction);
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Close automatically once changes are fully applied. */
|
||||
gtk_widget_destroy (assistant);
|
||||
assistant = NULL;
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,7 @@ find_toplevel_at_pointer (GdkDisplay *display)
|
||||
GdkWindow *pointer_window;
|
||||
GtkWidget *widget = NULL;
|
||||
|
||||
pointer_window = gdk_device_get_window_at_position (gtk_get_current_event_device (),
|
||||
NULL, NULL);
|
||||
pointer_window = gdk_display_get_window_at_pointer (display, NULL, NULL);
|
||||
|
||||
/* The user data field of a GdkWindow is used to store a pointer
|
||||
* to the widget that created it.
|
||||
@@ -132,13 +131,11 @@ query_for_toplevel (GdkScreen *screen,
|
||||
gtk_widget_show_all (popup);
|
||||
cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);
|
||||
|
||||
if (gdk_device_grab (gtk_get_current_event_device (),
|
||||
gtk_widget_get_window (popup),
|
||||
GDK_OWNERSHIP_NONE,
|
||||
FALSE,
|
||||
GDK_BUTTON_RELEASE_MASK,
|
||||
cursor,
|
||||
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
|
||||
if (gdk_pointer_grab (gtk_widget_get_window (popup), FALSE,
|
||||
GDK_BUTTON_RELEASE_MASK,
|
||||
NULL,
|
||||
cursor,
|
||||
GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
|
||||
{
|
||||
gboolean clicked = FALSE;
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ button_press (GtkWidget *widget,
|
||||
GtkWidget *menu;
|
||||
GtkWidget *item;
|
||||
|
||||
if (button->button != GDK_BUTTON_SECONDARY)
|
||||
if (button->button != 3)
|
||||
return FALSE;
|
||||
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
@@ -36,17 +36,26 @@ change_color_callback (GtkWidget *button,
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
GtkColorSelection *colorsel;
|
||||
GtkColorChooserDialog *selection_dialog;
|
||||
GtkColorSelectionDialog *selection_dialog;
|
||||
gint response;
|
||||
|
||||
dialog = gtk_color_chooser_dialog_new ("Changing color", GTK_WINDOW (window));
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
|
||||
dialog = gtk_color_selection_dialog_new ("Changing color");
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
|
||||
|
||||
selection_dialog = GTK_COLOR_SELECTION_DIALOG (dialog);
|
||||
colorsel = GTK_COLOR_SELECTION (gtk_color_selection_dialog_get_color_selection (selection_dialog));
|
||||
|
||||
gtk_color_selection_set_previous_rgba (colorsel, &color);
|
||||
gtk_color_selection_set_current_rgba (colorsel, &color);
|
||||
gtk_color_selection_set_has_palette (colorsel, TRUE);
|
||||
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
{
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
|
||||
gtk_color_selection_get_current_rgba (colorsel, &color);
|
||||
|
||||
gtk_widget_override_background_color (da, 0, &color);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ scribble_button_press_event (GtkWidget *widget,
|
||||
if (surface == NULL)
|
||||
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
|
||||
|
||||
if (event->button == GDK_BUTTON_PRIMARY)
|
||||
if (event->button == 1)
|
||||
draw_brush (widget, event->x, event->y);
|
||||
|
||||
/* We've handled the event, stop processing */
|
||||
@@ -126,7 +126,7 @@ scribble_motion_notify_event (GtkWidget *widget,
|
||||
* can cope.
|
||||
*/
|
||||
|
||||
gdk_window_get_device_position (event->window, event->device, &x, &y, &state);
|
||||
gdk_window_get_pointer (event->window, &x, &y, &state);
|
||||
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
draw_brush (widget, x, y);
|
||||
|
||||
@@ -48,27 +48,27 @@ add_items (void)
|
||||
g_return_if_fail (articles != NULL);
|
||||
|
||||
foo.number = 3;
|
||||
foo.product = g_strdup ("bottles of coke");
|
||||
foo.product = "bottles of coke";
|
||||
foo.yummy = 20;
|
||||
g_array_append_vals (articles, &foo, 1);
|
||||
|
||||
foo.number = 5;
|
||||
foo.product = g_strdup ("packages of noodles");
|
||||
foo.product = "packages of noodles";
|
||||
foo.yummy = 50;
|
||||
g_array_append_vals (articles, &foo, 1);
|
||||
|
||||
foo.number = 2;
|
||||
foo.product = g_strdup ("packages of chocolate chip cookies");
|
||||
foo.product = "packages of chocolate chip cookies";
|
||||
foo.yummy = 90;
|
||||
g_array_append_vals (articles, &foo, 1);
|
||||
|
||||
foo.number = 1;
|
||||
foo.product = g_strdup ("can vanilla ice cream");
|
||||
foo.product = "can vanilla ice cream";
|
||||
foo.yummy = 60;
|
||||
g_array_append_vals (articles, &foo, 1);
|
||||
|
||||
foo.number = 6;
|
||||
foo.product = g_strdup ("eggs");
|
||||
foo.product = "eggs";
|
||||
foo.yummy = 10;
|
||||
g_array_append_vals (articles, &foo, 1);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ if (defined @child_arrays) {
|
||||
}
|
||||
|
||||
# toplevel
|
||||
print "\nDemo gtk_demos[] = {\n";
|
||||
print "\nDemo testgtk_demos[] = {\n";
|
||||
|
||||
$first = 1;
|
||||
foreach $href (@demos) {
|
||||
|
||||
|
Before Width: | Height: | Size: 674 B |
|
Before Width: | Height: | Size: 2.3 KiB |
@@ -144,7 +144,7 @@ event_after (GtkWidget *text_view,
|
||||
|
||||
event = (GdkEventButton *)ev;
|
||||
|
||||
if (event->button != GDK_BUTTON_PRIMARY)
|
||||
if (event->button != 1)
|
||||
return FALSE;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
||||
@@ -225,6 +225,29 @@ motion_notify_event (GtkWidget *text_view,
|
||||
|
||||
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
|
||||
|
||||
gdk_window_get_pointer (gtk_widget_get_window (text_view),
|
||||
NULL, NULL, NULL);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Also update the cursor image if the window becomes visible
|
||||
* (e.g. when a window covering it got iconified).
|
||||
*/
|
||||
static gboolean
|
||||
visibility_notify_event (GtkWidget *text_view,
|
||||
GdkEventVisibility *event)
|
||||
{
|
||||
gint wx, wy, bx, by;
|
||||
|
||||
gdk_window_get_pointer (gtk_widget_get_window (text_view),
|
||||
&wx, &wy, NULL);
|
||||
|
||||
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
|
||||
GTK_TEXT_WINDOW_WIDGET,
|
||||
wx, wy, &bx, &by);
|
||||
|
||||
set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), bx, by);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -262,6 +285,8 @@ do_hypertext (GtkWidget *do_widget)
|
||||
G_CALLBACK (event_after), NULL);
|
||||
g_signal_connect (view, "motion-notify-event",
|
||||
G_CALLBACK (motion_notify_event), NULL);
|
||||
g_signal_connect (view, "visibility-notify-event",
|
||||
G_CALLBACK (visibility_notify_event), NULL);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
|
||||
@@ -63,13 +63,7 @@ do_links (GtkWidget *do_widget)
|
||||
label = gtk_label_new ("Some <a href=\"http://en.wikipedia.org/wiki/Text\""
|
||||
"title=\"plain text\">text</a> may be marked up\n"
|
||||
"as hyperlinks, which can be clicked\n"
|
||||
"or activated via <a href=\"keynav\">keynav</a>\n"
|
||||
"and they work fine with other markup, like when\n"
|
||||
"searching on <a href=\"http://www.google.com/\">"
|
||||
"<span color=\"#0266C8\">G</span><span color=\"#F90101\">o</span>"
|
||||
"<span color=\"#F2B50F\">o</span><span color=\"#0266C8\">g</span>"
|
||||
"<span color=\"#00933B\">l</span><span color=\"#F90101\">e</span>"
|
||||
"</a>.");
|
||||
"or activated via <a href=\"keynav\">keynav</a>");
|
||||
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
||||
g_signal_connect (label, "activate-link", G_CALLBACK (activate_link), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), label);
|
||||
|
||||
@@ -60,7 +60,7 @@ spinner_timeout (gpointer data)
|
||||
guint pulse;
|
||||
|
||||
if (model == NULL)
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
|
||||
gtk_tree_model_get_iter_first (model, &iter);
|
||||
gtk_tree_model_get (model, &iter,
|
||||
@@ -77,7 +77,7 @@ spinner_timeout (gpointer data)
|
||||
COLUMN_ACTIVE, TRUE,
|
||||
-1);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkTreeModel *
|
||||
|
||||
@@ -711,7 +711,7 @@ selection_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = G_VALUE_INIT;
|
||||
GValue value = {0, };
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
@@ -782,7 +782,7 @@ create_tree (void)
|
||||
GtkTreeIter iter;
|
||||
GtkWidget *box, *label, *scrolled_window;
|
||||
|
||||
Demo *d = gtk_demos;
|
||||
Demo *d = testgtk_demos;
|
||||
|
||||
model = gtk_tree_store_new (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_INT);
|
||||
tree_view = gtk_tree_view_new ();
|
||||
@@ -936,8 +936,10 @@ main (int argc, char **argv)
|
||||
* these few lines, which are just a hack so gtk-demo will work
|
||||
* in the GTK tree without installing it.
|
||||
*/
|
||||
if (g_file_test ("../../modules/input/immodules.cache", G_FILE_TEST_EXISTS))
|
||||
if (g_file_test ("../../gdk-pixbuf/libpixbufloader-pnm.la",
|
||||
G_FILE_TEST_EXISTS))
|
||||
{
|
||||
g_setenv ("GDK_PIXBUF_MODULE_FILE", "../../gdk-pixbuf/loaders.cache", TRUE);
|
||||
g_setenv ("GTK_IM_MODULE_FILE", "../../modules/input/immodules.cache", TRUE);
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
@@ -1000,7 +1002,7 @@ main (int argc, char **argv)
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
load_file (gtk_demos[0].filename);
|
||||
load_file (testgtk_demos[0].filename);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
#include <stdio.h>
|
||||
|
||||
static GtkWidget *
|
||||
create_menu (gint depth)
|
||||
create_menu (gint depth,
|
||||
gboolean tearoff)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *menuitem;
|
||||
@@ -44,6 +45,13 @@ create_menu (gint depth)
|
||||
menu = gtk_menu_new ();
|
||||
group = NULL;
|
||||
|
||||
if (tearoff)
|
||||
{
|
||||
menuitem = gtk_tearoff_menu_item_new ();
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
}
|
||||
|
||||
for (i = 0, j = 1; i < 5; i++, j++)
|
||||
{
|
||||
sprintf (buf, "item %2d - %d", depth, j);
|
||||
@@ -55,7 +63,7 @@ create_menu (gint depth)
|
||||
if (i == 3)
|
||||
gtk_widget_set_sensitive (menuitem, FALSE);
|
||||
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1));
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (depth - 1, TRUE));
|
||||
}
|
||||
|
||||
return menu;
|
||||
@@ -120,7 +128,7 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
menu = create_menu (2);
|
||||
menu = create_menu (2, TRUE);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("test\nline2");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
|
||||
@@ -128,12 +136,12 @@ do_menus (GtkWidget *do_widget)
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("foo");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3, TRUE));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("bar");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4, TRUE));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<interface>
|
||||
<menu id="appmenu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_New</attribute>
|
||||
<attribute name="action">app.new</attribute>
|
||||
<attribute name="accel"><Primary>n</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Open</attribute>
|
||||
<attribute name="action">app.open</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Save</attribute>
|
||||
<attribute name="action">app.save</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Save _As...</attribute>
|
||||
<attribute name="action">app.save-as</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><Primary>q</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<menu id="menubar">
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Preferences</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
|
||||
<attribute name="action">app.dark</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Hide Titlebar when maximized</attribute>
|
||||
<attribute name="action">win.titlebar</attribute>
|
||||
</item>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Color</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Red</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">red</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Green</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">green</attribute>
|
||||
<attribute name="accel"><Primary>g</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Blue</attribute>
|
||||
<attribute name="action">app.color</attribute>
|
||||
<attribute name="target">blue</attribute>
|
||||
<attribute name="accel"><Primary>b</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Shape</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Square</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">square</attribute>
|
||||
<attribute name="accel"><Primary>s</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Rectangle</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">rectangle</attribute>
|
||||
<attribute name="accel"><Primary>r</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Oval</attribute>
|
||||
<attribute name="action">win.shape</attribute>
|
||||
<attribute name="target">oval</attribute>
|
||||
<attribute name="accel"><Primary>o</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Bold</attribute>
|
||||
<attribute name="action">win.bold</attribute>
|
||||
<attribute name="accel"><Primary>b</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label" translatable="yes">_Help</attribute>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About</attribute>
|
||||
<attribute name="action">win.about</attribute>
|
||||
<attribute name="accel"><Primary>a</attribute>
|
||||
</item>
|
||||
</submenu>
|
||||
</menu>
|
||||
</interface>
|
||||
@@ -1,698 +0,0 @@
|
||||
/* 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;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<schemalist>
|
||||
|
||||
<enum id='org.gtk.Demo.Color'>
|
||||
<value nick='red' value='0'/>
|
||||
<value nick='green' value='1'/>
|
||||
<value nick='blue' value='2'/>
|
||||
</enum>
|
||||
|
||||
<schema id='org.gtk.Demo' path='/org/gtk/Demo/'>
|
||||
<key name='color' enum='org.gtk.Demo.Color'>
|
||||
<default>'red'</default>
|
||||
</key>
|
||||
</schema>
|
||||
|
||||
</schemalist>
|
||||
@@ -180,7 +180,7 @@ timeout (gpointer data)
|
||||
GDK_THREADS_LEAVE ();
|
||||
|
||||
frame_num++;
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint timeout_id;
|
||||
|
||||
@@ -29,7 +29,8 @@ static gboolean
|
||||
search_progress (gpointer data)
|
||||
{
|
||||
gtk_entry_progress_pulse (GTK_ENTRY (data));
|
||||
return G_SOURCE_CONTINUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -49,7 +49,7 @@ scroll_to_end (GtkTextView *textview)
|
||||
if (count > 150)
|
||||
count = 0;
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Scroll to the bottom of the buffer.
|
||||
@@ -100,7 +100,7 @@ scroll_to_bottom (GtkTextView *textview)
|
||||
if (count > 40)
|
||||
count = 0;
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint
|
||||
|
||||
@@ -350,7 +350,7 @@ interactive_canvas_real_drag_leave (gpointer data)
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
/* Transparent
|
||||
*
|
||||
* Use transparent background on GdkWindows to create a shadow effect on a GtkOverlay widget.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define SHADOW_OFFSET_X 7
|
||||
#define SHADOW_OFFSET_Y 7
|
||||
#define SHADOW_RADIUS 5
|
||||
|
||||
static void
|
||||
draw_shadow_box (cairo_t *cr,
|
||||
GdkRectangle rect,
|
||||
double radius,
|
||||
double transparency)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
double x0, x1, x2, x3;
|
||||
double y0, y1, y2, y3;
|
||||
|
||||
x0 = rect.x;
|
||||
x1 = rect.x + radius;
|
||||
x2 = rect.x + rect.width - radius;
|
||||
x3 = rect.x + rect.width;
|
||||
|
||||
y0 = rect.y;
|
||||
y1 = rect.y + radius;
|
||||
y2 = rect.y + rect.height - radius;
|
||||
y3 = rect.y + rect.height;
|
||||
|
||||
/* Fill non-border part */
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
|
||||
cairo_rectangle (cr,
|
||||
x1, y1, x2 - x1, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Upper border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (0, y0, 0, y1);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x1, y0,
|
||||
x2 - x1, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Bottom border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (0, y2, 0, y3);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x1, y2,
|
||||
x2 - x1, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Left border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y1,
|
||||
x1 - x0, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* Right border */
|
||||
|
||||
pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y1,
|
||||
x3 - x2, y2 - y1);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* NW corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x1, y1, 0,
|
||||
x1, y1, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y0,
|
||||
x1 - x0, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* NE corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x2, y1, 0,
|
||||
x2, y1, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y0,
|
||||
x3 - x2, y1 - y0);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* SW corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x1, y2, 0,
|
||||
x1, y2, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x0, y2,
|
||||
x1 - x0, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
|
||||
/* SE corner */
|
||||
|
||||
pattern = cairo_pattern_create_radial (x2, y2, 0,
|
||||
x2, y2, radius);
|
||||
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
|
||||
|
||||
cairo_set_source (cr, pattern);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
x2, y2,
|
||||
x3 - x2, y3 - y2);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
draw_callback (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
gtk_widget_get_allocation (widget, &rect);
|
||||
rect.x += SHADOW_OFFSET_X;
|
||||
rect.y += SHADOW_OFFSET_Y;
|
||||
rect.width -= SHADOW_OFFSET_X;
|
||||
rect.height -= SHADOW_OFFSET_Y;
|
||||
|
||||
draw_shadow_box (cr,
|
||||
rect, SHADOW_RADIUS, 0.4);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_transparent (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *overlay;
|
||||
GtkWidget *align;
|
||||
GtkWidget *entry;
|
||||
GdkRGBA transparent = {0, 0, 0, 0};
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window),
|
||||
450, 450);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transparent");
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_container_add (GTK_CONTAINER (overlay), sw);
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
|
||||
gtk_widget_override_background_color (overlay, 0, &transparent);
|
||||
|
||||
align = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (align),
|
||||
0, SHADOW_OFFSET_Y, 0, SHADOW_OFFSET_X);
|
||||
g_signal_connect (align, "draw", G_CALLBACK (draw_callback), NULL);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_container_add (GTK_CONTAINER (align), entry);
|
||||
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), align);
|
||||
gtk_widget_set_halign (align, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (align, GTK_ALIGN_START);
|
||||
|
||||
gtk_widget_show_all (overlay);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
{
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
bin_PROGRAMS = gtk3-widget-factory
|
||||
|
||||
gtk3_widget_factory_SOURCES = \
|
||||
widget-factory.c \
|
||||
widget_factory_resources.c
|
||||
|
||||
BUILT_SOURCES = \
|
||||
widget_factory_resources.c
|
||||
|
||||
gtk3_widget_factory_DEPENDENCIES = \
|
||||
$(top_builddir)/gtk/libgtk-3.la
|
||||
|
||||
gtk3_widget_factory_CPPFLAGS = \
|
||||
-I$(top_srcdir) \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GTK_DEP_CFLAGS)
|
||||
|
||||
gtk3_widget_factory_LDADD = \
|
||||
$(top_builddir)/gdk/libgdk-3.la \
|
||||
$(top_builddir)/gtk/libgtk-3.la \
|
||||
$(GTK_DEP_LIBS)
|
||||
|
||||
widget_factory_resources.c: widget-factory.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies $(srcdir)/widget-factory.gresource.xml)
|
||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source $<
|
||||
|
||||
EXTRA_DIST += \
|
||||
widget-factory.ui \
|
||||
widget-factory.gresource.xml \
|
||||
gtk-logo-256.png
|
||||
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/logos">
|
||||
<file>gtk-logo-256.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/ui">
|
||||
<file preprocess="xml-stripblanks">widget-factory.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
@@ -9,11 +9,10 @@ DOC_MODULE=gdk3
|
||||
DOC_MAIN_SGML_FILE=gdk-docs.sgml
|
||||
|
||||
# Extra options to supply to gtkdoc-scan
|
||||
SCAN_OPTIONS=--deprecated-guards=GDK_DISABLE_DEPRECATED \
|
||||
--ignore-decorators=G_GNUC_WARN_UNUSED_RESULT
|
||||
SCAN_OPTIONS=--deprecated-guards="GDK_ENABLE_BROKEN|GDK_DISABLE_DEPRECATED"
|
||||
|
||||
# The directory containing the source code. Relative to $(srcdir)
|
||||
DOC_SOURCE_DIR=$(top_srcdir)/gdk $(top_srcdir)/gdk/x11
|
||||
DOC_SOURCE_DIR=../../../gdk ../../../gdk/x11
|
||||
|
||||
# Used for dependencies
|
||||
HFILE_GLOB=$(top_srcdir)/gdk/*.h $(top_srcdir)/gdk/x11/gdkx.h
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
<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" />
|
||||
@@ -62,10 +61,6 @@
|
||||
<title>Index of new symbols in 3.2</title>
|
||||
<xi:include href="xml/api-index-3.2.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
<index id="api-index-3-4" role="3.4">
|
||||
<title>Index of new symbols in 3.4</title>
|
||||
<xi:include href="xml/api-index-3.4.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
|
||||
|
||||
@@ -74,7 +74,6 @@ gdk_grab_status_get_type
|
||||
gdk_gravity_get_type
|
||||
gdk_input_mode_get_type
|
||||
gdk_input_source_get_type
|
||||
gdk_modifier_intent_get_type
|
||||
gdk_modifier_type_get_type
|
||||
gdk_notify_type_get_type
|
||||
gdk_property_state_get_type
|
||||
@@ -199,7 +198,6 @@ gdk_screen_make_display_name
|
||||
gdk_screen_get_n_monitors
|
||||
gdk_screen_get_primary_monitor
|
||||
gdk_screen_get_monitor_geometry
|
||||
gdk_screen_get_monitor_workarea
|
||||
gdk_screen_get_monitor_at_point
|
||||
gdk_screen_get_monitor_at_window
|
||||
gdk_screen_get_monitor_height_mm
|
||||
@@ -367,9 +365,7 @@ gdk_window_restack
|
||||
gdk_window_focus
|
||||
gdk_window_register_dnd
|
||||
gdk_window_begin_resize_drag
|
||||
gdk_window_begin_resize_drag_for_device
|
||||
gdk_window_begin_move_drag
|
||||
gdk_window_begin_move_drag_for_device
|
||||
gdk_window_constrain_size
|
||||
gdk_window_beep
|
||||
|
||||
@@ -633,7 +629,6 @@ gdk_keymap_get_caps_lock_state
|
||||
gdk_keymap_get_num_lock_state
|
||||
gdk_keymap_add_virtual_modifiers
|
||||
gdk_keymap_map_virtual_modifiers
|
||||
gdk_keymap_get_modifier_mask
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_keyval_name
|
||||
@@ -757,11 +752,6 @@ GdkEventMask
|
||||
GDK_CURRENT_TIME
|
||||
GDK_PRIORITY_EVENTS
|
||||
GDK_PRIORITY_REDRAW
|
||||
GDK_EVENT_PROPAGATE
|
||||
GDK_EVENT_STOP
|
||||
GDK_BUTTON_PRIMARY
|
||||
GDK_BUTTON_MIDDLE
|
||||
GDK_BUTTON_SECONDARY
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_events_pending
|
||||
@@ -781,13 +771,10 @@ gdk_event_get_root_coords
|
||||
gdk_event_get_scroll_direction
|
||||
gdk_event_get_state
|
||||
gdk_event_get_time
|
||||
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
|
||||
@@ -835,7 +822,6 @@ GdkEventWindowState
|
||||
GdkEventSetting
|
||||
GdkEventOwnerChange
|
||||
GdkEventGrabBroken
|
||||
GdkEventMultiTouch
|
||||
|
||||
<SUBSECTION>
|
||||
GdkScrollDirection
|
||||
@@ -863,29 +849,6 @@ 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>
|
||||
@@ -993,7 +956,6 @@ gdk_x11_screen_supports_net_wm_hint
|
||||
gdk_x11_window_foreign_new_for_display
|
||||
gdk_x11_window_lookup_for_display
|
||||
gdk_x11_window_get_xid
|
||||
gdk_x11_window_set_hide_titlebar_when_maximized
|
||||
gdk_x11_window_set_theme_variant
|
||||
gdk_x11_window_set_user_time
|
||||
gdk_x11_window_move_to_current_desktop
|
||||
@@ -1020,98 +982,6 @@ gdk_x11_display_string_to_compound_text
|
||||
gdk_x11_display_utf8_to_compound_text
|
||||
gdk_x11_free_compound_text
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_X11_APP_LAUNCH_CONTEXT
|
||||
GDK_X11_APP_LAUNCH_CONTEXT
|
||||
GDK_X11_APP_LAUNCH_CONTEXT_CLASS
|
||||
GDK_IS_X11_APP_LAUNCH_CONTEXT
|
||||
GDK_IS_X11_APP_LAUNCH_CONTEXT_CLASS
|
||||
GDK_X11_APP_LAUNCH_CONTEXT_GET_CLASS
|
||||
GDK_TYPE_X11_CURSOR
|
||||
GDK_X11_CURSOR
|
||||
GDK_X11_CURSOR_CLASS
|
||||
GDK_IS_X11_CURSOR
|
||||
GDK_IS_X11_CURSOR_CLASS
|
||||
GDK_X11_CURSOR_GET_CLASS
|
||||
GDK_TYPE_X11_DEVICE_CORE
|
||||
GDK_X11_DEVICE_CORE
|
||||
GDK_X11_DEVICE_CORE_CLASS
|
||||
GDK_IS_X11_DEVICE_CORE
|
||||
GDK_IS_X11_DEVICE_CORE_CLASS
|
||||
GDK_X11_DEVICE_CORE_GET_CLASS
|
||||
GDK_TYPE_X11_DEVICE_MANAGER_CORE
|
||||
GDK_X11_DEVICE_MANAGER_CORE
|
||||
GDK_X11_DEVICE_MANAGER_CORE_CLASS
|
||||
GDK_IS_X11_DEVICE_MANAGER_CORE
|
||||
GDK_IS_X11_DEVICE_MANAGER_CORE_CLASS
|
||||
GDK_X11_DEVICE_MANAGER_CORE_GET_CLASS
|
||||
GDK_TYPE_X11_DEVICE_MANAGER_XI2
|
||||
GDK_X11_DEVICE_MANAGER_XI2
|
||||
GDK_X11_DEVICE_MANAGER_XI2_CLASS
|
||||
GDK_IS_X11_DEVICE_MANAGER_XI2
|
||||
GDK_IS_X11_DEVICE_MANAGER_XI2_CLASS
|
||||
GDK_X11_DEVICE_MANAGER_XI2_GET_CLASS
|
||||
GDK_TYPE_X11_DEVICE_MANAGER_XI
|
||||
GDK_X11_DEVICE_MANAGER_XI
|
||||
GDK_X11_DEVICE_MANAGER_XI_CLASS
|
||||
GDK_IS_X11_DEVICE_MANAGER_XI
|
||||
GDK_IS_X11_DEVICE_MANAGER_XI_CLASS
|
||||
GDK_X11_DEVICE_MANAGER_XI_GET_CLASS
|
||||
GDK_TYPE_X11_DEVICE_XI2
|
||||
GDK_X11_DEVICE_XI2
|
||||
GDK_X11_DEVICE_XI2_CLASS
|
||||
GDK_IS_X11_DEVICE_XI2
|
||||
GDK_IS_X11_DEVICE_XI2_CLASS
|
||||
GDK_X11_DEVICE_XI2_GET_CLASS
|
||||
GDK_TYPE_X11_DEVICE_XI
|
||||
GDK_X11_DEVICE_XI
|
||||
GDK_X11_DEVICE_XI_CLASS
|
||||
GDK_IS_X11_DEVICE_XI
|
||||
GDK_IS_X11_DEVICE_XI_CLASS
|
||||
GDK_X11_DEVICE_XI_GET_CLASS
|
||||
GDK_TYPE_X11_DISPLAY
|
||||
GDK_X11_DISPLAY
|
||||
GDK_X11_DISPLAY_CLASS
|
||||
GDK_IS_X11_DISPLAY
|
||||
GDK_IS_X11_DISPLAY_CLASS
|
||||
GDK_X11_DISPLAY_GET_CLASS
|
||||
GDK_TYPE_X11_DISPLAY_MANAGER
|
||||
GDK_X11_DISPLAY_MANAGER
|
||||
GDK_X11_DISPLAY_MANAGER_CLASS
|
||||
GDK_IS_X11_DISPLAY_MANAGER
|
||||
GDK_IS_X11_DISPLAY_MANAGER_CLASS
|
||||
GDK_X11_DISPLAY_MANAGER_GET_CLASS
|
||||
GDK_TYPE_X11_DRAG_CONTEXT
|
||||
GDK_X11_DRAG_CONTEXT
|
||||
GDK_X11_DRAG_CONTEXT_CLASS
|
||||
GDK_IS_X11_DRAG_CONTEXT
|
||||
GDK_IS_X11_DRAG_CONTEXT_CLASS
|
||||
GDK_X11_DRAG_CONTEXT_GET_CLASS
|
||||
GDK_TYPE_X11_KEYMAP
|
||||
GDK_X11_KEYMAP
|
||||
GDK_X11_KEYMAP_CLASS
|
||||
GDK_IS_X11_KEYMAP
|
||||
GDK_IS_X11_KEYMAP_CLASS
|
||||
GDK_X11_KEYMAP_GET_CLASS
|
||||
GDK_TYPE_X11_SCREEN
|
||||
GDK_X11_SCREEN
|
||||
GDK_X11_SCREEN_CLASS
|
||||
GDK_IS_X11_SCREEN
|
||||
GDK_IS_X11_SCREEN_CLASS
|
||||
GDK_X11_SCREEN_GET_CLASS
|
||||
GDK_TYPE_X11_VISUAL
|
||||
GDK_X11_VISUAL
|
||||
GDK_X11_VISUAL_CLASS
|
||||
GDK_IS_X11_VISUAL
|
||||
GDK_IS_X11_VISUAL_CLASS
|
||||
GDK_X11_VISUAL_GET_CLASS
|
||||
GDK_TYPE_X11_WINDOW
|
||||
GDK_X11_WINDOW
|
||||
GDK_X11_WINDOW_CLASS
|
||||
GDK_IS_X11_WINDOW
|
||||
GDK_IS_X11_WINDOW_CLASS
|
||||
GDK_X11_WINDOW_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gdk_x11_app_launch_context_get_type
|
||||
gdk_x11_cursor_get_type
|
||||
|
||||
@@ -9,6 +9,5 @@ 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
|
||||
|
||||
@@ -12,7 +12,7 @@ DOC_MAIN_SGML_FILE=gtk-docs.sgml
|
||||
SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED"
|
||||
|
||||
# The directory containing the source code. Relative to $(srcdir)
|
||||
DOC_SOURCE_DIR=$(top_srcdir)/gtk
|
||||
DOC_SOURCE_DIR=../../../gtk
|
||||
|
||||
# Used for dependencies
|
||||
HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||
@@ -119,13 +119,11 @@ content_files = \
|
||||
running.sgml \
|
||||
building.sgml \
|
||||
compiling.sgml \
|
||||
device-interaction-patterns.xml \
|
||||
drawing-model.xml \
|
||||
glossary.xml \
|
||||
migrating-2to3.xml \
|
||||
migrating-checklist.sgml \
|
||||
migrating-unique-GtkApplication.xml \
|
||||
migrating-smclient-GtkApplication.xml \
|
||||
migrating-GtkApplication.xml \
|
||||
migrating-GtkGrid.xml \
|
||||
migrating-GtkStyleContext.xml \
|
||||
objects_grouped.sgml \
|
||||
@@ -143,14 +141,12 @@ content_files = \
|
||||
overview.xml
|
||||
|
||||
expand_content_files = \
|
||||
device-interaction-patterns.xml \
|
||||
drawing-model.xml \
|
||||
getting_started.xml \
|
||||
glossary.xml \
|
||||
migrating-2to3.xml \
|
||||
migrating-checklist.sgml \
|
||||
migrating-unique-GtkApplication.xml \
|
||||
migrating-smclient-GtkApplication.xml \
|
||||
migrating-GtkApplication.xml \
|
||||
migrating-GtkGrid.xml \
|
||||
migrating-GtkStyleContext.xml \
|
||||
question_index.sgml \
|
||||
@@ -289,7 +285,6 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/check-button.png \
|
||||
$(srcdir)/images/color-button.png \
|
||||
$(srcdir)/images/colorsel.png \
|
||||
$(srcdir)/images/colorchooser.png \
|
||||
$(srcdir)/images/combo-box.png \
|
||||
$(srcdir)/images/combo-box-entry.png \
|
||||
$(srcdir)/images/entry.png \
|
||||
@@ -299,7 +294,6 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/filechooser.png \
|
||||
$(srcdir)/images/font-button.png \
|
||||
$(srcdir)/images/fontsel.png \
|
||||
$(srcdir)/images/fontchooser.png \
|
||||
$(srcdir)/images/frame.png \
|
||||
$(srcdir)/images/icon-view.png \
|
||||
$(srcdir)/images/image.png \
|
||||
@@ -371,10 +365,7 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/handles.png \
|
||||
$(srcdir)/images/extensions.png \
|
||||
$(srcdir)/images/numerableicon.png \
|
||||
$(srcdir)/images/numerableicon2.png \
|
||||
$(srcdir)/images/bloatpad-osx.png \
|
||||
$(srcdir)/images/bloatpad-gnome.png \
|
||||
$(srcdir)/images/bloatpad-xfce.png
|
||||
$(srcdir)/images/numerableicon2.png
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref
|
||||
FIXXREF_OPTIONS=--extra-dir=../gdk/html \
|
||||
|
||||
@@ -47,20 +47,9 @@ $ cc `pkg-config --cflags --libs gtk+-3.0` hello.c -o hello
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Deprecated GTK+ functions are annotated to make the compiler
|
||||
emit warnings when they are used (e.g. with gcc, you need to use
|
||||
the -Wdeprecated-declarations option). If these warnings are
|
||||
problematic, they can be turned off by defining the preprocessor
|
||||
symbol GDK_DISABLE_DEPRECATION_WARNINGS by using the commandline
|
||||
option <literal>-DGDK_DISABLE_DEPRECATION_WARNINGS</literal>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The older deprecation mechanism of hiding deprecated interfaces
|
||||
entirely from the compiler by using the preprocessor symbol
|
||||
GTK_DISABLE_DEPRECATED is still used for deprecated macros,
|
||||
enumeration values, etc. To detect uses of these in your code,
|
||||
use the commandline option <literal>-DGTK_DISABLE_DEPRECATED</literal>.
|
||||
If you want to make sure that your program doesn't use any deprecated
|
||||
functions, you can define the preprocessor symbol GTK_DISABLE_DEPRECATED
|
||||
by using the command line option <literal>-DGTK_DISABLE_DEPRECATED=1</literal>.
|
||||
There are similar symbols GDK_DISABLE_DEPRECATED,
|
||||
GDK_PIXBUF_DISABLE_DEPRECATED and G_DISABLE_DEPRECATED for GDK, GdkPixbuf and
|
||||
GLib.
|
||||
|
||||
@@ -1,578 +0,0 @@
|
||||
<?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,12 +68,6 @@
|
||||
<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>
|
||||
|
||||
@@ -215,22 +209,18 @@
|
||||
|
||||
<chapter id="SelectorWidgets">
|
||||
<title>Selectors (Color/File/Font)</title>
|
||||
<xi:include href="xml/gtkcolorchooser.xml" />
|
||||
<xi:include href="xml/gtkcolorbutton.xml" />
|
||||
<xi:include href="xml/gtkcolorchooserwidget.xml" />
|
||||
<xi:include href="xml/gtkcolorchooserdialog.xml" />
|
||||
<xi:include href="xml/gtkcolorsel.xml" />
|
||||
<xi:include href="xml/gtkcolorseldlg.xml" />
|
||||
<xi:include href="xml/gtkcolorsel.xml" />
|
||||
<xi:include href="xml/gtkhsv.xml" />
|
||||
<xi:include href="xml/gtkfilechooser.xml" />
|
||||
<xi:include href="xml/gtkfilechooserbutton.xml" />
|
||||
<xi:include href="xml/gtkfilechooserdialog.xml" />
|
||||
<xi:include href="xml/gtkfilechooserwidget.xml" />
|
||||
<xi:include href="xml/gtkfilefilter.xml" />
|
||||
<xi:include href="xml/gtkfontchooser.xml" />
|
||||
<xi:include href="xml/gtkfontbutton.xml" />
|
||||
<xi:include href="xml/gtkfontchooserwidget.xml" />
|
||||
<xi:include href="xml/gtkfontchooserdialog.xml" />
|
||||
<xi:include href="xml/gtkfontchooser.xml" />
|
||||
<xi:include href="xml/gtkfontchooserdlg.xml" />
|
||||
<xi:include href="xml/gtkfontsel.xml" />
|
||||
<xi:include href="xml/gtkfontseldlg.xml" />
|
||||
</chapter>
|
||||
@@ -348,8 +338,6 @@
|
||||
<chapter id="Application">
|
||||
<title>Application support</title>
|
||||
<xi:include href="xml/gtkapplication.xml" />
|
||||
<xi:include href="xml/gtkapplicationwindow.xml" />
|
||||
<xi:include href="xml/gtkactionable.xml" />
|
||||
</chapter>
|
||||
</part>
|
||||
|
||||
@@ -366,12 +354,11 @@
|
||||
</para>
|
||||
</partintro>
|
||||
|
||||
<xi:include href="xml/migrating-checklist.sgml" />
|
||||
<xi:include href="xml/migrating-2to3.xml" />
|
||||
<xi:include href="xml/migrating-GtkStyleContext.xml" />
|
||||
<xi:include href="xml/migrating-unique-GtkApplication.xml" />
|
||||
<xi:include href="xml/migrating-smclient-GtkApplication.xml" />
|
||||
<xi:include href="xml/migrating-GtkApplication.xml" />
|
||||
<xi:include href="xml/migrating-GtkGrid.xml" />
|
||||
<xi:include href="xml/migrating-checklist.sgml" />
|
||||
</part>
|
||||
|
||||
<part>
|
||||
@@ -398,10 +385,6 @@
|
||||
<title>Index of new symbols in 3.2</title>
|
||||
<xi:include href="xml/api-index-3.2.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
<index id="api-index-3-4" role="3.4">
|
||||
<title>Index of new symbols in 3.4</title>
|
||||
<xi:include href="xml/api-index-3.4.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ gtk_about_dialog_get_logo
|
||||
gtk_about_dialog_set_logo
|
||||
gtk_about_dialog_get_logo_icon_name
|
||||
gtk_about_dialog_set_logo_icon_name
|
||||
gtk_about_dialog_add_credit_section
|
||||
gtk_show_about_dialog
|
||||
<SUBSECTION Standard>
|
||||
GTK_ABOUT_DIALOG
|
||||
@@ -77,9 +76,6 @@ gtk_accelerator_valid
|
||||
gtk_accelerator_parse
|
||||
gtk_accelerator_name
|
||||
gtk_accelerator_get_label
|
||||
gtk_accelerator_parse_with_keycode
|
||||
gtk_accelerator_name_with_keycode
|
||||
gtk_accelerator_get_label_with_keycode
|
||||
gtk_accelerator_set_default_mod_mask
|
||||
gtk_accelerator_get_default_mod_mask
|
||||
|
||||
@@ -1136,7 +1132,6 @@ gtk_entry_completion_get_model
|
||||
gtk_entry_completion_set_match_func
|
||||
gtk_entry_completion_set_minimum_key_length
|
||||
gtk_entry_completion_get_minimum_key_length
|
||||
gtk_entry_completion_compute_prefix
|
||||
gtk_entry_completion_complete
|
||||
gtk_entry_completion_get_completion_prefix
|
||||
gtk_entry_completion_insert_prefix
|
||||
@@ -1535,7 +1530,7 @@ gtk_font_chooser_widget_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkfontchooserdialog</FILE>
|
||||
<FILE>gtkfontchooserdlg</FILE>
|
||||
<TITLE>GtkFontChooserDialog</TITLE>
|
||||
GtkFontChooserDialog
|
||||
gtk_font_chooser_dialog_new
|
||||
@@ -1579,51 +1574,6 @@ 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>
|
||||
@@ -2105,7 +2055,6 @@ gtk_link_button_get_type
|
||||
<TITLE>GtkMenu</TITLE>
|
||||
GtkMenu
|
||||
gtk_menu_new
|
||||
gtk_menu_new_from_model
|
||||
gtk_menu_set_screen
|
||||
gtk_menu_reorder_child
|
||||
gtk_menu_attach
|
||||
@@ -2150,7 +2099,6 @@ gtk_menu_get_type
|
||||
<TITLE>GtkMenuBar</TITLE>
|
||||
GtkMenuBar
|
||||
gtk_menu_bar_new
|
||||
gtk_menu_bar_new_from_model
|
||||
GtkPackDirection
|
||||
gtk_menu_bar_set_pack_direction
|
||||
gtk_menu_bar_get_pack_direction
|
||||
@@ -2872,11 +2820,9 @@ gtk_scale_new
|
||||
gtk_scale_new_with_range
|
||||
gtk_scale_set_digits
|
||||
gtk_scale_set_draw_value
|
||||
gtk_scale_set_has_origin
|
||||
gtk_scale_set_value_pos
|
||||
gtk_scale_get_digits
|
||||
gtk_scale_get_draw_value
|
||||
gtk_scale_get_has_origin
|
||||
gtk_scale_get_value_pos
|
||||
gtk_scale_get_layout
|
||||
gtk_scale_get_layout_offsets
|
||||
@@ -2984,9 +2930,6 @@ 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
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_SCROLLED_WINDOW
|
||||
@@ -4406,7 +4349,6 @@ gtk_tree_view_remove_column
|
||||
gtk_tree_view_insert_column
|
||||
gtk_tree_view_insert_column_with_attributes
|
||||
gtk_tree_view_insert_column_with_data_func
|
||||
gtk_tree_view_get_n_columns
|
||||
gtk_tree_view_get_column
|
||||
gtk_tree_view_get_columns
|
||||
gtk_tree_view_move_column_after
|
||||
@@ -5076,7 +5018,6 @@ GtkAllocation
|
||||
GtkSelectionData
|
||||
GtkWidgetAuxInfo
|
||||
GtkWidgetHelpType
|
||||
GtkCapturedEventFlags
|
||||
gtk_widget_new
|
||||
gtk_widget_destroy
|
||||
gtk_widget_in_destruction
|
||||
@@ -5261,8 +5202,6 @@ gtk_widget_set_mapped
|
||||
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
|
||||
@@ -5312,10 +5251,6 @@ 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
|
||||
@@ -5351,9 +5286,7 @@ gtk_window_set_gravity
|
||||
gtk_window_get_gravity
|
||||
gtk_window_set_position
|
||||
gtk_window_set_transient_for
|
||||
gtk_window_set_attached_to
|
||||
gtk_window_set_destroy_with_parent
|
||||
gtk_window_set_hide_titlebar_when_maximized
|
||||
gtk_window_set_screen
|
||||
gtk_window_get_screen
|
||||
gtk_window_is_active
|
||||
@@ -5399,7 +5332,6 @@ gtk_window_get_default_icon_list
|
||||
gtk_window_get_default_icon_name
|
||||
gtk_window_get_default_size
|
||||
gtk_window_get_destroy_with_parent
|
||||
gtk_window_get_hide_titlebar_when_maximized
|
||||
gtk_window_get_icon
|
||||
gtk_window_get_icon_list
|
||||
gtk_window_get_icon_name
|
||||
@@ -5410,7 +5342,6 @@ gtk_window_get_role
|
||||
gtk_window_get_size
|
||||
gtk_window_get_title
|
||||
gtk_window_get_transient_for
|
||||
gtk_window_get_attached_to
|
||||
gtk_window_get_type_hint
|
||||
gtk_window_get_skip_taskbar_hint
|
||||
gtk_window_get_skip_pager_hint
|
||||
@@ -5721,12 +5652,6 @@ GTK_STYLE_CLASS_VIEW
|
||||
GTK_STYLE_CLASS_WARNING
|
||||
GTK_STYLE_CLASS_HORIZONTAL
|
||||
GTK_STYLE_CLASS_VERTICAL
|
||||
GTK_STYLE_CLASS_TOP
|
||||
GTK_STYLE_CLASS_BOTTOM
|
||||
GTK_STYLE_CLASS_LEFT
|
||||
GTK_STYLE_CLASS_RIGHT
|
||||
GTK_STYLE_CLASS_LINKED
|
||||
GTK_STYLE_CLASS_ARROW
|
||||
GTK_STYLE_REGION_COLUMN
|
||||
GTK_STYLE_REGION_COLUMN_HEADER
|
||||
GTK_STYLE_REGION_ROW
|
||||
@@ -5739,7 +5664,6 @@ gtk_style_context_add_provider_for_screen
|
||||
gtk_style_context_get
|
||||
gtk_style_context_get_direction
|
||||
gtk_style_context_get_junction_sides
|
||||
gtk_style_context_set_parent
|
||||
gtk_style_context_get_path
|
||||
gtk_style_context_get_property
|
||||
gtk_style_context_get_screen
|
||||
@@ -5748,7 +5672,6 @@ gtk_style_context_get_style
|
||||
gtk_style_context_get_style_property
|
||||
gtk_style_context_get_style_valist
|
||||
gtk_style_context_get_valist
|
||||
gtk_style_context_get_section
|
||||
gtk_style_context_get_color
|
||||
gtk_style_context_get_background_color
|
||||
gtk_style_context_get_border_color
|
||||
@@ -5773,7 +5696,6 @@ gtk_style_context_restore
|
||||
gtk_style_context_save
|
||||
gtk_style_context_set_direction
|
||||
gtk_style_context_set_junction_sides
|
||||
gtk_style_context_set_parent
|
||||
gtk_style_context_set_path
|
||||
gtk_style_context_add_class
|
||||
gtk_style_context_remove_class
|
||||
@@ -5809,7 +5731,6 @@ gtk_render_slider
|
||||
gtk_render_activity
|
||||
gtk_render_icon_pixbuf
|
||||
gtk_render_icon
|
||||
gtk_render_insertion_cursor
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_STYLE_CONTEXT
|
||||
@@ -5914,7 +5835,6 @@ gtk_symbolic_color_new_name
|
||||
gtk_symbolic_color_new_shade
|
||||
gtk_symbolic_color_new_alpha
|
||||
gtk_symbolic_color_new_mix
|
||||
gtk_symbolic_color_new_win32
|
||||
gtk_symbolic_color_ref
|
||||
gtk_symbolic_color_unref
|
||||
gtk_symbolic_color_resolve
|
||||
@@ -7068,20 +6988,6 @@ gtk_application_add_window
|
||||
gtk_application_remove_window
|
||||
gtk_application_get_windows
|
||||
|
||||
<SUBSECTION>
|
||||
GtkApplicationInhibitFlags
|
||||
gtk_application_inhibit
|
||||
gtk_application_uninhibit
|
||||
gtk_application_is_inhibited
|
||||
GtkApplicationEndSessionStyle
|
||||
gtk_application_end_session
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_application_get_app_menu
|
||||
gtk_application_set_app_menu
|
||||
gtk_application_get_menubar
|
||||
gtk_application_set_menubar
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkApplicationClass
|
||||
GTK_TYPE_APPLICATION
|
||||
@@ -7095,54 +7001,6 @@ gtk_application_get_type
|
||||
GtkApplicationPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkapplicationwindow</FILE>
|
||||
<TITLE>GtkApplicationWindow</TITLE>
|
||||
GtkApplicationWindow
|
||||
gtk_application_window_new
|
||||
gtk_application_window_set_show_menubar
|
||||
gtk_application_window_get_show_menubar
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkApplicationWindowClass
|
||||
GTK_TYPE_APPLICATION_WINDOW
|
||||
GTK_APPLICATION_WINDOW
|
||||
GTK_APPLICATION_WINDOW_CLASS
|
||||
GTK_IS_APPLICATION_WINDOW
|
||||
GTK_IS_APPLICATION_WINDOW_CLASS
|
||||
GTK_APPLICATION_WINDOW_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_application_window_get_type
|
||||
GtkApplicationWindowPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkactionable</FILE>
|
||||
<TITLE>GtkActionable</TITLE>
|
||||
GtkActionable
|
||||
GtkActionableInterface
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_actionable_get_action_name
|
||||
gtk_actionable_set_action_name
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_actionable_get_action_target_value
|
||||
gtk_actionable_set_action_target_value
|
||||
gtk_actionable_set_action_target
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_actionable_set_detailed_action_name
|
||||
|
||||
<SUBSECTION Standard>
|
||||
gtk_actionable_get_type
|
||||
GTK_ACTIONABLE
|
||||
GTK_ACTIONABLE_GET_IFACE
|
||||
GTK_IS_ACTIONABLE
|
||||
GTK_TYPE_ACTIONABLE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgrid</FILE>
|
||||
<TITLE>GtkGrid</TITLE>
|
||||
@@ -7352,61 +7210,3 @@ GtkOverlayClass
|
||||
gtk_overlay_get_type
|
||||
GtkOverlayPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcolorchooser</FILE>
|
||||
<TITLE>GtkColorChooser</TITLE>
|
||||
GtkColorChooser
|
||||
gtk_color_chooser_get_rgba
|
||||
gtk_color_chooser_set_rgba
|
||||
gtk_color_chooser_get_use_alpha
|
||||
gtk_color_chooser_set_use_alpha
|
||||
gtk_color_chooser_add_palette
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_COLOR_CHOOSER
|
||||
GTK_COLOR_CHOOSER
|
||||
GTK_IS_COLOR_CHOOSER
|
||||
GTK_COLOR_CHOOSER_GET_IFACE
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_color_chooser_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcolorchooserwidget</FILE>
|
||||
<TITLE>GtkColorChooserWidget</TITLE>
|
||||
GtkColorChooserWidget
|
||||
gtk_color_chooser_widget_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_COLOR_CHOOSER_WIDGET
|
||||
GTK_COLOR_CHOOSER_WIDGET
|
||||
GTK_COLOR_CHOOSER_WIDGET_CLASS
|
||||
GTK_IS_COLOR_CHOOSER_WIDGET
|
||||
GTK_IS_COLOR_CHOOSER_WIDGET_CLASS
|
||||
GTK_COLOR_CHOOSER_WIDGET_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_color_chooser_widget_get_type
|
||||
GtkColorChooserWidgetPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcolorchooserdialog</FILE>
|
||||
<TITLE>GtkColorChooserDialog</TITLE>
|
||||
GtkColorChooserDialog
|
||||
gtk_color_chooser_dialog_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_COLOR_CHOOSER_DIALOG
|
||||
GTK_COLOR_CHOOSER_DIALOG
|
||||
GTK_COLOR_CHOOSER_DIALOG_CLASS
|
||||
GTK_IS_COLOR_CHOOSER_DIALOG
|
||||
GTK_IS_COLOR_CHOOSER_DIALOG_CLASS
|
||||
GTK_COLOR_CHOOSER_DIALOG_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GtkColorChooserDialogPrivate
|
||||
gtk_color_chooser_dialog_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -6,7 +6,6 @@ gtk_accel_group_get_type
|
||||
gtk_accel_label_get_type
|
||||
gtk_accel_map_get_type
|
||||
gtk_accessible_get_type
|
||||
gtk_actionable_get_type
|
||||
gtk_action_get_type
|
||||
gtk_action_group_get_type
|
||||
gtk_activatable_get_type
|
||||
@@ -17,7 +16,6 @@ gtk_app_chooser_button_get_type
|
||||
gtk_app_chooser_dialog_get_type
|
||||
gtk_app_chooser_widget_get_type
|
||||
gtk_application_get_type
|
||||
gtk_application_window_get_type
|
||||
gtk_arrow_get_type
|
||||
gtk_aspect_frame_get_type
|
||||
gtk_assistant_get_type
|
||||
@@ -47,9 +45,6 @@ gtk_check_button_get_type
|
||||
gtk_check_menu_item_get_type
|
||||
gtk_clipboard_get_type
|
||||
gtk_color_button_get_type
|
||||
gtk_color_chooser_get_type
|
||||
gtk_color_chooser_dialog_get_type
|
||||
gtk_color_chooser_widget_get_type
|
||||
gtk_color_selection_dialog_get_type
|
||||
gtk_color_selection_get_type
|
||||
gtk_combo_box_get_type
|
||||
@@ -77,7 +72,6 @@ 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
|
||||
|
||||
|
Before Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 62 KiB |
@@ -1203,6 +1203,8 @@ gtk_arrow_draw (GtkWidget *widget,
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<xi:include href="migrating-GtkStyleContext.xml" />
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-migrating-unique-GtkApplication">
|
||||
<chapter id="gtk-migrating-GtkApplication">
|
||||
|
||||
<title>Migrating from libunique to GApplication or GtkApplication</title>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
<example><title>A unique application</title>
|
||||
<para>Here is a simple application using libunique:
|
||||
<informalexample><programlisting>
|
||||
<programlisting>
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -53,9 +53,9 @@ main (int argc, char *argv[])
|
||||
|
||||
return 0;
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
</programlisting>
|
||||
The same application using GtkApplication:
|
||||
<informalexample><programlisting>
|
||||
<programlisting>
|
||||
static void
|
||||
activate (GtkApplication *app)
|
||||
{
|
||||
@@ -85,13 +85,13 @@ main (int argc, char *argv[])
|
||||
app = gtk_application_new ("org.gtk.TestApplication", 0);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
status = g_application_run (app);
|
||||
|
||||
g_object_unref (app);
|
||||
|
||||
return status;
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
</programlisting>
|
||||
</para>
|
||||
</example>
|
||||
<section><title>Uniqueness</title>
|
||||
@@ -3,10 +3,10 @@
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-migrating-checklist">
|
||||
<title>Migration Details Checklist</title>
|
||||
<title>Migration Checklist</title>
|
||||
|
||||
<para>
|
||||
This chapter includes a checklist of smaller things you need to do to
|
||||
This chapter includes a checklist of things you need to do to
|
||||
ensure that your programs are good citizens in the GTK+ world. By
|
||||
paying attention to the points in the checklist, you ensure that
|
||||
many automatic features of GTK+ will work correctly in your
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<chapter id="gtk-migrating-smclient-GtkApplication">
|
||||
|
||||
<title>Migrating from EggSMClient to GtkApplication</title>
|
||||
|
||||
<para>
|
||||
EggSMClient provides 'session management' support for applications.
|
||||
This means a number of things:
|
||||
<itemizedlist>
|
||||
<listitem>logout notification and negotiation</listitem>
|
||||
<listitem>application state saving</listitem>
|
||||
<listitem>restarting of applications with saved state</listitem>
|
||||
</itemizedlist>
|
||||
EggSMClient supports this functionality to varying degrees on
|
||||
Windows and OS X, as well as with XSMP and D-Bus based session
|
||||
managers in X11.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Starting with GTK+ 3.4, #GtkApplication supports logout notification
|
||||
and negotiation similar to EggSMClient.
|
||||
</para>
|
||||
<table>
|
||||
<tgroup cols="2">
|
||||
<title>EggSMClient to GtkApplication</title>
|
||||
<thead>
|
||||
<row><entry>EggSMClient</entry><entry>GtkApplication</entry></row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row><entry>EggSMClient::quit-requested</entry><entry>instead of calling will_quit (FALSE,...) in response to this signal, install an inhibitor</entry></row>
|
||||
<row><entry>EggSMClient::quit</entry><entry>the #GtkApplication::quit signal</entry></row>
|
||||
<row><entry>EggSMClient::quit-cancelled</entry><entry></entry></row>
|
||||
<row><entry>egg_sm_client_will_quit</entry><entry>instead of calling will_quit (FALSE,...), install an inhibitor</entry></row>
|
||||
<row><entry>egg_sm_client_end_session</entry><entry>gtk_application_end_session()</entry></row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
At this point, GtkApplication has no special support for state saving.
|
||||
Applications can use GSettings or GKeyFile and save as much state as
|
||||
they see fit in response to #GtkApplication::quit or whenever they
|
||||
consider appropriate.
|
||||
</para>
|
||||
</chapter>
|
||||
@@ -121,9 +121,9 @@ Here's a simple example:
|
||||
do_small_part_of_task ();
|
||||
|
||||
if (task_complete)
|
||||
return G_SOURCE_REMOVE; /* removes the idle handler */
|
||||
return FALSE; /* removes the idle handler */
|
||||
else
|
||||
return G_SOURCE_CONTINUE; /* runs the idle handler again */
|
||||
return TRUE; /* runs the idle handler again */
|
||||
}
|
||||
|
||||
g_idle_add (my_idle_handler, NULL);
|
||||
|
||||
@@ -262,8 +262,6 @@ additional environment variables.
|
||||
that enables <literal>XSETTINGS</literal> and has a value in
|
||||
<literal>Gtk/IMModule</literal>, that will be used for the default
|
||||
IM module.
|
||||
This also can be a colon-separated list of input-methods, which
|
||||
GTK+ will try in turn until it finds one available on the system.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
|
||||
@@ -135,10 +135,4 @@
|
||||
<link linkend="GtkSwitch">
|
||||
<inlinegraphic fileref="switch.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkColorChooserDialog">
|
||||
<inlinegraphic fileref="colorchooser.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkFontChooserDialog">
|
||||
<inlinegraphic fileref="fontchooser.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
</para>
|
||||
|
||||
@@ -106,12 +106,6 @@ in 256 color mode.
|
||||
|
||||
</refsect2>
|
||||
|
||||
<para>
|
||||
More information about GTK+ on Windows, including detailed build
|
||||
instructions, binary downloads, etc, can be found
|
||||
<ulink url="http://live.gnome.org/GTK+/Win32">online</ulink>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
@@ -9,7 +9,7 @@ DOC_MODULE=gail-libgail-util3
|
||||
DOC_MAIN_SGML_FILE=gail-libgail-util-docs.sgml
|
||||
|
||||
# The directory containing the source code (if it contains documentation).
|
||||
DOC_SOURCE_DIR=$(top_srcdir)/libgail-util
|
||||
DOC_SOURCE_DIR=../../../libgail-util
|
||||
|
||||
# Used for dependencies
|
||||
HFILE_GLOB = $(top_srcdir)/libgail-util/*.h
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
#undef GTK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtkunixprint.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <X11/Xatom.h>
|
||||
@@ -1154,33 +1151,6 @@ create_appchooserdialog (void)
|
||||
return info;
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_fontchooserdialog (void)
|
||||
{
|
||||
WidgetInfo *info;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_font_chooser_dialog_new ("Font Chooser Dialog", NULL);
|
||||
gtk_window_set_default_size (GTK_WINDOW (widget), 200, 300);
|
||||
info = new_widget_info ("fontchooser", widget, ASIS);
|
||||
info->include_decorations = TRUE;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_colorchooserdialog (void)
|
||||
{
|
||||
WidgetInfo *info;
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_color_chooser_dialog_new ("Color Chooser Dialog", NULL);
|
||||
info = new_widget_info ("colorchooser", widget, ASIS);
|
||||
info->include_decorations = TRUE;
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
GList *
|
||||
get_all_widgets (void)
|
||||
{
|
||||
@@ -1231,8 +1201,6 @@ get_all_widgets (void)
|
||||
retval = g_list_prepend (retval, create_appchooserbutton ());
|
||||
retval = g_list_prepend (retval, create_appchooserdialog ());
|
||||
retval = g_list_prepend (retval, create_lockbutton ());
|
||||
retval = g_list_prepend (retval, create_fontchooserdialog ());
|
||||
retval = g_list_prepend (retval, create_colorchooserdialog ());
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -46,14 +46,15 @@ AM_CPPFLAGS = \
|
||||
|
||||
LDADD = \
|
||||
$(top_builddir)/gtk/libgtk-3.la \
|
||||
$(top_builddir)/gdk/libgdk-3.la \
|
||||
$(GTK_DEP_LIBS)
|
||||
|
||||
drawing_LDADD = $(LDADD) \
|
||||
$(top_builddir)/gdk/libgdk-3.la
|
||||
|
||||
noinst_PROGRAMS = \
|
||||
hello-world \
|
||||
window-default \
|
||||
bloatpad \
|
||||
plugman \
|
||||
grid-packing \
|
||||
drawing \
|
||||
builder
|
||||
|
||||
@@ -1,159 +1,18 @@
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
activate_toggle (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *state;
|
||||
|
||||
state = g_action_get_state (G_ACTION (action));
|
||||
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
activate_radio (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_action_change_state (G_ACTION (action), parameter);
|
||||
}
|
||||
|
||||
static void
|
||||
change_fullscreen_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (g_variant_get_boolean (state))
|
||||
gtk_window_fullscreen (user_data);
|
||||
else
|
||||
gtk_window_unfullscreen (user_data);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_justify_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkTextView *text = g_object_get_data (user_data, "bloatpad-text");
|
||||
const gchar *str;
|
||||
|
||||
str = g_variant_get_string (state, NULL);
|
||||
|
||||
if (g_str_equal (str, "left"))
|
||||
gtk_text_view_set_justification (text, GTK_JUSTIFY_LEFT);
|
||||
else if (g_str_equal (str, "center"))
|
||||
gtk_text_view_set_justification (text, GTK_JUSTIFY_CENTER);
|
||||
else if (g_str_equal (str, "right"))
|
||||
gtk_text_view_set_justification (text, GTK_JUSTIFY_RIGHT);
|
||||
else
|
||||
/* ignore this attempted change */
|
||||
return;
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GtkClipboard *
|
||||
get_clipboard (GtkWidget *widget)
|
||||
{
|
||||
return gtk_widget_get_clipboard (widget, gdk_atom_intern_static_string ("CLIPBOARD"));
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "bloatpad-text");
|
||||
|
||||
gtk_text_buffer_copy_clipboard (gtk_text_view_get_buffer (text),
|
||||
get_clipboard ((GtkWidget*) text));
|
||||
}
|
||||
|
||||
static void
|
||||
window_paste (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "bloatpad-text");
|
||||
|
||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||
get_clipboard ((GtkWidget*) text),
|
||||
NULL,
|
||||
TRUE);
|
||||
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "copy", window_copy, NULL, NULL, NULL },
|
||||
{ "paste", window_paste, NULL, NULL, NULL },
|
||||
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state },
|
||||
{ "justify", activate_radio, "s", "'left'", change_justify_state }
|
||||
};
|
||||
|
||||
static void
|
||||
new_window (GApplication *app,
|
||||
GFile *file)
|
||||
{
|
||||
GtkWidget *window, *grid, *scrolled, *view;
|
||||
GtkWidget *toolbar;
|
||||
GtkToolItem *button;
|
||||
GtkWidget *sw, *box, *label;
|
||||
GtkWidget *window, *scrolled, *view;
|
||||
|
||||
window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (app));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Bloatpad");
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_LEFT);
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::left");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_CENTER);
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::center");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_toggle_tool_button_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT);
|
||||
gtk_actionable_set_detailed_action_name (GTK_ACTIONABLE (button), "win.justify::right");
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_separator_tool_item_new ();
|
||||
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (button), FALSE);
|
||||
gtk_tool_item_set_expand (GTK_TOOL_ITEM (button), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
button = gtk_tool_item_new ();
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_container_add (GTK_CONTAINER (button), box);
|
||||
label = gtk_label_new ("Fullscreen:");
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
sw = gtk_switch_new ();
|
||||
gtk_actionable_set_action_name (GTK_ACTIONABLE (sw), "win.fullscreen");
|
||||
gtk_container_add (GTK_CONTAINER (box), sw);
|
||||
gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (button));
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), toolbar, 0, 0, 1, 1);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
|
||||
g_object_set_data ((GObject*)window, "bloatpad-text", view);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 1, 1, 1);
|
||||
gtk_container_add (GTK_CONTAINER (window), scrolled);
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
@@ -202,132 +61,6 @@ bloat_pad_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (bloat_pad_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
new_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GApplication *app = user_data;
|
||||
|
||||
g_application_activate (app);
|
||||
}
|
||||
|
||||
static void
|
||||
about_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_show_about_dialog (NULL,
|
||||
"program-name", "Bloatpad",
|
||||
"title", "About Bloatpad",
|
||||
"comments", "Not much to say, really.",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
quit_app (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)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
|
||||
quit_app (app);
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "new", new_activated, NULL, NULL, NULL },
|
||||
{ "about", about_activated, NULL, NULL, NULL },
|
||||
{ "quit", quit_activated, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
bloat_pad_startup (GApplication *application)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
G_APPLICATION_CLASS (bloat_pad_parent_class)
|
||||
->startup (application);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
"<interface>"
|
||||
" <menu id='app-menu'>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_New Window</attribute>"
|
||||
" <attribute name='action'>app.new</attribute>"
|
||||
" <attribute name='accel'><Primary>n</attribute>"
|
||||
" </item>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_About Bloatpad</attribute>"
|
||||
" <attribute name='action'>app.about</attribute>"
|
||||
" </item>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Quit</attribute>"
|
||||
" <attribute name='action'>app.quit</attribute>"
|
||||
" <attribute name='accel'><Primary>q</attribute>"
|
||||
" </item>"
|
||||
" </section>"
|
||||
" </menu>"
|
||||
" <menu id='menubar'>"
|
||||
" <submenu>"
|
||||
" <attribute name='label' translatable='yes'>_Edit</attribute>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Copy</attribute>"
|
||||
" <attribute name='action'>win.copy</attribute>"
|
||||
" <attribute name='accel'><Primary>c</attribute>"
|
||||
" </item>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Parse</attribute>"
|
||||
" <attribute name='action'>win.parse</attribute>"
|
||||
" <attribute name='accel'><Primary>v</attribute>"
|
||||
" </item>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" <submenu>"
|
||||
" <attribute name='label' translatable='yes'>_View</attribute>"
|
||||
" <section>"
|
||||
" <item>"
|
||||
" <attribute name='label' translatable='yes'>_Fullscreen</attribute>"
|
||||
" <attribute name='action'>win.fullscreen</attribute>"
|
||||
" <attribute name='accel'>F11</attribute>"
|
||||
" </item>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" </menu>"
|
||||
"</interface>", -1, NULL);
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
|
||||
gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
bloat_pad_init (BloatPad *app)
|
||||
{
|
||||
@@ -336,44 +69,21 @@ bloat_pad_init (BloatPad *app)
|
||||
static void
|
||||
bloat_pad_class_init (BloatPadClass *class)
|
||||
{
|
||||
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
G_OBJECT_CLASS (class)->finalize= bloat_pad_finalize;
|
||||
|
||||
application_class->startup = bloat_pad_startup;
|
||||
application_class->activate = bloat_pad_activate;
|
||||
application_class->open = bloat_pad_open;
|
||||
|
||||
object_class->finalize = bloat_pad_finalize;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
quit_cb (GtkApplication *app)
|
||||
{
|
||||
g_print ("Session manager to us to quit\n");
|
||||
|
||||
quit_app (app);
|
||||
G_APPLICATION_CLASS (class)->activate = bloat_pad_activate;
|
||||
G_APPLICATION_CLASS (class)->open = bloat_pad_open;
|
||||
}
|
||||
|
||||
BloatPad *
|
||||
bloat_pad_new (void)
|
||||
{
|
||||
GtkApplication *bloat_pad;
|
||||
|
||||
g_type_init ();
|
||||
|
||||
g_set_application_name ("Bloatpad");
|
||||
|
||||
bloat_pad = g_object_new (bloat_pad_get_type (),
|
||||
"application-id", "org.gtk.Test.bloatpad",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
"inactivity-timeout", 30000,
|
||||
"register-session", TRUE,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (bloat_pad, "quit", G_CALLBACK (quit_cb), NULL);
|
||||
|
||||
return bloat_pad;
|
||||
return g_object_new (bloat_pad_get_type (),
|
||||
"application-id", "org.gtk.Test.bloatpad",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -383,12 +93,7 @@ main (int argc, char **argv)
|
||||
int status;
|
||||
|
||||
bloat_pad = bloat_pad_new ();
|
||||
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (bloat_pad),
|
||||
"F11", "win.fullscreen", NULL);
|
||||
|
||||
status = g_application_run (G_APPLICATION (bloat_pad), argc, argv);
|
||||
|
||||
g_object_unref (bloat_pad);
|
||||
|
||||
return status;
|
||||
|
||||
@@ -86,11 +86,11 @@ button_press_event_cb (GtkWidget *widget,
|
||||
if (surface == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (event->button == GDK_BUTTON_PRIMARY)
|
||||
if (event->button == 1)
|
||||
{
|
||||
draw_brush (widget, event->x, event->y);
|
||||
}
|
||||
else if (event->button == GDK_BUTTON_SECONDARY)
|
||||
else if (event->button == 3)
|
||||
{
|
||||
clear_surface ();
|
||||
gtk_widget_queue_draw (widget);
|
||||
@@ -109,12 +109,27 @@ motion_notify_event_cb (GtkWidget *widget,
|
||||
GdkEventMotion *event,
|
||||
gpointer data)
|
||||
{
|
||||
int x, y;
|
||||
GdkModifierType state;
|
||||
|
||||
/* paranoia check, in case we haven't gotten a configure event */
|
||||
if (surface == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (event->state & GDK_BUTTON1_MASK)
|
||||
draw_brush (widget, event->x, event->y);
|
||||
/* This call is very important; it requests the next motion event.
|
||||
* If you don't call gdk_window_get_pointer() you'll only get
|
||||
* a single motion event. The reason is that we specified
|
||||
* GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events().
|
||||
* If we hadn't specified that, we could just use event->x, event->y
|
||||
* as the pointer location. But we'd also get deluged in events.
|
||||
* By requesting the next event as we handle the current one,
|
||||
* we avoid getting a huge number of events faster than we
|
||||
* can cope.
|
||||
*/
|
||||
gdk_window_get_pointer (event->window, &x, &y, &state);
|
||||
|
||||
if (state & GDK_BUTTON1_MASK)
|
||||
draw_brush (widget, x, y);
|
||||
|
||||
/* We've handled it, stop processing */
|
||||
return TRUE;
|
||||
@@ -174,7 +189,8 @@ main (int argc,
|
||||
*/
|
||||
gtk_widget_set_events (da, gtk_widget_get_events (da)
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_POINTER_MOTION_MASK);
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_POINTER_MOTION_HINT_MASK);
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
@@ -1,468 +0,0 @@
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
activate_toggle (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVariant *state;
|
||||
|
||||
state = g_action_get_state (G_ACTION (action));
|
||||
g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
|
||||
g_variant_unref (state);
|
||||
}
|
||||
|
||||
static void
|
||||
change_fullscreen_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (g_variant_get_boolean (state))
|
||||
gtk_window_fullscreen (user_data);
|
||||
else
|
||||
gtk_window_unfullscreen (user_data);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GtkClipboard *
|
||||
get_clipboard (GtkWidget *widget)
|
||||
{
|
||||
return gtk_widget_get_clipboard (widget, gdk_atom_intern_static_string ("CLIPBOARD"));
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||
|
||||
gtk_text_buffer_copy_clipboard (gtk_text_view_get_buffer (text),
|
||||
get_clipboard ((GtkWidget*) text));
|
||||
}
|
||||
|
||||
static void
|
||||
window_paste (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||
|
||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||
get_clipboard ((GtkWidget*) text),
|
||||
NULL,
|
||||
TRUE);
|
||||
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "copy", window_copy, NULL, NULL, NULL },
|
||||
{ "paste", window_paste, NULL, NULL, NULL },
|
||||
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
|
||||
};
|
||||
|
||||
static void
|
||||
new_window (GApplication *app,
|
||||
GFile *file)
|
||||
{
|
||||
GtkWidget *window, *grid, *scrolled, *view;
|
||||
|
||||
window = gtk_application_window_new (GTK_APPLICATION (app));
|
||||
gtk_window_set_default_size ((GtkWindow*)window, 640, 480);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Plugman");
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), grid);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
|
||||
g_object_set_data ((GObject*)window, "plugman-text", view);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
gchar *contents;
|
||||
gsize length;
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_set_text (buffer, contents, length);
|
||||
g_free (contents);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_show_all (GTK_WIDGET (window));
|
||||
}
|
||||
|
||||
static void
|
||||
plug_man_activate (GApplication *application)
|
||||
{
|
||||
new_window (application, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
plug_man_open (GApplication *application,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
new_window (application, files[i]);
|
||||
}
|
||||
|
||||
typedef GtkApplication PlugMan;
|
||||
typedef GtkApplicationClass PlugManClass;
|
||||
|
||||
G_DEFINE_TYPE (PlugMan, plug_man, GTK_TYPE_APPLICATION)
|
||||
|
||||
static void
|
||||
plug_man_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (plug_man_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
show_about (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_show_about_dialog (NULL,
|
||||
"program-name", "Plugman",
|
||||
"title", "About Plugman",
|
||||
"comments", "A cheap Bloatpad clone.",
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
quit_app (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GList *list, *next;
|
||||
GtkWindow *win;
|
||||
|
||||
g_print ("Going down...\n");
|
||||
|
||||
list = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
|
||||
while (list)
|
||||
{
|
||||
win = list->data;
|
||||
next = list->next;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (win));
|
||||
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean is_red_plugin_enabled;
|
||||
static gboolean is_black_plugin_enabled;
|
||||
|
||||
static gboolean
|
||||
plugin_enabled (const gchar *name)
|
||||
{
|
||||
if (g_strcmp0 (name, "red") == 0)
|
||||
return is_red_plugin_enabled;
|
||||
else
|
||||
return is_black_plugin_enabled;
|
||||
}
|
||||
|
||||
static GMenuModel *
|
||||
find_plugin_menu (void)
|
||||
{
|
||||
return (GMenuModel*) g_object_get_data (G_OBJECT (g_application_get_default ()), "plugin-menu");
|
||||
}
|
||||
|
||||
static void
|
||||
plugin_action (GAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer data)
|
||||
{
|
||||
GApplication *app;
|
||||
GList *list;
|
||||
GtkWindow *window;
|
||||
GtkWidget *text;
|
||||
GdkRGBA color;
|
||||
|
||||
app = g_application_get_default ();
|
||||
list = gtk_application_get_windows (GTK_APPLICATION (app));
|
||||
window = GTK_WINDOW (list->data);
|
||||
text = g_object_get_data ((GObject*)window, "plugman-text");
|
||||
|
||||
gdk_rgba_parse (&color, g_action_get_name (action));
|
||||
|
||||
gtk_widget_override_color (text, 0, &color);
|
||||
}
|
||||
|
||||
static void
|
||||
enable_plugin (const gchar *name)
|
||||
{
|
||||
GMenuModel *plugin_menu;
|
||||
GAction *action;
|
||||
|
||||
g_print ("Enabling '%s' plugin\n", name);
|
||||
|
||||
action = (GAction *)g_simple_action_new (name, NULL);
|
||||
g_signal_connect (action, "activate", G_CALLBACK (plugin_action), (gpointer)name);
|
||||
g_action_map_add_action (G_ACTION_MAP (g_application_get_default ()), action);
|
||||
g_print ("Actions of '%s' plugin added\n", name);
|
||||
g_object_unref (action);
|
||||
|
||||
plugin_menu = find_plugin_menu ();
|
||||
if (plugin_menu)
|
||||
{
|
||||
GMenu *section;
|
||||
GMenuItem *item;
|
||||
gchar *label;
|
||||
gchar *action_name;
|
||||
|
||||
section = g_menu_new ();
|
||||
label = g_strdup_printf ("Turn text %s", name);
|
||||
action_name = g_strconcat ("app.", name, NULL);
|
||||
g_menu_insert (section, 0, label, action_name);
|
||||
g_free (label);
|
||||
g_free (action_name);
|
||||
item = g_menu_item_new_section (NULL, (GMenuModel*)section);
|
||||
g_menu_item_set_attribute (item, "id", "s", name);
|
||||
g_menu_append_item (G_MENU (plugin_menu), item);
|
||||
g_object_unref (item);
|
||||
g_object_unref (section);
|
||||
g_print ("Menus of '%s' plugin added\n", name);
|
||||
}
|
||||
else
|
||||
g_warning ("Plugin menu not found\n");
|
||||
|
||||
if (g_strcmp0 (name, "red") == 0)
|
||||
is_red_plugin_enabled = TRUE;
|
||||
else
|
||||
is_black_plugin_enabled = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
disable_plugin (const gchar *name)
|
||||
{
|
||||
GMenuModel *plugin_menu;
|
||||
|
||||
g_print ("Disabling '%s' plugin\n", name);
|
||||
|
||||
plugin_menu = find_plugin_menu ();
|
||||
if (plugin_menu)
|
||||
{
|
||||
const gchar *id;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < g_menu_model_get_n_items (plugin_menu); i++)
|
||||
{
|
||||
if (g_menu_model_get_item_attribute (plugin_menu, i, "id", "s", &id) &&
|
||||
g_strcmp0 (id, name) == 0)
|
||||
{
|
||||
g_menu_remove (G_MENU (plugin_menu), i);
|
||||
g_print ("Menus of '%s' plugin removed\n", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
g_warning ("Plugin menu not found\n");
|
||||
|
||||
g_action_map_remove_action (G_ACTION_MAP (g_application_get_default ()), name);
|
||||
g_print ("Actions of '%s' plugin removed\n", name);
|
||||
|
||||
if (g_strcmp0 (name, "red") == 0)
|
||||
is_red_plugin_enabled = FALSE;
|
||||
else
|
||||
is_black_plugin_enabled = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
enable_or_disable_plugin (GtkToggleButton *button,
|
||||
const gchar *name)
|
||||
{
|
||||
if (plugin_enabled (name))
|
||||
disable_plugin (name);
|
||||
else
|
||||
enable_plugin (name);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
configure_plugins (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *check;
|
||||
GError *error = NULL;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
"<interface>"
|
||||
" <object class='GtkDialog' id='plugin-dialog'>"
|
||||
" <property name='border-width'>12</property>"
|
||||
" <property name='title'>Plugins</property>"
|
||||
" <child internal-child='vbox'>"
|
||||
" <object class='GtkBox' id='content-area'>"
|
||||
" <property name='visible'>True</property>"
|
||||
" <child>"
|
||||
" <object class='GtkCheckButton' id='red-plugin'>"
|
||||
" <property name='label'>Red Plugin - turn your text red</property>"
|
||||
" <property name='visible'>True</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child>"
|
||||
" <object class='GtkCheckButton' id='black-plugin'>"
|
||||
" <property name='label'>Black Plugin - turn your text black</property>"
|
||||
" <property name='visible'>True</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child internal-child='action_area'>"
|
||||
" <object class='GtkButtonBox' id='action-area'>"
|
||||
" <property name='visible'>True</property>"
|
||||
" <child>"
|
||||
" <object class='GtkButton' id='close-button'>"
|
||||
" <property name='label'>Close</property>"
|
||||
" <property name='visible'>True</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <action-widgets>"
|
||||
" <action-widget response='-5'>close-button</action-widget>"
|
||||
" </action-widgets>"
|
||||
" </object>"
|
||||
"</interface>", -1, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
|
||||
check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red"));
|
||||
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "red");
|
||||
check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
|
||||
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "black");
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "about", show_about, NULL, NULL, NULL },
|
||||
{ "quit", quit_app, NULL, NULL, NULL },
|
||||
{ "plugins", configure_plugins, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
plug_man_startup (GApplication *application)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
G_APPLICATION_CLASS (plug_man_parent_class)
|
||||
->startup (application);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
"<interface>"
|
||||
" <menu id='app-menu'>"
|
||||
" <section>"
|
||||
" <item label='_About Plugman' action='app.about'/>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
|
||||
" </section>"
|
||||
" </menu>"
|
||||
" <menu id='menubar'>"
|
||||
" <submenu label='_Edit'>"
|
||||
" <section>"
|
||||
" <item label='_Copy' action='win.copy'/>"
|
||||
" <item label='_Paste' action='win.paste'/>"
|
||||
" </section>"
|
||||
" <item><link name='section' id='plugins'>"
|
||||
" </link></item>"
|
||||
" <section>"
|
||||
" <item label='Plugins' action='app.plugins'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" <submenu label='_View'>"
|
||||
" <section>"
|
||||
" <item label='_Fullscreen' action='win.fullscreen'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" </menu>"
|
||||
"</interface>", -1, NULL);
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
|
||||
gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
|
||||
g_object_set_data_full (G_OBJECT (application), "plugin-menu", gtk_builder_get_object (builder, "plugins"), g_object_unref);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
plug_man_init (PlugMan *app)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
plug_man_class_init (PlugManClass *class)
|
||||
{
|
||||
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
application_class->startup = plug_man_startup;
|
||||
application_class->activate = plug_man_activate;
|
||||
application_class->open = plug_man_open;
|
||||
|
||||
object_class->finalize = plug_man_finalize;
|
||||
|
||||
}
|
||||
|
||||
PlugMan *
|
||||
plug_man_new (void)
|
||||
{
|
||||
g_type_init ();
|
||||
|
||||
return g_object_new (plug_man_get_type (),
|
||||
"application-id", "org.gtk.Test.plugman",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
PlugMan *plug_man;
|
||||
int status;
|
||||
|
||||
plug_man = plug_man_new ();
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (plug_man),
|
||||
"F11", "win.fullscreen", NULL);
|
||||
status = g_application_run (G_APPLICATION (plug_man), argc, argv);
|
||||
g_object_unref (plug_man);
|
||||
|
||||
return status;
|
||||
}
|
||||
11
gail-3.0-uninstalled.pc.in
Normal file
@@ -0,0 +1,11 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: Gail
|
||||
Description: GNOME Accessibility Implementation Library
|
||||
Version: @VERSION@
|
||||
Requires: atk gtk+-3.0
|
||||
Libs: ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail.la ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail-util/libgailutil.la
|
||||
Cflags: -I${pc_top_builddir}/${pcfiledir}/modules/other/gail
|
||||
@@ -8,6 +8,5 @@ Name: GDK
|
||||
Description: GTK+ Drawing Kit
|
||||
Version: @VERSION@
|
||||
Requires: @GDK_PACKAGES@
|
||||
Requires.private: @GDK_PRIVATE_PACKAGES@
|
||||
Libs: -L${libdir} -lgdk-3 @GDK_EXTRA_LIBS@
|
||||
Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ @GDK_EXTRA_CFLAGS@
|
||||
|
||||
@@ -17,7 +17,6 @@ CLEANFILES =
|
||||
|
||||
EXTRA_DIST += \
|
||||
keynames.txt \
|
||||
keynames-translate.txt \
|
||||
keyname-table.h \
|
||||
gdkkeynames.c \
|
||||
gen-keyname-table.pl \
|
||||
@@ -88,7 +87,6 @@ gdk_public_h_sources = \
|
||||
gdkselection.h \
|
||||
gdktestutils.h \
|
||||
gdkthreads.h \
|
||||
gdktouchcluster.h \
|
||||
gdktypes.h \
|
||||
gdkvisual.h \
|
||||
gdkwindow.h
|
||||
@@ -114,7 +112,6 @@ gdk_c_sources = \
|
||||
gdkcairo.c \
|
||||
gdkcolor.c \
|
||||
gdkcursor.c \
|
||||
gdkdeprecated.c \
|
||||
gdkdevice.c \
|
||||
gdkdevicemanager.c \
|
||||
gdkdisplay.c \
|
||||
@@ -131,7 +128,6 @@ gdk_c_sources = \
|
||||
gdkrgba.c \
|
||||
gdkscreen.c \
|
||||
gdkselection.c \
|
||||
gdktouchcluster.c \
|
||||
gdkvisual.c \
|
||||
gdkwindow.c \
|
||||
gdkwindowimpl.c
|
||||
|
||||
@@ -175,84 +175,30 @@ struct BroadwayOutput {
|
||||
GOutputStream *out;
|
||||
int error;
|
||||
guint32 serial;
|
||||
gboolean proto_v7_plus;
|
||||
};
|
||||
|
||||
static void
|
||||
broadway_output_send_cmd (BroadwayOutput *output,
|
||||
gboolean fin, BroadwayWSOpCode code,
|
||||
const void *buf, gsize count)
|
||||
broadway_output_write_header (BroadwayOutput *output)
|
||||
{
|
||||
gboolean mask = FALSE;
|
||||
guchar header[16];
|
||||
size_t p;
|
||||
g_output_stream_write (output->out, "\0", 1, NULL, NULL);
|
||||
}
|
||||
|
||||
gboolean mid_header = count > 125 && count <= 65535;
|
||||
gboolean long_header = count > 65535;
|
||||
|
||||
/* NB. big-endian spec => bit 0 == MSB */
|
||||
header[0] = ( (fin ? 0x80 : 0) | (code & 0x0f) );
|
||||
header[1] = ( (mask ? 0x80 : 0) |
|
||||
(mid_header ? 126 : long_header ? 127 : count) );
|
||||
p = 2;
|
||||
if (mid_header)
|
||||
{
|
||||
*(guint16 *)(header + p) = GUINT16_TO_BE( (guint16)count );
|
||||
p += 2;
|
||||
}
|
||||
else if (long_header)
|
||||
{
|
||||
*(guint64 *)(header + p) = GUINT64_TO_BE( count );
|
||||
p += 8;
|
||||
}
|
||||
// FIXME: if we are paranoid we should 'mask' the data
|
||||
// FIXME: we should really emit these as a single write
|
||||
g_output_stream_write_all (output->out, header, p, NULL, NULL, NULL);
|
||||
static void
|
||||
broadway_output_write (BroadwayOutput *output,
|
||||
const void *buf, gsize count)
|
||||
{
|
||||
g_output_stream_write_all (output->out, buf, count, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
broadway_output_sendmsg (BroadwayOutput *output,
|
||||
const void *buf, gsize count)
|
||||
send_boundary (BroadwayOutput *output)
|
||||
{
|
||||
if (!output->proto_v7_plus)
|
||||
g_output_stream_write_all (output->out, buf, count, NULL, NULL, NULL);
|
||||
else
|
||||
broadway_output_send_cmd (output, TRUE, BROADWAY_WS_TEXT, buf, count);
|
||||
}
|
||||
|
||||
void broadway_output_pong (BroadwayOutput *output)
|
||||
{
|
||||
if (output->proto_v7_plus)
|
||||
broadway_output_send_cmd (output, TRUE, BROADWAY_WS_CNX_PONG, NULL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
broadway_output_sendmsg_initiate (BroadwayOutput *output)
|
||||
{
|
||||
if (!output->proto_v7_plus)
|
||||
g_output_stream_write (output->out, "\0", 1, NULL, NULL);
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
broadway_output_flush (BroadwayOutput *output)
|
||||
{
|
||||
if (!output->proto_v7_plus)
|
||||
{
|
||||
broadway_output_sendmsg (output, "\xff", 1);
|
||||
broadway_output_sendmsg (output, "\0", 1);
|
||||
return !output->error;
|
||||
}
|
||||
else /* no need to flush */
|
||||
return !output->error;
|
||||
broadway_output_write (output, "\xff", 1);
|
||||
broadway_output_write (output, "\0", 1);
|
||||
}
|
||||
|
||||
BroadwayOutput *
|
||||
broadway_output_new(GOutputStream *out, guint32 serial,
|
||||
gboolean proto_v7_plus)
|
||||
broadway_output_new(GOutputStream *out, guint32 serial)
|
||||
{
|
||||
BroadwayOutput *output;
|
||||
|
||||
@@ -260,9 +206,8 @@ broadway_output_new(GOutputStream *out, guint32 serial,
|
||||
|
||||
output->out = g_object_ref (out);
|
||||
output->serial = serial;
|
||||
output->proto_v7_plus = proto_v7_plus;
|
||||
|
||||
broadway_output_sendmsg_initiate (output);
|
||||
broadway_output_write_header (output);
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -280,6 +225,13 @@ broadway_output_get_next_serial (BroadwayOutput *output)
|
||||
return output->serial;
|
||||
}
|
||||
|
||||
int
|
||||
broadway_output_flush (BroadwayOutput *output)
|
||||
{
|
||||
send_boundary (output);
|
||||
return !output->error;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* Core rendering operations *
|
||||
@@ -339,7 +291,7 @@ broadway_output_copy_rectangles (BroadwayOutput *output, int id,
|
||||
|
||||
assert (p == len);
|
||||
|
||||
broadway_output_sendmsg (output, buf, len);
|
||||
broadway_output_write (output, buf, len);
|
||||
free (buf);
|
||||
}
|
||||
|
||||
@@ -357,7 +309,7 @@ broadway_output_grab_pointer (BroadwayOutput *output,
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
guint32
|
||||
@@ -372,7 +324,7 @@ broadway_output_ungrab_pointer (BroadwayOutput *output)
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
|
||||
return serial;
|
||||
}
|
||||
@@ -395,7 +347,7 @@ broadway_output_new_surface(BroadwayOutput *output,
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -409,7 +361,7 @@ broadway_output_show_surface(BroadwayOutput *output, int id)
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -423,7 +375,7 @@ broadway_output_hide_surface(BroadwayOutput *output, int id)
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -437,7 +389,7 @@ broadway_output_destroy_surface(BroadwayOutput *output, int id)
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +427,7 @@ broadway_output_move_resize_surface (BroadwayOutput *output,
|
||||
}
|
||||
assert (p <= sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, p);
|
||||
broadway_output_write (output, buf, p);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -493,7 +445,7 @@ broadway_output_set_transient_for (BroadwayOutput *output,
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
|
||||
@@ -501,31 +453,27 @@ void
|
||||
broadway_output_put_rgb (BroadwayOutput *output, int id, int x, int y,
|
||||
int w, int h, int byte_stride, void *data)
|
||||
{
|
||||
gsize buf_size;
|
||||
gsize url_len;
|
||||
char *url, *buf;
|
||||
char buf[HEADER_LEN + 15];
|
||||
gsize len;
|
||||
char *url;
|
||||
int p;
|
||||
|
||||
url = to_png_rgb (w, h, byte_stride, (guint32*)data);
|
||||
url_len = strlen (url);
|
||||
|
||||
buf_size = HEADER_LEN + 15 + url_len;
|
||||
buf = g_malloc (buf_size);
|
||||
|
||||
p = write_header (output, buf, 'i');
|
||||
|
||||
append_uint16 (id, buf, &p);
|
||||
append_uint16 (x, buf, &p);
|
||||
append_uint16 (y, buf, &p);
|
||||
|
||||
append_uint32 (url_len, buf, &p);
|
||||
url = to_png_rgb (w, h, byte_stride, (guint32*)data);
|
||||
len = strlen (url);
|
||||
append_uint32 (len, buf, &p);
|
||||
|
||||
g_assert (p == HEADER_LEN + 15);
|
||||
strncpy (buf + p, url, url_len);
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, buf_size);
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
|
||||
broadway_output_write (output, url, len);
|
||||
|
||||
g_free (buf);
|
||||
free (url);
|
||||
}
|
||||
|
||||
@@ -756,40 +704,37 @@ void
|
||||
broadway_output_put_rgba (BroadwayOutput *output, int id, int x, int y,
|
||||
int w, int h, int byte_stride, void *data)
|
||||
{
|
||||
char buf[HEADER_LEN + 15];
|
||||
gsize len;
|
||||
char *url;
|
||||
BroadwayBox *rects;
|
||||
int p, i, n_rects;
|
||||
guint8 *subdata;
|
||||
|
||||
rects = rgba_find_rects (data, w, h, byte_stride, &n_rects);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
gsize url_len, buf_size;
|
||||
char *buf, *url;
|
||||
guint8 *subdata;
|
||||
|
||||
subdata = (guint8 *)data + rects[i].x1 * 4 + rects[i].y1 * byte_stride;
|
||||
url = to_png_rgba (rects[i].x2 - rects[i].x1,
|
||||
rects[i].y2 - rects[i].y1,
|
||||
byte_stride, (guint32*)subdata);
|
||||
|
||||
url_len = strlen (url);
|
||||
buf_size = HEADER_LEN + 15 + url_len;
|
||||
buf = g_malloc (buf_size);
|
||||
|
||||
|
||||
p = write_header (output, buf, 'i');
|
||||
append_uint16 (id, buf, &p);
|
||||
append_uint16 (x + rects[i].x1, buf, &p);
|
||||
append_uint16 (y + rects[i].y1, buf, &p);
|
||||
|
||||
append_uint32 (url_len, buf, &p);
|
||||
g_assert (p == HEADER_LEN + 15);
|
||||
strncpy (buf + p, url, url_len);
|
||||
url = to_png_rgba (rects[i].x2 - rects[i].x1,
|
||||
rects[i].y2 - rects[i].y1,
|
||||
byte_stride, (guint32*)subdata);
|
||||
len = strlen (url);
|
||||
append_uint32 (len, buf, &p);
|
||||
|
||||
broadway_output_sendmsg (output, buf, buf_size);
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
|
||||
broadway_output_write (output, url, len);
|
||||
|
||||
free (url);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
free (rects);
|
||||
@@ -805,7 +750,35 @@ broadway_output_surface_flush (BroadwayOutput *output,
|
||||
p = write_header (output, buf, 'f');
|
||||
append_uint16 (id, buf, &p);
|
||||
|
||||
g_assert (p == sizeof (buf));
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_sendmsg (output, buf, sizeof (buf));
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
send_image_a (BroadwayOutput *output, int id, int x, int y,
|
||||
int w, int h, int byte_stride, guint8 *data)
|
||||
{
|
||||
char buf[HEADER_LEN + 15];
|
||||
gsize len;
|
||||
char *url;
|
||||
|
||||
p = write_header (output, buf, 'i');
|
||||
append_uint16 (id, buf, &p);
|
||||
append_uint16 (x, buf, &p);
|
||||
append_uint16 (y, buf, &p);
|
||||
|
||||
url = to_png_a (w, h, byte_stride, data);
|
||||
len = strlen (url);
|
||||
append_uint32 (len, buf, &p);
|
||||
|
||||
assert (p == sizeof (buf));
|
||||
|
||||
broadway_output_write (output, buf, sizeof (buf));
|
||||
|
||||
broadway_output_write (output, url, len);
|
||||
|
||||
free (url);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8,18 +8,8 @@ typedef struct {
|
||||
int width, height;
|
||||
} BroadwayRect;
|
||||
|
||||
typedef enum {
|
||||
BROADWAY_WS_CONTINUATION = 0,
|
||||
BROADWAY_WS_TEXT = 1,
|
||||
BROADWAY_WS_BINARY = 2,
|
||||
BROADWAY_WS_CNX_CLOSE = 8,
|
||||
BROADWAY_WS_CNX_PING = 9,
|
||||
BROADWAY_WS_CNX_PONG = 0xa
|
||||
} BroadwayWSOpCode;
|
||||
|
||||
BroadwayOutput *broadway_output_new (GOutputStream *out,
|
||||
guint32 serial,
|
||||
gboolean proto_v7_plus);
|
||||
guint32 serial);
|
||||
void broadway_output_free (BroadwayOutput *output);
|
||||
int broadway_output_flush (BroadwayOutput *output);
|
||||
int broadway_output_has_error (BroadwayOutput *output);
|
||||
@@ -76,4 +66,3 @@ void broadway_output_grab_pointer (BroadwayOutput *output,
|
||||
int id,
|
||||
gboolean owner_event);
|
||||
guint32 broadway_output_ungrab_pointer (BroadwayOutput *output);
|
||||
void broadway_output_pong (BroadwayOutput *output);
|
||||
|
||||
@@ -2769,19 +2769,10 @@ function connect()
|
||||
useToplevelWindows = true;
|
||||
}
|
||||
|
||||
var loc = window.location.toString().replace("http:", "ws:");
|
||||
loc = loc.substr(0, loc.lastIndexOf('/')) + "/socket";
|
||||
var ws = null;
|
||||
|
||||
if ("WebSocket" in window) {
|
||||
ws = new WebSocket(loc, "broadway");
|
||||
} else if ("MozWebSocket" in window) { // Firefox 6
|
||||
ws = new MozWebSocket(loc);
|
||||
} else {
|
||||
alert("WebSocket not supported, input will not work!");
|
||||
return;
|
||||
}
|
||||
|
||||
var loc = window.location.toString().replace("http:", "ws:");
|
||||
loc = loc.substr(0, loc.lastIndexOf('/')) + "/socket";
|
||||
var ws = new WebSocket(loc, "broadway");
|
||||
ws.onopen = function() {
|
||||
inputSocket = ws;
|
||||
var w, h;
|
||||
@@ -2806,7 +2797,9 @@ function connect()
|
||||
ws.onmessage = function(event) {
|
||||
handleMessage(event.data);
|
||||
};
|
||||
|
||||
} else {
|
||||
alert("WebSocket not supported, input will not work!");
|
||||
}
|
||||
setupDocument(document);
|
||||
window.onunload = function (ev) {
|
||||
for (var i = 0; i < toplevelWindows.length; i++)
|
||||
|
||||
@@ -48,10 +48,6 @@
|
||||
static void gdk_broadway_display_dispose (GObject *object);
|
||||
static void gdk_broadway_display_finalize (GObject *object);
|
||||
|
||||
#if 0
|
||||
#define DEBUG_WEBSOCKETS 1
|
||||
#endif
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
|
||||
|
||||
static void
|
||||
@@ -132,7 +128,7 @@ typedef struct HttpRequest {
|
||||
GString *request;
|
||||
} HttpRequest;
|
||||
|
||||
static void start_output (HttpRequest *request, gboolean proto_v7_plus);
|
||||
static void start_output (HttpRequest *request);
|
||||
|
||||
static void
|
||||
http_request_free (HttpRequest *request)
|
||||
@@ -150,7 +146,6 @@ struct BroadwayInput {
|
||||
GSource *source;
|
||||
gboolean seen_time;
|
||||
gint64 time_base;
|
||||
gboolean proto_v7_plus;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -234,7 +229,7 @@ parse_input_message (BroadwayInput *input, const char *message)
|
||||
5 seconds after last_seen_time, to avoid issues that could appear when
|
||||
a long hiatus due to a reconnect seems to be instant */
|
||||
input->time_base = time_ - (broadway_display->last_seen_time + 5000);
|
||||
}
|
||||
}
|
||||
time_ = time_ - input->time_base;
|
||||
}
|
||||
|
||||
@@ -314,171 +309,47 @@ parse_input_message (BroadwayInput *input, const char *message)
|
||||
|
||||
}
|
||||
|
||||
static inline void
|
||||
hex_dump (guchar *data, gsize len)
|
||||
{
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
gsize i, j;
|
||||
for (j = 0; j < len + 15; j += 16)
|
||||
{
|
||||
fprintf (stderr, "0x%.4x ", j);
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
if ((j + i) < len)
|
||||
fprintf (stderr, "%.2x ", data[j+i]);
|
||||
else
|
||||
fprintf (stderr, " ");
|
||||
if (i == 8)
|
||||
fprintf (stderr, " ");
|
||||
}
|
||||
fprintf (stderr, " | ");
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
if ((j + i) < len && g_ascii_isalnum(data[j+i]))
|
||||
fprintf (stderr, "%c", data[j+i]);
|
||||
else
|
||||
fprintf (stderr, ".");
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
parse_input (BroadwayInput *input)
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
char *buf, *ptr;
|
||||
gsize len;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (input->display);
|
||||
|
||||
if (!input->buffer->len)
|
||||
buf = (char *)input->buffer->data;
|
||||
len = input->buffer->len;
|
||||
|
||||
if (len == 0)
|
||||
return;
|
||||
|
||||
if (input->proto_v7_plus)
|
||||
if (buf[0] != 0)
|
||||
{
|
||||
hex_dump (input->buffer->data, input->buffer->len);
|
||||
|
||||
while (input->buffer->len > 2)
|
||||
{
|
||||
gsize len, payload_len;
|
||||
BroadwayWSOpCode code;
|
||||
gboolean is_mask, fin;
|
||||
guchar *buf, *data, *mask;
|
||||
|
||||
buf = input->buffer->data;
|
||||
len = input->buffer->len;
|
||||
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_print ("Parse input first byte 0x%2x 0x%2x\n", buf[0], buf[1]);
|
||||
#endif
|
||||
|
||||
fin = buf[0] & 0x80;
|
||||
code = buf[0] & 0x0f;
|
||||
payload_len = buf[1] & 0x7f;
|
||||
is_mask = buf[1] & 0x80;
|
||||
data = buf + 2;
|
||||
|
||||
if (payload_len > 125)
|
||||
{
|
||||
if (len < 4)
|
||||
return;
|
||||
payload_len = GUINT16_FROM_BE( *(guint16 *) data );
|
||||
data += 2;
|
||||
}
|
||||
else if (payload_len > 126)
|
||||
{
|
||||
if (len < 10)
|
||||
return;
|
||||
payload_len = GUINT64_FROM_BE( *(guint64 *) data );
|
||||
data += 8;
|
||||
}
|
||||
|
||||
mask = NULL;
|
||||
if (is_mask)
|
||||
{
|
||||
if (data - buf + 4 > len)
|
||||
return;
|
||||
mask = data;
|
||||
data += 4;
|
||||
}
|
||||
|
||||
if (data - buf + payload_len > len)
|
||||
return; /* wait to accumulate more */
|
||||
|
||||
if (is_mask)
|
||||
{
|
||||
gsize i;
|
||||
for (i = 0; i < payload_len; i++)
|
||||
data[i] ^= mask[i%4];
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case BROADWAY_WS_CNX_CLOSE:
|
||||
break; /* hang around anyway */
|
||||
case BROADWAY_WS_TEXT:
|
||||
if (!fin)
|
||||
{
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_warning ("can't yet accept fragmented input");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
char *terminated = g_strndup((char *)data, payload_len);
|
||||
parse_input_message (input, terminated);
|
||||
g_free (terminated);
|
||||
}
|
||||
break;
|
||||
case BROADWAY_WS_CNX_PING:
|
||||
broadway_output_pong (broadway_display->output);
|
||||
break;
|
||||
case BROADWAY_WS_CNX_PONG:
|
||||
break; /* we never send pings, but tolerate pongs */
|
||||
case BROADWAY_WS_BINARY:
|
||||
case BROADWAY_WS_CONTINUATION:
|
||||
default:
|
||||
{
|
||||
g_warning ("fragmented or unknown input code 0x%2x with fin set", code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_byte_array_remove_range (input->buffer, 0, data - buf + payload_len);
|
||||
}
|
||||
broadway_display->input = NULL;
|
||||
broadway_input_free (input);
|
||||
return;
|
||||
}
|
||||
else /* old style protocol */
|
||||
|
||||
while ((ptr = memchr (buf, 0xff, len)) != NULL)
|
||||
{
|
||||
char *buf, *ptr;
|
||||
gsize len;
|
||||
*ptr = 0;
|
||||
ptr++;
|
||||
|
||||
buf = (char *)input->buffer->data;
|
||||
len = input->buffer->len;
|
||||
parse_input_message (input, buf + 1);
|
||||
|
||||
if (buf[0] != 0)
|
||||
len -= ptr - buf;
|
||||
buf = ptr;
|
||||
|
||||
if (len > 0 && buf[0] != 0)
|
||||
{
|
||||
broadway_display->input = NULL;
|
||||
broadway_input_free (input);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
while ((ptr = memchr (buf, 0xff, len)) != NULL)
|
||||
{
|
||||
*ptr = 0;
|
||||
ptr++;
|
||||
|
||||
parse_input_message (input, buf + 1);
|
||||
|
||||
len -= ptr - buf;
|
||||
buf = ptr;
|
||||
|
||||
if (len > 0 && buf[0] != 0)
|
||||
{
|
||||
broadway_display->input = NULL;
|
||||
broadway_input_free (input);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_byte_array_remove_range (input->buffer, 0, buf - (char *)input->buffer->data);
|
||||
}
|
||||
|
||||
g_byte_array_remove_range (input->buffer, 0, buf - (char *)input->buffer->data);
|
||||
}
|
||||
|
||||
|
||||
@@ -487,7 +358,7 @@ process_input_idle_cb (GdkBroadwayDisplay *display)
|
||||
{
|
||||
display->process_input_idle = 0;
|
||||
process_input_messages (display);
|
||||
return G_SOURCE_REMOVE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -533,7 +404,7 @@ _gdk_broadway_display_read_all_input_nonblocking (GdkDisplay *display)
|
||||
broadway_input_free (input);
|
||||
if (res < 0)
|
||||
{
|
||||
g_print ("input error %s\n", error->message);
|
||||
g_print ("input error %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
return;
|
||||
@@ -666,32 +537,6 @@ send_error (HttpRequest *request,
|
||||
http_request_free (request);
|
||||
}
|
||||
|
||||
/* magic from: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17 */
|
||||
#define SEC_WEB_SOCKET_KEY_MAGIC "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
||||
|
||||
/* 'x3JJHMbDL1EzLkh9GBhXDw==' generates 'HSmrc0sMlYUkAGmm5OPpG2HaGWk=' */
|
||||
static gchar *
|
||||
generate_handshake_response_wsietf_v7 (const gchar *key)
|
||||
{
|
||||
gsize digest_len = 20;
|
||||
guchar digest[digest_len];
|
||||
GChecksum *checksum;
|
||||
|
||||
checksum = g_checksum_new (G_CHECKSUM_SHA1);
|
||||
if (!checksum)
|
||||
return NULL;
|
||||
|
||||
g_checksum_update (checksum, (guchar *)key, -1);
|
||||
g_checksum_update (checksum, (guchar *)SEC_WEB_SOCKET_KEY_MAGIC, -1);
|
||||
|
||||
g_checksum_get_digest (checksum, digest, &digest_len);
|
||||
g_checksum_free (checksum);
|
||||
|
||||
g_assert (digest_len == 20);
|
||||
|
||||
return g_base64_encode (digest, digest_len);
|
||||
}
|
||||
|
||||
static void
|
||||
start_input (HttpRequest *request)
|
||||
{
|
||||
@@ -711,8 +556,6 @@ start_input (HttpRequest *request)
|
||||
const void *data_buffer;
|
||||
gsize data_buffer_size;
|
||||
GInputStream *in;
|
||||
char *key_v7;
|
||||
gboolean proto_v7_plus;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (request->display);
|
||||
|
||||
@@ -722,16 +565,12 @@ start_input (HttpRequest *request)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_print ("incoming request:\n%s\n", request->request->str);
|
||||
#endif
|
||||
lines = g_strsplit (request->request->str, "\n", 0);
|
||||
|
||||
num_key1 = 0;
|
||||
num_key2 = 0;
|
||||
key1 = 0;
|
||||
key2 = 0;
|
||||
key_v7 = NULL;
|
||||
origin = NULL;
|
||||
host = NULL;
|
||||
for (i = 0; lines[i] != NULL; i++)
|
||||
@@ -766,10 +605,6 @@ start_input (HttpRequest *request)
|
||||
key2 /= num_space;
|
||||
num_key2++;
|
||||
}
|
||||
else if ((p = parse_line (lines[i], "Sec-WebSocket-Key")))
|
||||
{
|
||||
key_v7 = p;
|
||||
}
|
||||
else if ((p = parse_line (lines[i], "Origin")))
|
||||
{
|
||||
origin = p;
|
||||
@@ -778,97 +613,56 @@ start_input (HttpRequest *request)
|
||||
{
|
||||
host = p;
|
||||
}
|
||||
else if ((p = parse_line (lines[i], "Sec-WebSocket-Origin")))
|
||||
{
|
||||
origin = p;
|
||||
}
|
||||
}
|
||||
|
||||
if (origin == NULL || host == NULL)
|
||||
if (num_key1 != 1 || num_key2 != 1 || origin == NULL || host == NULL)
|
||||
{
|
||||
g_strfreev (lines);
|
||||
send_error (request, 400, "Bad websocket request");
|
||||
return;
|
||||
}
|
||||
|
||||
if (key_v7 != NULL)
|
||||
challenge[0] = (key1 >> 24) & 0xff;
|
||||
challenge[1] = (key1 >> 16) & 0xff;
|
||||
challenge[2] = (key1 >> 8) & 0xff;
|
||||
challenge[3] = (key1 >> 0) & 0xff;
|
||||
challenge[4] = (key2 >> 24) & 0xff;
|
||||
challenge[5] = (key2 >> 16) & 0xff;
|
||||
challenge[6] = (key2 >> 8) & 0xff;
|
||||
challenge[7] = (key2 >> 0) & 0xff;
|
||||
|
||||
if (!g_input_stream_read_all (G_INPUT_STREAM (request->data), challenge+8, 8, NULL, NULL, NULL))
|
||||
{
|
||||
char* accept = generate_handshake_response_wsietf_v7 (key_v7);
|
||||
res = g_strdup_printf ("HTTP/1.1 101 Switching Protocols\r\n"
|
||||
"Upgrade: websocket\r\n"
|
||||
"Connection: Upgrade\r\n"
|
||||
"Sec-WebSocket-Accept: %s\r\n"
|
||||
"Sec-WebSocket-Origin: %s\r\n"
|
||||
"Sec-WebSocket-Location: ws://%s/socket\r\n"
|
||||
"Sec-WebSocket-Protocol: broadway\r\n"
|
||||
"\r\n", accept, origin, host);
|
||||
g_free (accept);
|
||||
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_print ("v7 proto response:\n%s", res);
|
||||
#endif
|
||||
|
||||
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
|
||||
res, strlen (res), NULL, NULL, NULL);
|
||||
g_free (res);
|
||||
proto_v7_plus = TRUE;
|
||||
g_strfreev (lines);
|
||||
send_error (request, 400, "Bad websocket request");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_key1 != 1 || num_key2 != 1)
|
||||
{
|
||||
g_strfreev (lines);
|
||||
send_error (request, 400, "Bad websocket request");
|
||||
return;
|
||||
}
|
||||
|
||||
challenge[0] = (key1 >> 24) & 0xff;
|
||||
challenge[1] = (key1 >> 16) & 0xff;
|
||||
challenge[2] = (key1 >> 8) & 0xff;
|
||||
challenge[3] = (key1 >> 0) & 0xff;
|
||||
challenge[4] = (key2 >> 24) & 0xff;
|
||||
challenge[5] = (key2 >> 16) & 0xff;
|
||||
challenge[6] = (key2 >> 8) & 0xff;
|
||||
challenge[7] = (key2 >> 0) & 0xff;
|
||||
checksum = g_checksum_new (G_CHECKSUM_MD5);
|
||||
g_checksum_update (checksum, challenge, 16);
|
||||
len = 16;
|
||||
g_checksum_get_digest (checksum, challenge, &len);
|
||||
g_checksum_free (checksum);
|
||||
|
||||
if (!g_input_stream_read_all (G_INPUT_STREAM (request->data), challenge+8, 8, NULL, NULL, NULL))
|
||||
{
|
||||
g_strfreev (lines);
|
||||
send_error (request, 400, "Bad websocket request");
|
||||
return;
|
||||
}
|
||||
res = g_strdup_printf ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
|
||||
"Upgrade: WebSocket\r\n"
|
||||
"Connection: Upgrade\r\n"
|
||||
"Sec-WebSocket-Origin: %s\r\n"
|
||||
"Sec-WebSocket-Location: ws://%s/socket\r\n"
|
||||
"Sec-WebSocket-Protocol: broadway\r\n"
|
||||
"\r\n",
|
||||
origin, host);
|
||||
|
||||
checksum = g_checksum_new (G_CHECKSUM_MD5);
|
||||
g_checksum_update (checksum, challenge, 16);
|
||||
len = 16;
|
||||
g_checksum_get_digest (checksum, challenge, &len);
|
||||
g_checksum_free (checksum);
|
||||
|
||||
res = g_strdup_printf ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
|
||||
"Upgrade: WebSocket\r\n"
|
||||
"Connection: Upgrade\r\n"
|
||||
"Sec-WebSocket-Origin: %s\r\n"
|
||||
"Sec-WebSocket-Location: ws://%s/socket\r\n"
|
||||
"Sec-WebSocket-Protocol: broadway\r\n"
|
||||
"\r\n",
|
||||
origin, host);
|
||||
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_print ("legacy response:\n%s", res);
|
||||
#endif
|
||||
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
|
||||
res, strlen (res), NULL, NULL, NULL);
|
||||
g_free (res);
|
||||
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
|
||||
challenge, 16, NULL, NULL, NULL);
|
||||
proto_v7_plus = FALSE;
|
||||
}
|
||||
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
|
||||
res, strlen (res), NULL, NULL, NULL);
|
||||
g_free (res);
|
||||
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
|
||||
challenge, 16, NULL, NULL, NULL);
|
||||
|
||||
input = g_new0 (BroadwayInput, 1);
|
||||
|
||||
input->display = request->display;
|
||||
input->connection = g_object_ref (request->connection);
|
||||
input->proto_v7_plus = proto_v7_plus;
|
||||
|
||||
data_buffer = g_buffered_input_stream_peek_buffer (G_BUFFERED_INPUT_STREAM (request->data), &data_buffer_size);
|
||||
input->buffer = g_byte_array_sized_new (data_buffer_size);
|
||||
@@ -876,7 +670,7 @@ start_input (HttpRequest *request)
|
||||
|
||||
broadway_display->input = input;
|
||||
|
||||
start_output (request, proto_v7_plus);
|
||||
start_output (request);
|
||||
|
||||
/* This will free and close the data input stream, but we got all the buffered content already */
|
||||
http_request_free (request);
|
||||
@@ -894,7 +688,7 @@ start_input (HttpRequest *request)
|
||||
}
|
||||
|
||||
static void
|
||||
start_output (HttpRequest *request, gboolean proto_v7_plus)
|
||||
start_output (HttpRequest *request)
|
||||
{
|
||||
GSocket *socket;
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
@@ -914,7 +708,7 @@ start_output (HttpRequest *request, gboolean proto_v7_plus)
|
||||
|
||||
broadway_display->output =
|
||||
broadway_output_new (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
|
||||
broadway_display->saved_serial, proto_v7_plus);
|
||||
broadway_display->saved_serial);
|
||||
|
||||
_gdk_broadway_resync_windows ();
|
||||
|
||||
@@ -1016,7 +810,7 @@ got_http_request_line (GInputStream *stream,
|
||||
/* Protect against overflow in request length */
|
||||
if (request->request->len > 1024 * 5)
|
||||
{
|
||||
send_error (request, 400, "Request too long");
|
||||
send_error (request, 400, "Request to long");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1226,7 +1020,8 @@ gdk_broadway_display_finalize (GObject *object)
|
||||
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));
|
||||
|
||||
/* input GdkDevice list */
|
||||
g_list_free_full (broadway_display->input_devices, g_object_unref);
|
||||
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
|
||||
g_list_free (broadway_display->input_devices);
|
||||
/* Free all GdkScreens */
|
||||
g_object_unref (broadway_display->screens[0]);
|
||||
g_free (broadway_display->screens);
|
||||
|
||||
@@ -321,7 +321,6 @@ gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass)
|
||||
screen_class->get_monitor_height_mm = gdk_broadway_screen_get_monitor_height_mm;
|
||||
screen_class->get_monitor_plug_name = gdk_broadway_screen_get_monitor_plug_name;
|
||||
screen_class->get_monitor_geometry = gdk_broadway_screen_get_monitor_geometry;
|
||||
screen_class->get_monitor_workarea = gdk_broadway_screen_get_monitor_geometry;
|
||||
screen_class->is_composited = gdk_broadway_screen_is_composited;
|
||||
screen_class->make_display_name = gdk_broadway_screen_make_display_name;
|
||||
screen_class->get_active_window = gdk_broadway_screen_get_active_window;
|
||||
|
||||
@@ -257,7 +257,7 @@ gdk_window_impl_broadway_init (GdkWindowImplBroadway *impl)
|
||||
{
|
||||
impl->toplevel_window_type = -1;
|
||||
impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
(GDestroyNotify) gdk_cursor_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -286,7 +286,7 @@ gdk_window_impl_broadway_finalize (GObject *object)
|
||||
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
|
||||
|
||||
if (impl->cursor)
|
||||
g_object_unref (impl->cursor);
|
||||
gdk_cursor_unref (impl->cursor);
|
||||
|
||||
g_hash_table_destroy (impl->device_cursor);
|
||||
|
||||
@@ -1467,7 +1467,6 @@ create_moveresize_window (MoveResizeData *mv_resize,
|
||||
static void
|
||||
gdk_broadway_window_begin_resize_drag (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
@@ -1505,7 +1504,6 @@ gdk_broadway_window_begin_resize_drag (GdkWindow *window,
|
||||
|
||||
static void
|
||||
gdk_broadway_window_begin_move_drag (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
|
||||
39
gdk/gdk.c
@@ -101,7 +101,7 @@ static int gdk_initialized = 0; /* 1 if the library is initi
|
||||
|
||||
static gchar *gdk_progclass = NULL;
|
||||
|
||||
static GMutex gdk_threads_mutex;
|
||||
static GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
|
||||
|
||||
static GCallback gdk_threads_lock = NULL;
|
||||
static GCallback gdk_threads_unlock = NULL;
|
||||
@@ -432,13 +432,13 @@ gdk_init (int *argc, char ***argv)
|
||||
* Win32 backend, GDK calls should not be attempted from multiple threads
|
||||
* at all.
|
||||
*
|
||||
* You must call gdk_threads_init() before executing any other GTK+ or
|
||||
* GDK functions in a threaded GTK+ program.
|
||||
* You must call g_thread_init() and gdk_threads_init() before executing
|
||||
* any other GTK+ or GDK functions in a threaded GTK+ program.
|
||||
*
|
||||
* Idles, timeouts, and input functions from GLib, such as g_idle_add(),
|
||||
* are executed outside of the main GTK+ lock. So, if you need to call
|
||||
* GTK+ inside of such a callback, you must surround the callback with
|
||||
* a gdk_threads_enter()/gdk_threads_leave() pair or use
|
||||
* Idles, timeouts, and input functions from GLib, such as g_idle_add(), are
|
||||
* executed outside of the main GTK+ lock.
|
||||
* So, if you need to call GTK+ inside of such a callback, you must surround
|
||||
* the callback with a gdk_threads_enter()/gdk_threads_leave() pair or use
|
||||
* gdk_threads_add_idle_full() which does this for you.
|
||||
* However, event dispatching from the mainloop is still executed within
|
||||
* the main GTK+ lock, so callback functions connected to event signals
|
||||
@@ -468,6 +468,7 @@ gdk_init (int *argc, char ***argv)
|
||||
* {
|
||||
* GtkWidget *window;
|
||||
*
|
||||
* g_thread_init (NULL);
|
||||
* gdk_threads_init (<!-- -->);
|
||||
* gdk_threads_enter (<!-- -->);
|
||||
*
|
||||
@@ -592,6 +593,7 @@ gdk_init (int *argc, char ***argv)
|
||||
* pthread_t no_tid, yes_tid;
|
||||
*
|
||||
* /<!---->* init threads *<!---->/
|
||||
* g_thread_init (NULL);
|
||||
* gdk_threads_init (<!-- -->);
|
||||
* gdk_threads_enter (<!-- -->);
|
||||
*
|
||||
@@ -639,9 +641,9 @@ gdk_init (int *argc, char ***argv)
|
||||
/**
|
||||
* gdk_threads_enter:
|
||||
*
|
||||
* This function marks the beginning of a critical section in which
|
||||
* GDK and GTK+ functions can be called safely and without causing race
|
||||
* conditions. Only one thread at a time can be in such a critial
|
||||
* This macro marks the beginning of a critical section in which GDK and
|
||||
* GTK+ functions can be called safely and without causing race
|
||||
* conditions. Only one thread at a time can be in such a critial
|
||||
* section.
|
||||
*/
|
||||
void
|
||||
@@ -666,13 +668,15 @@ gdk_threads_leave (void)
|
||||
static void
|
||||
gdk_threads_impl_lock (void)
|
||||
{
|
||||
g_mutex_lock (&gdk_threads_mutex);
|
||||
if (gdk_threads_mutex)
|
||||
g_mutex_lock (gdk_threads_mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_threads_impl_unlock (void)
|
||||
{
|
||||
g_mutex_unlock (&gdk_threads_mutex);
|
||||
if (gdk_threads_mutex)
|
||||
g_mutex_unlock (gdk_threads_mutex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,13 +684,18 @@ gdk_threads_impl_unlock (void)
|
||||
*
|
||||
* Initializes GDK so that it can be used from multiple threads
|
||||
* in conjunction with gdk_threads_enter() and gdk_threads_leave().
|
||||
* g_thread_init() must be called previous to this function.
|
||||
*
|
||||
* This call must be made before any use of the main loop from
|
||||
* GTK+; to be safe, call it before gtk_init().
|
||||
*/
|
||||
**/
|
||||
void
|
||||
gdk_threads_init (void)
|
||||
{
|
||||
if (!g_thread_supported ())
|
||||
g_error ("g_thread_init() must be called before gdk_threads_init()");
|
||||
|
||||
gdk_threads_mutex = g_mutex_new ();
|
||||
if (!gdk_threads_lock)
|
||||
gdk_threads_lock = gdk_threads_impl_lock;
|
||||
if (!gdk_threads_unlock)
|
||||
@@ -774,7 +783,7 @@ gdk_threads_dispatch_free (gpointer data)
|
||||
* removed from the list of event sources and will not be called again.
|
||||
*
|
||||
* This variant of g_idle_add_full() calls @function with the GDK lock
|
||||
* held. It can be thought of a MT-safe version for GTK+ widgets for the
|
||||
* held. It can be thought of a MT-safe version for GTK+ widgets for the
|
||||
* following use case, where you have to worry about idle_callback()
|
||||
* running in thread A and accessing @self after it has been finalized
|
||||
* in thread B:
|
||||
@@ -895,7 +904,7 @@ gdk_threads_add_idle (GSourceFunc function,
|
||||
*
|
||||
* self->timeout_id = 0;
|
||||
*
|
||||
* return G_SOURCE_REMOVE;
|
||||
* return FALSE;
|
||||
* }
|
||||
*
|
||||
* static void some_widget_do_stuff_later (SomeWidget *self)
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#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>
|
||||
|
||||
@@ -168,7 +168,6 @@ gdk_event_get_scroll_direction
|
||||
gdk_event_get_source_device
|
||||
gdk_event_get_state
|
||||
gdk_event_get_time
|
||||
gdk_event_get_touch_id
|
||||
gdk_event_get_type
|
||||
gdk_event_handler_set
|
||||
gdk_event_mask_get_type
|
||||
@@ -179,7 +178,6 @@ gdk_event_request_motions
|
||||
gdk_event_set_device
|
||||
gdk_event_set_screen
|
||||
gdk_event_set_source_device
|
||||
gdk_event_triggers_context_menu
|
||||
gdk_events_get_angle
|
||||
gdk_events_get_center
|
||||
gdk_events_get_distance
|
||||
@@ -209,7 +207,6 @@ gdk_keymap_get_direction
|
||||
gdk_keymap_get_entries_for_keycode
|
||||
gdk_keymap_get_entries_for_keyval
|
||||
gdk_keymap_get_for_display
|
||||
gdk_keymap_get_modifier_mask
|
||||
gdk_keymap_get_num_lock_state
|
||||
gdk_keymap_get_type
|
||||
gdk_keymap_have_bidi_layouts
|
||||
@@ -225,7 +222,6 @@ gdk_keyval_to_lower
|
||||
gdk_keyval_to_unicode
|
||||
gdk_keyval_to_upper
|
||||
gdk_list_visuals
|
||||
gdk_modifier_intent_get_type
|
||||
gdk_modifier_type_get_type
|
||||
gdk_notify_startup_complete
|
||||
gdk_notify_startup_complete_with_id
|
||||
@@ -272,7 +268,6 @@ gdk_screen_get_height_mm
|
||||
gdk_screen_get_monitor_at_point
|
||||
gdk_screen_get_monitor_at_window
|
||||
gdk_screen_get_monitor_geometry
|
||||
gdk_screen_get_monitor_workarea
|
||||
gdk_screen_get_monitor_height_mm
|
||||
gdk_screen_get_monitor_plug_name
|
||||
gdk_screen_get_monitor_width_mm
|
||||
@@ -328,11 +323,6 @@ 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
|
||||
@@ -361,7 +351,6 @@ gdk_win32_pixbuf_to_hicon_libgtk_only
|
||||
gdk_win32_selection_add_targets
|
||||
gdk_win32_set_modal_dialog_libgtk_only
|
||||
gdk_win32_window_is_win32
|
||||
gdk_win32_window_get_impl_hwnd
|
||||
gdk_win32_window_get_handle
|
||||
gdk_win32_window_get_type
|
||||
gdk_win32_display_get_type
|
||||
@@ -373,11 +362,9 @@ gdk_window_at_pointer
|
||||
gdk_window_attributes_type_get_type
|
||||
gdk_window_beep
|
||||
gdk_window_begin_move_drag
|
||||
gdk_window_begin_move_drag_for_device
|
||||
gdk_window_begin_paint_rect
|
||||
gdk_window_begin_paint_region
|
||||
gdk_window_begin_resize_drag
|
||||
gdk_window_begin_resize_drag_for_device
|
||||
gdk_window_window_class_get_type
|
||||
gdk_window_configure_finished
|
||||
gdk_window_constrain_size
|
||||
@@ -586,9 +573,7 @@ gdk_x11_window_get_type
|
||||
gdk_x11_window_get_xid
|
||||
gdk_x11_window_move_to_current_desktop
|
||||
gdk_x11_window_set_theme_variant
|
||||
gdk_x11_window_set_hide_titlebar_when_maximized
|
||||
gdk_x11_window_set_user_time
|
||||
gdk_x11_window_set_utf8_property
|
||||
gdk_x11_xatom_to_atom
|
||||
gdk_x11_xatom_to_atom_for_display
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
* screen or workspace.
|
||||
* <example>
|
||||
* <title>Launching an application</title>
|
||||
* <informalexample>
|
||||
* <programlisting>
|
||||
* GdkAppLaunchContext *context;
|
||||
*
|
||||
@@ -52,7 +51,6 @@
|
||||
*
|
||||
* g_object_unref (context);
|
||||
* </programlisting>
|
||||
* </informalexample>
|
||||
* </example>
|
||||
*/
|
||||
|
||||
|
||||
@@ -35,16 +35,16 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
|
||||
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
|
||||
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
|
||||
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
|
||||
|
||||
|
||||
GType gdk_app_launch_context_get_type (void);
|
||||
|
||||
GDK_DEPRECATED_FOR(gdk_display_get_app_launch_context)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
GdkAppLaunchContext *gdk_app_launch_context_new (void);
|
||||
GDK_DEPRECATED_FOR(gdk_display_get_app_launch_context)
|
||||
void gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
|
||||
GdkDisplay *display);
|
||||
#endif
|
||||
void gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
|
||||
GdkScreen *screen);
|
||||
void gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
|
||||
|
||||