Compare commits
77 Commits
touchscree
...
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:
|
||||
|
||||
190
NEWS
190
NEWS
@@ -1,178 +1,37 @@
|
||||
Overview of Changes in GTK+ 3.3.6
|
||||
Overview of Changes in GTK+ 3.2.2
|
||||
=================================
|
||||
|
||||
* 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
|
||||
@@ -198,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
|
||||
=====================
|
||||
|
||||
|
||||
@@ -588,7 +588,7 @@ $(CopyDir)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..\..\..;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\include;$(GlibEtcInstallRoot)\include\cairo;$(GlibEtcInstallRoot)\include\atk-1.0;$(GlibEtcInstallRoot)\include\pango-1.0;$(GlibEtcInstallRoot)\include\gdk-pixbuf-2.0;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;G_DISABLE_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
|
||||
|
||||
@@ -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>
|
||||
|
||||
86
configure.ac
86
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], [7])
|
||||
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,7 +39,7 @@ AC_CONFIG_AUX_DIR([build-aux])
|
||||
m4_define([gtk_binary_version], [3.0.0])
|
||||
|
||||
# required versions of other packages
|
||||
m4_define([glib_required_version], [2.31.6])
|
||||
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])
|
||||
@@ -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.
|
||||
@@ -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
|
||||
@@ -1256,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)
|
||||
@@ -1310,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"
|
||||
@@ -1330,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)
|
||||
@@ -1499,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
|
||||
@@ -1665,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
|
||||
@@ -1734,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
|
||||
|
||||
@@ -43,7 +43,6 @@ demos = \
|
||||
textview.c \
|
||||
textscroll.c \
|
||||
toolpalette.c \
|
||||
transparent.c \
|
||||
tree_store.c \
|
||||
ui_manager.c
|
||||
|
||||
|
||||
@@ -29,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,
|
||||
@@ -202,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);
|
||||
|
||||
@@ -261,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'/>"
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -61,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,8 +752,6 @@ GdkEventMask
|
||||
GDK_CURRENT_TIME
|
||||
GDK_PRIORITY_EVENTS
|
||||
GDK_PRIORITY_REDRAW
|
||||
GDK_EVENT_PROPAGATE
|
||||
GDK_EVENT_STOP
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_events_pending
|
||||
@@ -782,7 +775,6 @@ gdk_event_request_motions
|
||||
gdk_events_get_angle
|
||||
gdk_events_get_center
|
||||
gdk_events_get_distance
|
||||
gdk_event_triggers_context_menu
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_event_handler_set
|
||||
@@ -964,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
|
||||
@@ -991,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
|
||||
|
||||
@@ -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
|
||||
@@ -365,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.
|
||||
|
||||
@@ -338,7 +338,6 @@
|
||||
<chapter id="Application">
|
||||
<title>Application support</title>
|
||||
<xi:include href="xml/gtkapplication.xml" />
|
||||
<xi:include href="xml/gtkapplicationwindow.xml" />
|
||||
</chapter>
|
||||
</part>
|
||||
|
||||
@@ -386,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>
|
||||
|
||||
|
||||
@@ -76,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
|
||||
|
||||
@@ -1135,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
|
||||
@@ -2824,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
|
||||
@@ -2936,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
|
||||
@@ -4358,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
|
||||
@@ -5212,7 +5202,6 @@ gtk_widget_set_mapped
|
||||
gtk_widget_get_mapped
|
||||
gtk_widget_get_requisition
|
||||
gtk_widget_device_is_shadowed
|
||||
gtk_widget_get_modifier_mask
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_widget_get_path
|
||||
@@ -5298,7 +5287,6 @@ gtk_window_get_gravity
|
||||
gtk_window_set_position
|
||||
gtk_window_set_transient_for
|
||||
gtk_window_set_destroy_with_parent
|
||||
gtk_window_set_hide_titlebar_when_maximized
|
||||
gtk_window_set_screen
|
||||
gtk_window_get_screen
|
||||
gtk_window_is_active
|
||||
@@ -5344,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
|
||||
@@ -5665,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
|
||||
@@ -5750,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
|
||||
@@ -5855,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
|
||||
@@ -7009,12 +6988,6 @@ gtk_application_add_window
|
||||
gtk_application_remove_window
|
||||
gtk_application_get_windows
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_application_get_app_menu
|
||||
gtk_application_set_app_menu
|
||||
gtk_application_get_menubar
|
||||
gtk_application_set_menubar
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkApplicationClass
|
||||
GTK_TYPE_APPLICATION
|
||||
@@ -7028,28 +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>gtkgrid</FILE>
|
||||
<TITLE>GtkGrid</TITLE>
|
||||
|
||||
@@ -16,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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 42 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 52 KiB |
@@ -1203,6 +1203,8 @@ gtk_arrow_draw (GtkWidget *widget,
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<xi:include href="migrating-GtkStyleContext.xml" />
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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,94 +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
|
||||
change_fullscreen_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (g_variant_get_boolean (state))
|
||||
gtk_window_fullscreen (user_data);
|
||||
else
|
||||
gtk_window_unfullscreen (user_data);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GtkClipboard *
|
||||
get_clipboard (GtkWidget *widget)
|
||||
{
|
||||
return gtk_widget_get_clipboard (widget, gdk_atom_intern_static_string ("CLIPBOARD"));
|
||||
}
|
||||
|
||||
static void
|
||||
window_copy (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "bloatpad-text");
|
||||
|
||||
gtk_text_buffer_copy_clipboard (gtk_text_view_get_buffer (text),
|
||||
get_clipboard ((GtkWidget*) text));
|
||||
}
|
||||
|
||||
static void
|
||||
window_paste (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWindow *window = GTK_WINDOW (user_data);
|
||||
GtkTextView *text = g_object_get_data ((GObject*)window, "bloatpad-text");
|
||||
|
||||
gtk_text_buffer_paste_clipboard (gtk_text_view_get_buffer (text),
|
||||
get_clipboard ((GtkWidget*) text),
|
||||
NULL,
|
||||
TRUE);
|
||||
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "copy", window_copy, NULL, NULL, NULL },
|
||||
{ "paste", window_paste, NULL, NULL, NULL },
|
||||
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state }
|
||||
};
|
||||
|
||||
static void
|
||||
new_window (GApplication *app,
|
||||
GFile *file)
|
||||
{
|
||||
GtkWidget *window, *grid, *scrolled, *view;
|
||||
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);
|
||||
|
||||
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, 0, 1, 1);
|
||||
gtk_container_add (GTK_CONTAINER (window), scrolled);
|
||||
|
||||
if (file != NULL)
|
||||
{
|
||||
@@ -137,97 +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)
|
||||
{
|
||||
g_application_activate (user_data);
|
||||
}
|
||||
|
||||
static void
|
||||
show_about (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_show_about_dialog (NULL,
|
||||
"program-name", "Bloatpad",
|
||||
"title", "About Bloatpad",
|
||||
"comments", "Not much to say, really.",
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
quit_app (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GList *list, *next;
|
||||
GtkWindow *win;
|
||||
|
||||
g_print ("Going down...\n");
|
||||
|
||||
list = gtk_application_get_windows (GTK_APPLICATION (g_application_get_default ()));
|
||||
while (list)
|
||||
{
|
||||
win = list->data;
|
||||
next = list->next;
|
||||
|
||||
gtk_widget_destroy (GTK_WIDGET (win));
|
||||
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "new", new_activated, NULL, NULL, NULL },
|
||||
{ "about", show_about, NULL, NULL, NULL },
|
||||
{ "quit", quit_app, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
bloat_pad_startup (GApplication *application)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
G_APPLICATION_CLASS (bloat_pad_parent_class)
|
||||
->startup (application);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
"<interface>"
|
||||
" <menu id='app-menu'>"
|
||||
" <section>"
|
||||
" <item label='_New Window' action='app.new' accel='<Primary>n'/>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item label='_About Bloatpad' action='app.about'/>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
|
||||
" </section>"
|
||||
" </menu>"
|
||||
" <menu id='menubar'>"
|
||||
" <submenu label='_Edit'>"
|
||||
" <section>"
|
||||
" <item label='_Copy' action='win.copy' accel='<Primary>c'/>"
|
||||
" <item label='_Paste' action='win.paste' accel='<Primary>v'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" <submenu label='_View'>"
|
||||
" <section>"
|
||||
" <item label='_Fullscreen' action='win.fullscreen'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" </menu>"
|
||||
"</interface>", -1, NULL);
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
|
||||
gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
bloat_pad_init (BloatPad *app)
|
||||
{
|
||||
@@ -236,15 +69,10 @@ 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);
|
||||
|
||||
application_class->startup = bloat_pad_startup;
|
||||
application_class->activate = bloat_pad_activate;
|
||||
application_class->open = bloat_pad_open;
|
||||
|
||||
object_class->finalize = bloat_pad_finalize;
|
||||
G_OBJECT_CLASS (class)->finalize= bloat_pad_finalize;
|
||||
|
||||
G_APPLICATION_CLASS (class)->activate = bloat_pad_activate;
|
||||
G_APPLICATION_CLASS (class)->open = bloat_pad_open;
|
||||
}
|
||||
|
||||
BloatPad *
|
||||
@@ -265,8 +93,6 @@ 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);
|
||||
|
||||
|
||||
@@ -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,467 +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);
|
||||
|
||||
plugin_menu = find_plugin_menu ();
|
||||
if (plugin_menu)
|
||||
{
|
||||
GMenu *section;
|
||||
GMenuItem *item;
|
||||
gchar *label;
|
||||
gchar *action;
|
||||
|
||||
section = g_menu_new ();
|
||||
label = g_strdup_printf ("Turn text %s", name);
|
||||
action = g_strconcat ("app.", name, NULL);
|
||||
g_menu_insert (section, 0, label, action);
|
||||
g_free (label);
|
||||
g_free (action);
|
||||
item = g_menu_item_new_section (NULL, (GMenuModel*)section);
|
||||
g_menu_item_set_attribute (item, "id", "s", name);
|
||||
g_menu_append_item (G_MENU (plugin_menu), item);
|
||||
g_object_unref (item);
|
||||
g_object_unref (section);
|
||||
g_print ("Menus of '%s' plugin added\n", name);
|
||||
}
|
||||
else
|
||||
g_warning ("Plugin menu not found\n");
|
||||
|
||||
if (g_strcmp0 (name, "red") == 0)
|
||||
is_red_plugin_enabled = TRUE;
|
||||
else
|
||||
is_black_plugin_enabled = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
disable_plugin (const gchar *name)
|
||||
{
|
||||
GMenuModel *plugin_menu;
|
||||
|
||||
g_print ("Disabling '%s' plugin\n", name);
|
||||
|
||||
plugin_menu = find_plugin_menu ();
|
||||
if (plugin_menu)
|
||||
{
|
||||
const gchar *id;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < g_menu_model_get_n_items (plugin_menu); i++)
|
||||
{
|
||||
if (g_menu_model_get_item_attribute (plugin_menu, i, "id", "s", &id) &&
|
||||
g_strcmp0 (id, name) == 0)
|
||||
{
|
||||
g_menu_remove (G_MENU (plugin_menu), i);
|
||||
g_print ("Menus of '%s' plugin removed\n", name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
g_warning ("Plugin menu not found\n");
|
||||
|
||||
g_action_map_remove_action (G_ACTION_MAP (g_application_get_default ()), name);
|
||||
g_print ("Actions of '%s' plugin removed\n", name);
|
||||
|
||||
if (g_strcmp0 (name, "red") == 0)
|
||||
is_red_plugin_enabled = FALSE;
|
||||
else
|
||||
is_black_plugin_enabled = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
enable_or_disable_plugin (GtkToggleButton *button,
|
||||
const gchar *name)
|
||||
{
|
||||
if (plugin_enabled (name))
|
||||
disable_plugin (name);
|
||||
else
|
||||
enable_plugin (name);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
configure_plugins (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *dialog;
|
||||
GtkWidget *check;
|
||||
GError *error = NULL;
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
"<interface>"
|
||||
" <object class='GtkDialog' id='plugin-dialog'>"
|
||||
" <property name='border-width'>12</property>"
|
||||
" <property name='title'>Plugins</property>"
|
||||
" <child internal-child='vbox'>"
|
||||
" <object class='GtkBox' id='content-area'>"
|
||||
" <property name='visible'>True</property>"
|
||||
" <child>"
|
||||
" <object class='GtkCheckButton' id='red-plugin'>"
|
||||
" <property name='label'>Red Plugin - turn your text red</property>"
|
||||
" <property name='visible'>True</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child>"
|
||||
" <object class='GtkCheckButton' id='black-plugin'>"
|
||||
" <property name='label'>Black Plugin - turn your text black</property>"
|
||||
" <property name='visible'>True</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <child internal-child='action_area'>"
|
||||
" <object class='GtkButtonBox' id='action-area'>"
|
||||
" <property name='visible'>True</property>"
|
||||
" <child>"
|
||||
" <object class='GtkButton' id='close-button'>"
|
||||
" <property name='label'>Close</property>"
|
||||
" <property name='visible'>True</property>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" </object>"
|
||||
" </child>"
|
||||
" <action-widgets>"
|
||||
" <action-widget response='-5'>close-button</action-widget>"
|
||||
" </action-widgets>"
|
||||
" </object>"
|
||||
"</interface>", -1, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
dialog = (GtkWidget *)gtk_builder_get_object (builder, "plugin-dialog");
|
||||
check = (GtkWidget *)gtk_builder_get_object (builder, "red-plugin");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("red"));
|
||||
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "red");
|
||||
check = (GtkWidget *)gtk_builder_get_object (builder, "black-plugin");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), plugin_enabled ("black"));
|
||||
g_signal_connect (check, "toggled", G_CALLBACK (enable_or_disable_plugin), "black");
|
||||
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "about", show_about, NULL, NULL, NULL },
|
||||
{ "quit", quit_app, NULL, NULL, NULL },
|
||||
{ "plugins", configure_plugins, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
plug_man_startup (GApplication *application)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
G_APPLICATION_CLASS (plug_man_parent_class)
|
||||
->startup (application);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
gtk_builder_add_from_string (builder,
|
||||
"<interface>"
|
||||
" <menu id='app-menu'>"
|
||||
" <section>"
|
||||
" <item label='_About Plugman' action='app.about'/>"
|
||||
" </section>"
|
||||
" <section>"
|
||||
" <item label='_Quit' action='app.quit' accel='<Primary>q'/>"
|
||||
" </section>"
|
||||
" </menu>"
|
||||
" <menu id='menubar'>"
|
||||
" <submenu label='_Edit'>"
|
||||
" <section>"
|
||||
" <item label='_Copy' action='win.copy'/>"
|
||||
" <item label='_Paste' action='win.paste'/>"
|
||||
" </section>"
|
||||
" <item><link name='section' id='plugins'>"
|
||||
" </link></item>"
|
||||
" <section>"
|
||||
" <item label='Plugins' action='app.plugins'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" <submenu label='_View'>"
|
||||
" <section>"
|
||||
" <item label='_Fullscreen' action='win.fullscreen'/>"
|
||||
" </section>"
|
||||
" </submenu>"
|
||||
" </menu>"
|
||||
"</interface>", -1, NULL);
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
|
||||
gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
|
||||
g_object_set_data_full (G_OBJECT (application), "plugin-menu", gtk_builder_get_object (builder, "plugins"), g_object_unref);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
plug_man_init (PlugMan *app)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
plug_man_class_init (PlugManClass *class)
|
||||
{
|
||||
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
application_class->startup = plug_man_startup;
|
||||
application_class->activate = plug_man_activate;
|
||||
application_class->open = plug_man_open;
|
||||
|
||||
object_class->finalize = plug_man_finalize;
|
||||
|
||||
}
|
||||
|
||||
PlugMan *
|
||||
plug_man_new (void)
|
||||
{
|
||||
g_type_init ();
|
||||
|
||||
return g_object_new (plug_man_get_type (),
|
||||
"application-id", "org.gtk.Test.plugman",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
PlugMan *plug_man;
|
||||
int status;
|
||||
|
||||
plug_man = plug_man_new ();
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (plug_man),
|
||||
"F11", "win.fullscreen", NULL);
|
||||
status = g_application_run (G_APPLICATION (plug_man), argc, argv);
|
||||
g_object_unref (plug_man);
|
||||
|
||||
return status;
|
||||
}
|
||||
11
gail-3.0-uninstalled.pc.in
Normal file
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 \
|
||||
@@ -113,7 +112,6 @@ gdk_c_sources = \
|
||||
gdkcairo.c \
|
||||
gdkcolor.c \
|
||||
gdkcursor.c \
|
||||
gdkdeprecated.c \
|
||||
gdkdevice.c \
|
||||
gdkdevicemanager.c \
|
||||
gdkdisplay.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,158 +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;
|
||||
|
||||
buf = input->buffer->data;
|
||||
len = input->buffer->len;
|
||||
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_print ("Parse input first byte 0x%2x 0x%2x\n", buf[0], buf[1]);
|
||||
#endif
|
||||
|
||||
fin = buf[0] & 0x80;
|
||||
code = buf[0] & 0x0f;
|
||||
payload_len = buf[1] & 0x7f;
|
||||
is_mask = buf[1] & 0x80;
|
||||
data = buf + 2;
|
||||
|
||||
if (payload_len > 125)
|
||||
{
|
||||
if (len < 4)
|
||||
return;
|
||||
payload_len = GUINT16_FROM_BE( *(guint16 *) data );
|
||||
data += 2;
|
||||
}
|
||||
else if (payload_len > 126)
|
||||
{
|
||||
if (len < 10)
|
||||
return;
|
||||
payload_len = GUINT64_FROM_BE( *(guint64 *) data );
|
||||
data += 8;
|
||||
}
|
||||
if (data - buf + payload_len > len)
|
||||
return; /* wait to accumulate more */
|
||||
|
||||
if (is_mask)
|
||||
{
|
||||
gsize i;
|
||||
for (i = 0; i < payload_len; i++)
|
||||
data[i + 4] ^= data[i%4];
|
||||
data += 4;
|
||||
}
|
||||
|
||||
switch (code) {
|
||||
case BROADWAY_WS_CNX_CLOSE:
|
||||
break; /* hang around anyway */
|
||||
case BROADWAY_WS_TEXT:
|
||||
if (!fin)
|
||||
{
|
||||
#ifdef DEBUG_WEBSOCKETS
|
||||
g_warning ("can't yet accept fragmented input");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
parse_input_message (input, (char *)data);
|
||||
break;
|
||||
case BROADWAY_WS_CNX_PING:
|
||||
broadway_output_pong (broadway_display->output);
|
||||
break;
|
||||
case BROADWAY_WS_CNX_PONG:
|
||||
break; /* we never send pings, but tolerate pongs */
|
||||
case BROADWAY_WS_BINARY:
|
||||
case BROADWAY_WS_CONTINUATION:
|
||||
default:
|
||||
{
|
||||
g_warning ("fragmented or unknown input code 0x%2x with fin set", code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_byte_array_remove_range (input->buffer, 0, data - buf + payload_len);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -520,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;
|
||||
@@ -653,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)
|
||||
{
|
||||
@@ -698,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);
|
||||
|
||||
@@ -709,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++)
|
||||
@@ -753,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;
|
||||
@@ -765,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);
|
||||
@@ -863,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);
|
||||
@@ -881,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;
|
||||
@@ -901,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 ();
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
37
gdk/gdk.c
37
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:
|
||||
|
||||
@@ -178,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
|
||||
@@ -208,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
|
||||
@@ -224,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
|
||||
@@ -271,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
|
||||
@@ -355,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
|
||||
@@ -367,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
|
||||
@@ -580,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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -89,8 +89,6 @@ gdk_cairo_get_clip_rectangle (cairo_t *cr,
|
||||
* Sets the specified #GdkColor as the source color of @cr.
|
||||
*
|
||||
* Since: 2.8
|
||||
*
|
||||
* Deprecated: 3.4: Use gdk_cairo_set_source_rgba() instead
|
||||
*/
|
||||
void
|
||||
gdk_cairo_set_source_color (cairo_t *cr,
|
||||
@@ -429,11 +427,7 @@ gdk_cairo_region_create_from_surface (cairo_surface_t *surface)
|
||||
gint x0 = x;
|
||||
while (x < extents.width)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
if (((data[x / 8] >> (x%8)) & 1) == 0)
|
||||
#else
|
||||
if (((data[x / 8] >> (7-(x%8))) & 1) == 0)
|
||||
#endif
|
||||
/* This pixel is "transparent"*/
|
||||
break;
|
||||
x++;
|
||||
|
||||
@@ -35,6 +35,8 @@ cairo_t * gdk_cairo_create (GdkWindow *window);
|
||||
gboolean gdk_cairo_get_clip_rectangle (cairo_t *cr,
|
||||
GdkRectangle *rect);
|
||||
|
||||
void gdk_cairo_set_source_color (cairo_t *cr,
|
||||
const GdkColor *color);
|
||||
void gdk_cairo_set_source_rgba (cairo_t *cr,
|
||||
const GdkRGBA *rgba);
|
||||
void gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
@@ -55,10 +57,6 @@ cairo_region_t *
|
||||
gdk_cairo_region_create_from_surface
|
||||
(cairo_surface_t *surface);
|
||||
|
||||
GDK_DEPRECATED_FOR(gdk_cairo_set_source_rgba)
|
||||
void gdk_cairo_set_source_color (cairo_t *cr,
|
||||
const GdkColor *color);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_CAIRO_H__ */
|
||||
|
||||
@@ -43,7 +43,7 @@ G_BEGIN_DECLS
|
||||
* draw this color on the screen. Not used anymore.
|
||||
* @red: The red component of the color. This is
|
||||
* a value between 0 and 65535, with 65535 indicating
|
||||
* full intensity
|
||||
* full intensitiy
|
||||
* @green: The green component of the color
|
||||
* @blue: The blue component of the color
|
||||
*
|
||||
|
||||
@@ -14,19 +14,6 @@
|
||||
|
||||
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
|
||||
|
||||
#define GDK_WINDOWING_WIN32
|
||||
|
||||
|
||||
@@ -228,10 +228,10 @@ GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
GdkCursor* gdk_cursor_new_from_name (GdkDisplay *display,
|
||||
const gchar *name);
|
||||
GdkDisplay* gdk_cursor_get_display (GdkCursor *cursor);
|
||||
GDK_DEPRECATED_FOR(g_object_ref)
|
||||
GdkCursor * gdk_cursor_ref (GdkCursor *cursor);
|
||||
GDK_DEPRECATED_FOR(g_object_unref)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
GdkCursor* gdk_cursor_ref (GdkCursor *cursor);
|
||||
void gdk_cursor_unref (GdkCursor *cursor);
|
||||
#endif
|
||||
GdkPixbuf* gdk_cursor_get_image (GdkCursor *cursor);
|
||||
GdkCursorType gdk_cursor_get_cursor_type (GdkCursor *cursor);
|
||||
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* gdkdeprecated.c
|
||||
*
|
||||
* Copyright 1995-2011 Red Hat Inc.
|
||||
*
|
||||
* Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdisplay.h"
|
||||
|
||||
/**
|
||||
* gdk_pointer_ungrab:
|
||||
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
|
||||
* timestamp is available.
|
||||
*
|
||||
* Ungrabs the pointer on the default display, if it is grabbed by this
|
||||
* application.
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
|
||||
* instead.
|
||||
**/
|
||||
void
|
||||
gdk_pointer_ungrab (guint32 time)
|
||||
{
|
||||
gdk_display_pointer_ungrab (gdk_display_get_default (), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pointer_is_grabbed:
|
||||
*
|
||||
* Returns %TRUE if the pointer on the default display is currently
|
||||
* grabbed by this application.
|
||||
*
|
||||
* Note that this does not take the inmplicit pointer grab on button
|
||||
* presses into account.
|
||||
*
|
||||
* Return value: %TRUE if the pointer is currently grabbed by this application.
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
|
||||
**/
|
||||
gboolean
|
||||
gdk_pointer_is_grabbed (void)
|
||||
{
|
||||
return gdk_display_pointer_is_grabbed (gdk_display_get_default ());
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keyboard_ungrab:
|
||||
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
|
||||
* timestamp is available.
|
||||
*
|
||||
* Ungrabs the keyboard on the default display, if it is grabbed by this
|
||||
* application.
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
|
||||
* instead.
|
||||
**/
|
||||
void
|
||||
gdk_keyboard_ungrab (guint32 time)
|
||||
{
|
||||
gdk_display_keyboard_ungrab (gdk_display_get_default (), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_window_at_pointer:
|
||||
* @win_x: (out) (allow-none): return location for origin of the window under the pointer
|
||||
* @win_y: (out) (allow-none): return location for origin of the window under the pointer
|
||||
*
|
||||
* Obtains the window underneath the mouse pointer, returning the
|
||||
* location of that window in @win_x, @win_y. Returns %NULL if the
|
||||
* window under the mouse pointer is not known to GDK (if the window
|
||||
* belongs to another application and a #GdkWindow hasn't been created
|
||||
* for it with gdk_window_foreign_new())
|
||||
*
|
||||
* NOTE: For multihead-aware widgets or applications use
|
||||
* gdk_display_get_window_at_pointer() instead.
|
||||
*
|
||||
* Return value: (transfer none): window under the mouse pointer
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
|
||||
**/
|
||||
GdkWindow*
|
||||
gdk_window_at_pointer (gint *win_x,
|
||||
gint *win_y)
|
||||
{
|
||||
return gdk_display_get_window_at_pointer (gdk_display_get_default (), win_x, win_y);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ typedef enum
|
||||
* of a stylus on a graphics tablet.
|
||||
* @GDK_SOURCE_CURSOR: the device is a graphics tablet "puck" or similar device.
|
||||
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
|
||||
* @GDK_SOURCE_TOUCH: the device is a touch capable device.
|
||||
*
|
||||
* An enumeration describing the type of an input device in general terms.
|
||||
*/
|
||||
@@ -71,8 +70,7 @@ typedef enum
|
||||
GDK_SOURCE_PEN,
|
||||
GDK_SOURCE_ERASER,
|
||||
GDK_SOURCE_CURSOR,
|
||||
GDK_SOURCE_KEYBOARD,
|
||||
GDK_SOURCE_TOUCH
|
||||
GDK_SOURCE_KEYBOARD
|
||||
} GdkInputSource;
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,37 +33,18 @@
|
||||
* In addition to a single pointer and keyboard for user interface input,
|
||||
* GDK contains support for a variety of input devices, including graphics
|
||||
* tablets, touchscreens and multiple pointers/keyboards interacting
|
||||
* simultaneously with the user interface. Such input devices often have
|
||||
* additional features, such as sub-pixel positioning information and
|
||||
* additional device-dependent information.
|
||||
*
|
||||
* In order to query the device hierarchy and be aware of changes in the
|
||||
* device hierarchy (such as virtual devices being created or removed, or
|
||||
* physical devices being plugged or unplugged), GDK provides
|
||||
* #GdkDeviceManager.
|
||||
* simultaneously with the user interface. Under X, the support for multiple
|
||||
* input devices is done through the <firstterm>XInput 2</firstterm> extension,
|
||||
* which also supports additional features such as sub-pixel positioning
|
||||
* information and additional device-dependent information.
|
||||
*
|
||||
* By default, and if the platform supports it, GDK is aware of multiple
|
||||
* keyboard/pointer pairs and multitouch devices. This behavior can be
|
||||
* changed by calling gdk_disable_multidevice() before gdk_display_open().
|
||||
* There should rarely be a need to do that though, since GDK defaults
|
||||
* to a compatibility mode in which it will emit just one enter/leave
|
||||
* event pair for all devices on a window. To enable per-device
|
||||
* enter/leave events and other multi-pointer interaction features,
|
||||
* gdk_window_set_support_multidevice() must be called on
|
||||
* #GdkWindows (or gtk_widget_set_support_multidevice() on widgets).
|
||||
* window. See the gdk_window_set_support_multidevice() documentation
|
||||
* for more information.
|
||||
*
|
||||
* On X11, multi-device support is implemented through XInput 2.
|
||||
* Unless gdk_disable_multidevice() is called, the XInput 2
|
||||
* #GdkDeviceManager implementation will be used as the input source.
|
||||
* Otherwise either the core or XInput 1 implementations will be used.
|
||||
*
|
||||
* For simple applications that don't have any special interest in
|
||||
* input devices, the so-called <firstterm>client pointer</firstterm>
|
||||
* provides a reasonable approximation to a simple setup with a single
|
||||
* pointer and keyboard. The device that has been set as the client
|
||||
* pointer can be accessed via gdk_device_manager_get_client_pointer().
|
||||
* keyboard/pointer pairs and multitouch devices, this behavior can be
|
||||
* changed by calling gdk_disable_multidevice() before gdk_display_open(),
|
||||
* although there would rarely be a reason to do that. For a widget or
|
||||
* window to be dealt as multipointer aware,
|
||||
* gdk_window_set_support_multidevice() or
|
||||
* gtk_widget_set_support_multidevice() must have been called on it.
|
||||
*
|
||||
* Conceptually, in multidevice mode there are 2 device types. Virtual
|
||||
* devices (or master devices) are represented by the pointer cursors
|
||||
@@ -79,43 +60,28 @@
|
||||
* be controlling each of these virtual devices. Physical devices may also
|
||||
* be "floating", which means they are not attached to any virtual device.
|
||||
*
|
||||
* <example><title>Master and slave devices</title>
|
||||
* <screen>
|
||||
* carlos@sacarino:~$ xinput list
|
||||
* ⎡ Virtual core pointer id=2 [master pointer (3)]
|
||||
* ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
|
||||
* ⎜ ↳ Wacom ISDv4 E6 Pen stylus id=10 [slave pointer (2)]
|
||||
* ⎜ ↳ Wacom ISDv4 E6 Finger touch id=11 [slave pointer (2)]
|
||||
* ⎜ ↳ SynPS/2 Synaptics TouchPad id=13 [slave pointer (2)]
|
||||
* ⎜ ↳ TPPS/2 IBM TrackPoint id=14 [slave pointer (2)]
|
||||
* ⎜ ↳ Wacom ISDv4 E6 Pen eraser id=16 [slave pointer (2)]
|
||||
* ⎣ Virtual core keyboard id=3 [master keyboard (2)]
|
||||
* ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
|
||||
* ↳ Power Button id=6 [slave keyboard (3)]
|
||||
* ↳ Video Bus id=7 [slave keyboard (3)]
|
||||
* ↳ Sleep Button id=8 [slave keyboard (3)]
|
||||
* ↳ Integrated Camera id=9 [slave keyboard (3)]
|
||||
* ↳ AT Translated Set 2 keyboard id=12 [slave keyboard (3)]
|
||||
* ↳ ThinkPad Extra Buttons id=15 [slave keyboard (3)]
|
||||
* </screen>
|
||||
* </example>
|
||||
*
|
||||
* By default, GDK will automatically listen for events coming from all
|
||||
* master devices, setting the #GdkDevice for all events coming from input
|
||||
* devices. Events containing device information are #GDK_MOTION_NOTIFY,
|
||||
* devices,
|
||||
* <footnote>
|
||||
* Events containing device information are #GDK_MOTION_NOTIFY,
|
||||
* #GDK_BUTTON_PRESS, #GDK_2BUTTON_PRESS, #GDK_3BUTTON_PRESS,
|
||||
* #GDK_BUTTON_RELEASE, #GDK_SCROLL, #GDK_KEY_PRESS, #GDK_KEY_RELEASE,
|
||||
* #GDK_ENTER_NOTIFY, #GDK_LEAVE_NOTIFY, #GDK_FOCUS_CHANGE,
|
||||
* #GDK_PROXIMITY_IN, #GDK_PROXIMITY_OUT, #GDK_DRAG_ENTER, #GDK_DRAG_LEAVE,
|
||||
* #GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START, #GDK_DROP_FINISHED
|
||||
* and #GDK_GRAB_BROKEN. When dealing with an event on a master device,
|
||||
* it is possible to get the source (slave) device that the event originated
|
||||
* from via gdk_event_get_source_device().
|
||||
* and #GDK_GRAB_BROKEN.
|
||||
* </footnote>
|
||||
* Although gdk_window_set_support_multidevice() must be called on
|
||||
* #GdkWindows in order to support additional features of multiple pointer
|
||||
* interaction, such as multiple per-device enter/leave events, the default
|
||||
* setting will emit just one enter/leave event pair for all devices on the
|
||||
* window. See gdk_window_set_support_multidevice() documentation for more
|
||||
* information.
|
||||
*
|
||||
* In order to listen for events coming from devices
|
||||
* other than a virtual device, gdk_window_set_device_events() must be
|
||||
* called. Generally, this function can be used to modify the event mask
|
||||
* for any given device.
|
||||
* In order to listen for events coming from other than a virtual device,
|
||||
* gdk_window_set_device_events() must be called. Generally, this function
|
||||
* can be used to modify the event mask for any given device.
|
||||
*
|
||||
* Input devices may also provide additional information besides X/Y.
|
||||
* For example, graphics tablets may also provide pressure and X/Y tilt
|
||||
@@ -129,6 +95,14 @@
|
||||
* Devices may also have associated <firstterm>keys</firstterm> or
|
||||
* macro buttons. Such keys can be globally set to map into normal X
|
||||
* keyboard events. The mapping is set using gdk_device_set_key().
|
||||
*
|
||||
* In order to query the device hierarchy and be aware of changes in the
|
||||
* device hierarchy (such as virtual devices being created or removed, or
|
||||
* physical devices being plugged or unplugged), GDK provides
|
||||
* #GdkDeviceManager. On X11, multidevice support is implemented through
|
||||
* XInput 2. Unless gdk_disable_multidevice() is called, the XInput 2.x
|
||||
* #GdkDeviceManager implementation will be used as the input source. Otherwise
|
||||
* either the core or XInput 1.x implementations will be used.
|
||||
*/
|
||||
|
||||
static void gdk_device_manager_set_property (GObject *object,
|
||||
|
||||
104
gdk/gdkdisplay.c
104
gdk/gdkdisplay.c
@@ -404,6 +404,42 @@ gdk_display_pointer_ungrab (GdkDisplay *display,
|
||||
g_list_free (devices);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pointer_ungrab:
|
||||
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
|
||||
* timestamp is available.
|
||||
*
|
||||
* Ungrabs the pointer on the default display, if it is grabbed by this
|
||||
* application.
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
|
||||
* instead.
|
||||
**/
|
||||
void
|
||||
gdk_pointer_ungrab (guint32 time)
|
||||
{
|
||||
gdk_display_pointer_ungrab (gdk_display_get_default (), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_pointer_is_grabbed:
|
||||
*
|
||||
* Returns %TRUE if the pointer on the default display is currently
|
||||
* grabbed by this application.
|
||||
*
|
||||
* Note that this does not take the inmplicit pointer grab on button
|
||||
* presses into account.
|
||||
*
|
||||
* Return value: %TRUE if the pointer is currently grabbed by this application.
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_display_device_is_grabbed() instead.
|
||||
**/
|
||||
gboolean
|
||||
gdk_pointer_is_grabbed (void)
|
||||
{
|
||||
return gdk_display_pointer_is_grabbed (gdk_display_get_default ());
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_keyboard_ungrab:
|
||||
* @display: a #GdkDisplay.
|
||||
@@ -444,6 +480,23 @@ gdk_display_keyboard_ungrab (GdkDisplay *display,
|
||||
g_list_free (devices);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keyboard_ungrab:
|
||||
* @time_: a timestamp from a #GdkEvent, or %GDK_CURRENT_TIME if no
|
||||
* timestamp is available.
|
||||
*
|
||||
* Ungrabs the keyboard on the default display, if it is grabbed by this
|
||||
* application.
|
||||
*
|
||||
* Deprecated: 3.0: Use gdk_device_ungrab(), together with gdk_device_grab()
|
||||
* instead.
|
||||
**/
|
||||
void
|
||||
gdk_keyboard_ungrab (guint32 time)
|
||||
{
|
||||
gdk_display_keyboard_ungrab (gdk_display_get_default (), time);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_beep:
|
||||
*
|
||||
@@ -729,9 +782,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
src_toplevel == dest_toplevel)
|
||||
{
|
||||
/* Same toplevels */
|
||||
gdk_window_get_device_position (dest_toplevel,
|
||||
device,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (dest_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
src_window,
|
||||
dest_window,
|
||||
@@ -744,9 +796,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
}
|
||||
else if (dest_toplevel == NULL)
|
||||
{
|
||||
gdk_window_get_device_position (src_toplevel,
|
||||
device,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (src_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
src_window,
|
||||
NULL,
|
||||
@@ -760,9 +811,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
else
|
||||
{
|
||||
/* Different toplevels */
|
||||
gdk_window_get_device_position (src_toplevel,
|
||||
device,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (src_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
src_window,
|
||||
NULL,
|
||||
@@ -772,9 +822,8 @@ synthesize_crossing_events (GdkDisplay *display,
|
||||
time,
|
||||
NULL,
|
||||
serial, FALSE);
|
||||
gdk_window_get_device_position (dest_toplevel,
|
||||
device,
|
||||
&x, &y, &state);
|
||||
gdk_window_get_pointer (dest_toplevel,
|
||||
&x, &y, &state);
|
||||
_gdk_synthesize_crossing_events (display,
|
||||
NULL,
|
||||
dest_window,
|
||||
@@ -899,25 +948,15 @@ switch_to_pointer_grab (GdkDisplay *display,
|
||||
|
||||
if (grab == NULL) /* Ungrabbed, send events */
|
||||
{
|
||||
/* If the source device is a touch device, do not
|
||||
* propagate any enter event yet, until one is
|
||||
* synthesized when needed.
|
||||
*/
|
||||
if (source_device &&
|
||||
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
|
||||
info->need_touch_press_enter = TRUE;
|
||||
|
||||
pointer_window = NULL;
|
||||
|
||||
if (new_toplevel &&
|
||||
!info->need_touch_press_enter)
|
||||
{
|
||||
/* Find (possibly virtual) child window */
|
||||
pointer_window =
|
||||
_gdk_window_find_descendant_at (new_toplevel,
|
||||
x, y,
|
||||
NULL, NULL);
|
||||
}
|
||||
pointer_window = NULL;
|
||||
if (new_toplevel)
|
||||
{
|
||||
/* Find (possibly virtual) child window */
|
||||
pointer_window =
|
||||
_gdk_window_find_descendant_at (new_toplevel,
|
||||
x, y,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
if (pointer_window != last_grab->window)
|
||||
synthesize_crossing_events (display, device, source_device,
|
||||
@@ -1132,9 +1171,6 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
|
||||
{
|
||||
GdkPointerWindowInfo *info;
|
||||
|
||||
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
|
||||
device = gdk_device_get_associated_device (device);
|
||||
|
||||
if (G_UNLIKELY (!device))
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -52,14 +52,13 @@ GdkScreen * gdk_display_get_screen (GdkDisplay *display,
|
||||
GdkScreen * gdk_display_get_default_screen (GdkDisplay *display);
|
||||
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GDK_DEPRECATED_FOR(gdk_device_ungrab)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
void gdk_display_pointer_ungrab (GdkDisplay *display,
|
||||
guint32 time_);
|
||||
GDK_DEPRECATED_FOR(gdk_device_ungrab)
|
||||
void gdk_display_keyboard_ungrab (GdkDisplay *display,
|
||||
guint32 time_);
|
||||
GDK_DEPRECATED_FOR(gdk_display_device_is_grabbed)
|
||||
gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
#endif /* GDK_MULTIDEVICE_SAFE */
|
||||
|
||||
gboolean gdk_display_device_is_grabbed (GdkDisplay *display,
|
||||
@@ -71,8 +70,9 @@ void gdk_display_flush (GdkDisplay *display);
|
||||
void gdk_display_close (GdkDisplay *display);
|
||||
gboolean gdk_display_is_closed (GdkDisplay *display);
|
||||
|
||||
GDK_DEPRECATED_FOR(gdk_device_manager_list_devices)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
GList * gdk_display_list_devices (GdkDisplay *display);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
|
||||
GdkEvent* gdk_display_get_event (GdkDisplay *display);
|
||||
GdkEvent* gdk_display_peek_event (GdkDisplay *display);
|
||||
@@ -88,21 +88,20 @@ void gdk_display_set_double_click_distance (GdkDisplay *display,
|
||||
GdkDisplay *gdk_display_get_default (void);
|
||||
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GDK_DEPRECATED_FOR(gdk_device_get_position)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
void gdk_display_get_pointer (GdkDisplay *display,
|
||||
GdkScreen **screen,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
GDK_DEPRECATED_FOR(gdk_device_get_window_at_position)
|
||||
GdkWindow * gdk_display_get_window_at_pointer (GdkDisplay *display,
|
||||
gint *win_x,
|
||||
gint *win_y);
|
||||
GDK_DEPRECATED_FOR(gdk_device_warp)
|
||||
void gdk_display_warp_pointer (GdkDisplay *display,
|
||||
GdkScreen *screen,
|
||||
gint x,
|
||||
gint y);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
#endif /* GDK_MULTIDEVICE_SAFE */
|
||||
|
||||
GdkDisplay *gdk_display_open_default_libgtk_only (void);
|
||||
|
||||
@@ -75,8 +75,6 @@ typedef struct
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
guint32 state;
|
||||
guint32 button;
|
||||
GdkDevice *last_slave;
|
||||
guint need_touch_press_enter : 1;
|
||||
} GdkPointerWindowInfo;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -580,7 +580,7 @@ gdk_event_copy (const GdkEvent *event)
|
||||
case GDK_SELECTION_REQUEST:
|
||||
new_event->selection.requestor = event->selection.requestor;
|
||||
if (new_event->selection.requestor)
|
||||
g_object_ref (new_event->selection.requestor);
|
||||
g_object_unref (new_event->selection.requestor);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1448,56 +1448,6 @@ gdk_event_request_motions (const GdkEventMotion *event)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_event_triggers_context_menu:
|
||||
* @event: a #GdkEvent, currently only button events are meaningful values
|
||||
*
|
||||
* This function returns whether a #GdkEventButton should trigger a
|
||||
* context menu, according to platform conventions. The right mouse
|
||||
* button always triggers context menus. Additionally, if
|
||||
* gdk_keymap_get_modifier_mask() returns a non-0 mask for
|
||||
* %GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will
|
||||
* also trigger a context menu if this modifier is pressed.
|
||||
*
|
||||
* This function should always be used instead of simply checking for
|
||||
* event->button == 3.
|
||||
*
|
||||
* Returns: %TRUE if the event should trigger a context menu.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
gboolean
|
||||
gdk_event_triggers_context_menu (const GdkEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS)
|
||||
{
|
||||
const GdkEventButton *bevent = (const GdkEventButton *) event;
|
||||
GdkDisplay *display;
|
||||
GdkModifierType modifier;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (bevent->window), FALSE);
|
||||
|
||||
if (bevent->button == 3 &&
|
||||
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
|
||||
return TRUE;
|
||||
|
||||
display = gdk_window_get_display (bevent->window);
|
||||
|
||||
modifier = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
|
||||
GDK_MODIFIER_INTENT_CONTEXT_MENU);
|
||||
|
||||
if (modifier != 0 &&
|
||||
bevent->button == 1 &&
|
||||
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
|
||||
(bevent->state & modifier))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_events_get_axis_distances (GdkEvent *event1,
|
||||
GdkEvent *event2,
|
||||
|
||||
@@ -74,25 +74,6 @@ G_BEGIN_DECLS
|
||||
*/
|
||||
#define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
|
||||
|
||||
/**
|
||||
* GDK_EVENT_PROPAGATE:
|
||||
*
|
||||
* Use this macro as the return value for continuing the propagation of
|
||||
* an event handler.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
#define GDK_EVENT_PROPAGATE (FALSE)
|
||||
|
||||
/**
|
||||
* GDK_EVENT_STOP:
|
||||
*
|
||||
* Use this macro as the return value for stopping the propagation of
|
||||
* an event handler.
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
#define GDK_EVENT_STOP (TRUE)
|
||||
|
||||
typedef struct _GdkEventAny GdkEventAny;
|
||||
typedef struct _GdkEventExpose GdkEventExpose;
|
||||
@@ -354,15 +335,6 @@ typedef enum
|
||||
* @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
|
||||
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
|
||||
* state (e.g. sensitivity).
|
||||
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
|
||||
* state (e.g. sensitivity).
|
||||
* @GDK_CROSSING_TOUCH_PRESS: crossing because a touch device was pressed,
|
||||
* this event is synthetic as the pointer might have not left the window.
|
||||
* @GDK_CROSSING_TOUCH_RELEASE: crossing because a touch device was released.
|
||||
* this event is synthetic as the pointer might have not left the window.
|
||||
* @GDK_CROSSING_DEVICE_SWITCH: crossing because of a device switch (i.e.
|
||||
* a mouse taking control of the pointer after a touch device), this event
|
||||
* is synthetic as the pointer didn't leave the window.
|
||||
*
|
||||
* Specifies the crossing mode for #GdkEventCrossing.
|
||||
*/
|
||||
@@ -373,10 +345,7 @@ typedef enum
|
||||
GDK_CROSSING_UNGRAB,
|
||||
GDK_CROSSING_GTK_GRAB,
|
||||
GDK_CROSSING_GTK_UNGRAB,
|
||||
GDK_CROSSING_STATE_CHANGED,
|
||||
GDK_CROSSING_TOUCH_PRESS,
|
||||
GDK_CROSSING_TOUCH_RELEASE,
|
||||
GDK_CROSSING_DEVICE_SWITCH
|
||||
GDK_CROSSING_STATE_CHANGED
|
||||
} GdkCrossingMode;
|
||||
|
||||
/**
|
||||
@@ -402,7 +371,6 @@ typedef enum
|
||||
* decorations.
|
||||
* @GDK_WINDOW_STATE_ABOVE: the window is kept above other windows.
|
||||
* @GDK_WINDOW_STATE_BELOW: the window is kept below other windows.
|
||||
* @GDK_WINDOW_STATE_FOCUSED: the window is presented as focused (with active decorations).
|
||||
*
|
||||
* Specifies the state of a toplevel window.
|
||||
*/
|
||||
@@ -414,8 +382,7 @@ typedef enum
|
||||
GDK_WINDOW_STATE_STICKY = 1 << 3,
|
||||
GDK_WINDOW_STATE_FULLSCREEN = 1 << 4,
|
||||
GDK_WINDOW_STATE_ABOVE = 1 << 5,
|
||||
GDK_WINDOW_STATE_BELOW = 1 << 6,
|
||||
GDK_WINDOW_STATE_FOCUSED = 1 << 7
|
||||
GDK_WINDOW_STATE_BELOW = 1 << 6
|
||||
} GdkWindowState;
|
||||
|
||||
/**
|
||||
@@ -1109,8 +1076,7 @@ GdkDevice* gdk_event_get_device (const GdkEvent *event);
|
||||
void gdk_event_set_source_device (GdkEvent *event,
|
||||
GdkDevice *device);
|
||||
GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
|
||||
void gdk_event_request_motions (const GdkEventMotion *event);
|
||||
gboolean gdk_event_triggers_context_menu (const GdkEvent *event);
|
||||
void gdk_event_request_motions (const GdkEventMotion *event);
|
||||
|
||||
gboolean gdk_events_get_distance (GdkEvent *event1,
|
||||
GdkEvent *event2,
|
||||
|
||||
@@ -204,7 +204,6 @@ struct _GdkWindow
|
||||
guint input_only : 1;
|
||||
guint modal_hint : 1;
|
||||
guint composited : 1;
|
||||
guint has_alpha_background : 1;
|
||||
|
||||
guint destroyed : 2;
|
||||
|
||||
@@ -228,18 +227,10 @@ struct _GdkWindow
|
||||
|
||||
gint abs_x, abs_y; /* Absolute offset in impl */
|
||||
gint width, height;
|
||||
guint32 clip_tag;
|
||||
|
||||
/* The clip region is the part of the window, in window coordinates
|
||||
that is fully or partially (i.e. semi transparently) visible in
|
||||
the window hierarchy from the toplevel and down */
|
||||
cairo_region_t *clip_region;
|
||||
/* This is the clip region, with additionally all the opaque
|
||||
child windows removed */
|
||||
cairo_region_t *clip_region_with_children;
|
||||
/* The layered region is the subset of clip_region that
|
||||
is covered by non-opaque sibling or ancestor sibling window. */
|
||||
cairo_region_t *layered_region;
|
||||
|
||||
cairo_region_t *clip_region; /* Clip region (wrt toplevel) in window coords */
|
||||
cairo_region_t *clip_region_with_children; /* Clip region in window coords */
|
||||
GdkCursor *cursor;
|
||||
GHashTable *device_cursor;
|
||||
|
||||
@@ -400,6 +391,11 @@ void _gdk_display_set_window_under_pointer (GdkDisplay *display,
|
||||
|
||||
void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
|
||||
|
||||
cairo_region_t *_gdk_window_calculate_full_clip_region (GdkWindow *window,
|
||||
GdkWindow *base_window,
|
||||
gboolean do_children,
|
||||
gint *base_x_offset,
|
||||
gint *base_y_offset);
|
||||
gboolean _gdk_window_has_impl (GdkWindow *window);
|
||||
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
|
||||
|
||||
|
||||
@@ -109,11 +109,6 @@ enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
||||
static GdkModifierType gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (GdkKeymap, gdk_keymap, G_TYPE_OBJECT)
|
||||
@@ -123,8 +118,6 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
klass->get_modifier_mask = gdk_keymap_real_get_modifier_mask;
|
||||
|
||||
/**
|
||||
* GdkKeymap::direction-changed:
|
||||
* @keymap: the object on which the signal is emitted
|
||||
@@ -407,9 +400,6 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
gint *n_keys)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
|
||||
g_return_val_if_fail (keys != NULL, FALSE);
|
||||
g_return_val_if_fail (n_keys != NULL, FALSE);
|
||||
g_return_val_if_fail (keyval != 0, FALSE);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->get_entries_for_keyval (keymap, keyval,
|
||||
keys, n_keys);
|
||||
@@ -442,7 +432,6 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
||||
gint *n_entries)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
|
||||
g_return_val_if_fail (n_entries != NULL, FALSE);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->get_entries_for_keycode (keymap, hardware_keycode,
|
||||
keys, keyvals, n_entries);
|
||||
@@ -466,7 +455,6 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
|
||||
const GdkKeymapKey *key)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
|
||||
g_return_val_if_fail (key != NULL, 0);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->lookup_key (keymap, key);
|
||||
}
|
||||
@@ -618,64 +606,6 @@ gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
return GDK_KEYMAP_GET_CLASS(keymap)->map_virtual_modifiers (keymap, state);
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
switch (intent)
|
||||
{
|
||||
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
|
||||
return 0;
|
||||
|
||||
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
|
||||
return GDK_SHIFT_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
|
||||
return GDK_MOD1_MASK | GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_get_modifier_mask:
|
||||
* @keymap: a #GdkKeymap
|
||||
* @intent: the use case for the modifier mask
|
||||
*
|
||||
* Returns the modifier mask the @keymap's windowing system backend
|
||||
* uses for a particular purpose.
|
||||
*
|
||||
* Note that this function always returns real hardware modifiers, not
|
||||
* virtual ones (e.g. it will return #GDK_MOD1_MASK rather than
|
||||
* #GDK_META_MASK if the backend maps MOD1 to META), so there are use
|
||||
* cases where the return value of this function has to be transformed
|
||||
* by gdk_keymap_add_virtual_modifiers() in order to contain the
|
||||
* expected result.
|
||||
*
|
||||
* Returns: the modifier mask used for @intent.
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
GdkModifierType
|
||||
gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), 0);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_mask (keymap, intent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_keyval_name:
|
||||
* @keyval: a key value
|
||||
|
||||
@@ -114,9 +114,6 @@ void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
|
||||
/* Key values
|
||||
*/
|
||||
|
||||
@@ -61,8 +61,6 @@ struct _GdkKeymapClass
|
||||
GdkModifierType *state);
|
||||
gboolean (* map_virtual_modifiers) (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GdkModifierType (*get_modifier_mask) (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
|
||||
/* Signals */
|
||||
|
||||
@@ -78,28 +78,27 @@ const gchar * gdk_get_display_arg_name (void);
|
||||
gchar* gdk_get_display (void);
|
||||
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GDK_DEPRECATED_FOR(gdk_device_grab)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_);
|
||||
GDK_DEPRECATED_FOR(gdk_device_grab)
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_);
|
||||
GdkGrabStatus gdk_keyboard_grab (GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
guint32 time_);
|
||||
gboolean owner_events,
|
||||
guint32 time_);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
#endif /* GDK_MULTIDEVICE_SAFE */
|
||||
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GDK_DEPRECATED_FOR(gdk_device_ungrab)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
void gdk_pointer_ungrab (guint32 time_);
|
||||
GDK_DEPRECATED_FOR(gdk_device_ungrab)
|
||||
void gdk_keyboard_ungrab (guint32 time_);
|
||||
GDK_DEPRECATED_FOR(gdk_display_device_is_grabbed)
|
||||
gboolean gdk_pointer_is_grabbed (void);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
#endif /* GDK_MULTIDEVICE_SAFE */
|
||||
|
||||
gint gdk_screen_width (void) G_GNUC_CONST;
|
||||
|
||||
@@ -750,16 +750,12 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
/**
|
||||
* gdk_screen_get_monitor_geometry:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: the monitor number
|
||||
* @dest: (out) (allow-none): a #GdkRectangle to be filled with
|
||||
* the monitor geometry
|
||||
* @monitor_num: the monitor number, between 0 and gdk_screen_get_n_monitors (screen)
|
||||
* @dest: (out) (allow-none): a #GdkRectangle to be filled with the monitor geometry
|
||||
*
|
||||
* Retrieves the #GdkRectangle representing the size and position of
|
||||
* the individual monitor within the entire screen area.
|
||||
*
|
||||
* Monitor numbers start at 0. To obtain the number of monitors of
|
||||
* @screen, use gdk_screen_get_n_monitors().
|
||||
*
|
||||
* Note that the size of the entire screen area can be retrieved via
|
||||
* gdk_screen_get_width() and gdk_screen_get_height().
|
||||
*
|
||||
@@ -773,33 +769,6 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
GDK_SCREEN_GET_CLASS(screen)->get_monitor_geometry (screen, monitor_num, dest);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_get_monitor_workarea:
|
||||
* @screen: a #GdkScreen
|
||||
* @monitor_num: the monitor number
|
||||
* @dest: (out) (allow-none): a #GdkRectangle to be filled with
|
||||
* the monitor workarea
|
||||
*
|
||||
* Retrieves the #GdkRectangle representing the size and position of
|
||||
* the "work area" on a monitor within the entire screen area.
|
||||
*
|
||||
* The work area should be considered when positioning menus and
|
||||
* similar popups, to avoid placing them below panels, docks or other
|
||||
* desktop components.
|
||||
*
|
||||
* Monitor numbers start at 0. To obtain the number of monitors of
|
||||
* @screen, use gdk_screen_get_n_monitors().
|
||||
*
|
||||
* Since: 3.4
|
||||
*/
|
||||
void
|
||||
gdk_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
GDK_SCREEN_GET_CLASS(screen)->get_monitor_workarea (screen, monitor_num, dest);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_screen_list_visuals:
|
||||
* @screen: the relevant #GdkScreen.
|
||||
|
||||
@@ -57,15 +57,11 @@ GList * gdk_screen_list_visuals (GdkScreen *screen);
|
||||
GList * gdk_screen_get_toplevel_windows (GdkScreen *screen);
|
||||
gchar * gdk_screen_make_display_name (GdkScreen *screen);
|
||||
|
||||
gint gdk_screen_get_n_monitors (GdkScreen *screen);
|
||||
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
|
||||
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest);
|
||||
void gdk_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest);
|
||||
|
||||
gint gdk_screen_get_n_monitors (GdkScreen *screen);
|
||||
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
|
||||
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest);
|
||||
gint gdk_screen_get_monitor_at_point (GdkScreen *screen,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
@@ -62,9 +62,6 @@ struct _GdkScreenClass
|
||||
void (* get_monitor_geometry) (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest);
|
||||
void (* get_monitor_workarea) (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest);
|
||||
GList * (* list_visuals) (GdkScreen *screen);
|
||||
GdkVisual * (* get_system_visual) (GdkScreen *screen);
|
||||
GdkVisual * (* get_rgba_visual) (GdkScreen *screen);
|
||||
|
||||
@@ -242,44 +242,6 @@ typedef enum
|
||||
GDK_MODIFIER_MASK = 0x5c001fff
|
||||
} GdkModifierType;
|
||||
|
||||
/**
|
||||
* GdkModifierIntent:
|
||||
* @GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR: the primary modifier used to invoke
|
||||
* menu accelerators.
|
||||
* @GDK_MODIFIER_INTENT_CONTEXT_MENU: the modifier used to invoke context menus.
|
||||
* Note that mouse button 3 always triggers context menus. When this modifier
|
||||
* is not 0, it <strong>additionally</strong> triggers context menus when used
|
||||
* with mouse button 1.
|
||||
* @GDK_MODIFIER_INTENT_EXTEND_SELECTION: the modifier used to extend selections
|
||||
* using <modifier>-click or <modifier>-cursor-key
|
||||
* @GDK_MODIFIER_INTENT_MODIFY_SELECTION: the modifier used to modify selections,
|
||||
* which in most cases means toggling the clicked item into or out of the selection.
|
||||
* @GDK_MODIFIER_INTENT_NO_TEXT_INPUT: when any of these modifiers is pressed, the
|
||||
* key event cannot produce a symbol directly. This is meant to be used for
|
||||
* input methods, and for use cases like typeahead search.
|
||||
* @GDK_MODIFIER_INTENT_SHIFT_GROUP: the modifier that switches between keyboard
|
||||
* groups (AltGr on X11/Windows and Option/Alt on OS X).
|
||||
*
|
||||
* This enum is used with gdk_keymap_get_modifier_mask() and
|
||||
* gdk_get_modifier_mask() in order to determine what modifiers the
|
||||
* currently used windowing system backend uses for particular
|
||||
* purposes. For example, on X11/Windows, the Control key is used for
|
||||
* invoking menu shortcuts (accelerators), whereas on Apple computers
|
||||
* it's the Command key (which correspond to %GDK_CONTROL_MASK and
|
||||
* %GDK_MOD2_MASK, respectively).
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
typedef enum
|
||||
{
|
||||
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR,
|
||||
GDK_MODIFIER_INTENT_CONTEXT_MENU,
|
||||
GDK_MODIFIER_INTENT_EXTEND_SELECTION,
|
||||
GDK_MODIFIER_INTENT_MODIFY_SELECTION,
|
||||
GDK_MODIFIER_INTENT_NO_TEXT_INPUT,
|
||||
GDK_MODIFIER_INTENT_SHIFT_GROUP
|
||||
} GdkModifierIntent;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_OK = 0,
|
||||
|
||||
780
gdk/gdkwindow.c
780
gdk/gdkwindow.c
File diff suppressed because it is too large
Load Diff
@@ -53,8 +53,8 @@ typedef struct _GdkWindowRedirect GdkWindowRedirect;
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_INPUT_OUTPUT, /*< nick=input-output >*/
|
||||
GDK_INPUT_ONLY /*< nick=input-only >*/
|
||||
GDK_INPUT_OUTPUT,
|
||||
GDK_INPUT_ONLY
|
||||
} GdkWindowWindowClass;
|
||||
|
||||
/**
|
||||
@@ -503,7 +503,6 @@ GdkVisual * gdk_window_get_visual (GdkWindow *window);
|
||||
GdkScreen * gdk_window_get_screen (GdkWindow *window);
|
||||
GdkDisplay * gdk_window_get_display (GdkWindow *window);
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GDK_DEPRECATED_FOR(gdk_device_get_window_at_position)
|
||||
GdkWindow* gdk_window_at_pointer (gint *win_x,
|
||||
gint *win_y);
|
||||
#endif /* GDK_MULTIDEVICE_SAFE */
|
||||
@@ -657,7 +656,6 @@ void gdk_window_set_startup_id (GdkWindow *window,
|
||||
const gchar *startup_id);
|
||||
void gdk_window_set_transient_for (GdkWindow *window,
|
||||
GdkWindow *parent);
|
||||
GDK_DEPRECATED_FOR(gdk_window_set_background_rgba)
|
||||
void gdk_window_set_background (GdkWindow *window,
|
||||
const GdkColor *color);
|
||||
void gdk_window_set_background_rgba (GdkWindow *window,
|
||||
@@ -712,11 +710,10 @@ void gdk_window_get_frame_extents (GdkWindow *window,
|
||||
GdkRectangle *rect);
|
||||
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GDK_DEPRECATED_FOR(gdk_window_get_device_position)
|
||||
GdkWindow * gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
GdkWindow* gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
GdkModifierType *mask);
|
||||
#endif /* GDK_MULTIDEVICE_SAFE */
|
||||
GdkWindow * gdk_window_get_device_position (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -785,32 +782,19 @@ void gdk_window_register_dnd (GdkWindow *window);
|
||||
|
||||
GdkDragProtocol
|
||||
gdk_window_get_drag_protocol(GdkWindow *window,
|
||||
GdkWindow **target);
|
||||
GdkWindow **target);
|
||||
|
||||
void gdk_window_begin_resize_drag (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void gdk_window_begin_resize_drag_for_device (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void gdk_window_begin_move_drag (GdkWindow *window,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void gdk_window_begin_move_drag_for_device (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void gdk_window_begin_resize_drag (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void gdk_window_begin_move_drag (GdkWindow *window,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
|
||||
/* Interface for dirty-region queueing */
|
||||
void gdk_window_invalidate_rect (GdkWindow *window,
|
||||
|
||||
@@ -231,18 +231,16 @@ struct _GdkWindowImplClass
|
||||
void (* set_functions) (GdkWindow *window,
|
||||
GdkWMFunction functions);
|
||||
void (* begin_resize_drag) (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
GdkWindowEdge edge,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move_drag) (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* enable_synchronized_configure) (GdkWindow *window);
|
||||
void (* configure_finished) (GdkWindow *window);
|
||||
void (* set_opacity) (GdkWindow *window,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
if (@ARGV != 2) {
|
||||
die "Usage: gen-keyname-table.pl keynames.txt keynames-translate.txt > keyname-table.h\n";
|
||||
if (@ARGV != 1) {
|
||||
die "Usage: gen-keyname-table.pl keynames.txt > keyname-table.h\n";
|
||||
}
|
||||
|
||||
open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n";
|
||||
@@ -20,18 +20,6 @@ while (defined($_ = <IN>)) {
|
||||
push @translate, $2;
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
|
||||
open IN, $ARGV[1] || die "Cannot open $ARGV[1]: $!\n";
|
||||
while (defined($_ = <IN>)) {
|
||||
next if /^!/;
|
||||
if (!/^\s*([\w_]*\S)\s+$/) {
|
||||
die "Cannot parse line $_";
|
||||
}
|
||||
|
||||
push @translate, $1;
|
||||
}
|
||||
close IN;
|
||||
|
||||
$offset = 0;
|
||||
|
||||
@@ -111,30 +99,13 @@ print <<EOT;
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* Translators, the strings in the 'keyboard label' context are
|
||||
* display names for keyboard keys. Some of them have prefixes like
|
||||
* XF86 or ISO_ - these should be removed in the translation. Similarly,
|
||||
* underscores should be replaced by spaces. The prefix 'KP_' stands
|
||||
* for 'key pad' and you may want to include that in your translation.
|
||||
* Here are some examples of English translations:
|
||||
* XF86AudioMute - Audio mute
|
||||
* Scroll_lock - Scroll lock
|
||||
* KP_Space - Space (keypad)
|
||||
*/
|
||||
EOT
|
||||
|
||||
for $key (@translate) {
|
||||
if ($key eq 'KP_Space') {
|
||||
print "/* Translators: KP_ means 'key pad' here */\n";
|
||||
}
|
||||
if ($key eq 'XF86MonBrightnessUp') {
|
||||
print "/* Translators: 'Mon' means Monitor here, and the XF86 prefix should be removed */\n";
|
||||
}
|
||||
print <<EOT;
|
||||
NC_("keyboard label", "$key")
|
||||
N_("keyboard label|$key")
|
||||
EOT
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOT;
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
XF86MonBrightnessUp
|
||||
XF86MonBrightnessDown
|
||||
XF86KbdBrightnessUp
|
||||
XF86KbdBrightnessDown
|
||||
XF86AudioMute
|
||||
XF86AudioLowerVolume
|
||||
XF86AudioRaiseVolume
|
||||
XF86AudioPlay
|
||||
XF86AudioStop
|
||||
XF86AudioNext
|
||||
XF86AudioPrev
|
||||
XF86AudioRecord
|
||||
XF86AudioPause
|
||||
XF86AudioRewind
|
||||
XF86AudioMedia
|
||||
XF86ScreenSaver
|
||||
XF86Battery
|
||||
XF86Launch1
|
||||
XF86Forward
|
||||
XF86Back
|
||||
XF86Sleep
|
||||
XF86Hibernate
|
||||
XF86WLAN
|
||||
XF86WebCam
|
||||
XF86Display
|
||||
XF86TouchpadToggle
|
||||
XF86WakeUp
|
||||
XF86Suspend
|
||||
@@ -54,12 +54,6 @@ static GdkWindow *current_keyboard_window;
|
||||
static void append_event (GdkEvent *event,
|
||||
gboolean windowing);
|
||||
|
||||
static GdkWindow *find_toplevel_under_pointer (GdkDisplay *display,
|
||||
NSPoint screen_point,
|
||||
gint *x,
|
||||
gint *y);
|
||||
|
||||
|
||||
void
|
||||
_gdk_quartz_events_init (void)
|
||||
{
|
||||
@@ -331,61 +325,6 @@ get_event_mask_from_ns_event (NSEvent *nsevent)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
get_window_point_from_screen_point (GdkWindow *window,
|
||||
NSPoint screen_point,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
NSPoint point;
|
||||
NSWindow *nswindow;
|
||||
|
||||
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
|
||||
|
||||
point = [nswindow convertScreenToBase:screen_point];
|
||||
|
||||
*x = point.x;
|
||||
*y = window->height - point.y;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
get_toplevel_from_ns_event (NSEvent *nsevent,
|
||||
NSPoint *screen_point,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
GdkWindow *toplevel;
|
||||
|
||||
if ([nsevent window])
|
||||
{
|
||||
GdkQuartzView *view;
|
||||
NSPoint point;
|
||||
|
||||
view = (GdkQuartzView *)[[nsevent window] contentView];
|
||||
|
||||
toplevel = [view gdkWindow];
|
||||
|
||||
point = [nsevent locationInWindow];
|
||||
*screen_point = [[nsevent window] convertBaseToScreen:point];
|
||||
|
||||
*x = point.x;
|
||||
*y = toplevel->height - point.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fallback used when no NSWindow set. This happens e.g. when
|
||||
* we allow motion events without a window set in gdk_event_translate()
|
||||
* that occur immediately after the main menu bar was clicked/used.
|
||||
*/
|
||||
*screen_point = [NSEvent mouseLocation];
|
||||
toplevel = find_toplevel_under_pointer (_gdk_display,
|
||||
*screen_point,
|
||||
x, y);
|
||||
}
|
||||
|
||||
return toplevel;
|
||||
}
|
||||
|
||||
static GdkEvent *
|
||||
create_focus_event (GdkWindow *window,
|
||||
gboolean in)
|
||||
@@ -407,18 +346,31 @@ create_focus_event (GdkWindow *window,
|
||||
static void
|
||||
generate_motion_event (GdkWindow *window)
|
||||
{
|
||||
NSPoint point;
|
||||
NSPoint screen_point;
|
||||
NSWindow *nswindow;
|
||||
GdkQuartzView *view;
|
||||
GdkEvent *event;
|
||||
gint x, y, x_root, y_root;
|
||||
GdkDisplay *display;
|
||||
|
||||
event = gdk_event_new (GDK_MOTION_NOTIFY);
|
||||
event->any.window = NULL;
|
||||
event->any.send_event = TRUE;
|
||||
|
||||
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
|
||||
view = (GdkQuartzView *)[nswindow contentView];
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
screen_point = [NSEvent mouseLocation];
|
||||
|
||||
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
|
||||
get_window_point_from_screen_point (window, screen_point, &x, &y);
|
||||
|
||||
point = [nswindow convertScreenToBase:screen_point];
|
||||
|
||||
x = point.x;
|
||||
y = window->height - point.y;
|
||||
|
||||
event->any.type = GDK_MOTION_NOTIFY;
|
||||
event->motion.window = window;
|
||||
@@ -484,7 +436,9 @@ _gdk_quartz_events_update_focus_window (GdkWindow *window,
|
||||
void
|
||||
_gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
|
||||
{
|
||||
NSPoint point;
|
||||
NSPoint screen_point;
|
||||
NSWindow *nswindow;
|
||||
GdkEvent *event;
|
||||
gint x, y, x_root, y_root;
|
||||
|
||||
@@ -492,10 +446,16 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
|
||||
event->any.window = NULL;
|
||||
event->any.send_event = FALSE;
|
||||
|
||||
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
|
||||
|
||||
screen_point = [NSEvent mouseLocation];
|
||||
|
||||
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
|
||||
get_window_point_from_screen_point (window, screen_point, &x, &y);
|
||||
|
||||
point = [nswindow convertScreenToBase:screen_point];
|
||||
|
||||
x = point.x;
|
||||
y = window->height - point.y;
|
||||
|
||||
event->crossing.window = window;
|
||||
event->crossing.subwindow = NULL;
|
||||
@@ -545,7 +505,17 @@ find_toplevel_under_pointer (GdkDisplay *display,
|
||||
info = _gdk_display_get_pointer_info (display, display->core_pointer);
|
||||
toplevel = info->toplevel_under_pointer;
|
||||
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
|
||||
get_window_point_from_screen_point (toplevel, screen_point, x, y);
|
||||
{
|
||||
NSWindow *nswindow;
|
||||
NSPoint point;
|
||||
|
||||
nswindow = ((GdkWindowImplQuartz *)toplevel->impl)->toplevel;
|
||||
|
||||
point = [nswindow convertScreenToBase:screen_point];
|
||||
|
||||
*x = point.x;
|
||||
*y = toplevel->height - point.y;
|
||||
}
|
||||
|
||||
return toplevel;
|
||||
}
|
||||
@@ -593,17 +563,22 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
NSPoint point;
|
||||
NSPoint screen_point;
|
||||
NSEventType event_type;
|
||||
GdkWindow *toplevel;
|
||||
GdkQuartzView *view;
|
||||
GdkDisplay *display;
|
||||
GdkDeviceGrabInfo *grab;
|
||||
|
||||
toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
|
||||
view = (GdkQuartzView *)[[nsevent window] contentView];
|
||||
toplevel = [view gdkWindow];
|
||||
|
||||
display = gdk_window_get_display (toplevel);
|
||||
|
||||
event_type = [nsevent type];
|
||||
point = [nsevent locationInWindow];
|
||||
screen_point = [[nsevent window] convertBaseToScreen:point];
|
||||
|
||||
/* From the docs for XGrabPointer:
|
||||
*
|
||||
@@ -651,10 +626,16 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
|
||||
{
|
||||
/* Finally check the grab window. */
|
||||
GdkWindow *grab_toplevel;
|
||||
NSWindow *grab_nswindow;
|
||||
|
||||
grab_toplevel = gdk_window_get_effective_toplevel (grab->window);
|
||||
get_window_point_from_screen_point (grab_toplevel, screen_point,
|
||||
x, y);
|
||||
|
||||
grab_nswindow = ((GdkWindowImplQuartz *)grab_toplevel->impl)->toplevel;
|
||||
point = [grab_nswindow convertScreenToBase:screen_point];
|
||||
|
||||
/* Note: x_root and y_root are already right. */
|
||||
*x = point.x;
|
||||
*y = grab_toplevel->height - point.y;
|
||||
|
||||
return grab_toplevel;
|
||||
}
|
||||
@@ -712,13 +693,20 @@ find_window_for_ns_event (NSEvent *nsevent,
|
||||
gint *y_root)
|
||||
{
|
||||
GdkQuartzView *view;
|
||||
GdkWindow *toplevel;
|
||||
NSPoint point;
|
||||
NSPoint screen_point;
|
||||
NSEventType event_type;
|
||||
GdkWindow *toplevel;
|
||||
|
||||
view = (GdkQuartzView *)[[nsevent window] contentView];
|
||||
toplevel = [view gdkWindow];
|
||||
|
||||
point = [nsevent locationInWindow];
|
||||
screen_point = [[nsevent window] convertBaseToScreen:point];
|
||||
|
||||
*x = point.x;
|
||||
*y = toplevel->height - point.y;
|
||||
|
||||
toplevel = get_toplevel_from_ns_event (nsevent, &screen_point, x, y);
|
||||
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, x_root, y_root);
|
||||
|
||||
event_type = [nsevent type];
|
||||
@@ -1105,12 +1093,11 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
|
||||
{
|
||||
GdkWindowImplQuartz *toplevel_impl;
|
||||
gboolean lion;
|
||||
|
||||
/* Resizing only begins if an NSLeftMouseButton event is received in
|
||||
* the resizing area. Handle anything else.
|
||||
*/
|
||||
if ([event type] != NSLeftMouseDown)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
|
||||
if ([toplevel_impl->toplevel showsResizeIndicator])
|
||||
@@ -1128,13 +1115,14 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
|
||||
* is too important to not make functional.
|
||||
*/
|
||||
frame = [toplevel_impl->view bounds];
|
||||
if (x > frame.size.width - GRIP_WIDTH &&
|
||||
x < frame.size.width &&
|
||||
y > frame.size.height - GRIP_HEIGHT &&
|
||||
y < frame.size.height)
|
||||
return TRUE;
|
||||
if (x > frame.size.width - GRIP_WIDTH
|
||||
&& x < frame.size.width
|
||||
&& y > frame.size.height - GRIP_HEIGHT
|
||||
&& y < frame.size.height)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we're on Lion and within 5 pixels of an edge,
|
||||
* then assume that the user wants to resize, and
|
||||
* return NULL to let Quartz get on with it. We check
|
||||
@@ -1142,12 +1130,14 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
|
||||
* This extra check is in case the user starts
|
||||
* dragging before GDK recognizes the grab.
|
||||
*/
|
||||
lion = gdk_quartz_osx_version () >= GDK_OSX_LION;
|
||||
if (lion && (x < GDK_LION_RESIZE ||
|
||||
x > toplevel->width - GDK_LION_RESIZE ||
|
||||
y > toplevel->height - GDK_LION_RESIZE))
|
||||
return TRUE;
|
||||
|
||||
lion = gdk_quartz_osx_version() >= GDK_OSX_LION;
|
||||
if (lion && (x < GDK_LION_RESIZE ||
|
||||
x > toplevel->width - GDK_LION_RESIZE ||
|
||||
y > toplevel->height - GDK_LION_RESIZE))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1195,33 +1185,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
nswindow = [nsevent window];
|
||||
|
||||
/* Ignore events for windows not created by GDK. */
|
||||
if (nswindow && ![[nswindow contentView] isKindOfClass:[GdkQuartzView class]])
|
||||
/* Ignore events for no window or ones not created by GDK. */
|
||||
if (!nswindow || ![[nswindow contentView] isKindOfClass:[GdkQuartzView class]])
|
||||
return FALSE;
|
||||
|
||||
/* Ignore events for ones with no windows */
|
||||
if (!nswindow)
|
||||
{
|
||||
GdkWindow *toplevel = NULL;
|
||||
|
||||
if (event_type == NSMouseMoved)
|
||||
{
|
||||
/* Motion events received after clicking the menu bar do not have the
|
||||
* window field set. Instead of giving up on the event immediately,
|
||||
* we first check whether this event is within our window bounds.
|
||||
*/
|
||||
NSPoint screen_point = [NSEvent mouseLocation];
|
||||
gint x_tmp, y_tmp;
|
||||
|
||||
toplevel = find_toplevel_under_pointer (_gdk_display,
|
||||
screen_point,
|
||||
&x_tmp, &y_tmp);
|
||||
}
|
||||
|
||||
if (!toplevel)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Ignore events and break grabs while the window is being
|
||||
* dragged. This is a workaround for the window getting events for
|
||||
* the window title.
|
||||
@@ -1238,9 +1205,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
window = find_window_for_ns_event (nsevent, &x, &y, &x_root, &y_root);
|
||||
if (!window)
|
||||
return FALSE;
|
||||
|
||||
/* Quartz handles resizing on its own, so we want to stay out of the way. */
|
||||
if (test_resize (nsevent, window, x, y))
|
||||
if (test_resize(nsevent, window, x, y))
|
||||
return FALSE;
|
||||
|
||||
/* Apply any window filters. */
|
||||
|
||||
@@ -31,13 +31,14 @@ GdkOSXVersion
|
||||
gdk_quartz_osx_version (void)
|
||||
{
|
||||
gint minor;
|
||||
OSErr err = Gestalt (gestaltSystemVersionMinor, &minor);
|
||||
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
|
||||
OSErr err = Gestalt(gestaltSystemVersionMinor, &minor);
|
||||
g_return_val_if_fail(err == noErr, GDK_OSX_UNSUPPORTED);
|
||||
|
||||
if (minor < GDK_OSX_MIN)
|
||||
return GDK_OSX_UNSUPPORTED;
|
||||
return GDK_OSX_UNSUPPORTED;
|
||||
else if (minor > GDK_OSX_CURRENT)
|
||||
return GDK_OSX_NEW;
|
||||
return GDK_OSX_NEW;
|
||||
else
|
||||
return minor;
|
||||
return minor;
|
||||
|
||||
}
|
||||
|
||||
@@ -692,18 +692,12 @@ gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
|
||||
if (hardware_keycode < 0 || hardware_keycode >= NUM_KEYCODES)
|
||||
return FALSE;
|
||||
|
||||
/* Check if modifiers modify the keyval */
|
||||
for (bit = GDK_SHIFT_MASK; bit < GDK_BUTTON1_MASK; bit <<= 1)
|
||||
|
||||
/* Check if shift or capslock modify the keyval */
|
||||
for (bit = GDK_SHIFT_MASK; bit < GDK_CONTROL_MASK; bit <<= 1)
|
||||
{
|
||||
if (translate_keysym (hardware_keycode,
|
||||
(bit == GDK_MOD1_MASK) ? 0 : group,
|
||||
state & ~bit,
|
||||
NULL, NULL) !=
|
||||
translate_keysym (hardware_keycode,
|
||||
(bit == GDK_MOD1_MASK) ? 1 : group,
|
||||
state | bit,
|
||||
NULL, NULL))
|
||||
if (translate_keysym (hardware_keycode, group, state & ~bit, NULL, NULL) !=
|
||||
translate_keysym (hardware_keycode, group, state | bit, NULL, NULL))
|
||||
tmp_modifiers |= bit;
|
||||
}
|
||||
|
||||
@@ -736,35 +730,6 @@ gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_quartz_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
{
|
||||
switch (intent)
|
||||
{
|
||||
case GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR:
|
||||
return GDK_MOD2_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_CONTEXT_MENU:
|
||||
return GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_EXTEND_SELECTION:
|
||||
return GDK_SHIFT_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_MODIFY_SELECTION:
|
||||
return GDK_MOD2_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_NO_TEXT_INPUT:
|
||||
return GDK_MOD2_MASK | GDK_CONTROL_MASK;
|
||||
|
||||
case GDK_MODIFIER_INTENT_SHIFT_GROUP:
|
||||
return GDK_MOD1_MASK;
|
||||
|
||||
default:
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
}
|
||||
|
||||
/* What sort of key event is this? Returns one of
|
||||
* GDK_KEY_PRESS, GDK_KEY_RELEASE, GDK_NOTHING (should be ignored)
|
||||
*/
|
||||
@@ -854,5 +819,4 @@ gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
|
||||
keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
|
||||
keymap_class->get_modifier_mask = gdk_quartz_keymap_get_modifier_mask;
|
||||
}
|
||||
|
||||
@@ -462,7 +462,6 @@ gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
|
||||
screen_class->get_monitor_height_mm = gdk_quartz_screen_get_monitor_height_mm;
|
||||
screen_class->get_monitor_plug_name = gdk_quartz_screen_get_monitor_plug_name;
|
||||
screen_class->get_monitor_geometry = gdk_quartz_screen_get_monitor_geometry;
|
||||
screen_class->get_monitor_workarea = gdk_quartz_screen_get_monitor_geometry;
|
||||
screen_class->is_composited = gdk_quartz_screen_is_composited;
|
||||
screen_class->make_display_name = gdk_quartz_screen_make_display_name;
|
||||
screen_class->get_active_window = gdk_quartz_screen_get_active_window;
|
||||
|
||||
@@ -2441,7 +2441,6 @@ gdk_quartz_window_set_skip_pager_hint (GdkWindow *window,
|
||||
static void
|
||||
gdk_quartz_window_begin_resize_drag (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
@@ -2473,7 +2472,6 @@ gdk_quartz_window_begin_resize_drag (GdkWindow *window,
|
||||
|
||||
static void
|
||||
gdk_quartz_window_begin_move_drag (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
|
||||
@@ -168,6 +168,7 @@ static GdkCursor *
|
||||
create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
|
||||
{
|
||||
GdkWaylandCursor *cursor;
|
||||
struct wl_visual *visual;
|
||||
int stride, fd;
|
||||
char *filename;
|
||||
GError *error = NULL;
|
||||
@@ -223,30 +224,33 @@ create_cursor(GdkDisplayWayland *display, GdkPixbuf *pixbuf, int x, int y)
|
||||
else
|
||||
memset (cursor->map, 0, 4);
|
||||
|
||||
visual = display->premultiplied_argb_visual;
|
||||
cursor->buffer = wl_shm_create_buffer(display->shm,
|
||||
fd,
|
||||
cursor->width,
|
||||
cursor->height,
|
||||
stride, WL_SHM_FORMAT_ARGB32);
|
||||
stride, visual);
|
||||
|
||||
close(fd);
|
||||
|
||||
return GDK_CURSOR (cursor);
|
||||
}
|
||||
|
||||
#define DATADIR "/usr/share/wayland"
|
||||
|
||||
static const struct {
|
||||
GdkCursorType type;
|
||||
const char *filename;
|
||||
int hotspot_x, hotspot_y;
|
||||
} cursor_definitions[] = {
|
||||
{ GDK_BLANK_CURSOR, NULL, 0, 0 },
|
||||
{ GDK_HAND1, "hand1.png", 18, 11 },
|
||||
{ GDK_HAND2, "hand2.png", 14, 8 },
|
||||
{ GDK_LEFT_PTR, "left_ptr.png", 10, 5 },
|
||||
{ GDK_SB_H_DOUBLE_ARROW, "sb_h_double_arrow.png", 15, 15 },
|
||||
{ GDK_SB_V_DOUBLE_ARROW, "sb_v_double_arrow.png", 15, 15 },
|
||||
{ GDK_XTERM, "xterm.png", 15, 15 },
|
||||
{ GDK_BOTTOM_RIGHT_CORNER, "bottom_right_corner.png", 28, 28 }
|
||||
{ GDK_HAND1, DATADIR "/hand1.png", 18, 11 },
|
||||
{ GDK_HAND2, DATADIR "/hand2.png", 14, 8 },
|
||||
{ GDK_LEFT_PTR, DATADIR "/left_ptr.png", 10, 5 },
|
||||
{ GDK_SB_H_DOUBLE_ARROW, DATADIR "/sb_h_double_arrow.png", 15, 15 },
|
||||
{ GDK_SB_V_DOUBLE_ARROW, DATADIR "/sb_v_double_arrow.png", 15, 15 },
|
||||
{ GDK_XTERM, DATADIR "/xterm.png", 15, 15 },
|
||||
{ GDK_BOTTOM_RIGHT_CORNER, DATADIR "/bottom_right_corner.png", 28, 28 }
|
||||
};
|
||||
|
||||
GdkCursor *
|
||||
@@ -254,7 +258,7 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType cursor_type)
|
||||
{
|
||||
GdkDisplayWayland *wayland_display;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
int i;
|
||||
|
||||
@@ -266,8 +270,8 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
|
||||
|
||||
if (i == G_N_ELEMENTS (cursor_definitions))
|
||||
{
|
||||
g_warning ("Unhandled cursor type %d, falling back to blank\n",
|
||||
cursor_type);
|
||||
g_warning("unhandled cursor type %d, falling back to blank\n",
|
||||
cursor_type);
|
||||
i = 0;
|
||||
}
|
||||
|
||||
@@ -279,44 +283,20 @@ _gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
|
||||
return g_object_ref (wayland_display->cursors[i]);
|
||||
|
||||
GDK_NOTE (CURSOR,
|
||||
g_message ("Creating new cursor for type %d, filename %s",
|
||||
g_message ("creating new cursor for type %d, filename %s",
|
||||
cursor_type, cursor_definitions[i].filename));
|
||||
|
||||
if (cursor_type != GDK_BLANK_CURSOR)
|
||||
pixbuf = gdk_pixbuf_new_from_file(cursor_definitions[i].filename, &error);
|
||||
else
|
||||
pixbuf = NULL;
|
||||
if (error != NULL)
|
||||
{
|
||||
const gchar * const *directories;
|
||||
gint j;
|
||||
|
||||
directories = g_get_system_data_dirs();
|
||||
|
||||
for (j = 0; directories[j] != NULL; j++)
|
||||
{
|
||||
gchar *filename;
|
||||
filename = g_build_filename (directories[j],
|
||||
"wayland",
|
||||
cursor_definitions[i].filename,
|
||||
NULL);
|
||||
if (g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, &error);
|
||||
|
||||
if (error != NULL)
|
||||
{
|
||||
g_warning ("Failed to load cursor: %s: %s",
|
||||
filename, error->message);
|
||||
g_error_free(error);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pixbuf)
|
||||
{
|
||||
g_warning ("Unable to find cursor for: %s",
|
||||
cursor_definitions[i].filename);
|
||||
return NULL;
|
||||
}
|
||||
GDK_NOTE (CURSOR,
|
||||
g_message ("failed to load %s: %s",
|
||||
cursor_definitions[i].filename, error->message));
|
||||
g_error_free(error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wayland_display->cursors[i] =
|
||||
|
||||
@@ -43,8 +43,6 @@ typedef struct _GdkDeviceCore GdkDeviceCore;
|
||||
typedef struct _GdkDeviceCoreClass GdkDeviceCoreClass;
|
||||
typedef struct _GdkWaylandDevice GdkWaylandDevice;
|
||||
|
||||
typedef struct _DataOffer DataOffer;
|
||||
|
||||
struct _GdkWaylandDevice
|
||||
{
|
||||
GdkDisplay *display;
|
||||
@@ -54,12 +52,8 @@ struct _GdkWaylandDevice
|
||||
GdkWindow *pointer_focus;
|
||||
GdkWindow *keyboard_focus;
|
||||
struct wl_input_device *device;
|
||||
struct wl_data_device *data_device;
|
||||
int32_t x, y, surface_x, surface_y;
|
||||
uint32_t time;
|
||||
|
||||
DataOffer *drag_offer;
|
||||
DataOffer *selection_offer;
|
||||
};
|
||||
|
||||
struct _GdkDeviceCore
|
||||
@@ -120,7 +114,7 @@ gdk_device_core_get_state (GdkDevice *device,
|
||||
{
|
||||
gint x_int, y_int;
|
||||
|
||||
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
|
||||
gdk_window_get_pointer (window, &x_int, &y_int, mask);
|
||||
|
||||
if (axes)
|
||||
{
|
||||
@@ -601,171 +595,17 @@ static const struct wl_input_device_listener input_device_listener = {
|
||||
input_handle_keyboard_focus,
|
||||
};
|
||||
|
||||
struct _DataOffer {
|
||||
struct wl_data_offer *offer;
|
||||
gint ref_count;
|
||||
GPtrArray *types;
|
||||
};
|
||||
|
||||
static void
|
||||
data_offer_offer (void *data,
|
||||
struct wl_data_offer *wl_data_offer,
|
||||
const char *type)
|
||||
{
|
||||
DataOffer *offer = (DataOffer *)data;
|
||||
g_debug (G_STRLOC ": %s wl_data_offer = %p type = %s",
|
||||
G_STRFUNC, wl_data_offer, type);
|
||||
|
||||
g_ptr_array_add (offer->types, g_strdup (type));
|
||||
}
|
||||
|
||||
static void
|
||||
data_offer_unref (DataOffer *offer)
|
||||
{
|
||||
offer->ref_count--;
|
||||
|
||||
if (offer->ref_count == 0)
|
||||
{
|
||||
g_ptr_array_free (offer->types, TRUE);
|
||||
g_free (offer);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_data_offer_listener data_offer_listener = {
|
||||
data_offer_offer,
|
||||
};
|
||||
|
||||
static void
|
||||
data_device_data_offer (void *data,
|
||||
struct wl_data_device *data_device,
|
||||
uint32_t id)
|
||||
{
|
||||
DataOffer *offer;
|
||||
|
||||
g_debug (G_STRLOC ": %s data_device = %p id = %lu",
|
||||
G_STRFUNC, data_device, (long unsigned int)id);
|
||||
|
||||
/* This structure is reference counted to handle the case where you get a
|
||||
* leave but are in the middle of transferring data
|
||||
*/
|
||||
offer = g_new0 (DataOffer, 1);
|
||||
offer->ref_count = 1;
|
||||
offer->types = g_ptr_array_new_with_free_func (g_free);
|
||||
offer->offer = (struct wl_data_offer *)
|
||||
wl_proxy_create_for_id ((struct wl_proxy *) data_device,
|
||||
id,
|
||||
&wl_data_offer_interface);
|
||||
|
||||
/* The DataOffer structure is then retrieved later since this sets the user
|
||||
* data.
|
||||
*/
|
||||
wl_data_offer_add_listener (offer->offer,
|
||||
&data_offer_listener,
|
||||
offer);
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_enter (void *data,
|
||||
struct wl_data_device *data_device,
|
||||
uint32_t time,
|
||||
struct wl_surface *surface,
|
||||
int32_t x,
|
||||
int32_t y,
|
||||
struct wl_data_offer *offer)
|
||||
{
|
||||
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
|
||||
|
||||
g_debug (G_STRLOC ": %s data_device = %p time = %d, surface = %p, x = %d y = %d, offer = %p",
|
||||
G_STRFUNC, data_device, time, surface, x, y, offer);
|
||||
|
||||
/* Retrieve the DataOffer associated with with the wl_data_offer - this
|
||||
* association is made when the listener is attached.
|
||||
*/
|
||||
g_assert (device->drag_offer == NULL);
|
||||
device->drag_offer = wl_data_offer_get_user_data (offer);
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_leave (void *data,
|
||||
struct wl_data_device *data_device)
|
||||
{
|
||||
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
|
||||
|
||||
g_debug (G_STRLOC ": %s data_device = %p",
|
||||
G_STRFUNC, data_device);
|
||||
|
||||
data_offer_unref (device->drag_offer);
|
||||
device->drag_offer = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_motion (void *data,
|
||||
struct wl_data_device *data_device,
|
||||
uint32_t time,
|
||||
int32_t x,
|
||||
int32_t y)
|
||||
{
|
||||
g_debug (G_STRLOC ": %s data_device = %p, time = %d, x = %d, y = %d",
|
||||
G_STRFUNC, data_device, time, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_drop (void *data,
|
||||
struct wl_data_device *data_device)
|
||||
{
|
||||
g_debug (G_STRLOC ": %s data_device = %p",
|
||||
G_STRFUNC, data_device);
|
||||
}
|
||||
|
||||
static void
|
||||
data_device_selection (void *data,
|
||||
struct wl_data_device *wl_data_device,
|
||||
struct wl_data_offer *offer)
|
||||
{
|
||||
GdkWaylandDevice *device = (GdkWaylandDevice *)data;
|
||||
GdkDeviceManager *device_manager =
|
||||
gdk_display_get_device_manager (device->display);
|
||||
GdkDeviceManagerCore *device_manager_core =
|
||||
GDK_DEVICE_MANAGER_CORE (device_manager);
|
||||
|
||||
g_debug (G_STRLOC ": %s wl_data_device = %p wl_data_offer = %p",
|
||||
G_STRFUNC, wl_data_device, offer);
|
||||
|
||||
if (device->selection_offer)
|
||||
{
|
||||
data_offer_unref (device->selection_offer);
|
||||
device->selection_offer = NULL;
|
||||
}
|
||||
|
||||
/* Retrieve the DataOffer associated with with the wl_data_offer - this
|
||||
* association is made when the listener is attached.
|
||||
*/
|
||||
g_assert (device->selection_offer == NULL);
|
||||
device->selection_offer = wl_data_offer_get_user_data (offer);
|
||||
}
|
||||
|
||||
static const struct wl_data_device_listener data_device_listener = {
|
||||
data_device_data_offer,
|
||||
data_device_enter,
|
||||
data_device_leave,
|
||||
data_device_motion,
|
||||
data_device_drop,
|
||||
data_device_selection
|
||||
};
|
||||
|
||||
void
|
||||
_gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
|
||||
struct wl_input_device *wl_device)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkDisplayWayland *display_wayland;
|
||||
GdkDeviceManagerCore *device_manager_core =
|
||||
GDK_DEVICE_MANAGER_CORE(device_manager);
|
||||
GdkWaylandDevice *device;
|
||||
|
||||
device = g_new0 (GdkWaylandDevice, 1);
|
||||
display = gdk_device_manager_get_display (device_manager);
|
||||
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
||||
|
||||
device->display = display;
|
||||
device->pointer = g_object_new (GDK_TYPE_DEVICE_CORE,
|
||||
@@ -795,12 +635,6 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
|
||||
wl_input_device_add_listener(device->device,
|
||||
&input_device_listener, device);
|
||||
|
||||
device->data_device =
|
||||
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
|
||||
device->device);
|
||||
wl_data_device_add_listener (device->data_device,
|
||||
&data_device_listener, device);
|
||||
|
||||
device_manager_core->devices =
|
||||
g_list_prepend (device_manager_core->devices, device->keyboard);
|
||||
device_manager_core->devices =
|
||||
|
||||
@@ -90,6 +90,38 @@ gdk_input_init (GdkDisplay *display)
|
||||
g_list_free (list);
|
||||
}
|
||||
|
||||
static void
|
||||
shell_handle_configure(void *data, struct wl_shell *shell,
|
||||
uint32_t time, uint32_t edges,
|
||||
struct wl_surface *surface,
|
||||
int32_t width, int32_t height)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkDisplay *display;
|
||||
GdkEvent *event;
|
||||
|
||||
window = wl_surface_get_user_data(surface);
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.window = window;
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
_gdk_window_update_size (window);
|
||||
_gdk_wayland_window_update_size (window, width, height, edges);
|
||||
|
||||
g_object_ref(window);
|
||||
|
||||
_gdk_wayland_display_deliver_event (display, event);
|
||||
}
|
||||
|
||||
static const struct wl_shell_listener shell_listener = {
|
||||
shell_handle_configure,
|
||||
};
|
||||
|
||||
static void
|
||||
output_handle_geometry(void *data,
|
||||
struct wl_output *wl_output,
|
||||
@@ -111,6 +143,31 @@ display_handle_mode(void *data,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
compositor_handle_visual(void *data,
|
||||
struct wl_compositor *compositor,
|
||||
uint32_t id, uint32_t token)
|
||||
{
|
||||
GdkDisplayWayland *d = data;
|
||||
|
||||
switch (token) {
|
||||
case WL_COMPOSITOR_VISUAL_ARGB32:
|
||||
d->argb_visual = wl_visual_create(d->wl_display, id, 1);
|
||||
break;
|
||||
case WL_COMPOSITOR_VISUAL_PREMULTIPLIED_ARGB32:
|
||||
d->premultiplied_argb_visual =
|
||||
wl_visual_create(d->wl_display, id, 1);
|
||||
break;
|
||||
case WL_COMPOSITOR_VISUAL_XRGB32:
|
||||
d->rgb_visual = wl_visual_create(d->wl_display, id, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_compositor_listener compositor_listener = {
|
||||
compositor_handle_visual,
|
||||
};
|
||||
|
||||
static const struct wl_output_listener output_listener = {
|
||||
output_handle_geometry,
|
||||
display_handle_mode
|
||||
@@ -125,25 +182,23 @@ gdk_display_handle_global(struct wl_display *display, uint32_t id,
|
||||
struct wl_input_device *input;
|
||||
|
||||
if (strcmp(interface, "wl_compositor") == 0) {
|
||||
display_wayland->compositor =
|
||||
wl_display_bind(display, id, &wl_compositor_interface);
|
||||
display_wayland->compositor = wl_compositor_create(display, id, 1);
|
||||
wl_compositor_add_listener(display_wayland->compositor,
|
||||
&compositor_listener, display_wayland);
|
||||
} else if (strcmp(interface, "wl_shm") == 0) {
|
||||
display_wayland->shm = wl_display_bind(display, id, &wl_shm_interface);
|
||||
display_wayland->shm = wl_shm_create(display, id, 1);
|
||||
} else if (strcmp(interface, "wl_shell") == 0) {
|
||||
display_wayland->shell = wl_display_bind(display, id, &wl_shell_interface);
|
||||
display_wayland->shell = wl_shell_create(display, id, 1);
|
||||
wl_shell_add_listener(display_wayland->shell,
|
||||
&shell_listener, display_wayland);
|
||||
} else if (strcmp(interface, "wl_output") == 0) {
|
||||
display_wayland->output =
|
||||
wl_display_bind(display, id, &wl_output_interface);
|
||||
display_wayland->output = wl_output_create(display, id, 1);
|
||||
wl_output_add_listener(display_wayland->output,
|
||||
&output_listener, display_wayland);
|
||||
} else if (strcmp(interface, "wl_input_device") == 0) {
|
||||
input = wl_display_bind(display, id, &wl_input_device_interface);
|
||||
input = wl_input_device_create(display, id, 1);
|
||||
_gdk_wayland_device_manager_add_device (gdk_display->device_manager,
|
||||
input);
|
||||
} else if (strcmp(interface, "wl_data_device_manager") == 0) {
|
||||
display_wayland->data_device_manager =
|
||||
wl_display_bind(display, id,
|
||||
&wl_data_device_manager_interface);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,16 +375,28 @@ gdk_wayland_display_beep (GdkDisplay *display)
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
}
|
||||
|
||||
static void
|
||||
sync_callback(void *data)
|
||||
{
|
||||
gboolean *done = data;
|
||||
|
||||
*done = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_sync (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplayWayland *display_wayland;
|
||||
gboolean done;
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
||||
|
||||
wl_display_roundtrip(display_wayland->wl_display);
|
||||
wl_display_sync_callback(display_wayland->wl_display, sync_callback, &done);
|
||||
wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_WRITABLE);
|
||||
while (!done)
|
||||
wl_display_iterate(display_wayland->wl_display, WL_DISPLAY_READABLE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -71,12 +71,12 @@ struct _GdkDisplayWayland
|
||||
|
||||
/* Wayland fields below */
|
||||
struct wl_display *wl_display;
|
||||
struct wl_visual *argb_visual, *premultiplied_argb_visual, *rgb_visual;
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_shm *shm;
|
||||
struct wl_shell *shell;
|
||||
struct wl_output *output;
|
||||
struct wl_input_device *input_device;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
GSource *event_source;
|
||||
EGLDisplay egl_display;
|
||||
EGLContext egl_context;
|
||||
|
||||
@@ -47,9 +47,6 @@ struct _GdkWaylandDisplayManager
|
||||
|
||||
GdkDisplay *default_display;
|
||||
GSList *displays;
|
||||
|
||||
GHashTable *name_to_atoms;
|
||||
guint next_atom;
|
||||
};
|
||||
|
||||
struct _GdkWaylandDisplayManagerClass
|
||||
@@ -95,51 +92,18 @@ gdk_wayland_display_manager_get_default_display (GdkDisplayManager *manager)
|
||||
}
|
||||
|
||||
static GdkAtom
|
||||
gdk_wayland_display_manager_atom_intern (GdkDisplayManager *manager_in,
|
||||
gdk_wayland_display_manager_atom_intern (GdkDisplayManager *manager,
|
||||
const gchar *atom_name,
|
||||
gboolean dup)
|
||||
{
|
||||
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (manager_in);
|
||||
GdkAtom atom;
|
||||
gpointer data;
|
||||
const gchar *atom_name_intern;
|
||||
|
||||
atom_name_intern = g_intern_string (atom_name);
|
||||
data = g_hash_table_lookup (manager->name_to_atoms, atom_name_intern);
|
||||
|
||||
if (data)
|
||||
{
|
||||
atom = GDK_POINTER_TO_ATOM (data);
|
||||
return atom;
|
||||
}
|
||||
|
||||
atom = _GDK_MAKE_ATOM (manager->next_atom);
|
||||
|
||||
g_hash_table_insert (manager->name_to_atoms,
|
||||
(gchar *)atom_name_intern,
|
||||
GDK_ATOM_TO_POINTER (atom));
|
||||
manager->next_atom++;
|
||||
|
||||
return atom;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gdk_wayland_display_manager_get_atom_name (GdkDisplayManager *manager_in,
|
||||
gdk_wayland_display_manager_get_atom_name (GdkDisplayManager *manager,
|
||||
GdkAtom atom)
|
||||
{
|
||||
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (manager_in);
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
g_hash_table_iter_init (&iter, manager->name_to_atoms);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
if (GDK_POINTER_TO_ATOM (key) == atom)
|
||||
return g_strdup (value);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static guint
|
||||
@@ -192,44 +156,9 @@ gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
|
||||
manager_class->get_keyval_name = gdk_wayland_display_manager_get_keyval_name;
|
||||
}
|
||||
|
||||
struct {
|
||||
const gchar *name;
|
||||
guint atom_id;
|
||||
} predefined_atoms[] = {
|
||||
{ "NONE", 0 },
|
||||
{ "PRIMARY", 1 },
|
||||
{ "SECONDARY", 2 },
|
||||
{ "ATOM", 4 },
|
||||
{ "BITMAP", 5 },
|
||||
{ "COLORMAP", 7 },
|
||||
{ "DRAWABLE", 17 },
|
||||
{ "INTEGER", 19 },
|
||||
{ "PIXMAP", 20 },
|
||||
{ "STRING", 31 },
|
||||
{ "WINDOW", 33 },
|
||||
{ "CLIPBOARD", 69 },
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_display_manager_init (GdkWaylandDisplayManager *manager)
|
||||
{
|
||||
gint i;
|
||||
|
||||
manager->name_to_atoms = g_hash_table_new (NULL, NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (predefined_atoms); i++)
|
||||
{
|
||||
GdkAtom atom;
|
||||
const gchar *atom_name = predefined_atoms[i].name;
|
||||
|
||||
atom = _GDK_MAKE_ATOM (predefined_atoms[i].atom_id);
|
||||
g_hash_table_insert (manager->name_to_atoms,
|
||||
(gchar *)g_intern_static_string (atom_name),
|
||||
GDK_ATOM_TO_POINTER (atom));
|
||||
}
|
||||
|
||||
manager->next_atom =
|
||||
predefined_atoms[G_N_ELEMENTS (predefined_atoms) - 1].atom_id + 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -53,7 +53,9 @@ struct _GdkScreenWayland
|
||||
int width_mm, height_mm;
|
||||
|
||||
/* Visual Part */
|
||||
GdkVisual *visual;
|
||||
GdkVisual *argb_visual;
|
||||
GdkVisual *premultiplied_argb_visual;
|
||||
GdkVisual *rgb_visual;
|
||||
|
||||
/* Xinerama/RandR 1.2 */
|
||||
gint n_monitors;
|
||||
@@ -153,7 +155,10 @@ gdk_wayland_screen_finalize (GObject *object)
|
||||
if (screen_wayland->root_window)
|
||||
g_object_unref (screen_wayland->root_window);
|
||||
|
||||
g_object_unref (screen_wayland->visual);
|
||||
/* Visual Part */
|
||||
g_object_unref (screen_wayland->argb_visual);
|
||||
g_object_unref (screen_wayland->premultiplied_argb_visual);
|
||||
g_object_unref (screen_wayland->rgb_visual);
|
||||
|
||||
deinit_multihead (GDK_SCREEN (object));
|
||||
|
||||
@@ -289,13 +294,13 @@ gdk_wayland_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
static GdkVisual *
|
||||
gdk_wayland_screen_get_system_visual (GdkScreen * screen)
|
||||
{
|
||||
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->visual;
|
||||
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
||||
}
|
||||
|
||||
static GdkVisual *
|
||||
gdk_wayland_screen_get_rgba_visual (GdkScreen *screen)
|
||||
{
|
||||
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->visual;
|
||||
return (GdkVisual *) GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -344,6 +349,7 @@ typedef struct _GdkWaylandVisualClass GdkWaylandVisualClass;
|
||||
struct _GdkWaylandVisual
|
||||
{
|
||||
GdkVisual visual;
|
||||
struct wl_visual *wl_visual;
|
||||
};
|
||||
|
||||
struct _GdkWaylandVisualClass
|
||||
@@ -378,21 +384,21 @@ gdk_wayland_screen_visual_get_best_type (GdkScreen *screen)
|
||||
static GdkVisual*
|
||||
gdk_wayland_screen_visual_get_best (GdkScreen *screen)
|
||||
{
|
||||
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
|
||||
gint depth)
|
||||
{
|
||||
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_wayland_screen_visual_get_best_with_type (GdkScreen *screen,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
@@ -400,7 +406,7 @@ gdk_wayland_screen_visual_get_best_with_both (GdkScreen *screen,
|
||||
gint depth,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
return GDK_SCREEN_WAYLAND (screen)->visual;
|
||||
return GDK_SCREEN_WAYLAND (screen)->argb_visual;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -434,7 +440,9 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
|
||||
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
|
||||
screen_wayland = GDK_SCREEN_WAYLAND (screen);
|
||||
|
||||
list = g_list_append (NULL, screen_wayland->visual);
|
||||
list = g_list_append (NULL, screen_wayland->argb_visual);
|
||||
list = g_list_append (NULL, screen_wayland->premultiplied_argb_visual);
|
||||
list = g_list_append (NULL, screen_wayland->rgb_visual);
|
||||
|
||||
return list;
|
||||
}
|
||||
@@ -443,7 +451,7 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
|
||||
#define GDK_WAYLAND_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_VISUAL, GdkWaylandVisual))
|
||||
|
||||
static GdkVisual *
|
||||
gdk_wayland_visual_new (GdkScreen *screen)
|
||||
gdk_wayland_visual_new (GdkScreen *screen, struct wl_visual *wl_visual)
|
||||
{
|
||||
GdkVisual *visual;
|
||||
|
||||
@@ -452,6 +460,8 @@ gdk_wayland_visual_new (GdkScreen *screen)
|
||||
visual->type = GDK_VISUAL_TRUE_COLOR;
|
||||
visual->depth = 32;
|
||||
|
||||
GDK_WAYLAND_VISUAL (visual)->wl_visual = wl_visual;
|
||||
|
||||
return visual;
|
||||
}
|
||||
|
||||
@@ -460,6 +470,10 @@ _gdk_wayland_screen_new (GdkDisplay *display)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkScreenWayland *screen_wayland;
|
||||
GdkDisplayWayland *display_wayland;
|
||||
struct wl_visual *visual;
|
||||
|
||||
display_wayland = GDK_DISPLAY_WAYLAND (display);
|
||||
|
||||
screen = g_object_new (GDK_TYPE_SCREEN_WAYLAND, NULL);
|
||||
|
||||
@@ -468,7 +482,15 @@ _gdk_wayland_screen_new (GdkDisplay *display)
|
||||
screen_wayland->width = 8192;
|
||||
screen_wayland->height = 8192;
|
||||
|
||||
screen_wayland->visual = gdk_wayland_visual_new (screen);
|
||||
visual = display_wayland->argb_visual;
|
||||
screen_wayland->argb_visual = gdk_wayland_visual_new (screen, visual);
|
||||
|
||||
visual = display_wayland->premultiplied_argb_visual;
|
||||
screen_wayland->premultiplied_argb_visual =
|
||||
gdk_wayland_visual_new (screen, visual);
|
||||
|
||||
visual = display_wayland->rgb_visual;
|
||||
screen_wayland->rgb_visual = gdk_wayland_visual_new (screen, visual);
|
||||
|
||||
screen_wayland->root_window =
|
||||
_gdk_wayland_screen_create_root_window (screen,
|
||||
@@ -502,7 +524,6 @@ _gdk_screen_wayland_class_init (GdkScreenWaylandClass *klass)
|
||||
screen_class->get_monitor_height_mm = gdk_wayland_screen_get_monitor_height_mm;
|
||||
screen_class->get_monitor_plug_name = gdk_wayland_screen_get_monitor_plug_name;
|
||||
screen_class->get_monitor_geometry = gdk_wayland_screen_get_monitor_geometry;
|
||||
screen_class->get_monitor_workarea = gdk_wayland_screen_get_monitor_geometry;
|
||||
screen_class->get_system_visual = gdk_wayland_screen_get_system_visual;
|
||||
screen_class->get_rgba_visual = gdk_wayland_screen_get_rgba_visual;
|
||||
screen_class->is_composited = gdk_wayland_screen_is_composited;
|
||||
|
||||
@@ -99,7 +99,6 @@ struct _GdkWindowImplWayland
|
||||
gint8 toplevel_window_type;
|
||||
|
||||
struct wl_surface *surface;
|
||||
struct wl_shell_surface *shell_surface;
|
||||
unsigned int mapped : 1;
|
||||
GdkWindow *transient_for;
|
||||
|
||||
@@ -338,12 +337,12 @@ gdk_wayland_window_attach_image (GdkWindow *window)
|
||||
data->buffer =
|
||||
wl_egl_pixmap_create_buffer(data->pixmap);
|
||||
|
||||
if (impl->resize_edges & WL_SHELL_SURFACE_RESIZE_LEFT)
|
||||
if (impl->resize_edges & WL_SHELL_RESIZE_LEFT)
|
||||
dx = server_width - data->width;
|
||||
else
|
||||
dx = 0;
|
||||
|
||||
if (impl->resize_edges & WL_SHELL_SURFACE_RESIZE_TOP)
|
||||
if (impl->resize_edges & WL_SHELL_RESIZE_TOP)
|
||||
dy = server_height - data->height;
|
||||
else
|
||||
dy = 0;
|
||||
@@ -361,7 +360,7 @@ gdk_window_impl_wayland_finalize (GObject *object)
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (object);
|
||||
|
||||
if (impl->cursor)
|
||||
g_object_unref (impl->cursor);
|
||||
gdk_cursor_unref (impl->cursor);
|
||||
if (impl->server_surface)
|
||||
cairo_surface_destroy (impl->server_surface);
|
||||
|
||||
@@ -388,13 +387,15 @@ gdk_wayland_create_cairo_surface (GdkDisplayWayland *display,
|
||||
{
|
||||
GdkWaylandCairoSurfaceData *data;
|
||||
cairo_surface_t *surface;
|
||||
struct wl_visual *visual;
|
||||
|
||||
data = g_new (GdkWaylandCairoSurfaceData, 1);
|
||||
data->display = display;
|
||||
data->buffer = NULL;
|
||||
visual = display->premultiplied_argb_visual;
|
||||
data->width = width;
|
||||
data->height = height;
|
||||
data->pixmap = wl_egl_pixmap_create(width, height, 0);
|
||||
data->pixmap = wl_egl_pixmap_create(width, height, visual, 0);
|
||||
data->image =
|
||||
display->create_image(display->egl_display, NULL, EGL_NATIVE_PIXMAP_KHR,
|
||||
(EGLClientBuffer) data->pixmap, NULL);
|
||||
@@ -451,6 +452,8 @@ gdk_wayland_window_map (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkWindowImplWayland *parent;
|
||||
GdkDisplayWayland *display_wayland =
|
||||
GDK_DISPLAY_WAYLAND (gdk_window_get_display (impl->wrapper));
|
||||
|
||||
if (!impl->mapped)
|
||||
{
|
||||
@@ -463,47 +466,15 @@ gdk_wayland_window_map (GdkWindow *window)
|
||||
window->y);
|
||||
|
||||
parent = GDK_WINDOW_IMPL_WAYLAND (impl->transient_for->impl);
|
||||
wl_shell_surface_set_transient (impl->shell_surface, parent->shell_surface,
|
||||
window->x, window->y, 0);
|
||||
wl_shell_set_transient (display_wayland->shell, impl->surface, parent->surface,
|
||||
window->x, window->y, 0);
|
||||
}
|
||||
else
|
||||
wl_shell_surface_set_toplevel (impl->shell_surface);
|
||||
wl_shell_set_toplevel (display_wayland->shell, impl->surface);
|
||||
impl->mapped = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
shell_surface_handle_configure(void *data,
|
||||
struct wl_shell_surface *shell_surface,
|
||||
uint32_t time,
|
||||
uint32_t edges,
|
||||
int32_t width,
|
||||
int32_t height)
|
||||
{
|
||||
GdkWindow *window = GDK_WINDOW (data);
|
||||
GdkDisplay *display;
|
||||
GdkEvent *event;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.window = window;
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
_gdk_window_update_size (window);
|
||||
_gdk_wayland_window_update_size (window, width, height, edges);
|
||||
|
||||
g_object_ref(window);
|
||||
|
||||
_gdk_wayland_display_deliver_event (display, event);
|
||||
}
|
||||
|
||||
static const struct wl_shell_surface_listener shell_surface_listener = {
|
||||
shell_surface_handle_configure,
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
|
||||
{
|
||||
@@ -523,11 +494,6 @@ gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
|
||||
impl->surface = wl_compositor_create_surface(display_wayland->compositor);
|
||||
wl_surface_set_user_data(impl->surface, window);
|
||||
|
||||
impl->shell_surface = wl_shell_get_shell_surface (display_wayland->shell,
|
||||
impl->surface);
|
||||
wl_shell_surface_add_listener(impl->shell_surface,
|
||||
&shell_surface_listener, window);
|
||||
|
||||
_gdk_make_event (window, GDK_MAP, NULL, FALSE);
|
||||
event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY, NULL, FALSE);
|
||||
event->visibility.state = GDK_VISIBILITY_UNOBSCURED;
|
||||
@@ -1139,13 +1105,15 @@ gdk_wayland_window_set_functions (GdkWindow *window,
|
||||
static void
|
||||
gdk_wayland_window_begin_resize_drag (GdkWindow *window,
|
||||
GdkWindowEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkDeviceManager *dm;
|
||||
GdkWindowImplWayland *impl;
|
||||
GdkDevice *device;
|
||||
uint32_t grab_type;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
@@ -1155,35 +1123,35 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
|
||||
switch (edge)
|
||||
{
|
||||
case GDK_WINDOW_EDGE_NORTH_WEST:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_TOP_LEFT;
|
||||
grab_type = WL_SHELL_RESIZE_TOP_LEFT;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_NORTH:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_TOP;
|
||||
grab_type = WL_SHELL_RESIZE_TOP;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_NORTH_EAST:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
grab_type = WL_SHELL_RESIZE_RIGHT;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_WEST:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_LEFT;
|
||||
grab_type = WL_SHELL_RESIZE_LEFT;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_EAST:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_RIGHT;
|
||||
grab_type = WL_SHELL_RESIZE_RIGHT;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_SOUTH_WEST:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT;
|
||||
grab_type = WL_SHELL_RESIZE_BOTTOM_LEFT;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_SOUTH:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_BOTTOM;
|
||||
grab_type = WL_SHELL_RESIZE_BOTTOM;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_EDGE_SOUTH_EAST:
|
||||
grab_type = WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT;
|
||||
grab_type = WL_SHELL_RESIZE_BOTTOM_RIGHT;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1193,22 +1161,25 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
|
||||
}
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
dm = gdk_display_get_device_manager (display);
|
||||
device = gdk_device_manager_get_client_pointer (dm);
|
||||
|
||||
wl_shell_surface_resize(impl->shell_surface,
|
||||
_gdk_wayland_device_get_device (device),
|
||||
timestamp, grab_type);
|
||||
wl_shell_resize(GDK_DISPLAY_WAYLAND (display)->shell, impl->surface,
|
||||
_gdk_wayland_device_get_device (device),
|
||||
timestamp, grab_type);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_window_begin_move_drag (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkDeviceManager *dm;
|
||||
GdkWindowImplWayland *impl;
|
||||
GdkDevice *device;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
!WINDOW_IS_TOPLEVEL (window))
|
||||
@@ -1216,8 +1187,11 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
|
||||
wl_shell_surface_move(impl->shell_surface,
|
||||
_gdk_wayland_device_get_device (device), timestamp);
|
||||
dm = gdk_display_get_device_manager (display);
|
||||
device = gdk_device_manager_get_client_pointer (dm);
|
||||
|
||||
wl_shell_move(GDK_DISPLAY_WAYLAND (display)->shell, impl->surface,
|
||||
_gdk_wayland_device_get_device (device), timestamp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -318,37 +318,8 @@ gdk_device_win32_grab (GdkDevice *device,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
HCURSOR hcursor;
|
||||
GdkWin32Cursor *cursor_private;
|
||||
|
||||
cursor_private = (GdkWin32Cursor*) cursor;
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
if (!cursor)
|
||||
hcursor = NULL;
|
||||
else if ((hcursor = CopyCursor (cursor_private->hcursor)) == NULL)
|
||||
WIN32_API_FAILED ("CopyCursor");
|
||||
|
||||
if (_gdk_win32_grab_cursor != NULL)
|
||||
{
|
||||
if (GetCursor () == _gdk_win32_grab_cursor)
|
||||
SetCursor (NULL);
|
||||
DestroyCursor (_gdk_win32_grab_cursor);
|
||||
}
|
||||
|
||||
_gdk_win32_grab_cursor = hcursor;
|
||||
|
||||
if (_gdk_win32_grab_cursor != NULL)
|
||||
SetCursor (_gdk_win32_grab_cursor);
|
||||
else if (impl->hcursor != NULL)
|
||||
SetCursor (impl->hcursor);
|
||||
else
|
||||
SetCursor (LoadCursor (NULL, IDC_ARROW));
|
||||
|
||||
SetCapture (GDK_WINDOW_HWND (window));
|
||||
}
|
||||
SetCapture (GDK_WINDOW_HWND (window));
|
||||
|
||||
return GDK_GRAB_SUCCESS;
|
||||
}
|
||||
@@ -367,28 +338,11 @@ gdk_device_win32_ungrab (GdkDevice *device,
|
||||
info->serial_end = 0;
|
||||
|
||||
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
|
||||
{
|
||||
if (_gdk_win32_grab_cursor != NULL)
|
||||
{
|
||||
if (GetCursor () == _gdk_win32_grab_cursor)
|
||||
SetCursor (NULL);
|
||||
DestroyCursor (_gdk_win32_grab_cursor);
|
||||
}
|
||||
_gdk_win32_grab_cursor = NULL;
|
||||
|
||||
ReleaseCapture ();
|
||||
}
|
||||
ReleaseCapture ();
|
||||
|
||||
_gdk_display_device_grab_update (display, device, NULL, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
screen_to_client (HWND hwnd, POINT screen_pt, POINT *client_pt)
|
||||
{
|
||||
*client_pt = screen_pt;
|
||||
ScreenToClient (hwnd, client_pt);
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_device_win32_window_at_position (GdkDevice *device,
|
||||
gint *win_x,
|
||||
@@ -396,75 +350,45 @@ gdk_device_win32_window_at_position (GdkDevice *device,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
GdkWindow *window = NULL;
|
||||
POINT screen_pt, client_pt;
|
||||
GdkWindow *window;
|
||||
POINT point, pointc;
|
||||
HWND hwnd, hwndc;
|
||||
RECT rect;
|
||||
|
||||
GetCursorPos (&screen_pt);
|
||||
GetCursorPos (&pointc);
|
||||
point = pointc;
|
||||
hwnd = WindowFromPoint (point);
|
||||
|
||||
if (get_toplevel)
|
||||
if (hwnd == NULL)
|
||||
{
|
||||
/* Only consider visible children of the desktop to avoid the various
|
||||
* non-visible windows you often find on a running Windows box. These
|
||||
* might overlap our windows and cause our walk to fail. As we assume
|
||||
* WindowFromPoint() can find our windows, we follow similar logic
|
||||
* here, and ignore invisible and disabled windows.
|
||||
*/
|
||||
hwnd = GetDesktopWindow ();
|
||||
do {
|
||||
window = gdk_win32_handle_table_lookup (hwnd);
|
||||
|
||||
if (window != NULL &&
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_ROOT &&
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
break;
|
||||
|
||||
screen_to_client (hwnd, screen_pt, &client_pt);
|
||||
hwndc = ChildWindowFromPointEx (hwnd, client_pt, CWP_SKIPDISABLED |
|
||||
CWP_SKIPINVISIBLE);
|
||||
|
||||
/* Verify that we're really inside the client area of the window */
|
||||
if (hwndc != hwnd)
|
||||
{
|
||||
GetClientRect (hwndc, &rect);
|
||||
screen_to_client (hwndc, screen_pt, &client_pt);
|
||||
if (!PtInRect (&rect, client_pt))
|
||||
hwndc = hwnd;
|
||||
}
|
||||
|
||||
} while (hwndc != hwnd && (hwnd = hwndc, 1));
|
||||
|
||||
window = _gdk_root;
|
||||
*win_x = pointc.x + _gdk_offset_x;
|
||||
*win_y = pointc.y + _gdk_offset_y;
|
||||
return window;
|
||||
}
|
||||
else
|
||||
|
||||
ScreenToClient (hwnd, &point);
|
||||
|
||||
do
|
||||
{
|
||||
hwnd = WindowFromPoint (screen_pt);
|
||||
if (get_toplevel &&
|
||||
(window = gdk_win32_handle_table_lookup (hwnd)) != NULL &&
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
break;
|
||||
|
||||
/* Verify that we're really inside the client area of the window */
|
||||
GetClientRect (hwnd, &rect);
|
||||
screen_to_client (hwnd, screen_pt, &client_pt);
|
||||
if (!PtInRect (&rect, client_pt))
|
||||
hwnd = NULL;
|
||||
|
||||
/* If we didn't hit any window at that point, return the desktop */
|
||||
if (hwnd == NULL)
|
||||
{
|
||||
if (win_x)
|
||||
*win_x = screen_pt.x + _gdk_offset_x;
|
||||
if (win_y)
|
||||
*win_y = screen_pt.y + _gdk_offset_y;
|
||||
return _gdk_root;
|
||||
}
|
||||
|
||||
window = gdk_win32_handle_table_lookup (hwnd);
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
ClientToScreen (hwnd, &point);
|
||||
ScreenToClient (hwndc, &point);
|
||||
}
|
||||
while (hwndc != hwnd && (hwnd = hwndc, 1));
|
||||
|
||||
window = gdk_win32_handle_table_lookup (hwnd);
|
||||
|
||||
if (window && (win_x || win_y))
|
||||
{
|
||||
if (win_x)
|
||||
*win_x = client_pt.x;
|
||||
if (win_y)
|
||||
*win_y = client_pt.y;
|
||||
GetClientRect (hwnd, &rect);
|
||||
*win_x = point.x - rect.left;
|
||||
*win_y = point.y - rect.top;
|
||||
}
|
||||
|
||||
return window;
|
||||
|
||||
@@ -360,10 +360,9 @@ print_cursor (int index)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_gdk_input_wintab_init_check (GdkDeviceManager *_device_manager)
|
||||
static void
|
||||
_gdk_input_wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
{
|
||||
GdkDeviceManagerWin32 *device_manager = (GdkDeviceManagerWin32 *)_device_manager;
|
||||
static gboolean wintab_initialized = FALSE;
|
||||
GdkDeviceWintab *device;
|
||||
GdkWindowAttr wa;
|
||||
@@ -578,8 +577,8 @@ _gdk_input_wintab_init_check (GdkDeviceManager *_device_manager)
|
||||
device = g_object_new (GDK_TYPE_DEVICE_WINTAB,
|
||||
"name", device_name,
|
||||
"type", GDK_DEVICE_TYPE_SLAVE,
|
||||
"input-source", GDK_SOURCE_PEN,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"source", GDK_SOURCE_PEN,
|
||||
"mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", FALSE,
|
||||
"display", _gdk_display,
|
||||
"device-manager", device_manager,
|
||||
@@ -691,6 +690,8 @@ gdk_device_manager_win32_constructed (GObject *object)
|
||||
|
||||
_gdk_device_set_associated_device (device_manager->core_pointer, device_manager->core_keyboard);
|
||||
_gdk_device_set_associated_device (device_manager->core_keyboard, device_manager->core_pointer);
|
||||
|
||||
_gdk_input_wintab_init_check (device_manager);
|
||||
}
|
||||
|
||||
static GList *
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gdkwin32display.h"
|
||||
#include "gdkwin32screen.h"
|
||||
#include "gdkwin32window.h"
|
||||
#include "gdkwin32.h"
|
||||
|
||||
#define HAVE_MONITOR_INFO
|
||||
|
||||
@@ -80,7 +79,7 @@ enum_monitor (HMONITOR hmonitor,
|
||||
DWORD dwFlags;
|
||||
CHAR szDevice[CCHDEVICENAME];
|
||||
} MONITORINFOEXA2;
|
||||
|
||||
|
||||
MONITORINFOEXA2 monitor_info;
|
||||
HDC hDC;
|
||||
|
||||
@@ -253,7 +252,7 @@ gdk_win32_display_get_name (GdkDisplay *display)
|
||||
PFN_ProcessIdToSessionId processIdToSessionId;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
|
||||
if (display_name_cache != NULL)
|
||||
return display_name_cache;
|
||||
|
||||
@@ -305,7 +304,7 @@ static gint
|
||||
gdk_win32_display_get_n_screens (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -342,194 +341,15 @@ gdk_win32_display_supports_selection_notification (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static HWND _hwnd_next_viewer = NULL;
|
||||
static int debug_indent = 0;
|
||||
|
||||
/*
|
||||
* maybe this should be integrated with the default message loop - or maybe not ;-)
|
||||
*/
|
||||
static LRESULT CALLBACK
|
||||
inner_clipboard_window_procedure (HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_DESTROY: /* remove us from chain */
|
||||
{
|
||||
ChangeClipboardChain (hwnd, _hwnd_next_viewer);
|
||||
PostQuitMessage (0);
|
||||
return 0;
|
||||
}
|
||||
case WM_CHANGECBCHAIN:
|
||||
{
|
||||
HWND hwndRemove = (HWND) wparam; /* handle of window being removed */
|
||||
HWND hwndNext = (HWND) lparam; /* handle of next window in chain */
|
||||
|
||||
if (hwndRemove == _hwnd_next_viewer)
|
||||
_hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext;
|
||||
else if (_hwnd_next_viewer != NULL)
|
||||
return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#ifdef WM_CLIPBOARDUPDATE
|
||||
case WM_CLIPBOARDUPDATE:
|
||||
#endif
|
||||
case WM_DRAWCLIPBOARD:
|
||||
{
|
||||
int success;
|
||||
HWND hwndOwner;
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
UINT nFormat = 0;
|
||||
#endif
|
||||
GdkEvent *event;
|
||||
GdkWindow *owner;
|
||||
|
||||
success = OpenClipboard (hwnd);
|
||||
g_return_val_if_fail (success, 0);
|
||||
hwndOwner = GetClipboardOwner ();
|
||||
owner = gdk_win32_window_lookup_for_display (_gdk_display, hwndOwner);
|
||||
if (owner == NULL)
|
||||
owner = gdk_win32_window_foreign_new_for_display (_gdk_display, hwndOwner);
|
||||
|
||||
GDK_NOTE (DND, g_print (" drawclipboard owner: %p", hwndOwner));
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (_gdk_debug_flags & GDK_DEBUG_DND)
|
||||
{
|
||||
while ((nFormat = EnumClipboardFormats (nFormat)) != 0)
|
||||
g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
|
||||
}
|
||||
#endif
|
||||
|
||||
GDK_NOTE (DND, g_print (" \n"));
|
||||
|
||||
|
||||
event = gdk_event_new (GDK_OWNER_CHANGE);
|
||||
event->owner_change.window = _gdk_root;
|
||||
event->owner_change.owner = owner;
|
||||
event->owner_change.reason = GDK_OWNER_CHANGE_NEW_OWNER;
|
||||
event->owner_change.selection = GDK_SELECTION_CLIPBOARD;
|
||||
event->owner_change.time = _gdk_win32_get_next_tick (0);
|
||||
event->owner_change.selection_time = GDK_CURRENT_TIME;
|
||||
_gdk_win32_append_event (event);
|
||||
|
||||
CloseClipboard ();
|
||||
|
||||
if (_hwnd_next_viewer != NULL)
|
||||
return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
|
||||
|
||||
/* clear error to avoid confusing SetClipboardViewer() return */
|
||||
SetLastError (0);
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
/* Otherwise call DefWindowProcW(). */
|
||||
GDK_NOTE (EVENTS, g_print (" DefWindowProcW"));
|
||||
return DefWindowProc (hwnd, message, wparam, lparam);
|
||||
}
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
_clipboard_window_procedure (HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
{
|
||||
LRESULT retval;
|
||||
|
||||
GDK_NOTE (EVENTS, g_print ("%s%*s%s %p",
|
||||
(debug_indent > 0 ? "\n" : ""),
|
||||
debug_indent, "",
|
||||
_gdk_win32_message_to_string (message), hwnd));
|
||||
debug_indent += 2;
|
||||
retval = inner_clipboard_window_procedure (hwnd, message, wparam, lparam);
|
||||
debug_indent -= 2;
|
||||
|
||||
GDK_NOTE (EVENTS, g_print (" => %I64d%s", (gint64) retval, (debug_indent == 0 ? "\n" : "")));
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a hidden window and adds it to the clipboard chain
|
||||
*/
|
||||
static HWND
|
||||
_gdk_win32_register_clipboard_notification (void)
|
||||
{
|
||||
WNDCLASS wclass = { 0, };
|
||||
HWND hwnd;
|
||||
ATOM klass;
|
||||
|
||||
wclass.lpszClassName = "GdkClipboardNotification";
|
||||
wclass.lpfnWndProc = _clipboard_window_procedure;
|
||||
wclass.hInstance = _gdk_app_hmodule;
|
||||
|
||||
klass = RegisterClass (&wclass);
|
||||
if (!klass)
|
||||
return NULL;
|
||||
|
||||
hwnd = CreateWindow (MAKEINTRESOURCE (klass),
|
||||
NULL, WS_POPUP,
|
||||
0, 0, 0, 0, NULL, NULL,
|
||||
_gdk_app_hmodule, NULL);
|
||||
if (!hwnd)
|
||||
goto failed;
|
||||
|
||||
SetLastError (0);
|
||||
_hwnd_next_viewer = SetClipboardViewer (hwnd);
|
||||
|
||||
if (_hwnd_next_viewer == NULL && GetLastError() != 0)
|
||||
goto failed;
|
||||
|
||||
/* FIXME: http://msdn.microsoft.com/en-us/library/ms649033(v=VS.85).aspx */
|
||||
/* This is only supported by Vista, and not yet by mingw64 */
|
||||
/* if (AddClipboardFormatListener (hwnd) == FALSE) */
|
||||
/* goto failed; */
|
||||
|
||||
return hwnd;
|
||||
|
||||
failed:
|
||||
g_critical ("Failed to install clipboard viewer");
|
||||
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
|
||||
return NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_display_request_selection_notification (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
GdkAtom selection)
|
||||
|
||||
{
|
||||
static HWND hwndViewer = NULL;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
GDK_NOTE (DND,
|
||||
g_print ("gdk_display_request_selection_notification (..., %s)",
|
||||
gdk_atom_name (selection)));
|
||||
|
||||
if (selection == GDK_SELECTION_CLIPBOARD ||
|
||||
selection == GDK_SELECTION_PRIMARY)
|
||||
{
|
||||
if (!hwndViewer)
|
||||
{
|
||||
hwndViewer = _gdk_win32_register_clipboard_notification ();
|
||||
GDK_NOTE (DND, g_print (" registered"));
|
||||
}
|
||||
ret = (hwndViewer != NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE (DND, g_print (" unsupported"));
|
||||
ret = FALSE;
|
||||
}
|
||||
|
||||
GDK_NOTE (DND, g_print (" -> %s\n", ret ? "TRUE" : "FALSE"));
|
||||
return ret;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -589,15 +409,6 @@ gdk_win32_display_flush (GdkDisplay * display)
|
||||
GdiFlush ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gdk_win32_display_sync (GdkDisplay * display)
|
||||
{
|
||||
g_return_if_fail (display == _gdk_display);
|
||||
|
||||
GdiFlush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_dispose (GObject *object)
|
||||
{
|
||||
@@ -669,7 +480,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->get_screen = gdk_win32_display_get_screen;
|
||||
display_class->get_default_screen = gdk_win32_display_get_default_screen;
|
||||
display_class->beep = gdk_win32_display_beep;
|
||||
display_class->sync = gdk_win32_display_sync;
|
||||
display_class->sync = _gdk_win32_display_sync;
|
||||
display_class->flush = gdk_win32_display_flush;
|
||||
display_class->has_pending = _gdk_win32_display_has_pending;
|
||||
display_class->queue_events = _gdk_win32_display_queue_events;
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
typedef struct _GdkDragContextPrivateWin32 GdkDragContextPrivateWin32;
|
||||
|
||||
typedef enum {
|
||||
GDK_DRAG_STATUS_DRAG,
|
||||
GDK_DRAG_STATUS_MOTION_WAIT,
|
||||
@@ -95,18 +97,29 @@ typedef enum {
|
||||
GDK_DRAG_STATUS_DROP
|
||||
} GdkDragStatus;
|
||||
|
||||
/* Structure that holds information about a drag in progress.
|
||||
* this is used on both source and destination sides.
|
||||
*/
|
||||
struct _GdkDragContextPrivateWin32 {
|
||||
gboolean being_finalized;
|
||||
gint ref_count;
|
||||
IUnknown *iface;
|
||||
DWORD last_key_state;
|
||||
POINT last_pt; /* Coordinates from last event */
|
||||
guint drag_status : 4; /* Current status of drag */
|
||||
guint drop_failed : 1; /* Whether the drop was unsuccessful */
|
||||
};
|
||||
|
||||
#define PRIVATE_DATA(context) (GDK_WIN32_DRAG_CONTEXT (context)->windowing_data)
|
||||
|
||||
static GList *contexts;
|
||||
static GdkDragContext *current_dest_drag = NULL;
|
||||
|
||||
struct _GdkWin32DragContext
|
||||
{
|
||||
GdkDragContext context;
|
||||
|
||||
guint drag_status : 4; /* Current status of drag */
|
||||
guint drop_failed : 1; /* Whether the drop was unsuccessful */
|
||||
|
||||
POINT ole2_dnd_last_pt; /* Coordinates from last event */
|
||||
DWORD ole2_dnd_last_key_state; /* Key state from last event */
|
||||
gboolean ole2_dnd_being_finalized;
|
||||
gint ole2_dnd_ref_count;
|
||||
IUnknown *ole2_dnd_iface;
|
||||
|
||||
GdkDragContextPrivateWin32 *windowing_data;
|
||||
};
|
||||
|
||||
struct _GdkWin32DragContextClass
|
||||
@@ -114,41 +127,49 @@ struct _GdkWin32DragContextClass
|
||||
GdkDragContextClass parent_class;
|
||||
};
|
||||
|
||||
static GList *contexts;
|
||||
static GdkDragContext *current_dest_drag = NULL;
|
||||
static gboolean use_ole2_dnd = FALSE;
|
||||
|
||||
G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
|
||||
static gboolean use_ole2_dnd = FALSE;
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_init (GdkWin32DragContext *context)
|
||||
gdk_win32_drag_context_init (GdkWin32DragContext *dragcontext)
|
||||
{
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
|
||||
private = G_TYPE_INSTANCE_GET_PRIVATE (dragcontext,
|
||||
GDK_TYPE_DRAG_CONTEXT,
|
||||
GdkDragContextPrivateWin32);
|
||||
|
||||
dragcontext->windowing_data = private;
|
||||
|
||||
if (!use_ole2_dnd)
|
||||
{
|
||||
contexts = g_list_prepend (contexts, context);
|
||||
contexts = g_list_prepend (contexts, dragcontext);
|
||||
}
|
||||
else
|
||||
{
|
||||
context->ole2_dnd_being_finalized = FALSE;
|
||||
context->ole2_dnd_ref_count = 1;
|
||||
context->ole2_dnd_iface = NULL;
|
||||
private->being_finalized = FALSE;
|
||||
private->ref_count = 1;
|
||||
private->iface = NULL;
|
||||
}
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", context));
|
||||
GDK_NOTE (DND, g_print ("gdk_drag_context_init %p\n", dragcontext));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_drag_context_finalize (GObject *object)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkWin32DragContext *context_win32;
|
||||
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_drag_context_finalize %p\n", object));
|
||||
|
||||
g_return_if_fail (GDK_IS_WIN32_DRAG_CONTEXT (object));
|
||||
g_list_free (context->targets);
|
||||
|
||||
context = GDK_DRAG_CONTEXT (object);
|
||||
context_win32 = GDK_WIN32_DRAG_CONTEXT (object);
|
||||
if (context->source_window)
|
||||
g_object_unref (context->source_window);
|
||||
|
||||
if (context->dest_window)
|
||||
g_object_unref (context->dest_window);
|
||||
|
||||
if (!use_ole2_dnd)
|
||||
{
|
||||
@@ -159,11 +180,12 @@ gdk_win32_drag_context_finalize (GObject *object)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (context_win32->ole2_dnd_iface)
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (context);
|
||||
if (private->iface)
|
||||
{
|
||||
context_win32->ole2_dnd_being_finalized = TRUE;
|
||||
context_win32->ole2_dnd_iface->lpVtbl->Release (context_win32->ole2_dnd_iface);
|
||||
context_win32->ole2_dnd_iface = NULL;
|
||||
private->being_finalized = TRUE;
|
||||
private->iface->lpVtbl->Release (private->iface);
|
||||
private->iface = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,16 +194,10 @@ gdk_win32_drag_context_finalize (GObject *object)
|
||||
|
||||
/* Drag Contexts */
|
||||
|
||||
static GdkDragContext *
|
||||
GdkDragContext *
|
||||
gdk_drag_context_new (void)
|
||||
{
|
||||
GdkWin32DragContext *context_win32;
|
||||
GdkDragContext *context;
|
||||
|
||||
context_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT, NULL);
|
||||
context = GDK_DRAG_CONTEXT(context_win32);
|
||||
|
||||
return context;
|
||||
return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
|
||||
}
|
||||
|
||||
static GdkDragContext *
|
||||
@@ -191,10 +207,12 @@ gdk_drag_context_find (gboolean is_source,
|
||||
{
|
||||
GList *tmp_list = contexts;
|
||||
GdkDragContext *context;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
context = (GdkDragContext *)tmp_list->data;
|
||||
private = PRIVATE_DATA (context);
|
||||
|
||||
if ((!context->is_source == !is_source) &&
|
||||
((source == NULL) || (context->source_window && (context->source_window == source))) &&
|
||||
@@ -261,9 +279,8 @@ static ULONG STDMETHODCALLTYPE
|
||||
idroptarget_addref (LPDROPTARGET This)
|
||||
{
|
||||
target_drag_context *ctx = (target_drag_context *) This;
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
|
||||
|
||||
int ref_count = ++context_win32->ole2_dnd_ref_count;
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||
int ref_count = ++private->ref_count;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_addref %p %d\n", This, ref_count));
|
||||
g_object_ref (G_OBJECT (ctx->context));
|
||||
@@ -308,13 +325,12 @@ static ULONG STDMETHODCALLTYPE
|
||||
idroptarget_release (LPDROPTARGET This)
|
||||
{
|
||||
target_drag_context *ctx = (target_drag_context *) This;
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
|
||||
|
||||
int ref_count = --context_win32->ole2_dnd_ref_count;
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||
int ref_count = --private->ref_count;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idroptarget_release %p %d\n", This, ref_count));
|
||||
|
||||
if (!context_win32->ole2_dnd_being_finalized)
|
||||
if (!private->being_finalized)
|
||||
g_object_unref (G_OBJECT (ctx->context));
|
||||
|
||||
if (ref_count == 0)
|
||||
@@ -524,9 +540,8 @@ static ULONG STDMETHODCALLTYPE
|
||||
idropsource_addref (LPDROPSOURCE This)
|
||||
{
|
||||
source_drag_context *ctx = (source_drag_context *) This;
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
|
||||
|
||||
int ref_count = ++context_win32->ole2_dnd_ref_count;
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||
int ref_count = ++private->ref_count;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idropsource_addref %p %d\n", This, ref_count));
|
||||
g_object_ref (G_OBJECT (ctx->context));
|
||||
@@ -571,13 +586,12 @@ static ULONG STDMETHODCALLTYPE
|
||||
idropsource_release (LPDROPSOURCE This)
|
||||
{
|
||||
source_drag_context *ctx = (source_drag_context *) This;
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (ctx->context);
|
||||
|
||||
int ref_count = --context_win32->ole2_dnd_ref_count;
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx->context);
|
||||
int ref_count = --private->ref_count;
|
||||
|
||||
GDK_NOTE (DND, g_print ("idropsource_release %p %d\n", This, ref_count));
|
||||
|
||||
if (!context_win32->ole2_dnd_being_finalized)
|
||||
if (!private->being_finalized)
|
||||
g_object_unref (G_OBJECT (ctx->context));
|
||||
|
||||
if (ref_count == 0)
|
||||
@@ -591,14 +605,14 @@ idropsource_release (LPDROPSOURCE This)
|
||||
* have been emitted and false otherwise.
|
||||
*/
|
||||
static gboolean
|
||||
send_change_events (GdkDragContext *context,
|
||||
send_change_events (GdkDragContext *ctx,
|
||||
DWORD key_state,
|
||||
gboolean esc_pressed)
|
||||
{
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (ctx);
|
||||
POINT pt;
|
||||
gboolean changed = FALSE;
|
||||
HWND hwnd = GDK_WINDOW_HWND (context->source_window);
|
||||
HWND hwnd = GDK_WINDOW_HWND (ctx->source_window);
|
||||
LPARAM lparam;
|
||||
WPARAM wparam;
|
||||
|
||||
@@ -608,46 +622,46 @@ send_change_events (GdkDragContext *context,
|
||||
if (!API_CALL (ScreenToClient, (hwnd, &pt)))
|
||||
return FALSE;
|
||||
|
||||
if (pt.x != context_win32->ole2_dnd_last_pt.x || pt.y != context_win32->ole2_dnd_last_pt.y ||
|
||||
key_state != context_win32->ole2_dnd_last_key_state)
|
||||
if (pt.x != private->last_pt.x || pt.y != private->last_pt.y ||
|
||||
key_state != private->last_key_state)
|
||||
{
|
||||
lparam = MAKELPARAM (pt.x, pt.y);
|
||||
wparam = key_state;
|
||||
if (pt.x != context_win32->ole2_dnd_last_pt.x || pt.y != context_win32->ole2_dnd_last_pt.y)
|
||||
if (pt.x != private->last_pt.x || pt.y != private->last_pt.y)
|
||||
{
|
||||
GDK_NOTE (DND, g_print ("Sending WM_MOUSEMOVE (%ld,%ld)\n", pt.x, pt.y));
|
||||
SendMessage (hwnd, WM_MOUSEMOVE, wparam, lparam);
|
||||
}
|
||||
|
||||
if ((key_state & MK_LBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_LBUTTON))
|
||||
if ((key_state & MK_LBUTTON) != (private->last_key_state & MK_LBUTTON))
|
||||
{
|
||||
if (key_state & MK_LBUTTON)
|
||||
SendMessage (hwnd, WM_LBUTTONDOWN, wparam, lparam);
|
||||
else
|
||||
SendMessage (hwnd, WM_LBUTTONUP, wparam, lparam);
|
||||
}
|
||||
if ((key_state & MK_MBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_MBUTTON))
|
||||
if ((key_state & MK_MBUTTON) != (private->last_key_state & MK_MBUTTON))
|
||||
{
|
||||
if (key_state & MK_MBUTTON)
|
||||
SendMessage (hwnd, WM_MBUTTONDOWN, wparam, lparam);
|
||||
else
|
||||
SendMessage (hwnd, WM_MBUTTONUP, wparam, lparam);
|
||||
}
|
||||
if ((key_state & MK_RBUTTON) != (context_win32->ole2_dnd_last_key_state & MK_RBUTTON))
|
||||
if ((key_state & MK_RBUTTON) != (private->last_key_state & MK_RBUTTON))
|
||||
{
|
||||
if (key_state & MK_RBUTTON)
|
||||
SendMessage (hwnd, WM_RBUTTONDOWN, wparam, lparam);
|
||||
else
|
||||
SendMessage (hwnd, WM_RBUTTONUP, wparam, lparam);
|
||||
}
|
||||
if ((key_state & MK_CONTROL) != (context_win32->ole2_dnd_last_key_state & MK_CONTROL))
|
||||
if ((key_state & MK_CONTROL) != (private->last_key_state & MK_CONTROL))
|
||||
{
|
||||
if (key_state & MK_CONTROL)
|
||||
SendMessage (hwnd, WM_KEYDOWN, VK_CONTROL, 0);
|
||||
else
|
||||
SendMessage (hwnd, WM_KEYUP, VK_CONTROL, 0);
|
||||
}
|
||||
if ((key_state & MK_SHIFT) != (context_win32->ole2_dnd_last_key_state & MK_SHIFT))
|
||||
if ((key_state & MK_SHIFT) != (private->last_key_state & MK_SHIFT))
|
||||
{
|
||||
if (key_state & MK_CONTROL)
|
||||
SendMessage (hwnd, WM_KEYDOWN, VK_SHIFT, 0);
|
||||
@@ -656,8 +670,8 @@ send_change_events (GdkDragContext *context,
|
||||
}
|
||||
|
||||
changed = TRUE;
|
||||
context_win32->ole2_dnd_last_key_state = key_state;
|
||||
context_win32->ole2_dnd_last_pt = pt;
|
||||
private->last_key_state = key_state;
|
||||
private->last_pt = pt;
|
||||
}
|
||||
|
||||
if (esc_pressed)
|
||||
@@ -1158,19 +1172,16 @@ static IEnumFORMATETCVtbl ief_vtbl = {
|
||||
static target_drag_context *
|
||||
target_context_new (GdkWindow *window)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkWin32DragContext *context_win32;
|
||||
target_drag_context *result;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
GdkDevice *device;
|
||||
GdkDeviceManager *device_manager;
|
||||
|
||||
context = gdk_drag_context_new ();
|
||||
context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
|
||||
|
||||
result = g_new0 (target_drag_context, 1);
|
||||
result->context = context;
|
||||
|
||||
result->idt.lpVtbl = &idt_vtbl;
|
||||
|
||||
result->context = gdk_drag_context_new ();
|
||||
result->context->protocol = GDK_DRAG_PROTO_OLE2;
|
||||
result->context->is_source = FALSE;
|
||||
|
||||
@@ -1183,12 +1194,14 @@ target_context_new (GdkWindow *window)
|
||||
result->context->dest_window = window;
|
||||
g_object_ref (window);
|
||||
|
||||
/* FIXME: context->targets? */
|
||||
/* FIXME: result->context->targets? */
|
||||
|
||||
result->context->actions = GDK_ACTION_DEFAULT | GDK_ACTION_COPY | GDK_ACTION_MOVE;
|
||||
result->context->suggested_action = GDK_ACTION_MOVE;
|
||||
result->context->action = GDK_ACTION_MOVE;
|
||||
|
||||
context_win32->ole2_dnd_iface = (IUnknown *) &result->idt;
|
||||
private = PRIVATE_DATA(result->context);
|
||||
private->iface = (IUnknown *) &result->idt;
|
||||
idroptarget_addref (&result->idt);
|
||||
|
||||
GDK_NOTE (DND, g_print ("target_context_new: %p\n", result));
|
||||
@@ -1200,19 +1213,16 @@ static source_drag_context *
|
||||
source_context_new (GdkWindow *window,
|
||||
GList *targets)
|
||||
{
|
||||
GdkDragContext *context;
|
||||
GdkWin32DragContext *context_win32;
|
||||
source_drag_context *result;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
GdkDevice *device;
|
||||
GdkDeviceManager *device_manager;
|
||||
|
||||
context = gdk_drag_context_new ();
|
||||
context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
|
||||
|
||||
result = g_new0 (source_drag_context, 1);
|
||||
result->context = context;
|
||||
|
||||
result->ids.lpVtbl = &ids_vtbl;
|
||||
|
||||
result->context = gdk_drag_context_new ();
|
||||
result->context->protocol = GDK_DRAG_PROTO_OLE2;
|
||||
result->context->is_source = TRUE;
|
||||
|
||||
@@ -1226,7 +1236,8 @@ source_context_new (GdkWindow *window,
|
||||
result->context->dest_window = NULL;
|
||||
result->context->targets = g_list_copy (targets);
|
||||
|
||||
context_win32->ole2_dnd_iface = (IUnknown *) &result->ids;
|
||||
private = PRIVATE_DATA(result->context);
|
||||
private->iface = (IUnknown *) &result->ids;
|
||||
idropsource_addref (&result->ids);
|
||||
|
||||
GDK_NOTE (DND, g_print ("source_context_new: %p\n", result));
|
||||
@@ -1656,6 +1667,7 @@ local_send_enter (GdkDragContext *context,
|
||||
guint32 time)
|
||||
{
|
||||
GdkEvent *tmp_event;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
GdkDragContext *new_context;
|
||||
GdkDevice *device;
|
||||
GdkDeviceManager *device_manager;
|
||||
@@ -1664,6 +1676,8 @@ local_send_enter (GdkDragContext *context,
|
||||
context,
|
||||
current_dest_drag));
|
||||
|
||||
private = PRIVATE_DATA (context);
|
||||
|
||||
if (current_dest_drag != NULL)
|
||||
{
|
||||
g_object_unref (G_OBJECT (current_dest_drag));
|
||||
@@ -1713,7 +1727,6 @@ local_send_motion (GdkDragContext *context,
|
||||
guint32 time)
|
||||
{
|
||||
GdkEvent *tmp_event;
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
|
||||
|
||||
GDK_NOTE (DND, g_print ("local_send_motion: context=%p (%d,%d) current_dest_drag=%p\n",
|
||||
context, x_root, y_root,
|
||||
@@ -1723,8 +1736,6 @@ local_send_motion (GdkDragContext *context,
|
||||
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
|
||||
(current_dest_drag->source_window == context->source_window))
|
||||
{
|
||||
GdkWin32DragContext *current_dest_drag_win32;
|
||||
|
||||
tmp_event = gdk_event_new (GDK_DRAG_MOTION);
|
||||
tmp_event->dnd.window = g_object_ref (current_dest_drag->dest_window);
|
||||
tmp_event->dnd.send_event = FALSE;
|
||||
@@ -1737,11 +1748,10 @@ local_send_motion (GdkDragContext *context,
|
||||
tmp_event->dnd.x_root = x_root;
|
||||
tmp_event->dnd.y_root = y_root;
|
||||
|
||||
current_dest_drag_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
|
||||
current_dest_drag_win32->ole2_dnd_last_pt.x = x_root - _gdk_offset_x;
|
||||
current_dest_drag_win32->ole2_dnd_last_pt.y = y_root - _gdk_offset_y;
|
||||
PRIVATE_DATA (current_dest_drag)->last_pt.x = x_root - _gdk_offset_x;
|
||||
PRIVATE_DATA (current_dest_drag)->last_pt.y = y_root - _gdk_offset_y;
|
||||
|
||||
context_win32->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
||||
PRIVATE_DATA (context)->drag_status = GDK_DRAG_STATUS_MOTION_WAIT;
|
||||
|
||||
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
|
||||
gdk_event_put (tmp_event);
|
||||
@@ -1763,7 +1773,8 @@ local_send_drop (GdkDragContext *context,
|
||||
(current_dest_drag->protocol == GDK_DRAG_PROTO_LOCAL) &&
|
||||
(current_dest_drag->source_window == context->source_window))
|
||||
{
|
||||
GdkWin32DragContext *context_win32;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
private = PRIVATE_DATA (current_dest_drag);
|
||||
|
||||
/* Pass ownership of context to the event */
|
||||
tmp_event = gdk_event_new (GDK_DROP_START);
|
||||
@@ -1773,9 +1784,8 @@ local_send_drop (GdkDragContext *context,
|
||||
tmp_event->dnd.time = GDK_CURRENT_TIME;
|
||||
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (current_dest_drag));
|
||||
|
||||
context_win32 = GDK_WIN32_DRAG_CONTEXT (current_dest_drag);
|
||||
tmp_event->dnd.x_root = context_win32->ole2_dnd_last_pt.x + _gdk_offset_x;
|
||||
tmp_event->dnd.y_root = context_win32->ole2_dnd_last_pt.y + _gdk_offset_y;
|
||||
tmp_event->dnd.x_root = private->last_pt.x + _gdk_offset_x;
|
||||
tmp_event->dnd.y_root = private->last_pt.y + _gdk_offset_y;
|
||||
|
||||
current_dest_drag = NULL;
|
||||
|
||||
@@ -1860,12 +1870,11 @@ _gdk_win32_dnd_do_dragdrop (void)
|
||||
if (use_ole2_dnd)
|
||||
{
|
||||
GdkDragContext* drag_ctx;
|
||||
GdkWin32DragContext *drag_ctx_win32;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
BYTE kbd_state[256];
|
||||
data_object *dobj;
|
||||
HRESULT hr;
|
||||
DWORD dwEffect;
|
||||
|
||||
#if 0
|
||||
HGLOBAL global;
|
||||
STGMEDIUM medium;
|
||||
@@ -1875,25 +1884,25 @@ _gdk_win32_dnd_do_dragdrop (void)
|
||||
return;
|
||||
|
||||
drag_ctx = pending_src_context->context;
|
||||
drag_ctx_win32 = GDK_WIN32_DRAG_CONTEXT (drag_ctx);
|
||||
private = PRIVATE_DATA (drag_ctx);
|
||||
|
||||
dobj = data_object_new (drag_ctx);
|
||||
|
||||
API_CALL (GetCursorPos, (&drag_ctx_win32->ole2_dnd_last_pt));
|
||||
API_CALL (ScreenToClient, (GDK_WINDOW_HWND (drag_ctx->source_window), &drag_ctx_win32->ole2_dnd_last_pt));
|
||||
drag_ctx_win32->ole2_dnd_last_key_state = 0;
|
||||
API_CALL (GetCursorPos, (&private->last_pt));
|
||||
API_CALL (ScreenToClient, (GDK_WINDOW_HWND (drag_ctx->source_window), &private->last_pt));
|
||||
private->last_key_state = 0;
|
||||
API_CALL (GetKeyboardState, (kbd_state));
|
||||
|
||||
if (kbd_state[VK_CONTROL])
|
||||
drag_ctx_win32->ole2_dnd_last_key_state |= MK_CONTROL;
|
||||
private->last_key_state |= MK_CONTROL;
|
||||
if (kbd_state[VK_SHIFT])
|
||||
drag_ctx_win32->ole2_dnd_last_key_state |= MK_SHIFT;
|
||||
private->last_key_state |= MK_SHIFT;
|
||||
if (kbd_state[VK_LBUTTON])
|
||||
drag_ctx_win32->ole2_dnd_last_key_state |= MK_LBUTTON;
|
||||
private->last_key_state |= MK_LBUTTON;
|
||||
if (kbd_state[VK_MBUTTON])
|
||||
drag_ctx_win32->ole2_dnd_last_key_state |= MK_MBUTTON;
|
||||
private->last_key_state |= MK_MBUTTON;
|
||||
if (kbd_state[VK_RBUTTON])
|
||||
drag_ctx_win32->ole2_dnd_last_key_state |= MK_RBUTTON;
|
||||
private->last_key_state |= MK_RBUTTON;
|
||||
|
||||
#if 0
|
||||
global = GlobalAlloc (GMEM_FIXED, sizeof (ctx));
|
||||
@@ -1991,87 +2000,46 @@ _gdk_win32_window_get_drag_protocol (GdkWindow *window,
|
||||
return protocol;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
gint x;
|
||||
gint y;
|
||||
HWND ignore;
|
||||
HWND result;
|
||||
} find_window_enum_arg;
|
||||
|
||||
static BOOL CALLBACK
|
||||
find_window_enum_proc (HWND hwnd,
|
||||
LPARAM lparam)
|
||||
{
|
||||
RECT rect;
|
||||
POINT tl, br;
|
||||
find_window_enum_arg *a = (find_window_enum_arg *) lparam;
|
||||
|
||||
if (hwnd == a->ignore)
|
||||
return TRUE;
|
||||
|
||||
if (!IsWindowVisible (hwnd))
|
||||
return TRUE;
|
||||
|
||||
tl.x = tl.y = 0;
|
||||
ClientToScreen (hwnd, &tl);
|
||||
GetClientRect (hwnd, &rect);
|
||||
br.x = rect.right;
|
||||
br.y = rect.bottom;
|
||||
ClientToScreen (hwnd, &br);
|
||||
|
||||
if (a->x >= tl.x && a->y >= tl.y && a->x < br.x && a->y < br.y)
|
||||
{
|
||||
a->result = hwnd;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_win32_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
{
|
||||
GdkWindow *dest_window, *dw;
|
||||
find_window_enum_arg a;
|
||||
GdkWindow *dest_window;
|
||||
POINT pt;
|
||||
HWND hwnd;
|
||||
|
||||
a.x = x_root - _gdk_offset_x;
|
||||
a.y = y_root - _gdk_offset_y;
|
||||
a.ignore = drag_window ? GDK_WINDOW_HWND (drag_window) : NULL;
|
||||
a.result = NULL;
|
||||
pt.x = x_root - _gdk_offset_x;
|
||||
pt.y = y_root - _gdk_offset_y;
|
||||
|
||||
EnumWindows (find_window_enum_proc, (LPARAM) &a);
|
||||
hwnd = WindowFromPoint (pt);
|
||||
|
||||
if (a.result == NULL)
|
||||
if (hwnd == NULL)
|
||||
dest_window = NULL;
|
||||
else
|
||||
{
|
||||
dw = gdk_win32_handle_table_lookup (a.result);
|
||||
if (dw)
|
||||
{
|
||||
dest_window = gdk_window_get_toplevel (dw);
|
||||
g_object_ref (dest_window);
|
||||
}
|
||||
dest_window = gdk_win32_handle_table_lookup (hwnd);
|
||||
if (dest_window)
|
||||
g_object_ref (dest_window);
|
||||
else
|
||||
dest_window = gdk_win32_window_foreign_new_for_display (_gdk_display, a.result);
|
||||
dest_window = gdk_win32_window_foreign_new_for_display (_gdk_display, hwnd);
|
||||
|
||||
if (use_ole2_dnd)
|
||||
*protocol = GDK_DRAG_PROTO_OLE2;
|
||||
*protocol = GDK_DRAG_PROTO_OLE2;
|
||||
else if (context->source_window)
|
||||
*protocol = GDK_DRAG_PROTO_LOCAL;
|
||||
else
|
||||
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
||||
*protocol = GDK_DRAG_PROTO_WIN32_DROPFILES;
|
||||
}
|
||||
|
||||
GDK_NOTE (DND,
|
||||
g_print ("gdk_drag_find_window: %p %+d%+d: %p: %p %s\n",
|
||||
(drag_window ? GDK_WINDOW_HWND (drag_window) : NULL),
|
||||
x_root, y_root,
|
||||
a.result,
|
||||
hwnd,
|
||||
(dest_window ? GDK_WINDOW_HWND (dest_window) : NULL),
|
||||
_gdk_win32_drag_protocol_to_string (*protocol)));
|
||||
|
||||
@@ -2088,7 +2056,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
|
||||
GdkDragAction possible_actions,
|
||||
guint32 time)
|
||||
{
|
||||
GdkWin32DragContext *context_win32;
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
|
||||
@@ -2104,7 +2072,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
|
||||
_gdk_win32_drag_action_to_string (context->suggested_action),
|
||||
_gdk_win32_drag_action_to_string (context->action)));
|
||||
|
||||
context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
|
||||
private = PRIVATE_DATA (context);
|
||||
|
||||
if (!use_ole2_dnd)
|
||||
{
|
||||
@@ -2127,7 +2095,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
|
||||
|
||||
/* Send a leave to the last destination */
|
||||
gdk_drag_do_leave (context, time);
|
||||
context_win32->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
|
||||
/* Check if new destination accepts drags, and which protocol */
|
||||
if (dest_window)
|
||||
@@ -2156,7 +2124,7 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
|
||||
/* Push a status event, to let the client know that
|
||||
* the drag changed
|
||||
*/
|
||||
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
|
||||
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
|
||||
tmp_event->dnd.window = g_object_ref (context->source_window);
|
||||
/* We use this to signal a synthetic status. Perhaps
|
||||
* we should use an extra field...
|
||||
@@ -2165,21 +2133,21 @@ gdk_win32_drag_context_drag_motion (GdkDragContext *context,
|
||||
|
||||
tmp_event->dnd.context = g_object_ref (context);
|
||||
tmp_event->dnd.time = time;
|
||||
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
|
||||
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (context));
|
||||
|
||||
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
|
||||
gdk_event_put (tmp_event);
|
||||
gdk_event_free (tmp_event);
|
||||
gdk_event_free (tmp_event);
|
||||
}
|
||||
|
||||
/* Send a drag-motion event */
|
||||
|
||||
context_win32->ole2_dnd_last_pt.x = x_root - _gdk_offset_x;
|
||||
context_win32->ole2_dnd_last_pt.y = y_root - _gdk_offset_y;
|
||||
private->last_pt.x = x_root - _gdk_offset_x;
|
||||
private->last_pt.y = y_root - _gdk_offset_y;
|
||||
|
||||
if (context->dest_window)
|
||||
{
|
||||
if (context_win32->drag_status == GDK_DRAG_STATUS_DRAG)
|
||||
if (private->drag_status == GDK_DRAG_STATUS_DRAG)
|
||||
{
|
||||
switch (context->protocol)
|
||||
{
|
||||
@@ -2256,11 +2224,14 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
|
||||
GdkDragAction action,
|
||||
guint32 time)
|
||||
{
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
GdkDragContext *src_context;
|
||||
GdkEvent *tmp_event;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
|
||||
private = PRIVATE_DATA (context);
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_drag_status: %s\n"
|
||||
" context=%p:{actions=%s,suggested=%s,action=%s}\n",
|
||||
_gdk_win32_drag_action_to_string (action),
|
||||
@@ -2279,17 +2250,17 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
|
||||
|
||||
if (src_context)
|
||||
{
|
||||
GdkWin32DragContext *src_context_win32 = GDK_WIN32_DRAG_CONTEXT (src_context);
|
||||
GdkDragContextPrivateWin32 *private = PRIVATE_DATA (src_context);
|
||||
|
||||
if (src_context_win32->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
||||
src_context_win32->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
if (private->drag_status == GDK_DRAG_STATUS_MOTION_WAIT)
|
||||
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
|
||||
tmp_event = gdk_event_new (GDK_DRAG_STATUS);
|
||||
tmp_event->dnd.window = g_object_ref (context->source_window);
|
||||
tmp_event->dnd.send_event = FALSE;
|
||||
tmp_event->dnd.context = g_object_ref (src_context);
|
||||
tmp_event->dnd.time = GDK_CURRENT_TIME; /* FIXME? */
|
||||
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
|
||||
gdk_event_set_device (tmp_event, gdk_drag_context_get_device (src_context));
|
||||
|
||||
if (action == GDK_ACTION_DEFAULT)
|
||||
action = 0;
|
||||
@@ -2298,7 +2269,7 @@ gdk_win32_drag_context_drag_status (GdkDragContext *context,
|
||||
|
||||
GDK_NOTE (EVENTS, _gdk_win32_print_event (tmp_event));
|
||||
gdk_event_put (tmp_event);
|
||||
gdk_event_free (tmp_event);
|
||||
gdk_event_free (tmp_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2325,6 +2296,7 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time)
|
||||
{
|
||||
GdkDragContextPrivateWin32 *private;
|
||||
GdkDragContext *src_context;
|
||||
GdkEvent *tmp_event;
|
||||
|
||||
@@ -2332,6 +2304,8 @@ gdk_win32_drag_context_drop_finish (GdkDragContext *context,
|
||||
|
||||
GDK_NOTE (DND, g_print ("gdk_drop_finish\n"));
|
||||
|
||||
private = PRIVATE_DATA (context);
|
||||
|
||||
if (!use_ole2_dnd)
|
||||
{
|
||||
src_context = gdk_drag_context_find (TRUE,
|
||||
@@ -2394,9 +2368,6 @@ _gdk_win32_window_register_dnd (GdkWindow *window)
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
if (gdk_window_get_window_type (window) == GDK_WINDOW_OFFSCREEN)
|
||||
return;
|
||||
|
||||
if (g_object_get_data (G_OBJECT (window), "gdk-dnd-registered") != NULL)
|
||||
return;
|
||||
else
|
||||
@@ -2452,9 +2423,7 @@ _gdk_win32_window_register_dnd (GdkWindow *window)
|
||||
static gboolean
|
||||
gdk_win32_drag_context_drop_status (GdkDragContext *context)
|
||||
{
|
||||
GdkWin32DragContext *context_win32 = GDK_WIN32_DRAG_CONTEXT (context);
|
||||
|
||||
return ! context_win32->drop_failed;
|
||||
return ! PRIVATE_DATA (context)->drop_failed;
|
||||
}
|
||||
|
||||
static GdkAtom
|
||||
@@ -2479,6 +2448,8 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
|
||||
|
||||
gdk_win32_drag_context_parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gdk_win32_drag_context_finalize;
|
||||
|
||||
context_class->find_window = gdk_win32_drag_context_find_window;
|
||||
@@ -2490,4 +2461,6 @@ gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
|
||||
context_class->drop_finish = gdk_win32_drag_context_drop_finish;
|
||||
context_class->drop_status = gdk_win32_drag_context_drop_status;
|
||||
context_class->get_selection = gdk_win32_drag_context_get_selection;
|
||||
|
||||
g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,12 +59,17 @@ _gdk_window_move_resize_child (GdkWindow *window,
|
||||
gint height)
|
||||
{
|
||||
GdkWindowImplWin32 *impl;
|
||||
gboolean is_move;
|
||||
gboolean is_resize;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
is_move = (x - window->x != 0) && (y - window->y != 0);
|
||||
is_resize = window->width != width && window->height != height;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s@%+d%+d %dx%d@%+d%+d\n",
|
||||
_gdk_win32_window_description (window),
|
||||
window->x, window->y, width, height, x, y));
|
||||
@@ -88,15 +93,19 @@ _gdk_window_move_resize_child (GdkWindow *window,
|
||||
_gdk_win32_window_tmp_unset_bg (window, TRUE);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
|
||||
"NOACTIVATE|NOZORDER)\n",
|
||||
"NOACTIVATE|NOZORDER%s%s)\n",
|
||||
GDK_WINDOW_HWND (window),
|
||||
window->x + window->parent->abs_x, window->y + window->parent->abs_y,
|
||||
width, height));
|
||||
width, height,
|
||||
(is_move ? "" : "|NOMOVE"),
|
||||
(is_resize ? "" : "|NOSIZE")));
|
||||
|
||||
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
|
||||
window->x + window->parent->abs_x, window->y + window->parent->abs_y,
|
||||
width, height,
|
||||
SWP_NOACTIVATE | SWP_NOZORDER));
|
||||
SWP_NOACTIVATE | SWP_NOZORDER |
|
||||
(is_move ? 0 : SWP_NOMOVE) |
|
||||
(is_resize ? 0 : SWP_NOSIZE)));
|
||||
|
||||
_gdk_win32_window_tmp_reset_bg (window, TRUE);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,6 @@ gint _gdk_input_ignore_wintab = FALSE;
|
||||
gint _gdk_max_colors = 0;
|
||||
|
||||
gboolean _modal_operation_in_progress = FALSE;
|
||||
HWND _modal_move_resize_window = NULL;
|
||||
gboolean _ignore_destroy_clipboard = FALSE;
|
||||
|
||||
HGLOBAL _delayed_rendering_data = NULL;
|
||||
|
||||
@@ -121,7 +121,4 @@ _gdk_input_init (GdkDisplay *display)
|
||||
_gdk_input_devices = g_list_append (NULL, display->core_pointer);
|
||||
_gdk_input_devices = g_list_concat (_gdk_input_devices,
|
||||
g_list_copy (device_manager->wintab_devices));
|
||||
|
||||
_gdk_input_wintab_init_check (device_manager);
|
||||
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ void _gdk_dropfiles_store (gchar *data);
|
||||
void _gdk_push_modal_window (GdkWindow *window);
|
||||
void _gdk_remove_modal_window (GdkWindow *window);
|
||||
GdkWindow *_gdk_modal_current (void);
|
||||
gboolean _gdk_modal_blocked (GdkWindow *window);
|
||||
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gchar *_gdk_win32_color_to_string (const GdkColor *color);
|
||||
@@ -343,8 +343,6 @@ extern gint _gdk_max_colors;
|
||||
/* TRUE while a modal sizing, moving, or dnd operation is in progress */
|
||||
extern gboolean _modal_operation_in_progress;
|
||||
|
||||
extern HWND _modal_move_resize_window;
|
||||
|
||||
/* TRUE when we are emptying the clipboard ourselves */
|
||||
extern gboolean _ignore_destroy_clipboard;
|
||||
|
||||
@@ -356,8 +354,6 @@ extern GHashTable *_format_atom_table;
|
||||
/* Hold the result of a delayed rendering */
|
||||
extern HGLOBAL _delayed_rendering_data;
|
||||
|
||||
extern HCURSOR _gdk_win32_grab_cursor;
|
||||
|
||||
HGLOBAL _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
|
||||
GdkAtom target);
|
||||
|
||||
@@ -390,6 +386,7 @@ gboolean _gdk_win32_display_supports_cursor_color (GdkDisplay *display);
|
||||
|
||||
GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
|
||||
|
||||
void _gdk_win32_display_sync (GdkDisplay * display);
|
||||
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
|
||||
void _gdk_win32_display_queue_events (GdkDisplay *display);
|
||||
|
||||
@@ -406,7 +403,7 @@ gboolean _gdk_win32_display_set_selection_owner (GdkDisplay *display,
|
||||
guint32 time,
|
||||
gboolean send_event);
|
||||
void _gdk_win32_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
HWND requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
@@ -496,8 +493,6 @@ GdkAtom _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
|
||||
gint only_if_exists);
|
||||
gchar *_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager,
|
||||
GdkAtom atom);
|
||||
void _gdk_win32_append_event (GdkEvent *event);
|
||||
void _gdk_win32_emit_configure_event (GdkWindow *window);
|
||||
|
||||
/* Initialization */
|
||||
void _gdk_win32_windowing_init (void);
|
||||
@@ -508,6 +503,5 @@ void _gdk_visual_init (void);
|
||||
void _gdk_dnd_init (void);
|
||||
void _gdk_events_init (void);
|
||||
void _gdk_input_init (GdkDisplay *display);
|
||||
void _gdk_input_wintab_init_check (GdkDeviceManager *device_manager);
|
||||
|
||||
#endif /* __GDK_PRIVATE_WIN32_H__ */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user