Compare commits
133 Commits
fixed-item
...
wip/mir
Author | SHA1 | Date | |
---|---|---|---|
|
08b276a6d4 | ||
|
e6289f6169 | ||
|
bf6743712d | ||
|
7ce746b9a5 | ||
|
ddd9718cde | ||
|
0c69298c1c | ||
|
1104088cbf | ||
|
ce50fc001a | ||
|
2e8f42da85 | ||
|
73864a350b | ||
|
f3f5b6bd02 | ||
|
0835964a3d | ||
|
3b2cd941e3 | ||
|
e8d7fa2d32 | ||
|
a514240b72 | ||
|
5ae4249f37 | ||
|
6e2230b270 | ||
|
8eafde7353 | ||
|
582231fe18 | ||
|
4073e6b3f5 | ||
|
2ffc1945ad | ||
|
d3566a9370 | ||
|
f7fb50be8d | ||
|
f0bc0d955d | ||
|
86623e1514 | ||
|
e40795cbff | ||
|
2c6694dbd7 | ||
|
09f81372c0 | ||
|
bc1328f7ae | ||
|
610b1bd561 | ||
|
bfa2bedda0 | ||
|
ee65b232d8 | ||
|
b73b191e08 | ||
|
40207471d5 | ||
|
3e4167f06e | ||
|
0022c25ab6 | ||
|
bd0e083ef2 | ||
|
5cea3ab1f3 | ||
|
674672dd66 | ||
|
7b9afbd5a0 | ||
|
da9db83702 | ||
|
469dad556a | ||
|
5628a398ab | ||
|
eaff88f0ec | ||
|
4e829c244e | ||
|
99310900bf | ||
|
ec68c85c52 | ||
|
c9e110870e | ||
|
d2c8f0a84b | ||
|
d6c1a6280d | ||
|
f15f13a0fb | ||
|
dc9d8e9202 | ||
|
350e76ae48 | ||
|
d917bdc836 | ||
|
84f6eefec8 | ||
|
d80ef2f827 | ||
|
234fec14f3 | ||
|
c6c2408a8d | ||
|
67b2f0c9b4 | ||
|
e8cccbb55c | ||
|
492b732872 | ||
|
392c9a46ad | ||
|
58a740b29a | ||
|
a1a6ef613e | ||
|
123b424fb7 | ||
|
d3c096e0cc | ||
|
da55db257c | ||
|
27387a0944 | ||
|
274a8d3774 | ||
|
ce1938651a | ||
|
063aa29f4b | ||
|
c80892c3f2 | ||
|
2a0167f82c | ||
|
9d44ec92e5 | ||
|
1cb15abce9 | ||
|
eb67f0208b | ||
|
45e65f2d49 | ||
|
605a8fc158 | ||
|
c435ca8913 | ||
|
26a1a824eb | ||
|
7451b48708 | ||
|
5b651d0dae | ||
|
7ff1142ee9 | ||
|
affd7c1d9d | ||
|
3a0b78fd98 | ||
|
5eb6f4d2ab | ||
|
35aec354d7 | ||
|
281ca4905a | ||
|
e9ba546203 | ||
|
40926214c7 | ||
|
69b8aa8fcf | ||
|
b99b0257c9 | ||
|
ee9454ce55 | ||
|
539f18f998 | ||
|
01dac000a6 | ||
|
c478e31448 | ||
|
313714c1e1 | ||
|
208b9f0bbe | ||
|
fc34b4a2e3 | ||
|
3b0f7eb23e | ||
|
4ccc2494b3 | ||
|
cb727c88dc | ||
|
f9375b1f6f | ||
|
a5ac6bb48a | ||
|
fff108dd0a | ||
|
37799e1b97 | ||
|
f8aab7f341 | ||
|
7a2f347678 | ||
|
8fc1a1e52a | ||
|
0263a9712a | ||
|
8da7f6861e | ||
|
391573ad2c | ||
|
6015befd96 | ||
|
bf742b1e67 | ||
|
4823516339 | ||
|
03dd609544 | ||
|
074ce8958d | ||
|
0b911c3f41 | ||
|
edcea7e60b | ||
|
0ffc8a1eec | ||
|
51aeb39bb0 | ||
|
750d7a2fe9 | ||
|
365819be8e | ||
|
7d2f3530e8 | ||
|
1f1cd64028 | ||
|
e41999cf98 | ||
|
714c38c8b1 | ||
|
06010eead1 | ||
|
0ede4d53cf | ||
|
23dfc25583 | ||
|
651f1c566a | ||
|
b7d55bfe14 | ||
|
85ba100f23 |
@@ -33,11 +33,11 @@ MAINTAINERCLEANFILES = \
|
||||
|
||||
|
||||
## Copy .pc files to target-specific names
|
||||
gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc gtk+-wayland-3.0.pc: gtk+-3.0.pc
|
||||
gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc gtk+-broadway-3.0.pc gtk+-wayland-3.0.pc gtk+-mir-3.0.pc: gtk+-3.0.pc
|
||||
rm -f $@ && \
|
||||
cp gtk+-3.0.pc $@
|
||||
|
||||
gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc: gdk-3.0.pc
|
||||
gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-wayland-3.0.pc gdk-mir-3.0.pc: gdk-3.0.pc
|
||||
rm -f $@ && \
|
||||
cp gdk-3.0.pc $@
|
||||
|
||||
@@ -59,12 +59,14 @@ DISTCLEANFILES = \
|
||||
gtk+-quartz-3.0.pc \
|
||||
gtk+-broadway-3.0.pc \
|
||||
gtk+-wayland-3.0.pc \
|
||||
gtk+-mir-3.0.pc \
|
||||
gdk-3.0.pc \
|
||||
gdk-x11-3.0.pc \
|
||||
gdk-win32-3.0.pc \
|
||||
gdk-quartz-3.0.pc \
|
||||
gdk-broadway-3.0.pc \
|
||||
gdk-wayland-3.0.pc \
|
||||
gdk-mir-3.0.pc \
|
||||
gail-3.0.pc \
|
||||
config.lt
|
||||
|
||||
|
77
NEWS
@@ -1,3 +1,80 @@
|
||||
Overview of Changes in GTK+ 3.12.1 to 3.12.2
|
||||
============================================
|
||||
|
||||
* Bug fixes:
|
||||
495105 Open recent file keyboard shortcuts do not work correctly
|
||||
686170 gdk/win32: VK_SNAPSHOT maps to GDK_Print
|
||||
726592 W32: problems with CSDed windows
|
||||
727487 Color picker check marks not cleared properly
|
||||
728093 Add missing transfer annotation to gtk_box_get_center_widget
|
||||
728140 Illegal parameter passed to g_variant_new in gtk_application...
|
||||
728183 Drag and drop (GdkFrameClock) does not work for hidden widgets
|
||||
728272 make broadway backend build on OpenBSD
|
||||
728284 Graphics artifact when scrolling with hover-selection
|
||||
728526 weird black border appear when dragging file
|
||||
728745 win32: add more clipboard data checks to avoid crash
|
||||
728806 W32: Check- and radio-buttons have a selection rectangle on ac...
|
||||
728807 W32: Checkbutton focus rectangle becomes almost white on prelight
|
||||
728808 W32: Checkboxes on modelbuttons are drawn like buttons themselves
|
||||
728810 W32: Modelbuttons look like buttons
|
||||
728992 GtkLockButton crash if clicked and permission is NULL
|
||||
729346 W32: App-notification has no theme, shows up transparent
|
||||
729451 Removing accels with application_set_accels_for_action
|
||||
729670 cairo surface leaked for each cursor created from pixmap
|
||||
|
||||
* Translation updates:
|
||||
Belarusian
|
||||
German
|
||||
Indonesian
|
||||
Japanese
|
||||
Russian
|
||||
Slovenian
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.12.0 to 3.12.1
|
||||
============================================
|
||||
|
||||
* Bug fixes:
|
||||
712752 GtkClipboard: add _get_default and _get_primary
|
||||
722058 GtkTreeModelFilter bug
|
||||
722817 Add gobject-introspection for GdkWin32
|
||||
726298 gtk-font-name isn't correctly handled on Windows
|
||||
726475 After looking at Asielriot solitare, I get rendering glitches...
|
||||
726859 Assertion/crash if gtk_radio_menu_item_set_group() is called twice
|
||||
726870 all: Name more idles and timeouts
|
||||
726871 treeview: Lower the duration of validation iterations
|
||||
726996 Label-for/Labelled-by AtkRelations missing for containers in ...
|
||||
727009 redefinition of GtkPrinterCloudprint: cloudprint fails to build
|
||||
727022 W32: Both inc- and dec-buttons on GtkSpinbutton are "inc"
|
||||
727035 W32: Combobox button is drawn with two arrows
|
||||
727036 W32: Combobox dropdown color is button-gray instead of window-white
|
||||
727037 W32: Menu items look thin, while submenu arrows are huge
|
||||
727075 W32: Combobox (with an entry) is gigantic
|
||||
727078 W32: GtkPopover is transparent and non-interactable
|
||||
727080 W32: Window re-size grip looks UGLY.
|
||||
727210 W32: Prelight doesn't apply to check/radio marks
|
||||
727211 W32: Selection background color applies to check/radio marks
|
||||
727213 W32: Notebook widget is not styled correctly
|
||||
727244 W32: Items selected in listbox have correct background color,...
|
||||
727245 W32: No .dim-label style
|
||||
727313 a11y: do not use deprecated a11y functions.
|
||||
727322 docs: Remove '\' escape character from literals
|
||||
727391 W32: scrollbar sliders have no "active" and "insensitive" styles
|
||||
727410 W32: tooltips are not themed
|
||||
727414 Redundant text in titlebar
|
||||
727643 Segfault in gtk-3.12.0
|
||||
727662 [PATCH] GtkVolumeButton displays "missing image" icons
|
||||
727973 W32: focused button is visibly smaller
|
||||
728023 Warning when passing NULL window to inhibit
|
||||
727644 SEGV in gtk_window_propagate_key_event()
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Catalan
|
||||
Greek
|
||||
Russian
|
||||
|
||||
Overview of Changes in GTK+ 3.11.9 to 3.12.0
|
||||
============================================
|
||||
|
||||
|
@@ -4,6 +4,10 @@
|
||||
<Import Project="gtk-build-defines.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros">
|
||||
<BinDir>$(SolutionDir)$(Configuration)\$(Platform)\bin</BinDir>
|
||||
<InstalledDlls>$(BinDir)\$(GtkDllPrefix)gdk(GtkDllSuffix).dll;$(BinDir)\$(GtkDllPrefix)gtk(GtkDllSuffix).dll;$(BinDir)\$(GtkDllPrefix)gailutil(GtkDllSuffix).dll</InstalledDlls>
|
||||
<InstalledBins>$(BinDir)\gtk3-demo.exe;$(BinDir)\gtk3-demo-application.exe</InstalledBins>
|
||||
<InstalledBroadwayBins>$(BinDir)\broadwayd.exe</InstalledBroadwayBins>
|
||||
<GtkDoInstallBin>
|
||||
mkdir $(CopyDir)\bin
|
||||
|
||||
@@ -15,22 +19,22 @@ if "$(Configuration)" == "Release_Broadway" goto DO_BROADWAY_BIN
|
||||
if "$(Configuration)" == "Debug_Broadway" goto DO_BROADWAY_BIN
|
||||
|
||||
|
||||
copy $(Configuration)\$(Platform)\bin\*.dll $(CopyDir)\bin
|
||||
copy $(BinDir)\*.dll $(CopyDir)\bin
|
||||
|
||||
copy $(Configuration)\$(Platform)\bin\*-$(ApiVersion).lib $(CopyDir)\lib
|
||||
copy $(BinDir)\*-$(ApiVersion).lib $(CopyDir)\lib
|
||||
|
||||
copy $(Configuration)\$(Platform)\bin\*.exe $(CopyDir)\bin
|
||||
copy $(BinDir)\*.exe $(CopyDir)\bin
|
||||
|
||||
goto DONE_BIN
|
||||
|
||||
|
||||
:DO_BROADWAY_BIN
|
||||
|
||||
copy $(Configuration)\$(Platform)\bin\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll $(CopyDir)\bin
|
||||
copy $(BinDir)\$(GtkDllPrefix)gdk$(GtkDllSuffix).dll $(CopyDir)\bin
|
||||
|
||||
copy $(Configuration)\$(Platform)\bin\gdk-$(ApiVersion).lib $(CopyDir)\lib
|
||||
copy $(BinDir)\gdk-$(ApiVersion).lib $(CopyDir)\lib
|
||||
|
||||
copy $(Configuration)\$(Platform)\bin\broadwayd.exe $(CopyDir)\bin
|
||||
copy $(BinDir)\broadwayd.exe $(CopyDir)\bin
|
||||
|
||||
|
||||
if "$(Configuration)" == "Release_Broadway" copy .\Release\$(Platform)\bin\$(GtkDllPrefix)gtk$(GtkDllSuffix).dll $(CopyDir)\bin
|
||||
@@ -214,6 +218,8 @@ copy ..\..\..\gtk\a11y\gtknotebookpageaccessible.h $(CopyDir)\include\gtk-$(ApiV
|
||||
|
||||
copy ..\..\..\gtk\a11y\gtkpanedaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y
|
||||
|
||||
copy ..\..\..\gtk\a11y\gtkpopoveraccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y
|
||||
|
||||
copy ..\..\..\gtk\a11y\gtkprogressbaraccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y
|
||||
|
||||
copy ..\..\..\gtk\a11y\gtkradiobuttonaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y
|
||||
@@ -796,6 +802,18 @@ copy ..\..\..\gdk\broadway\gdkbroadwayvisual.h $(CopyDir)\include\gtk-$(ApiVersi
|
||||
<_PropertySheetDisplayName>gtkinstallsprops</_PropertySheetDisplayName>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<BuildMacro Include="BinDir">
|
||||
<Value>$(BinDir)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="InstalledDlls">
|
||||
<Value>$(InstalledDlls)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="InstalledBins">
|
||||
<Value>$(InstalledBins)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="InstalledBroadwayBins">
|
||||
<Value>$(InstalledBroadwayBins)</Value>
|
||||
</BuildMacro>
|
||||
<BuildMacro Include="GtkDoInstallBin">
|
||||
<Value>$(GtkDoInstallBin)</Value>
|
||||
</BuildMacro>
|
||||
|
@@ -139,45 +139,49 @@
|
||||
<ExtensionsToDeleteOnClean Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command>$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\..\config.h.win32">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">Installing Build Results...</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="gdk.vcxproj">
|
||||
<Project>{fc5aadb5-95cd-4bf0-ba8b-0c16fe7073f7}</Project>
|
||||
|
@@ -121,6 +121,7 @@ copy ..\..\..\gtk\a11y\gtkmenushellaccessible.h $(CopyDir)\include\gtk-$(ApiVers
|
||||
copy ..\..\..\gtk\a11y\gtknotebookaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
copy ..\..\..\gtk\a11y\gtknotebookpageaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
copy ..\..\..\gtk\a11y\gtkpanedaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
copy ..\..\..\gtk\a11y\gtkpopoveraccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
copy ..\..\..\gtk\a11y\gtkprogressbaraccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
copy ..\..\..\gtk\a11y\gtkradiobuttonaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
copy ..\..\..\gtk\a11y\gtkradiomenuitemaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

|
||||
|
43
configure.ac
@@ -10,8 +10,8 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [12])
|
||||
m4_define([gtk_micro_version], [1])
|
||||
m4_define([gtk_interface_age], [1])
|
||||
m4_define([gtk_micro_version], [3])
|
||||
m4_define([gtk_interface_age], [3])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
m4_define([gtk_version],
|
||||
@@ -322,6 +322,10 @@ AC_ARG_ENABLE(wayland-backend,
|
||||
[AS_HELP_STRING([--enable-wayland-backend],
|
||||
[enable the wayland gdk backend])],
|
||||
[backend_set=yes])
|
||||
AC_ARG_ENABLE(mir-backend,
|
||||
[AS_HELP_STRING([--enable-mir-backend],
|
||||
[enable the Mir gdk backend])],
|
||||
[backend_set=yes])
|
||||
|
||||
if test -z "$backend_set"; then
|
||||
if test "$platform_win32" = yes; then
|
||||
@@ -329,6 +333,7 @@ if test -z "$backend_set"; then
|
||||
else
|
||||
enable_x11_backend=yes
|
||||
enable_wayland_backend=maybe
|
||||
enable_mir_backend=maybe
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -397,6 +402,11 @@ else
|
||||
fi
|
||||
AC_SUBST(DISABLE_ON_QUARTZ)
|
||||
|
||||
AC_CHECK_LIB([rt], [shm_open], [SHM_LIBS="-lrt"], [SHM_LIBS=""])
|
||||
AC_SUBST(SHM_LIBS)
|
||||
|
||||
AC_CHECK_FUNCS(posix_fallocate)
|
||||
|
||||
if test "x$enable_broadway_backend" = xyes; then
|
||||
GDK_BACKENDS="$GDK_BACKENDS broadway"
|
||||
cairo_backends="$cairo_backends cairo"
|
||||
@@ -445,6 +455,30 @@ else
|
||||
AM_CONDITIONAL(USE_WAYLAND, false)
|
||||
fi
|
||||
|
||||
MIR_DEPENDENCIES="mirclient"
|
||||
if test "$enable_mir_backend" = "maybe" ; then
|
||||
PKG_CHECK_EXISTS($MIR_DEPENDENCIES, [have_mir_deps=yes], [have_mir_deps=no])
|
||||
AC_MSG_CHECKING([for MIR_DEPENDENCIES])
|
||||
if test "$have_mir_deps" = "no" ; then
|
||||
enable_mir_backend=no
|
||||
else
|
||||
enable_mir_backend=yes
|
||||
fi
|
||||
AC_MSG_RESULT($enable_mir_backend)
|
||||
fi
|
||||
|
||||
if test "$enable_mir_backend" = "yes"; then
|
||||
cairo_backends="$cairo_backends cairo"
|
||||
GDK_BACKENDS="$GDK_BACKENDS mir"
|
||||
GDK_WINDOWING="$GDK_WINDOWING
|
||||
#define GDK_WINDOWING_MIR"
|
||||
MIR_PACKAGES="$MIR_DEPENDENCIES"
|
||||
|
||||
AM_CONDITIONAL(USE_MIR, true)
|
||||
else
|
||||
AM_CONDITIONAL(USE_MIR, false)
|
||||
fi
|
||||
|
||||
# strip leading space
|
||||
GDK_BACKENDS=${GDK_BACKENDS#* }
|
||||
|
||||
@@ -1316,7 +1350,7 @@ CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version"
|
||||
GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends"
|
||||
GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES $cairo_backends"
|
||||
if test "x$enable_x11_backend" = xyes; then
|
||||
GDK_PRIVATE_PACKAGES="$GDK_PRIVATE_PACKAGES pangoft2"
|
||||
fi
|
||||
@@ -1353,7 +1387,7 @@ fi
|
||||
PKG_CHECK_MODULES(ATK, $ATK_PACKAGES)
|
||||
|
||||
GTK_PACKAGES="atk >= atk_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version gdk-pixbuf-2.0 >= gdk_pixbuf_required_version gio-2.0 >= glib_required_version"
|
||||
GTK_PRIVATE_PACKAGES="$ATK_PACKAGES"
|
||||
GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES $MIR_PACKAGES"
|
||||
if test "x$enable_x11_backend" = xyes; then
|
||||
GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
|
||||
fi
|
||||
@@ -1876,6 +1910,7 @@ gdk/win32/rc/Makefile
|
||||
gdk/win32/rc/gdk.rc
|
||||
gdk/quartz/Makefile
|
||||
gdk/wayland/Makefile
|
||||
gdk/mir/Makefile
|
||||
gdk/gdkversionmacros.h
|
||||
gtk/Makefile
|
||||
gtk/makefile.msc
|
||||
|
@@ -50,18 +50,21 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
|
||||
/* We know the pixbuf inside the GtkImage has changed, but the image
|
||||
* itself doesn't know this; so queue a redraw. If we wanted to be
|
||||
* really efficient, we could use a drawing area or something
|
||||
* instead of a GtkImage, so we could control the exact position of
|
||||
* the pixbuf on the display, then we could queue a draw for only
|
||||
* the updated area of the image.
|
||||
* itself doesn't know this; so give it a hint by setting the pixbuf
|
||||
* again. Queuing a redraw used to be sufficient, but nowadays GtkImage
|
||||
* uses GtkIconHelper which caches the pixbuf state and will just redraw
|
||||
* from the cache.
|
||||
*/
|
||||
|
||||
gtk_widget_queue_draw (image);
|
||||
pixbuf = gtk_image_get_pixbuf (GTK_IMAGE (image));
|
||||
g_object_ref (pixbuf);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@@ -33,6 +33,7 @@ activate_link (GtkWidget *label,
|
||||
"The term <i>keynav</i> is a shorthand for "
|
||||
"keyboard navigation and refers to the process of using "
|
||||
"a program (exclusively) via keyboard input.");
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
|
||||
|
@@ -18,6 +18,8 @@ change_direction (GtkRevealer *revealer)
|
||||
gtk_revealer_set_reveal_child (revealer, !revealed);
|
||||
}
|
||||
|
||||
static guint timeout = 0;
|
||||
|
||||
static gboolean
|
||||
reveal_one (gpointer data)
|
||||
{
|
||||
@@ -33,11 +35,15 @@ reveal_one (gpointer data)
|
||||
G_CALLBACK (change_direction), NULL);
|
||||
count++;
|
||||
|
||||
return count < 9;
|
||||
if (count >= 9)
|
||||
{
|
||||
timeout = 0;
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint timeout = 0;
|
||||
|
||||
static void
|
||||
response_cb (GtkWidget *dialog,
|
||||
gint response_id,
|
||||
|
@@ -145,6 +145,7 @@ content_files = \
|
||||
osx.sgml \
|
||||
broadway.xml \
|
||||
wayland.xml \
|
||||
mir.xml \
|
||||
question_index.sgml \
|
||||
resources.sgml \
|
||||
text_widget.sgml \
|
||||
|
@@ -394,6 +394,11 @@ How to compile GTK+ itself
|
||||
<arg choice="plain">--disable-wayland-backend</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">--enable-mir-backend</arg>
|
||||
<arg choice="plain">--disable-mir-backend</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">--enable-introspection=[no/auto/yes]</arg>
|
||||
</group>
|
||||
@@ -595,8 +600,10 @@ How to compile GTK+ itself
|
||||
<systemitem>--disable-quartz-backend</systemitem>,
|
||||
<systemitem>--enable-broadway-backend</systemitem>,
|
||||
<systemitem>--disable-broadway-backend</systemitem>,
|
||||
<systemitem>--enable-wayland-backend</systemitem>, and
|
||||
<systemitem>--disable-wayland-backend</systemitem></title>
|
||||
<systemitem>--enable-wayland-backend</systemitem>,
|
||||
<systemitem>--disable-wayland-backend</systemitem>
|
||||
<systemitem>--enable-mir-backend</systemitem>, and
|
||||
<systemitem>--disable-mir-backend</systemitem></title>
|
||||
|
||||
<para>
|
||||
Enables specific backends for GDK. If none of these options
|
||||
|
@@ -605,12 +605,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
@@ -633,7 +637,7 @@ example_app_class_init (ExampleAppClass *class)
|
||||
<para>Our preferences menu item does not do anything yet,
|
||||
but the Quit menu item is fully functional. Note that it
|
||||
can also be activated by the usual Ctrl-Q shortcut. The
|
||||
shortcut was specified in the ui file.
|
||||
shortcut was added with gtk_application_set_accels_for_action().
|
||||
</para>
|
||||
|
||||
<para>The application menu looks like this:</para>
|
||||
@@ -982,9 +986,8 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
<programlisting><xi:include href="../../../../examples/application10/window.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
|
||||
</informalexample>
|
||||
|
||||
<para>A small extra refinement that we have added here is to allow
|
||||
the header bar to provide a fallback application menu, by setting
|
||||
the show-fallback-app-menu property to TRUE. Here is how the
|
||||
<para>A small extra bonus of using a header bar is that we get
|
||||
a fallback application menu for free. Here is how the
|
||||
application now looks, if this fallback is used.</para>
|
||||
|
||||
<informalfigure>
|
||||
|
@@ -394,6 +394,7 @@
|
||||
<xi:include href="osx.sgml" />
|
||||
<xi:include href="broadway.xml" />
|
||||
<xi:include href="wayland.xml" />
|
||||
<xi:include href="mir.xml" />
|
||||
</part>
|
||||
|
||||
<xi:include href="glossary.xml" />
|
||||
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 164 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 206 KiB |
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 218 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 91 KiB After Width: | Height: | Size: 46 KiB |
35
docs/reference/gtk/mir.xml
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk-mir">
|
||||
<refmeta>
|
||||
<refentrytitle>Using GTK+ with Mir</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>GTK Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>Using GTK+ with Mir</refname>
|
||||
<refpurpose>
|
||||
Mir-specific aspects of using GTK+
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Using GTK+ with Mir</title>
|
||||
|
||||
<para>
|
||||
The GDK Mir backend provides support for running GTK+ applications
|
||||
under Mir based display servers. To run your application in this way,
|
||||
select the Mir backend by setting <literal>GDK_BACKEND=mir</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, the Mir backend does not use any additional commandline
|
||||
options or environment variables.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -474,6 +474,11 @@ nevertheless.
|
||||
<listitem><para>Selects the Wayland backend for connecting to Wayland display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>mir</term>
|
||||
<listitem><para>Selects the Mir backend for connecting to Mir display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
Since 3.10, this environment variable can contain a comma-separated list
|
||||
of backend names, which are tried in order. The list may also contain
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -53,12 +53,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
|
@@ -25,12 +25,6 @@ struct _ExampleAppPrefsPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
preferences_closed (GtkWidget *button)
|
||||
{
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (button));
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
example_app_prefs_new (ExampleAppWindow *win)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
|
||||
}
|
||||
|
@@ -64,19 +64,6 @@
|
||||
</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">
|
||||
<signal name="clicked" handler="preferences_closed"/>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Close</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
@@ -9,7 +9,6 @@
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<property name="show-fallback-app-menu">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines_label">
|
||||
<property name="visible">False</property>
|
||||
@@ -30,6 +29,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -37,6 +37,9 @@
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
@@ -52,6 +55,10 @@
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="gears-icon">
|
||||
<property name="visible">True</property>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -46,12 +46,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -46,12 +46,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -4,12 +4,14 @@
|
||||
#include "exampleappwin.h"
|
||||
#include "exampleappprefs.h"
|
||||
|
||||
struct ExampleApp {
|
||||
GtkApplication parent;
|
||||
struct ExampleApp
|
||||
{
|
||||
GtkApplication parent;
|
||||
};
|
||||
|
||||
struct ExampleAppClass {
|
||||
GtkApplicationClass parent_class;
|
||||
struct ExampleAppClass
|
||||
{
|
||||
GtkApplicationClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(ExampleApp, example_app, GTK_TYPE_APPLICATION);
|
||||
@@ -24,12 +26,12 @@ preferences_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer app)
|
||||
{
|
||||
ExampleAppPrefs *prefs;
|
||||
GtkWindow *win;
|
||||
ExampleAppPrefs *prefs;
|
||||
GtkWindow *win;
|
||||
|
||||
win = gtk_application_get_active_window (GTK_APPLICATION (app));
|
||||
prefs = example_app_prefs_new (EXAMPLE_APP_WINDOW (win));
|
||||
gtk_window_present (GTK_WINDOW (prefs));
|
||||
win = gtk_application_get_active_window (GTK_APPLICATION (app));
|
||||
prefs = example_app_prefs_new (EXAMPLE_APP_WINDOW (win));
|
||||
gtk_window_present (GTK_WINDOW (prefs));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -40,36 +42,41 @@ quit_activated (GSimpleAction *action,
|
||||
g_application_quit (G_APPLICATION (app));
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "preferences", preferences_activated, NULL, NULL, NULL },
|
||||
{ "quit", quit_activated, NULL, NULL, NULL }
|
||||
static GActionEntry app_entries[] =
|
||||
{
|
||||
{ "preferences", preferences_activated, NULL, NULL, NULL },
|
||||
{ "quit", quit_activated, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
|
||||
g_object_unref (builder);
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
gtk_application_set_app_menu (GTK_APPLICATION (app), app_menu);
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_activate (GApplication *app)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindow *win;
|
||||
|
||||
win = example_app_window_new (EXAMPLE_APP (app));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
win = example_app_window_new (EXAMPLE_APP (app));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -78,35 +85,35 @@ example_app_open (GApplication *app,
|
||||
gint n_files,
|
||||
const gchar *hint)
|
||||
{
|
||||
GList *windows;
|
||||
ExampleAppWindow *win;
|
||||
int i;
|
||||
GList *windows;
|
||||
ExampleAppWindow *win;
|
||||
int i;
|
||||
|
||||
windows = gtk_application_get_windows (GTK_APPLICATION (app));
|
||||
if (windows)
|
||||
win = EXAMPLE_APP_WINDOW (windows->data);
|
||||
else
|
||||
win = example_app_window_new (EXAMPLE_APP (app));
|
||||
windows = gtk_application_get_windows (GTK_APPLICATION (app));
|
||||
if (windows)
|
||||
win = EXAMPLE_APP_WINDOW (windows->data);
|
||||
else
|
||||
win = example_app_window_new (EXAMPLE_APP (app));
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
example_app_window_open (win, files[i]);
|
||||
for (i = 0; i < n_files; i++)
|
||||
example_app_window_open (win, files[i]);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_class_init (ExampleAppClass *class)
|
||||
{
|
||||
G_APPLICATION_CLASS (class)->startup = example_app_startup;
|
||||
G_APPLICATION_CLASS (class)->activate = example_app_activate;
|
||||
G_APPLICATION_CLASS (class)->open = example_app_open;
|
||||
G_APPLICATION_CLASS (class)->startup = example_app_startup;
|
||||
G_APPLICATION_CLASS (class)->activate = example_app_activate;
|
||||
G_APPLICATION_CLASS (class)->open = example_app_open;
|
||||
}
|
||||
|
||||
ExampleApp *
|
||||
example_app_new (void)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_TYPE,
|
||||
"application-id", "org.gtk.exampleapp",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
return g_object_new (EXAMPLE_APP_TYPE,
|
||||
"application-id", "org.gtk.exampleapp",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
|
@@ -25,12 +25,6 @@ struct _ExampleAppPrefsPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
preferences_closed (GtkWidget *button)
|
||||
{
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (button));
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
example_app_prefs_new (ExampleAppWindow *win)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
|
||||
}
|
||||
|
@@ -2,19 +2,22 @@
|
||||
#include "exampleappwin.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
struct ExampleAppWindow {
|
||||
GtkApplicationWindow parent;
|
||||
struct ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
struct ExampleAppWindowClass {
|
||||
GtkApplicationWindowClass parent_class;
|
||||
struct ExampleAppWindowClass
|
||||
{
|
||||
GtkApplicationWindowClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct ExampleAppWindowPrivate {
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
struct ExampleAppWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
@@ -22,87 +25,88 @@ G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLIC
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_window_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
g_clear_object (&priv->settings);
|
||||
g_clear_object (&priv->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
{
|
||||
G_OBJECT_CLASS (class)->dispose = example_app_window_dispose;
|
||||
G_OBJECT_CLASS (class)->dispose = example_app_window_dispose;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
}
|
||||
|
||||
ExampleAppWindow *
|
||||
example_app_window_new (ExampleApp *app)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_WINDOW_TYPE, "application", app, NULL);
|
||||
return g_object_new (EXAMPLE_APP_WINDOW_TYPE, "application", app, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
gsize length;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
gsize length;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL)) {
|
||||
gtk_text_buffer_set_text (buffer, contents, length);
|
||||
g_free (contents);
|
||||
}
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
{
|
||||
gtk_text_buffer_set_text (buffer, contents, length);
|
||||
g_free (contents);
|
||||
}
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font", tag, "font", G_SETTINGS_BIND_DEFAULT);
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font", tag, "font", G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
||||
gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
|
||||
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
||||
gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
|
||||
|
||||
g_free (basename);
|
||||
g_free (basename);
|
||||
}
|
||||
|
@@ -4,12 +4,12 @@
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
/* Since this example is running uninstalled,
|
||||
* we have to help it find its schema. This
|
||||
* is *not* necessary in properly installed
|
||||
* application.
|
||||
*/
|
||||
g_setenv ("GSETTINGS_SCHEMA_DIR", ".", FALSE);
|
||||
/* Since this example is running uninstalled,
|
||||
* we have to help it find its schema. This
|
||||
* is *not* necessary in properly installed
|
||||
* application.
|
||||
*/
|
||||
g_setenv ("GSETTINGS_SCHEMA_DIR", ".", FALSE);
|
||||
|
||||
return g_application_run (G_APPLICATION (example_app_new ()), argc, argv);
|
||||
return g_application_run (G_APPLICATION (example_app_new ()), argc, argv);
|
||||
}
|
||||
|
@@ -64,19 +64,6 @@
|
||||
</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">
|
||||
<signal name="clicked" handler="preferences_closed"/>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Close</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -53,12 +53,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
|
@@ -25,12 +25,6 @@ struct _ExampleAppPrefsPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
preferences_closed (GtkWidget *button)
|
||||
{
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (button));
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
example_app_prefs_new (ExampleAppWindow *win)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
|
||||
}
|
||||
|
@@ -64,19 +64,6 @@
|
||||
</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">
|
||||
<signal name="clicked" handler="preferences_closed"/>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Close</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,6 +23,9 @@
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -53,12 +53,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
|
@@ -25,12 +25,6 @@ struct _ExampleAppPrefsPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
preferences_closed (GtkWidget *button)
|
||||
{
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (button));
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
example_app_prefs_new (ExampleAppWindow *win)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
|
||||
}
|
||||
|
@@ -64,19 +64,6 @@
|
||||
</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">
|
||||
<signal name="clicked" handler="preferences_closed"/>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Close</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
@@ -15,6 +15,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,6 +23,9 @@
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
@@ -37,6 +41,10 @@
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="gears-icon">
|
||||
<property name="visible">True</property>
|
||||
|
@@ -12,7 +12,6 @@
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Quit</attribute>
|
||||
<attribute name="action">app.quit</attribute>
|
||||
<attribute name="accel"><![CDATA[<Ctrl>Q]]></attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
|
@@ -53,12 +53,16 @@ example_app_startup (GApplication *app)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *app_menu;
|
||||
const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (example_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/app-menu.ui");
|
||||
app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
|
||||
|
@@ -25,12 +25,6 @@ struct _ExampleAppPrefsPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
preferences_closed (GtkWidget *button)
|
||||
{
|
||||
gtk_widget_destroy (gtk_widget_get_toplevel (button));
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
@@ -68,12 +62,10 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), preferences_closed);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
example_app_prefs_new (ExampleAppWindow *win)
|
||||
{
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, NULL);
|
||||
return g_object_new (EXAMPLE_APP_PREFS_TYPE, "transient-for", win, "use-header-bar", TRUE, NULL);
|
||||
}
|
||||
|
@@ -64,19 +64,6 @@
|
||||
</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">
|
||||
<signal name="clicked" handler="preferences_closed"/>
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Close</property>
|
||||
<property name="use-underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
@@ -32,6 +32,7 @@
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -39,6 +40,9 @@
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
@@ -54,6 +58,10 @@
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="gears-icon">
|
||||
<property name="visible">True</property>
|
||||
|
@@ -508,6 +508,7 @@ static void
|
||||
bloat_pad_startup (GApplication *application)
|
||||
{
|
||||
BloatPad *bloatpad = (BloatPad*) application;
|
||||
GtkApplication *app = GTK_APPLICATION (application);
|
||||
GtkBuilder *builder;
|
||||
GMenu *menu;
|
||||
GMenuItem *item;
|
||||
@@ -517,6 +518,19 @@ bloat_pad_startup (GApplication *application)
|
||||
GFile *file;
|
||||
gchar *data;
|
||||
gsize size;
|
||||
gint i;
|
||||
struct {
|
||||
const gchar *action_and_target;
|
||||
const gchar *accelerators[2];
|
||||
} accels[] = {
|
||||
{ "app.new", { "<Primary>n", NULL } },
|
||||
{ "app.quit", { "<Primary>q", NULL } },
|
||||
{ "win.copy", { "<Primary>c", NULL } },
|
||||
{ "win.paste", { "<Primary>p", NULL } },
|
||||
{ "win.justify::left", { "<Primary>l", NULL } },
|
||||
{ "win.justify::center", { "<Primary>m", NULL } },
|
||||
{ "win.justify::right", { "<Primary>r", NULL } }
|
||||
};
|
||||
|
||||
G_APPLICATION_CLASS (bloat_pad_parent_class)
|
||||
->startup (application);
|
||||
@@ -606,15 +620,10 @@ bloat_pad_startup (GApplication *application)
|
||||
" </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")));
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>n", "app.new", NULL);
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>q", "app.quit", NULL);
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>c", "win.copy", NULL);
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>p", "win.paste", NULL);
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>l", "win.justify", g_variant_new_string ("left"));
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>m", "win.justify", g_variant_new_string ("center"));
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (application), "<Primary>r", "win.justify", g_variant_new_string ("right"));
|
||||
gtk_application_set_app_menu (app, G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));
|
||||
gtk_application_set_menubar (app, G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")));
|
||||
for (i = 0; i < G_N_ELEMENTS (accels); i++)
|
||||
gtk_application_set_accels_for_action (app, accels[i].action_and_target, accels[i].accelerators);
|
||||
|
||||
menu = G_MENU (gtk_builder_get_object (builder, "icon-menu"));
|
||||
|
||||
@@ -743,11 +752,12 @@ main (int argc, char **argv)
|
||||
{
|
||||
BloatPad *bloat_pad;
|
||||
int status;
|
||||
const gchar *accels[] = { "F11", NULL };
|
||||
|
||||
bloat_pad = bloat_pad_new ();
|
||||
|
||||
gtk_application_add_accelerator (GTK_APPLICATION (bloat_pad),
|
||||
"F11", "win.fullscreen", NULL);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (bloat_pad),
|
||||
"win.fullscreen", accels);
|
||||
|
||||
status = g_application_run (G_APPLICATION (bloat_pad), argc, argv);
|
||||
|
||||
|
@@ -13,7 +13,7 @@ INTROSPECTION_COMPILER_ARGS = \
|
||||
|
||||
SUBDIRS = $(GDK_BACKENDS) .
|
||||
|
||||
DIST_SUBDIRS = win32 x11 quartz broadway wayland
|
||||
DIST_SUBDIRS = win32 x11 quartz broadway wayland mir
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
@@ -193,6 +193,10 @@ if USE_WAYLAND
|
||||
libgdk_3_la_LIBADD += wayland/libgdk-wayland.la
|
||||
endif
|
||||
|
||||
if USE_MIR
|
||||
libgdk_3_la_LIBADD += mir/libgdk-mir.la
|
||||
endif
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
|
||||
introspection_files = \
|
||||
|
@@ -1,5 +1,6 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
NULL =
|
||||
|
||||
libgdkincludedir = $(includedir)/gtk-3.0/gdk
|
||||
libgdkbroadwayincludedir = $(includedir)/gtk-3.0/gdk/broadway
|
||||
@@ -75,7 +76,8 @@ libgdk_broadway_la_SOURCES = \
|
||||
|
||||
if OS_UNIX
|
||||
libgdk_broadway_la_LIBADD = \
|
||||
-lrt
|
||||
$(SHM_LIBS) \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
broadwayd_SOURCES = \
|
||||
@@ -91,7 +93,7 @@ broadwayd_SOURCES = \
|
||||
if OS_WIN32
|
||||
broadwayd_LDADD = $(GDK_DEP_LIBS) -lws2_32
|
||||
else
|
||||
broadwayd_LDADD = $(GDK_DEP_LIBS) -lrt
|
||||
broadwayd_LDADD = $(GDK_DEP_LIBS) @SHM_LIBS@
|
||||
endif
|
||||
|
||||
MAINTAINERCLEANFILES = $(broadway_built_sources)
|
||||
|
@@ -540,12 +540,14 @@ map_named_shm (char *name, gsize size)
|
||||
res = ftruncate (fd, size);
|
||||
g_assert (res != -1);
|
||||
|
||||
#ifdef HAVE_POSIX_FALLOCATE
|
||||
res = posix_fallocate (fd, 0, size);
|
||||
if (res != 0)
|
||||
{
|
||||
shm_unlink (name);
|
||||
g_error ("Not enough shared memory for window surface");
|
||||
}
|
||||
#endif
|
||||
|
||||
ptr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
|
||||
|
@@ -318,6 +318,7 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
const char *option;
|
||||
char *end;
|
||||
gint64 value;
|
||||
GdkCursor *cursor;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
|
||||
@@ -346,7 +347,11 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
|
||||
|
||||
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_surface (display, surface, x, y);
|
||||
cursor = GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_surface (display, surface, x, y);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return cursor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -60,6 +60,10 @@
|
||||
#include "wayland/gdkprivate-wayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_MIR
|
||||
#include "mir/gdkmir-private.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SECTION:gdkdisplaymanager
|
||||
* @Short_description: Maintains a list of all open GdkDisplays
|
||||
@@ -272,6 +276,9 @@ static GdkBackend gdk_backends[] = {
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
{ "wayland", _gdk_wayland_display_open },
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_MIR
|
||||
{ "mir", _gdk_mir_display_open },
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
{ "broadway", _gdk_broadway_display_open },
|
||||
#endif
|
||||
|
39
gdk/mir/Makefile.am
Normal file
@@ -0,0 +1,39 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
include $(top_srcdir)/Makefile.decl
|
||||
|
||||
libgdkincludedir = $(includedir)/gtk-3.0/gdk
|
||||
libgdkmirincludedir = $(includedir)/gtk-3.0/gdk/mir
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DG_LOG_DOMAIN=\"Gdk\" \
|
||||
-DGDK_COMPILATION \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/gdk \
|
||||
-I$(top_builddir)/gdk \
|
||||
$(GDK_HIDDEN_VISIBILITY_CFLAGS) \
|
||||
$(GTK_DEBUG_FLAGS) \
|
||||
$(GDK_DEP_CFLAGS)
|
||||
|
||||
LDADDS = $(GDK_DEP_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES = \
|
||||
libgdk-mir.la
|
||||
|
||||
libgdk_mir_la_SOURCES = \
|
||||
gdkmircursor.c \
|
||||
gdkmirdevicemanager.c \
|
||||
gdkmirdisplay.c \
|
||||
gdkmireventsource.c \
|
||||
gdkmirkeyboard.c \
|
||||
gdkmirkeymap.c \
|
||||
gdkmirpointer.c \
|
||||
gdkmirscreen.c \
|
||||
gdkmirwindow.c \
|
||||
gdkmirwindowimpl.c \
|
||||
gdkmir-debug.c \
|
||||
gdkmir.h
|
||||
|
||||
libgdkinclude_HEADERS = \
|
||||
gdkmir.h
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
293
gdk/mir/gdkmir-debug.c
Normal file
@@ -0,0 +1,293 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
void
|
||||
_gdk_mir_print_modifiers (unsigned int modifiers)
|
||||
{
|
||||
g_printerr (" Modifiers");
|
||||
if ((modifiers & mir_key_modifier_alt) != 0)
|
||||
g_printerr (" alt");
|
||||
if ((modifiers & mir_key_modifier_alt_left) != 0)
|
||||
g_printerr (" alt-left");
|
||||
if ((modifiers & mir_key_modifier_alt_right) != 0)
|
||||
g_printerr (" alt-right");
|
||||
if ((modifiers & mir_key_modifier_shift) != 0)
|
||||
g_printerr (" shift");
|
||||
if ((modifiers & mir_key_modifier_shift_left) != 0)
|
||||
g_printerr (" shift-left");
|
||||
if ((modifiers & mir_key_modifier_shift_right) != 0)
|
||||
g_printerr (" shift-right");
|
||||
if ((modifiers & mir_key_modifier_sym) != 0)
|
||||
g_printerr (" sym");
|
||||
if ((modifiers & mir_key_modifier_function) != 0)
|
||||
g_printerr (" function");
|
||||
if ((modifiers & mir_key_modifier_ctrl) != 0)
|
||||
g_printerr (" ctrl");
|
||||
if ((modifiers & mir_key_modifier_ctrl_left) != 0)
|
||||
g_printerr (" ctrl-left");
|
||||
if ((modifiers & mir_key_modifier_ctrl_right) != 0)
|
||||
g_printerr (" ctrl-right");
|
||||
if ((modifiers & mir_key_modifier_meta) != 0)
|
||||
g_printerr (" meta");
|
||||
if ((modifiers & mir_key_modifier_meta_left) != 0)
|
||||
g_printerr (" meta-left");
|
||||
if ((modifiers & mir_key_modifier_meta_right) != 0)
|
||||
g_printerr (" meta-right");
|
||||
if ((modifiers & mir_key_modifier_caps_lock) != 0)
|
||||
g_printerr (" caps-lock");
|
||||
if ((modifiers & mir_key_modifier_num_lock) != 0)
|
||||
g_printerr (" num-lock");
|
||||
if ((modifiers & mir_key_modifier_scroll_lock) != 0)
|
||||
g_printerr (" scroll-lock");
|
||||
g_printerr ("\n");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_key_event (const MirKeyEvent *event)
|
||||
{
|
||||
g_printerr ("KEY\n");
|
||||
g_printerr (" Device %i\n", event->device_id);
|
||||
g_printerr (" Source %i\n", event->source_id);
|
||||
g_printerr (" Action ");
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_key_action_down:
|
||||
g_printerr ("down");
|
||||
break;
|
||||
case mir_key_action_up:
|
||||
g_printerr ("up");
|
||||
break;
|
||||
case mir_key_action_multiple:
|
||||
g_printerr ("multiple");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->action);
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Flags");
|
||||
if ((event->flags & mir_key_flag_woke_here) != 0)
|
||||
g_printerr (" woke-here");
|
||||
if ((event->flags & mir_key_flag_soft_keyboard) != 0)
|
||||
g_printerr (" soft-keyboard");
|
||||
if ((event->flags & mir_key_flag_keep_touch_mode) != 0)
|
||||
g_printerr (" keep-touch-mode");
|
||||
if ((event->flags & mir_key_flag_from_system) != 0)
|
||||
g_printerr (" from-system");
|
||||
if ((event->flags & mir_key_flag_editor_action) != 0)
|
||||
g_printerr (" editor-action");
|
||||
if ((event->flags & mir_key_flag_canceled) != 0)
|
||||
g_printerr (" canceled");
|
||||
if ((event->flags & mir_key_flag_virtual_hard_key) != 0)
|
||||
g_printerr (" virtual-hard-key");
|
||||
if ((event->flags & mir_key_flag_long_press) != 0)
|
||||
g_printerr (" long-press");
|
||||
if ((event->flags & mir_key_flag_canceled_long_press) != 0)
|
||||
g_printerr (" canceled-long-press");
|
||||
if ((event->flags & mir_key_flag_tracking) != 0)
|
||||
g_printerr (" tracking");
|
||||
if ((event->flags & mir_key_flag_fallback) != 0)
|
||||
g_printerr (" fallback");
|
||||
g_printerr ("\n");
|
||||
_gdk_mir_print_modifiers (event->modifiers);
|
||||
g_printerr (" Key Code %i\n", event->key_code);
|
||||
g_printerr (" Scan Code %i\n", event->scan_code);
|
||||
g_printerr (" Repeat Count %i\n", event->repeat_count);
|
||||
g_printerr (" Down Time %lli\n", (long long int) event->down_time);
|
||||
g_printerr (" Event Time %lli\n", (long long int) event->event_time);
|
||||
g_printerr (" Is System Key %s\n", event->is_system_key ? "true" : "false");
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_motion_event (const MirMotionEvent *event)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
g_printerr ("MOTION\n");
|
||||
g_printerr (" Device %i\n", event->device_id);
|
||||
g_printerr (" Source %i\n", event->source_id);
|
||||
g_printerr (" Action ");
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_motion_action_down:
|
||||
g_printerr ("down");
|
||||
break;
|
||||
case mir_motion_action_up:
|
||||
g_printerr ("up");
|
||||
break;
|
||||
case mir_motion_action_move:
|
||||
g_printerr ("move");
|
||||
break;
|
||||
case mir_motion_action_cancel:
|
||||
g_printerr ("cancel");
|
||||
break;
|
||||
case mir_motion_action_outside:
|
||||
g_printerr ("outside");
|
||||
break;
|
||||
case mir_motion_action_pointer_down:
|
||||
g_printerr ("pointer-down");
|
||||
break;
|
||||
case mir_motion_action_pointer_up:
|
||||
g_printerr ("pointer-up");
|
||||
break;
|
||||
case mir_motion_action_hover_move:
|
||||
g_printerr ("hover-move");
|
||||
break;
|
||||
case mir_motion_action_scroll:
|
||||
g_printerr ("scroll");
|
||||
break;
|
||||
case mir_motion_action_hover_enter:
|
||||
g_printerr ("hover-enter");
|
||||
break;
|
||||
case mir_motion_action_hover_exit:
|
||||
g_printerr ("hover-exit");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->action);
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Flags");
|
||||
switch (event->flags)
|
||||
{
|
||||
case mir_motion_flag_window_is_obscured:
|
||||
g_printerr (" window-is-obscured");
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
_gdk_mir_print_modifiers (event->modifiers);
|
||||
g_printerr (" Edge Flags %i\n", event->edge_flags);
|
||||
g_printerr (" Button State");
|
||||
switch (event->button_state)
|
||||
{
|
||||
case mir_motion_button_primary:
|
||||
g_printerr (" primary");
|
||||
break;
|
||||
case mir_motion_button_secondary:
|
||||
g_printerr (" secondary");
|
||||
break;
|
||||
case mir_motion_button_tertiary:
|
||||
g_printerr (" tertiary");
|
||||
break;
|
||||
case mir_motion_button_back:
|
||||
g_printerr (" back");
|
||||
break;
|
||||
case mir_motion_button_forward:
|
||||
g_printerr (" forward");
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Offset (%f, %f)\n", event->x_offset, event->y_offset);
|
||||
g_printerr (" Precision (%f, %f)\n", event->x_precision, event->y_precision);
|
||||
g_printerr (" Down Time %lli\n", (long long int) event->down_time);
|
||||
g_printerr (" Event Time %lli\n", (long long int) event->event_time);
|
||||
g_printerr (" Pointer Coordinates\n");
|
||||
for (i = 0; i < event->pointer_count; i++)
|
||||
{
|
||||
g_printerr (" ID=%i location=(%f, %f) raw=(%f, %f) touch=(%f, %f) size=%f pressure=%f orientation=%f scroll=(%f, %f) tool=",
|
||||
event->pointer_coordinates[i].id,
|
||||
event->pointer_coordinates[i].x, event->pointer_coordinates[i].y,
|
||||
event->pointer_coordinates[i].raw_x, event->pointer_coordinates[i].raw_y,
|
||||
event->pointer_coordinates[i].touch_major, event->pointer_coordinates[i].touch_minor,
|
||||
event->pointer_coordinates[i].size,
|
||||
event->pointer_coordinates[i].pressure,
|
||||
event->pointer_coordinates[i].orientation,
|
||||
event->pointer_coordinates[i].hscroll, event->pointer_coordinates[i].vscroll);
|
||||
switch (event->pointer_coordinates[i].tool_type)
|
||||
{
|
||||
case mir_motion_tool_type_unknown:
|
||||
g_printerr ("unknown");
|
||||
break;
|
||||
case mir_motion_tool_type_finger:
|
||||
g_printerr ("finger");
|
||||
break;
|
||||
case mir_motion_tool_type_stylus:
|
||||
g_printerr ("stylus");
|
||||
break;
|
||||
case mir_motion_tool_type_mouse:
|
||||
g_printerr ("mouse");
|
||||
break;
|
||||
case mir_motion_tool_type_eraser:
|
||||
g_printerr ("eraser");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->pointer_coordinates[i].tool_type);
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
|
||||
{
|
||||
g_printerr ("SURFACE\n");
|
||||
g_printerr (" Surface %i\n", event->id);
|
||||
g_printerr (" Attribute ");
|
||||
switch (event->attrib)
|
||||
{
|
||||
case mir_surface_attrib_type:
|
||||
g_printerr ("type");
|
||||
break;
|
||||
case mir_surface_attrib_state:
|
||||
g_printerr ("state");
|
||||
break;
|
||||
case mir_surface_attrib_swapinterval:
|
||||
g_printerr ("swapinterval");
|
||||
break;
|
||||
case mir_surface_attrib_focus:
|
||||
g_printerr ("focus");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", event->attrib);
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Value %i\n", event->value);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_resize_event (const MirResizeEvent *event)
|
||||
{
|
||||
g_printerr ("RESIZE\n");
|
||||
g_printerr (" Surface %i\n", event->surface_id);
|
||||
g_printerr (" Size (%i, %i)\n", event->width, event->height);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_event (const MirEvent *event)
|
||||
{
|
||||
switch (event->type)
|
||||
{
|
||||
case mir_event_type_key:
|
||||
_gdk_mir_print_key_event (&event->key);
|
||||
break;
|
||||
case mir_event_type_motion:
|
||||
_gdk_mir_print_motion_event (&event->motion);
|
||||
break;
|
||||
case mir_event_type_surface:
|
||||
_gdk_mir_print_surface_event (&event->surface);
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
_gdk_mir_print_resize_event (&event->resize);
|
||||
break;
|
||||
default:
|
||||
g_printerr ("EVENT %u\n", event->type);
|
||||
break;
|
||||
}
|
||||
}
|
86
gdk/mir/gdkmir-private.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_PRIVATE_MIR_H__
|
||||
#define __GDK_PRIVATE_MIR_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkdevicemanager.h"
|
||||
#include "gdkkeys.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
|
||||
typedef struct _GdkMirWindowImpl GdkMirWindowImpl;
|
||||
typedef struct _GdkMirWindowReference GdkMirWindowReference;
|
||||
typedef struct _GdkMirEventSource GdkMirEventSource;
|
||||
|
||||
#define GDK_TYPE_MIR_WINDOW_IMPL (gdk_mir_window_impl_get_type ())
|
||||
#define GDK_MIR_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL_MIR, GdkMirWindowImpl))
|
||||
#define GDK_IS_WINDOW_IMPL_MIR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_IMPL_MIR))
|
||||
|
||||
GdkDisplay *_gdk_mir_display_open (const gchar *display_name);
|
||||
|
||||
GdkScreen *_gdk_mir_screen_new (GdkDisplay *display);
|
||||
|
||||
GdkDeviceManager *_gdk_mir_device_manager_new (GdkDisplay *display);
|
||||
|
||||
GdkDevice *_gdk_mir_device_manager_get_keyboard (GdkDeviceManager *device_manager);
|
||||
|
||||
GdkKeymap *_gdk_mir_keymap_new (void);
|
||||
|
||||
GdkDevice *_gdk_mir_keyboard_new (GdkDeviceManager *device_manager, const gchar *name);
|
||||
|
||||
GdkDevice *_gdk_mir_pointer_new (GdkDeviceManager *device_manager, const gchar *name);
|
||||
|
||||
void _gdk_mir_pointer_set_location (GdkDevice *pointer, gdouble x, gdouble y, GdkWindow *window, GdkModifierType mask);
|
||||
|
||||
GdkCursor *_gdk_mir_cursor_new (GdkDisplay *display, GdkCursorType type);
|
||||
|
||||
GdkWindowImpl *_gdk_mir_window_impl_new (void);
|
||||
|
||||
void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state);
|
||||
|
||||
void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean cursor_inside, MirMotionButton button_state);
|
||||
|
||||
void _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, gdouble *x, gdouble *y, gboolean *cursor_inside, MirMotionButton *button_state);
|
||||
|
||||
GdkMirEventSource *_gdk_mir_display_get_event_source (GdkDisplay *display);
|
||||
|
||||
GdkMirEventSource *_gdk_mir_event_source_new (GdkDisplay *display);
|
||||
|
||||
GdkMirWindowReference *_gdk_mir_event_source_get_window_reference (GdkWindow *window);
|
||||
|
||||
void _gdk_mir_window_reference_unref (GdkMirWindowReference *ref);
|
||||
|
||||
void _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref, const MirEvent *event);
|
||||
|
||||
void _gdk_mir_print_modifiers (unsigned int modifiers);
|
||||
|
||||
void _gdk_mir_print_key_event (const MirKeyEvent *event);
|
||||
|
||||
void _gdk_mir_print_motion_event (const MirMotionEvent *event);
|
||||
|
||||
void _gdk_mir_print_surface_event (const MirSurfaceEvent *event);
|
||||
|
||||
void _gdk_mir_print_resize_event (const MirResizeEvent *event);
|
||||
|
||||
void _gdk_mir_print_event (const MirEvent *event);
|
||||
|
||||
#endif /* __GDK_PRIVATE_MIR_H__ */
|
39
gdk/mir/gdkmir.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_MIR_H__
|
||||
#define __GDK_MIR_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <mir_toolkit/mir_client_library.h>
|
||||
|
||||
#define GDK_TYPE_MIR_DISPLAY (gdk_mir_display_get_type ())
|
||||
#define GDK_IS_MIR_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_DISPLAY))
|
||||
|
||||
#define GDK_TYPE_MIR_WINDOW (gdk_mir_window_get_type ())
|
||||
#define GDK_IS_WINDOW_MIR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WINDOW_MIR))
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GType gdk_mir_display_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
struct MirConnection *gdk_mir_display_get_mir_connection (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
GType gdk_mir_window_get_type (void);
|
||||
|
||||
#endif /* __GDK_MIR_H__ */
|
73
gdk/mir/gdkmircursor.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcursorprivate.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
typedef struct GdkMirCursor GdkMirCursor;
|
||||
typedef struct GdkMirCursorClass GdkMirCursorClass;
|
||||
|
||||
#define GDK_TYPE_MIR_CURSOR (gdk_mir_cursor_get_type ())
|
||||
#define GDK_MIR_CURSOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_CURSOR, GdkMirCursor))
|
||||
#define GDK_MIR_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_CURSOR, GdkMirCursorClass))
|
||||
#define GDK_IS_MIR_CURSOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_CURSOR))
|
||||
#define GDK_IS_MIR_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_CURSOR))
|
||||
#define GDK_MIR_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_CURSOR, GdkMirCursorClass))
|
||||
|
||||
struct GdkMirCursor
|
||||
{
|
||||
GdkCursor parent_instance;
|
||||
};
|
||||
|
||||
struct GdkMirCursorClass
|
||||
{
|
||||
GdkCursorClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirCursor, gdk_mir_cursor, GDK_TYPE_CURSOR)
|
||||
|
||||
GdkCursor *
|
||||
_gdk_mir_cursor_new (GdkDisplay *display, GdkCursorType type)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_CURSOR, "display", display, "cursor-type", type, NULL);
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
gdk_mir_cursor_get_surface (GdkCursor *cursor,
|
||||
gdouble *x_hot,
|
||||
gdouble *y_hot)
|
||||
{
|
||||
g_printerr ("gdk_mir_cursor_get_surface\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_init (GdkMirCursor *cursor)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_class_init (GdkMirCursorClass *klass)
|
||||
{
|
||||
GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
|
||||
|
||||
cursor_class->get_surface = gdk_mir_cursor_get_surface;
|
||||
}
|
120
gdk/mir/gdkmirdevicemanager.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdevicemanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
typedef struct GdkMirDeviceManager GdkMirDeviceManager;
|
||||
typedef struct GdkMirDeviceManagerClass GdkMirDeviceManagerClass;
|
||||
|
||||
#define GDK_TYPE_MIR_DEVICE_MANAGER (gdk_mir_device_manager_get_type ())
|
||||
#define GDK_MIR_DEVICE_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_DEVICE_MANAGER, GdkMirDeviceManager))
|
||||
#define GDK_MIR_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_DEVICE_MANAGER, GdkMirDeviceManagerClass))
|
||||
#define GDK_IS_MIR_DEVICE_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_DEVICE_MANAGER))
|
||||
#define GDK_IS_MIR_DEVICE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_DEVICE_MANAGER))
|
||||
#define GDK_MIR_DEVICE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_DEVICE_MANAGER, GdkMirDeviceManagerClass))
|
||||
|
||||
struct GdkMirDeviceManager
|
||||
{
|
||||
GdkDeviceManager parent_instance;
|
||||
|
||||
GdkDevice *pointer;
|
||||
GdkDevice *keyboard;
|
||||
};
|
||||
|
||||
struct GdkMirDeviceManagerClass
|
||||
{
|
||||
GdkDeviceManagerClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirDeviceManager, gdk_mir_device_manager, GDK_TYPE_DEVICE_MANAGER)
|
||||
|
||||
GdkDeviceManager *
|
||||
_gdk_mir_device_manager_new (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_DEVICE_MANAGER, "display", display, NULL);
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_device_manager_list_devices (GdkDeviceManager *device_manager,
|
||||
GdkDeviceType type)
|
||||
{
|
||||
//g_printerr ("gdk_mir_device_manager_list_devices (%u)\n", type);
|
||||
GdkMirDeviceManager *dm = GDK_MIR_DEVICE_MANAGER (device_manager);
|
||||
|
||||
if (type == GDK_DEVICE_TYPE_MASTER)
|
||||
{
|
||||
GList *devices;
|
||||
|
||||
devices = g_list_append (NULL, dm->keyboard);
|
||||
devices = g_list_append (devices, dm->pointer);
|
||||
|
||||
return devices;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
gdk_mir_device_manager_get_client_pointer (GdkDeviceManager *device_manager)
|
||||
{
|
||||
//g_printerr ("gdk_mir_device_manager_get_client_pointer\n");
|
||||
return GDK_MIR_DEVICE_MANAGER (device_manager)->pointer;
|
||||
}
|
||||
|
||||
GdkDevice *
|
||||
_gdk_mir_device_manager_get_keyboard (GdkDeviceManager *device_manager)
|
||||
{
|
||||
return GDK_MIR_DEVICE_MANAGER (device_manager)->keyboard;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_device_manager_init (GdkMirDeviceManager *device_manager)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_device_manager_constructed (GObject *object)
|
||||
{
|
||||
GdkMirDeviceManager *device_manager = GDK_MIR_DEVICE_MANAGER (object);
|
||||
|
||||
device_manager->keyboard = _gdk_mir_keyboard_new (GDK_DEVICE_MANAGER (device_manager), "Mir Keyboard");
|
||||
device_manager->pointer = _gdk_mir_pointer_new (GDK_DEVICE_MANAGER (device_manager), "Mir Pointer");
|
||||
_gdk_device_set_associated_device (device_manager->keyboard, device_manager->pointer);
|
||||
_gdk_device_set_associated_device (device_manager->pointer, device_manager->keyboard);
|
||||
|
||||
gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager))->core_pointer = device_manager->pointer;
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_device_manager_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_device_manager_class_init (GdkMirDeviceManagerClass *klass)
|
||||
{
|
||||
GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
device_manager_class->list_devices = gdk_mir_device_manager_list_devices;
|
||||
device_manager_class->get_client_pointer = gdk_mir_device_manager_get_client_pointer;
|
||||
object_class->constructed = gdk_mir_device_manager_constructed;
|
||||
}
|
571
gdk/mir/gdkmirdisplay.c
Normal file
@@ -0,0 +1,571 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
#define GDK_MIR_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MIR, GdkMirDisplay))
|
||||
#define GDK_MIR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MIR, GdkMirDisplayClass))
|
||||
#define GDK_IS_MIR_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_DISPLAY))
|
||||
#define GDK_MIR_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_DISPLAY, GdkMirDisplayImplClass))
|
||||
|
||||
typedef struct GdkMirDisplay
|
||||
{
|
||||
GdkDisplay parent_instance;
|
||||
|
||||
/* Connection to Mir server */
|
||||
MirConnection *connection;
|
||||
|
||||
/* Event source */
|
||||
GdkMirEventSource *event_source;
|
||||
|
||||
/* Serial number? */
|
||||
gulong serial;
|
||||
|
||||
/* Screen information */
|
||||
GdkScreen *screen;
|
||||
|
||||
GdkCursor *cursor;
|
||||
|
||||
GdkKeymap *keymap;
|
||||
} GdkMirDisplay;
|
||||
|
||||
typedef struct GdkMirDisplayClass
|
||||
{
|
||||
GdkDisplayClass parent_class;
|
||||
} GdkMirDisplayClass;
|
||||
|
||||
/**
|
||||
* SECTION:mir_interaction
|
||||
* @Short_description: Mir backend-specific functions
|
||||
* @Title: Mir Interaction
|
||||
*
|
||||
* The functions in this section are specific to the GDK Mir backend.
|
||||
* To use them, you need to include the <literal><gdk/gdkmir.h></literal>
|
||||
* header and use the Mir-specific pkg-config files to build your
|
||||
* application (either <literal>gdk-mir-3.0</literal> or
|
||||
* <literal>gtk+-mir-3.0</literal>).
|
||||
*
|
||||
* To make your code compile with other GDK backends, guard backend-specific
|
||||
* calls by an ifdef as follows. Since GDK may be built with multiple
|
||||
* backends, you should also check for the backend that is in use (e.g. by
|
||||
* using the GDK_IS_MIR_DISPLAY() macro).
|
||||
* |[
|
||||
* #ifdef GDK_WINDOWING_MIR
|
||||
* if (GDK_IS_MIR_DISPLAY (display))
|
||||
* {
|
||||
* /* make Mir-specific calls here */
|
||||
* }
|
||||
* else
|
||||
* #endif
|
||||
* #ifdef GDK_WINDOWING_X11
|
||||
* if (GDK_IS_X11_DISPLAY (display))
|
||||
* {
|
||||
* /* make X11-specific calls here */
|
||||
* }
|
||||
* else
|
||||
* #endif
|
||||
* g_error ("Unsupported GDK backend");
|
||||
* ]|
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY)
|
||||
|
||||
GdkDisplay *
|
||||
_gdk_mir_display_open (const gchar *display_name)
|
||||
{
|
||||
MirConnection *connection;
|
||||
GdkMirDisplay *display;
|
||||
|
||||
g_printerr ("gdk_mir_display_open\n");
|
||||
|
||||
connection = mir_connect_sync (NULL, "GDK-Mir");
|
||||
if (!connection)
|
||||
return NULL;
|
||||
if (!mir_connection_is_valid (connection))
|
||||
{
|
||||
g_printerr ("Failed to connect to Mir: %s\n", mir_connection_get_error_message (connection));
|
||||
mir_connection_release (connection);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
display = g_object_new (GDK_TYPE_MIR_DISPLAY, NULL);
|
||||
|
||||
display->connection = connection;
|
||||
GDK_DISPLAY (display)->device_manager = _gdk_mir_device_manager_new (GDK_DISPLAY (display));
|
||||
display->screen = _gdk_mir_screen_new (GDK_DISPLAY (display));
|
||||
|
||||
g_signal_emit_by_name (display, "opened");
|
||||
|
||||
return GDK_DISPLAY (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_mir_display_get_mir_connection
|
||||
* @display: (type GdkMirDisplay): a #GdkDisplay
|
||||
*
|
||||
* Returns the #MirConnection for a #GdkDisplay
|
||||
*
|
||||
* Returns: (transfer none): a #MirConnection
|
||||
*
|
||||
* Since: 3.14
|
||||
*/
|
||||
struct MirConnection *
|
||||
gdk_mir_display_get_mir_connection (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MIR_DISPLAY (display), NULL);
|
||||
return GDK_MIR_DISPLAY (display)->connection;
|
||||
}
|
||||
|
||||
GdkMirEventSource *
|
||||
_gdk_mir_display_get_event_source (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MIR_DISPLAY (display), NULL);
|
||||
|
||||
return GDK_MIR_DISPLAY (display)->event_source;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_dispose (GObject *object)
|
||||
{
|
||||
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
|
||||
|
||||
g_object_unref (display->screen);
|
||||
display->screen = NULL;
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_display_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_finalize (GObject *object)
|
||||
{
|
||||
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
|
||||
|
||||
mir_connection_release (display->connection);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_display_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
gdk_mir_display_get_name (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_get_name\n");
|
||||
return "Mir";
|
||||
}
|
||||
|
||||
static GdkScreen *
|
||||
gdk_mir_display_get_default_screen (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_get_default_screen\n");
|
||||
return GDK_MIR_DISPLAY (display)->screen;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_beep (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_beep\n");
|
||||
/* No system level beep... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_sync (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_sync\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_flush (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_flush\n");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_has_pending\n");
|
||||
/* We don't need to poll for events - so nothing pending */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_queue_events (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_queue_events\n");
|
||||
/* We don't need to poll for events - so don't do anything*/
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_make_default (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_make_default\n");
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_display_get_default_group (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_default_group\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_shapes\n");
|
||||
/* Mir doesn't support shaped windows */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_input_shapes\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_composite (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_composite\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_clipboard_persistence (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_clipboard_persistence\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_cursor_alpha (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_cursor_alpha\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_cursor_color (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_cursor_color\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_supports_selection_notification (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_supports_selection_notification\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_request_selection_notification (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_request_selection_notification\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_store_clipboard (GdkDisplay *display,
|
||||
GdkWindow *clipboard_window,
|
||||
guint32 time_,
|
||||
const GdkAtom *targets,
|
||||
gint n_targets)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_store_clipboard\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_get_default_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_default_cursor_size\n");
|
||||
*width = *height = 32; // FIXME: Random value
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_maximal_cursor_size\n");
|
||||
*width = *height = 32; // FIXME: Random value
|
||||
}
|
||||
|
||||
static GdkCursor *
|
||||
gdk_mir_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType cursor_type)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_get_cursor_for_type (%u)\n", cursor_type);
|
||||
/* We don't support configurable cursors */
|
||||
return g_object_ref (GDK_MIR_DISPLAY (display)->cursor);
|
||||
}
|
||||
|
||||
static GdkCursor *
|
||||
gdk_mir_display_get_cursor_for_name (GdkDisplay *display,
|
||||
const gchar *name)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_cursor_for_name (\"%s\")\n", name);
|
||||
/* We don't support configurable cursors */
|
||||
return g_object_ref (GDK_MIR_DISPLAY (display)->cursor);
|
||||
}
|
||||
|
||||
static GdkCursor *
|
||||
gdk_mir_display_get_cursor_for_surface (GdkDisplay *display,
|
||||
cairo_surface_t *surface,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_display_list_devices (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_list_devices\n");
|
||||
// FIXME: Should this access the device manager?
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GdkAppLaunchContext *
|
||||
gdk_mir_display_get_app_launch_context (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_app_launch_context\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_before_process_all_updates\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_after_process_all_updates\n");
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_mir_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_get_next_serial\n");
|
||||
return GDK_MIR_DISPLAY (display)->serial++;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_notify_startup_complete (GdkDisplay *display,
|
||||
const gchar *startup_id)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_notify_startup_complete\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_event_data_copy (GdkDisplay *display,
|
||||
const GdkEvent *src,
|
||||
GdkEvent *dst)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_event_data_copy\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_event_data_free (GdkDisplay *display,
|
||||
GdkEvent *event)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_event_data_free\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_create_window_impl (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkWindow *real_parent,
|
||||
GdkScreen *screen,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindowAttr *attributes,
|
||||
gint attributes_mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_create_window_impl");
|
||||
g_printerr (" window=%p", window);
|
||||
g_printerr (" location=(%d, %d)", window->x, window->y);
|
||||
g_printerr (" size=(%d, %d)", window->width, window->height);
|
||||
g_printerr ("\n");
|
||||
if (attributes->wclass != GDK_INPUT_OUTPUT)
|
||||
return;
|
||||
window->impl = _gdk_mir_window_impl_new ();
|
||||
}
|
||||
|
||||
static GdkKeymap *
|
||||
gdk_mir_display_get_keymap (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_get_keymap\n");
|
||||
return GDK_MIR_DISPLAY (display)->keymap;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_push_error_trap (GdkDisplay *display)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_push_error_trap\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_display_pop_error_trap (GdkDisplay *display,
|
||||
gboolean ignored)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_pop_error_trap\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_display_get_selection_owner (GdkDisplay *display,
|
||||
GdkAtom selection)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_selection_owner\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_display_set_selection_owner (GdkDisplay *display,
|
||||
GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
guint32 time,
|
||||
gboolean send_event)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_set_selection_owner\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_send_selection_notify (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
GdkAtom property,
|
||||
guint32 time)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_send_selection_notify\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_display_get_selection_property (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_get_selection_property\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_convert_selection\n");
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gdk_mir_display_utf8_to_string_target (GdkDisplay *display,
|
||||
const gchar *str)
|
||||
{
|
||||
g_printerr ("gdk_mir_display_utf8_to_string_target\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_init (GdkMirDisplay *display)
|
||||
{
|
||||
display->event_source = _gdk_mir_event_source_new (GDK_DISPLAY (display));
|
||||
display->cursor = _gdk_mir_cursor_new (GDK_DISPLAY (display), GDK_ARROW);
|
||||
display->keymap = _gdk_mir_keymap_new ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_class_init (GdkMirDisplayClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (klass);
|
||||
|
||||
object_class->dispose = gdk_mir_display_dispose;
|
||||
object_class->finalize = gdk_mir_display_finalize;
|
||||
|
||||
display_class->window_type = gdk_mir_window_get_type ();
|
||||
|
||||
display_class->get_name = gdk_mir_display_get_name;
|
||||
display_class->get_default_screen = gdk_mir_display_get_default_screen;
|
||||
display_class->beep = gdk_mir_display_beep;
|
||||
display_class->sync = gdk_mir_display_sync;
|
||||
display_class->flush = gdk_mir_display_flush;
|
||||
display_class->has_pending = gdk_mir_display_has_pending;
|
||||
display_class->queue_events = gdk_mir_display_queue_events;
|
||||
display_class->make_default = gdk_mir_display_make_default;
|
||||
display_class->get_default_group = gdk_mir_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_mir_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_mir_display_supports_input_shapes;
|
||||
display_class->supports_composite = gdk_mir_display_supports_composite;
|
||||
display_class->supports_clipboard_persistence = gdk_mir_display_supports_clipboard_persistence;
|
||||
display_class->supports_cursor_alpha = gdk_mir_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = gdk_mir_display_supports_cursor_color;
|
||||
display_class->supports_selection_notification = gdk_mir_display_supports_selection_notification;
|
||||
display_class->request_selection_notification = gdk_mir_display_request_selection_notification;
|
||||
display_class->store_clipboard = gdk_mir_display_store_clipboard;
|
||||
display_class->get_default_cursor_size = gdk_mir_display_get_default_cursor_size;
|
||||
display_class->get_maximal_cursor_size = gdk_mir_display_get_maximal_cursor_size;
|
||||
display_class->get_cursor_for_type = gdk_mir_display_get_cursor_for_type;
|
||||
display_class->get_cursor_for_name = gdk_mir_display_get_cursor_for_name;
|
||||
display_class->get_cursor_for_surface = gdk_mir_display_get_cursor_for_surface;
|
||||
display_class->list_devices = gdk_mir_display_list_devices;
|
||||
display_class->get_app_launch_context = gdk_mir_display_get_app_launch_context;
|
||||
display_class->before_process_all_updates = gdk_mir_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = gdk_mir_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_mir_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_mir_display_notify_startup_complete;
|
||||
display_class->event_data_copy = gdk_mir_display_event_data_copy;
|
||||
display_class->event_data_free = gdk_mir_display_event_data_free;
|
||||
display_class->create_window_impl = gdk_mir_display_create_window_impl;
|
||||
display_class->get_keymap = gdk_mir_display_get_keymap;
|
||||
display_class->push_error_trap = gdk_mir_display_push_error_trap;
|
||||
display_class->pop_error_trap = gdk_mir_display_pop_error_trap;
|
||||
display_class->get_selection_owner = gdk_mir_display_get_selection_owner;
|
||||
display_class->set_selection_owner = gdk_mir_display_set_selection_owner;
|
||||
display_class->send_selection_notify = gdk_mir_display_send_selection_notify;
|
||||
display_class->get_selection_property = gdk_mir_display_get_selection_property;
|
||||
display_class->convert_selection = gdk_mir_display_convert_selection;
|
||||
display_class->text_property_to_utf8_list = gdk_mir_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = gdk_mir_display_utf8_to_string_target;
|
||||
}
|
624
gdk/mir/gdkmireventsource.c
Normal file
@@ -0,0 +1,624 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
struct _GdkMirWindowReference {
|
||||
GdkMirEventSource *source;
|
||||
GdkWindow *window;
|
||||
gint ref_count;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GdkMirWindowReference *window_ref;
|
||||
MirEvent event;
|
||||
} GdkMirQueuedEvent;
|
||||
|
||||
struct _GdkMirEventSource
|
||||
{
|
||||
GSource parent_instance;
|
||||
|
||||
GMutex mir_event_lock;
|
||||
GQueue mir_events;
|
||||
|
||||
GdkDisplay *display;
|
||||
};
|
||||
|
||||
static void
|
||||
send_event (GdkWindow *window, GdkDevice *device, GdkEvent *event)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GList *node;
|
||||
|
||||
gdk_event_set_device (event, device);
|
||||
gdk_event_set_screen (event, gdk_display_get_screen (gdk_window_get_display (window), 0));
|
||||
event->any.window = g_object_ref (window);
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, _gdk_display_get_next_serial (display));
|
||||
}
|
||||
|
||||
static void
|
||||
set_key_event_string (GdkEventKey *event)
|
||||
{
|
||||
gunichar c = 0;
|
||||
|
||||
if (event->keyval != GDK_KEY_VoidSymbol)
|
||||
c = gdk_keyval_to_unicode (event->keyval);
|
||||
|
||||
if (c)
|
||||
{
|
||||
gchar buf[7];
|
||||
gint len;
|
||||
gsize bytes_written;
|
||||
|
||||
/* Apply the control key - Taken from Xlib
|
||||
*/
|
||||
if (event->state & GDK_CONTROL_MASK)
|
||||
{
|
||||
if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
|
||||
else if (c == '2')
|
||||
{
|
||||
event->string = g_memdup ("\0\0", 2);
|
||||
event->length = 1;
|
||||
buf[0] = '\0';
|
||||
return;
|
||||
}
|
||||
else if (c >= '3' && c <= '7') c -= ('3' - '\033');
|
||||
else if (c == '8') c = '\177';
|
||||
else if (c == '/') c = '_' & 0x1F;
|
||||
}
|
||||
|
||||
len = g_unichar_to_utf8 (c, buf);
|
||||
buf[len] = '\0';
|
||||
|
||||
event->string = g_locale_from_utf8 (buf, len,
|
||||
NULL, &bytes_written,
|
||||
NULL);
|
||||
if (event->string)
|
||||
event->length = bytes_written;
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Escape)
|
||||
{
|
||||
event->length = 1;
|
||||
event->string = g_strdup ("\033");
|
||||
}
|
||||
else if (event->keyval == GDK_KEY_Return ||
|
||||
event->keyval == GDK_KEY_KP_Enter)
|
||||
{
|
||||
event->length = 1;
|
||||
event->string = g_strdup ("\r");
|
||||
}
|
||||
|
||||
if (!event->string)
|
||||
{
|
||||
event->length = 0;
|
||||
event->string = g_strdup ("");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
generate_key_event (GdkWindow *window, GdkEventType type, guint state, guint keyval, guint16 keycode, gboolean is_modifier)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->key.state = state;
|
||||
event->key.keyval = keyval;
|
||||
event->key.hardware_keycode = keycode + 8;
|
||||
event->key.is_modifier = is_modifier;
|
||||
set_key_event_string (&event->key);
|
||||
|
||||
send_event (window, _gdk_mir_device_manager_get_keyboard (gdk_display_get_device_manager (gdk_window_get_display (window))), event);
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
get_pointer (GdkWindow *window)
|
||||
{
|
||||
return gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (window)));
|
||||
}
|
||||
|
||||
static void
|
||||
generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint button, guint state)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->button.x = x;
|
||||
event->button.y = y;
|
||||
event->button.state = state;
|
||||
event->button.button = button;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_scroll_event (GdkWindow *window, gdouble x, gdouble y, gdouble delta_x, gdouble delta_y, guint state)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_SCROLL);
|
||||
event->scroll.x = x;
|
||||
event->scroll.y = y;
|
||||
event->scroll.state = state;
|
||||
event->scroll.direction = GDK_SCROLL_SMOOTH;
|
||||
event->scroll.delta_x = delta_x;
|
||||
event->scroll.delta_y = delta_y;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_motion_event (GdkWindow *window, gdouble x, gdouble y, guint state)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_MOTION_NOTIFY);
|
||||
event->motion.x = x;
|
||||
event->motion.y = y;
|
||||
event->motion.state = state;
|
||||
event->motion.is_hint = FALSE;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->crossing.x = x;
|
||||
event->crossing.y = y;
|
||||
event->crossing.mode = GDK_CROSSING_NORMAL;
|
||||
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
|
||||
event->crossing.focus = TRUE;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_focus_event (GdkWindow *window, gboolean focused)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
if (focused)
|
||||
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FOCUSED);
|
||||
else
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
|
||||
|
||||
event = gdk_event_new (GDK_FOCUS_CHANGE);
|
||||
event->focus_change.send_event = FALSE;
|
||||
event->focus_change.in = focused;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static guint
|
||||
get_modifier_state (unsigned int modifiers, unsigned int button_state)
|
||||
{
|
||||
guint modifier_state = 0;
|
||||
|
||||
if ((modifiers & mir_key_modifier_alt) != 0)
|
||||
modifier_state |= GDK_MOD1_MASK;
|
||||
if ((modifiers & mir_key_modifier_shift) != 0)
|
||||
modifier_state |= GDK_SHIFT_MASK;
|
||||
if ((modifiers & mir_key_modifier_ctrl) != 0)
|
||||
modifier_state |= GDK_CONTROL_MASK;
|
||||
if ((modifiers & mir_key_modifier_meta) != 0)
|
||||
modifier_state |= GDK_SUPER_MASK;
|
||||
if ((modifiers & mir_key_modifier_caps_lock) != 0)
|
||||
modifier_state |= GDK_LOCK_MASK;
|
||||
if ((button_state & mir_motion_button_primary) != 0)
|
||||
modifier_state |= GDK_BUTTON1_MASK;
|
||||
if ((button_state & mir_motion_button_secondary) != 0)
|
||||
modifier_state |= GDK_BUTTON3_MASK;
|
||||
if ((button_state & mir_motion_button_tertiary) != 0)
|
||||
modifier_state |= GDK_BUTTON2_MASK;
|
||||
|
||||
return modifier_state;
|
||||
}
|
||||
|
||||
/*
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (event_data->window->impl);
|
||||
MirMotionButton changed_button_state;
|
||||
GdkEventType event_type;
|
||||
gdouble x, y;
|
||||
guint modifier_state;
|
||||
gboolean is_modifier = FALSE;
|
||||
*/
|
||||
|
||||
static void
|
||||
handle_key_event (GdkWindow *window, const MirKeyEvent *event)
|
||||
{
|
||||
guint modifier_state;
|
||||
gboolean is_modifier = FALSE;
|
||||
|
||||
modifier_state = get_modifier_state (event->modifiers, 0); // FIXME: Need to track button state
|
||||
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_key_action_down:
|
||||
case mir_key_action_up:
|
||||
// FIXME: Convert keycode
|
||||
// FIXME: is_modifier
|
||||
generate_key_event (window,
|
||||
event->action == mir_key_action_down ? GDK_KEY_PRESS : GDK_KEY_RELEASE,
|
||||
modifier_state,
|
||||
event->key_code,
|
||||
event->scan_code,
|
||||
is_modifier);
|
||||
break;
|
||||
default:
|
||||
//case mir_key_action_multiple:
|
||||
// FIXME
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_motion_event (GdkWindow *window, const MirMotionEvent *event)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
gdouble x, y;
|
||||
gboolean cursor_inside;
|
||||
MirMotionButton button_state;
|
||||
guint modifier_state;
|
||||
GdkEventType event_type;
|
||||
MirMotionButton changed_button_state;
|
||||
|
||||
_gdk_mir_window_impl_get_cursor_state (impl, &x, &y, &cursor_inside, &button_state);
|
||||
if (event->pointer_count > 0)
|
||||
{
|
||||
x = event->pointer_coordinates[0].x;
|
||||
y = event->pointer_coordinates[0].y;
|
||||
}
|
||||
modifier_state = get_modifier_state (event->modifiers, event->button_state);
|
||||
|
||||
/* The Mir events generate hover-exits even while inside the window so
|
||||
counteract this by always generating an enter notify on all other events */
|
||||
if (!cursor_inside && event->action != mir_motion_action_hover_exit)
|
||||
{
|
||||
cursor_inside = TRUE;
|
||||
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y);
|
||||
}
|
||||
|
||||
/* Update which window has focus */
|
||||
_gdk_mir_pointer_set_location (get_pointer (window), x, y, window, modifier_state);
|
||||
switch (event->action)
|
||||
{
|
||||
case mir_motion_action_down:
|
||||
case mir_motion_action_up:
|
||||
event_type = event->action == mir_motion_action_down ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
|
||||
changed_button_state = button_state ^ event->button_state;
|
||||
if ((changed_button_state & mir_motion_button_primary) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_PRIMARY, modifier_state);
|
||||
if ((changed_button_state & mir_motion_button_secondary) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_SECONDARY, modifier_state);
|
||||
if ((changed_button_state & mir_motion_button_tertiary) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_MIDDLE, modifier_state);
|
||||
button_state = event->button_state;
|
||||
break;
|
||||
case mir_motion_action_scroll:
|
||||
generate_scroll_event (window, x, y, event->pointer_coordinates[0].hscroll, event->pointer_coordinates[0].vscroll, modifier_state);
|
||||
break;
|
||||
case mir_motion_action_move: // move with button
|
||||
case mir_motion_action_hover_move: // move without button
|
||||
generate_motion_event (window, x, y, modifier_state);
|
||||
break;
|
||||
case mir_motion_action_hover_exit:
|
||||
cursor_inside = FALSE;
|
||||
generate_crossing_event (window, GDK_LEAVE_NOTIFY, x, y);
|
||||
break;
|
||||
}
|
||||
|
||||
_gdk_mir_window_impl_set_cursor_state (impl, x, y, cursor_inside, button_state);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
switch (event->attrib)
|
||||
{
|
||||
case mir_surface_attrib_type:
|
||||
break;
|
||||
case mir_surface_attrib_state:
|
||||
_gdk_mir_window_impl_set_surface_state (impl, event->value);
|
||||
// FIXME: notify
|
||||
break;
|
||||
case mir_surface_attrib_swapinterval:
|
||||
break;
|
||||
case mir_surface_attrib_focus:
|
||||
generate_focus_event (window, event->value != 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
generate_configure_event (GdkWindow *window,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_CONFIGURE);
|
||||
event->configure.send_event = FALSE;
|
||||
event->configure.width = width;
|
||||
event->configure.height = height;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_resize_event (GdkWindow *window,
|
||||
const MirResizeEvent *event)
|
||||
{
|
||||
window->width = event->width;
|
||||
window->height = event->height;
|
||||
_gdk_window_update_size (window);
|
||||
|
||||
generate_configure_event (window, event->width, event->height);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWindow *window;
|
||||
MirEvent event;
|
||||
} EventData;
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_queue_event (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
const MirEvent *event)
|
||||
{
|
||||
if (g_getenv ("GDK_MIR_LOG_EVENTS"))
|
||||
_gdk_mir_print_event (event);
|
||||
|
||||
// FIXME: Only generate events if the window wanted them?
|
||||
switch (event->type)
|
||||
{
|
||||
case mir_event_type_key:
|
||||
handle_key_event (window, &event->key);
|
||||
break;
|
||||
case mir_event_type_motion:
|
||||
handle_motion_event (window, &event->motion);
|
||||
break;
|
||||
case mir_event_type_surface:
|
||||
handle_surface_event (window, &event->surface);
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
handle_resize_event (window, &event->resize);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
// FIXME?
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkMirQueuedEvent *
|
||||
gdk_mir_event_source_take_queued_event (GdkMirEventSource *source)
|
||||
{
|
||||
GdkMirQueuedEvent *queued_event;
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
queued_event = g_queue_pop_head (&source->mir_events);
|
||||
g_mutex_unlock (&source->mir_event_lock);
|
||||
|
||||
return queued_event;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_queued_event_free (GdkMirQueuedEvent *event)
|
||||
{
|
||||
_gdk_mir_window_reference_unref (event->window_ref);
|
||||
g_slice_free (GdkMirQueuedEvent, event);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_convert_events (GdkMirEventSource *source)
|
||||
{
|
||||
GdkMirQueuedEvent *event;
|
||||
|
||||
while ((event = gdk_mir_event_source_take_queued_event (source)))
|
||||
{
|
||||
GdkWindow *window = event->window_ref->window;
|
||||
|
||||
/* The window may have been destroyed in the main thread while the
|
||||
* event was being dispatched...
|
||||
*/
|
||||
if (window != NULL)
|
||||
gdk_mir_event_source_queue_event (source->display, window, &event->event);
|
||||
else
|
||||
g_warning ("window was destroyed before event arrived...");
|
||||
|
||||
gdk_mir_queued_event_free (event);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_event_source_prepare (GSource *g_source,
|
||||
gint *timeout)
|
||||
{
|
||||
GdkMirEventSource *source = (GdkMirEventSource *) g_source;
|
||||
gboolean mir_events_in_queue;
|
||||
|
||||
if (_gdk_event_queue_find_first (source->display))
|
||||
return TRUE;
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
mir_events_in_queue = g_queue_get_length (&source->mir_events) > 0;
|
||||
g_mutex_unlock (&source->mir_event_lock);
|
||||
|
||||
return mir_events_in_queue;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_event_source_check (GSource *g_source)
|
||||
{
|
||||
return gdk_mir_event_source_prepare (g_source, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_event_source_dispatch (GSource *g_source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkMirEventSource *source = (GdkMirEventSource *) g_source;
|
||||
GdkEvent *event;
|
||||
|
||||
/* First, run the queue of events from the thread */
|
||||
gdk_mir_event_source_convert_events (source);
|
||||
|
||||
/* Next, dispatch one single event from the display's queue.
|
||||
*
|
||||
* If there is more than one event then we will soon find ourselves
|
||||
* back here again.
|
||||
*/
|
||||
|
||||
gdk_threads_enter ();
|
||||
|
||||
event = gdk_display_get_event (source->display);
|
||||
|
||||
if (event)
|
||||
{
|
||||
_gdk_event_emit (event);
|
||||
|
||||
gdk_event_free (event);
|
||||
}
|
||||
|
||||
gdk_threads_leave ();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_finalize (GSource *g_source)
|
||||
{
|
||||
GdkMirEventSource *source = (GdkMirEventSource *) g_source;
|
||||
GdkMirQueuedEvent *event;
|
||||
|
||||
while ((event = gdk_mir_event_source_take_queued_event (source)))
|
||||
gdk_mir_queued_event_free (event);
|
||||
|
||||
g_mutex_clear (&source->mir_event_lock);
|
||||
}
|
||||
|
||||
static GSourceFuncs gdk_mir_event_source_funcs = {
|
||||
gdk_mir_event_source_prepare,
|
||||
gdk_mir_event_source_check,
|
||||
gdk_mir_event_source_dispatch,
|
||||
gdk_mir_event_source_finalize
|
||||
};
|
||||
|
||||
GdkMirEventSource *
|
||||
_gdk_mir_event_source_new (GdkDisplay *display)
|
||||
{
|
||||
GdkMirEventSource *source;
|
||||
GSource *g_source;
|
||||
|
||||
g_source = g_source_new (&gdk_mir_event_source_funcs, sizeof (GdkMirEventSource));
|
||||
g_source_attach (g_source, NULL);
|
||||
|
||||
source = (GdkMirEventSource *) g_source;
|
||||
g_mutex_init (&source->mir_event_lock);
|
||||
source->display = display;
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
GdkMirWindowReference *
|
||||
_gdk_mir_event_source_get_window_reference (GdkWindow *window)
|
||||
{
|
||||
static GQuark win_ref_quark;
|
||||
GdkMirWindowReference *ref;
|
||||
|
||||
if G_UNLIKELY (!win_ref_quark)
|
||||
win_ref_quark = g_quark_from_string ("GdkMirEventSource window reference");
|
||||
|
||||
ref = g_object_get_qdata (G_OBJECT (window), win_ref_quark);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
GdkMirEventSource *source;
|
||||
|
||||
source = _gdk_mir_display_get_event_source (gdk_window_get_display (window));
|
||||
g_source_ref ((GSource *) source);
|
||||
|
||||
ref = g_slice_new (GdkMirWindowReference);
|
||||
ref->window = window;
|
||||
ref->source = source;
|
||||
ref->ref_count = 0;
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &ref->window);
|
||||
|
||||
g_object_set_qdata_full (G_OBJECT (window), win_ref_quark,
|
||||
ref, (GDestroyNotify) _gdk_mir_window_reference_unref);
|
||||
}
|
||||
|
||||
g_atomic_int_inc (&ref->ref_count);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_window_reference_unref (GdkMirWindowReference *ref)
|
||||
{
|
||||
if (g_atomic_int_dec_and_test (&ref->ref_count))
|
||||
{
|
||||
if (ref->window)
|
||||
g_object_remove_weak_pointer (G_OBJECT (ref->window), (gpointer *) &ref->window);
|
||||
|
||||
g_source_unref ((GSource *) ref->source);
|
||||
|
||||
g_slice_free (GdkMirWindowReference, ref);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_event_source_queue (GdkMirWindowReference *window_ref,
|
||||
const MirEvent *event)
|
||||
{
|
||||
GdkMirEventSource *source = window_ref->source;
|
||||
GdkMirQueuedEvent *queued_event;
|
||||
|
||||
/* We are in the wrong thread right now. We absolutely cannot touch
|
||||
* the window.
|
||||
*
|
||||
* We can do pretty much anything we want with the source, though...
|
||||
*/
|
||||
|
||||
queued_event = g_slice_new (GdkMirQueuedEvent);
|
||||
g_atomic_int_inc (&window_ref->ref_count);
|
||||
queued_event->window_ref = window_ref;
|
||||
queued_event->event = *event;
|
||||
|
||||
g_mutex_lock (&source->mir_event_lock);
|
||||
g_queue_push_tail (&source->mir_events, queued_event);
|
||||
g_mutex_unlock (&source->mir_event_lock);
|
||||
|
||||
g_main_context_wakeup (NULL);
|
||||
}
|
173
gdk/mir/gdkmirkeyboard.c
Normal file
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
typedef struct GdkMirKeyboard GdkMirKeyboard;
|
||||
typedef struct GdkMirKeyboardClass GdkMirKeyboardClass;
|
||||
|
||||
#define GDK_TYPE_MIR_KEYBOARD (gdk_mir_keyboard_get_type ())
|
||||
#define GDK_MIR_KEYBOARD(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_KEYBOARD, GdkMirKeyboard))
|
||||
#define GDK_MIR_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_KEYBOARD, GdkMirKeyboardClass))
|
||||
#define GDK_IS_MIR_KEYBOARD(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_KEYBOARD))
|
||||
#define GDK_IS_MIR_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_KEYBOARD))
|
||||
#define GDK_MIR_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_KEYBOARD, GdkMirKeyboardClass))
|
||||
|
||||
struct GdkMirKeyboard
|
||||
{
|
||||
GdkDevice parent_instance;
|
||||
};
|
||||
|
||||
struct GdkMirKeyboardClass
|
||||
{
|
||||
GdkDeviceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirKeyboard, gdk_mir_keyboard, GDK_TYPE_DEVICE)
|
||||
|
||||
GdkDevice *
|
||||
_gdk_mir_keyboard_new (GdkDeviceManager *device_manager, const gchar *name)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_KEYBOARD,
|
||||
"display", gdk_device_manager_get_display (device_manager),
|
||||
"device-manager", device_manager,
|
||||
"name", name,
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"input-source", GDK_SOURCE_KEYBOARD,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", FALSE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keyboard_get_history (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
GdkTimeCoord ***events,
|
||||
gint *n_events)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_get_history\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_get_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_get_state\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_set_window_cursor (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_set_window_cursor\n");
|
||||
/* Keyboards don't have cursors... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_warp (GdkDevice *device,
|
||||
GdkScreen *screen,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_warp\n");
|
||||
/* Can't warp a keyboard... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_query_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkWindow **root_window,
|
||||
GdkWindow **child_window,
|
||||
gdouble *root_x,
|
||||
gdouble *root_y,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_query_state\n");
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_mir_keyboard_grab (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_grab\n");
|
||||
/* Mir doesn't do grabs, so sure, you have the grab */
|
||||
return GDK_GRAB_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_ungrab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_ungrab\n");
|
||||
/* Mir doesn't do grabs */
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_keyboard_window_at_position (GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keyboard_window_at_position (%f, %f)\n", *win_x, *win_y);
|
||||
/* Keyboard don't have locations... */
|
||||
return NULL; // FIXME: Or the window with the keyboard focus?
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_select_window_events (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkEventMask event_mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_keyboard_select_window_events\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_init (GdkMirKeyboard *device)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_class_init (GdkMirKeyboardClass *klass)
|
||||
{
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
device_class->get_history = gdk_mir_keyboard_get_history;
|
||||
device_class->get_state = gdk_mir_keyboard_get_state;
|
||||
device_class->set_window_cursor = gdk_mir_keyboard_set_window_cursor;
|
||||
device_class->warp = gdk_mir_keyboard_warp;
|
||||
device_class->query_state = gdk_mir_keyboard_query_state;
|
||||
device_class->grab = gdk_mir_keyboard_grab;
|
||||
device_class->ungrab = gdk_mir_keyboard_ungrab;
|
||||
device_class->window_at_position = gdk_mir_keyboard_window_at_position;
|
||||
device_class->select_window_events = gdk_mir_keyboard_select_window_events;
|
||||
}
|
466
gdk/mir/gdkmirkeymap.c
Normal file
@@ -0,0 +1,466 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
typedef struct GdkMirKeymap GdkMirKeymap;
|
||||
typedef struct GdkMirKeymapClass GdkMirKeymapClass;
|
||||
|
||||
#define GDK_TYPE_MIR_KEYMAP (gdk_mir_keymap_get_type ())
|
||||
#define GDK_MIR_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_KEYMAP, GdkMirKeymap))
|
||||
#define GDK_MIR_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_KEYMAP, GdkMirKeymapClass))
|
||||
#define GDK_IS_MIR_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_KEYMAP))
|
||||
#define GDK_IS_MIR_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_KEYMAP))
|
||||
#define GDK_MIR_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_KEYMAP, GdkMirKeymapClass))
|
||||
|
||||
struct GdkMirKeymap
|
||||
{
|
||||
GdkKeymap parent_instance;
|
||||
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
|
||||
PangoDirection *direction;
|
||||
gboolean bidi;
|
||||
};
|
||||
|
||||
struct GdkMirKeymapClass
|
||||
{
|
||||
GdkKeymapClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirKeymap, gdk_mir_keymap, GDK_TYPE_KEYMAP)
|
||||
|
||||
GdkKeymap *
|
||||
_gdk_mir_keymap_new (void)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_KEYMAP, NULL);
|
||||
}
|
||||
|
||||
static PangoDirection
|
||||
gdk_mir_keymap_get_direction (GdkKeymap *keymap)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_get_direction\n");
|
||||
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < xkb_keymap_num_layouts (mir_keymap->xkb_keymap); i++)
|
||||
{
|
||||
if (xkb_state_layout_index_is_active (mir_keymap->xkb_state, i, XKB_STATE_LAYOUT_EFFECTIVE))
|
||||
return mir_keymap->direction[i];
|
||||
}
|
||||
|
||||
return PANGO_DIRECTION_NEUTRAL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_have_bidi_layouts (GdkKeymap *keymap)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_have_bidi_layouts\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_caps_lock_state (GdkKeymap *keymap)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_get_caps_lock_state\n");
|
||||
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_CAPS);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_num_lock_state (GdkKeymap *keymap)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_get_num_lock_state\n");
|
||||
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_NUM);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
guint keyval,
|
||||
GdkKeymapKey **keys,
|
||||
gint *n_keys)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_get_entries_for_keyval\n");
|
||||
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
|
||||
GArray *key_array;
|
||||
guint keycode;
|
||||
|
||||
key_array = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
|
||||
|
||||
for (keycode = 8; keycode < 255; keycode++) /* FIXME: min/max keycode */
|
||||
{
|
||||
gint num_layouts, layout;
|
||||
|
||||
num_layouts = xkb_keymap_num_layouts_for_key (mir_keymap->xkb_keymap, keycode);
|
||||
for (layout = 0; layout < num_layouts; layout++)
|
||||
{
|
||||
gint num_levels, level;
|
||||
|
||||
num_levels = xkb_keymap_num_levels_for_key (mir_keymap->xkb_keymap, keycode, layout);
|
||||
for (level = 0; level < num_levels; level++)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
gint num_syms, sym;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (mir_keymap->xkb_keymap, keycode, layout, level, &syms);
|
||||
for (sym = 0; sym < num_syms; sym++)
|
||||
{
|
||||
if (syms[sym] == keyval)
|
||||
{
|
||||
GdkKeymapKey key;
|
||||
|
||||
key.keycode = keycode;
|
||||
key.group = layout;
|
||||
key.level = level;
|
||||
|
||||
g_array_append_val (key_array, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*n_keys = key_array->len;
|
||||
*keys = (GdkKeymapKey*) g_array_free (key_array, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_entries_for_keycode (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkKeymapKey **keys,
|
||||
guint **keyvals,
|
||||
gint *n_entries)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_get_entries_for_keycode\n");
|
||||
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
|
||||
gint num_layouts, layout;
|
||||
gint num_entries;
|
||||
gint i;
|
||||
|
||||
num_layouts = xkb_keymap_num_layouts_for_key (mir_keymap->xkb_keymap, hardware_keycode);
|
||||
|
||||
num_entries = 0;
|
||||
for (layout = 0; layout < num_layouts; layout++)
|
||||
num_entries += xkb_keymap_num_levels_for_key (mir_keymap->xkb_keymap, hardware_keycode, layout);
|
||||
|
||||
if (n_entries)
|
||||
*n_entries = num_entries;
|
||||
if (keys)
|
||||
*keys = g_new0 (GdkKeymapKey, num_entries);
|
||||
if (keyvals)
|
||||
*keyvals = g_new0 (guint, num_entries);
|
||||
|
||||
i = 0;
|
||||
for (layout = 0; layout < num_layouts; layout++)
|
||||
{
|
||||
gint num_levels, level;
|
||||
num_levels = xkb_keymap_num_levels_for_key (mir_keymap->xkb_keymap, hardware_keycode, layout);
|
||||
for (level = 0; level < num_levels; level++)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
int num_syms;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (mir_keymap->xkb_keymap, hardware_keycode, layout, 0, &syms);
|
||||
if (keys)
|
||||
{
|
||||
(*keys)[i].keycode = hardware_keycode;
|
||||
(*keys)[i].group = layout;
|
||||
(*keys)[i].level = level;
|
||||
}
|
||||
if (keyvals && num_syms > 0)
|
||||
(*keyvals)[i] = syms[0];
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return num_entries > 0;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_mir_keymap_lookup_key (GdkKeymap *keymap,
|
||||
const GdkKeymapKey *key)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_lookup_key\n");
|
||||
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
|
||||
const xkb_keysym_t *syms;
|
||||
int num_syms;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (mir_keymap->xkb_keymap,
|
||||
key->keycode,
|
||||
key->group,
|
||||
key->level,
|
||||
&syms);
|
||||
if (num_syms > 0)
|
||||
return syms[0];
|
||||
else
|
||||
return XKB_KEY_NoSymbol;
|
||||
}
|
||||
|
||||
static guint32
|
||||
get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
GdkModifierType state)
|
||||
{
|
||||
guint32 mods = 0;
|
||||
|
||||
if (state & GDK_SHIFT_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_SHIFT);
|
||||
if (state & GDK_LOCK_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS);
|
||||
if (state & GDK_CONTROL_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL);
|
||||
if (state & GDK_MOD1_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
|
||||
if (state & GDK_MOD2_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2");
|
||||
if (state & GDK_MOD3_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3");
|
||||
if (state & GDK_MOD4_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO);
|
||||
if (state & GDK_MOD5_MASK)
|
||||
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5");
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
|
||||
guint32 mods)
|
||||
{
|
||||
GdkModifierType state = 0;
|
||||
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_SHIFT)))
|
||||
state |= GDK_SHIFT_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS)))
|
||||
state |= GDK_LOCK_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL)))
|
||||
state |= GDK_CONTROL_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
|
||||
state |= GDK_MOD1_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2")))
|
||||
state |= GDK_MOD2_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3")))
|
||||
state |= GDK_MOD3_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO)))
|
||||
state |= GDK_MOD4_MASK;
|
||||
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5")))
|
||||
state |= GDK_MOD5_MASK;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
guint hardware_keycode,
|
||||
GdkModifierType state,
|
||||
gint group,
|
||||
guint *keyval,
|
||||
gint *effective_group,
|
||||
gint *effective_level,
|
||||
GdkModifierType *consumed_modifiers)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_translate_keyboard_state\n");
|
||||
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
|
||||
struct xkb_state *xkb_state;
|
||||
guint32 modifiers;
|
||||
guint32 consumed;
|
||||
xkb_layout_index_t layout;
|
||||
xkb_level_index_t level;
|
||||
xkb_keysym_t sym;
|
||||
|
||||
modifiers = get_xkb_modifiers (mir_keymap->xkb_keymap, state);
|
||||
|
||||
xkb_state = xkb_state_new (mir_keymap->xkb_keymap);
|
||||
|
||||
xkb_state_update_mask (xkb_state, modifiers, 0, 0, group, 0, 0);
|
||||
|
||||
layout = xkb_state_key_get_layout (xkb_state, hardware_keycode);
|
||||
level = xkb_state_key_get_level (xkb_state, hardware_keycode, layout);
|
||||
sym = xkb_state_key_get_one_sym (xkb_state, hardware_keycode);
|
||||
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (xkb_state, hardware_keycode, modifiers);
|
||||
|
||||
xkb_state_unref (xkb_state);
|
||||
|
||||
if (keyval)
|
||||
*keyval = sym;
|
||||
if (effective_group)
|
||||
*effective_group = layout;
|
||||
if (effective_level)
|
||||
*effective_level = level;
|
||||
if (consumed_modifiers)
|
||||
*consumed_modifiers = get_gdk_modifiers (mir_keymap->xkb_keymap, consumed);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_add_virtual_modifiers\n");
|
||||
// FIXME: What is this?
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_map_virtual_modifiers\n");
|
||||
// FIXME: What is this?
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_mir_keymap_get_modifier_state (GdkKeymap *keymap)
|
||||
{
|
||||
//g_printerr ("gdk_mir_keymap_get_modifier_state\n");
|
||||
GdkMirKeymap *mir_keymap = GDK_MIR_KEYMAP (keymap);
|
||||
xkb_mod_mask_t mods;
|
||||
|
||||
mods = xkb_state_serialize_mods (mir_keymap->xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
|
||||
return get_gdk_modifiers (mir_keymap->xkb_keymap, mods);
|
||||
}
|
||||
|
||||
static void
|
||||
update_direction (GdkMirKeymap *keymap)
|
||||
{
|
||||
gint num_layouts;
|
||||
gint *rtl;
|
||||
guint key;
|
||||
gboolean have_rtl, have_ltr;
|
||||
gint i;
|
||||
|
||||
num_layouts = xkb_keymap_num_layouts (keymap->xkb_keymap);
|
||||
|
||||
g_free (keymap->direction);
|
||||
keymap->direction = g_new0 (PangoDirection, num_layouts);
|
||||
|
||||
rtl = g_new0 (gint, num_layouts);
|
||||
|
||||
for (key = 8; key < 255; key++) /* FIXME: min/max keycode */
|
||||
{
|
||||
gint layouts;
|
||||
gint layout;
|
||||
|
||||
layouts = xkb_keymap_num_layouts_for_key (keymap->xkb_keymap, key);
|
||||
for (layout = 0; layout < layouts; layout++)
|
||||
{
|
||||
const xkb_keysym_t *syms;
|
||||
gint num_syms;
|
||||
gint sym;
|
||||
|
||||
num_syms = xkb_keymap_key_get_syms_by_level (keymap->xkb_keymap, key, layout, 0, &syms);
|
||||
for (sym = 0; sym < num_syms; sym++)
|
||||
{
|
||||
PangoDirection dir;
|
||||
dir = pango_unichar_direction (xkb_keysym_to_utf32 (syms[sym]));
|
||||
switch (dir)
|
||||
{
|
||||
case PANGO_DIRECTION_RTL:
|
||||
rtl[layout]++;
|
||||
break;
|
||||
case PANGO_DIRECTION_LTR:
|
||||
rtl[layout]--;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
have_rtl = have_ltr = FALSE;
|
||||
for (i = 0; i < num_layouts; i++)
|
||||
{
|
||||
if (rtl[i] > 0)
|
||||
{
|
||||
keymap->direction[i] = PANGO_DIRECTION_RTL;
|
||||
have_rtl = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
keymap->direction[i] = PANGO_DIRECTION_LTR;
|
||||
have_ltr = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (have_rtl && have_ltr)
|
||||
keymap->bidi = TRUE;
|
||||
|
||||
g_free (rtl);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_init (GdkMirKeymap *keymap)
|
||||
{
|
||||
struct xkb_context *context;
|
||||
struct xkb_rule_names names;
|
||||
|
||||
context = xkb_context_new (0);
|
||||
|
||||
names.rules = "evdev";
|
||||
names.model = "pc105";
|
||||
names.layout = "us";
|
||||
names.variant = "";
|
||||
names.options = "";
|
||||
keymap->xkb_keymap = xkb_keymap_new_from_names (context, &names, 0);
|
||||
keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);
|
||||
|
||||
xkb_context_unref (context);
|
||||
|
||||
update_direction (keymap);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_finalize (GObject *object)
|
||||
{
|
||||
GdkMirKeymap *keymap = GDK_MIR_KEYMAP (object);
|
||||
|
||||
xkb_keymap_unref (keymap->xkb_keymap);
|
||||
xkb_state_unref (keymap->xkb_state);
|
||||
g_free (keymap->direction);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_keymap_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keymap_class_init (GdkMirKeymapClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_mir_keymap_finalize;
|
||||
|
||||
keymap_class->get_direction = gdk_mir_keymap_get_direction;
|
||||
keymap_class->have_bidi_layouts = gdk_mir_keymap_have_bidi_layouts;
|
||||
keymap_class->get_caps_lock_state = gdk_mir_keymap_get_caps_lock_state;
|
||||
keymap_class->get_num_lock_state = gdk_mir_keymap_get_num_lock_state;
|
||||
keymap_class->get_entries_for_keyval = gdk_mir_keymap_get_entries_for_keyval;
|
||||
keymap_class->get_entries_for_keycode = gdk_mir_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_mir_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_mir_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_mir_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_mir_keymap_map_virtual_modifiers;
|
||||
keymap_class->get_modifier_state = gdk_mir_keymap_get_modifier_state;
|
||||
}
|
250
gdk/mir/gdkmirpointer.c
Normal file
@@ -0,0 +1,250 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkwindow.h"
|
||||
|
||||
typedef struct GdkMirPointer GdkMirPointer;
|
||||
typedef struct GdkMirPointerClass GdkMirPointerClass;
|
||||
|
||||
#define GDK_TYPE_MIR_POINTER (gdk_mir_pointer_get_type ())
|
||||
#define GDK_MIR_POINTER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_POINTER, GdkMirPointer))
|
||||
#define GDK_MIR_POINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_POINTER, GdkMirPointerClass))
|
||||
#define GDK_IS_MIR_POINTER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_POINTER))
|
||||
#define GDK_IS_MIR_POINTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_POINTER))
|
||||
#define GDK_MIR_POINTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_POINTER, GdkMirPointerClass))
|
||||
|
||||
struct GdkMirPointer
|
||||
{
|
||||
GdkDevice parent_instance;
|
||||
|
||||
/* Location of pointer */
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
|
||||
/* Window this pointer is over */
|
||||
GdkWindow *over_window;
|
||||
|
||||
/* Current modifier mask */
|
||||
GdkModifierType modifier_mask;
|
||||
};
|
||||
|
||||
struct GdkMirPointerClass
|
||||
{
|
||||
GdkDeviceClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirPointer, gdk_mir_pointer, GDK_TYPE_DEVICE)
|
||||
|
||||
GdkDevice *
|
||||
_gdk_mir_pointer_new (GdkDeviceManager *device_manager, const gchar *name)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_MIR_POINTER,
|
||||
"display", gdk_device_manager_get_display (device_manager),
|
||||
"device-manager", device_manager,
|
||||
"name", name,
|
||||
"type", GDK_DEVICE_TYPE_MASTER,
|
||||
"input-source", GDK_SOURCE_MOUSE,
|
||||
"input-mode", GDK_MODE_SCREEN,
|
||||
"has-cursor", TRUE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_pointer_set_location (GdkDevice *pointer,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
GdkWindow *window,
|
||||
GdkModifierType mask)
|
||||
{
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (pointer);
|
||||
|
||||
p->x = x;
|
||||
p->y = y;
|
||||
if (p->over_window)
|
||||
g_object_unref (p->over_window);
|
||||
p->over_window = g_object_ref (window);
|
||||
p->modifier_mask = mask;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_pointer_get_history (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
GdkTimeCoord ***events,
|
||||
gint *n_events)
|
||||
{
|
||||
g_printerr ("gdk_mir_pointer_get_history\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_get_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_get_state\n");
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (device);
|
||||
gdouble x, y;
|
||||
|
||||
gdk_window_get_device_position_double (window, device, &x, &y, mask);
|
||||
if (axes)
|
||||
{
|
||||
axes[0] = p->x;
|
||||
axes[1] = p->y;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_set_window_cursor (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_set_window_cursor\n");
|
||||
/* Mir doesn't support cursors */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_warp (GdkDevice *device,
|
||||
GdkScreen *screen,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_warp\n");
|
||||
/* Mir doesn't support warping */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_query_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkWindow **root_window,
|
||||
GdkWindow **child_window,
|
||||
gdouble *root_x,
|
||||
gdouble *root_y,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_query_state\n");
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (device);
|
||||
|
||||
if (root_window)
|
||||
*root_window = gdk_screen_get_root_window (gdk_display_get_default_screen (gdk_device_get_display (device)));
|
||||
if (child_window)
|
||||
*child_window = p->over_window;
|
||||
if (root_x)
|
||||
*root_x = p->x;
|
||||
if (root_y)
|
||||
*root_y = p->y;
|
||||
if (win_x)
|
||||
*win_x = p->x; // FIXME
|
||||
if (win_y)
|
||||
*win_y = p->y;
|
||||
if (mask)
|
||||
*mask = p->modifier_mask;
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_mir_pointer_grab (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_grab\n");
|
||||
/* Mir doesn't do grabs, so sure, you have the grab */
|
||||
return GDK_GRAB_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_ungrab (GdkDevice *device,
|
||||
guint32 time_)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_ungrab\n");
|
||||
/* Mir doesn't do grabs */
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_pointer_window_at_position (GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
//g_printerr ("gdk_mir_pointer_window_at_position\n");
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (device);
|
||||
|
||||
if (win_x)
|
||||
*win_x = p->x;
|
||||
if (win_y)
|
||||
*win_y = p->y;
|
||||
if (mask)
|
||||
*mask = p->modifier_mask;
|
||||
|
||||
return p->over_window;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_select_window_events (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkEventMask event_mask)
|
||||
{
|
||||
g_printerr ("gdk_mir_pointer_select_window_events\n");
|
||||
// FIXME?
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_init (GdkMirPointer *device)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_finalize (GObject *object)
|
||||
{
|
||||
GdkMirPointer *p = GDK_MIR_POINTER (object);
|
||||
|
||||
if (p->over_window)
|
||||
g_object_unref (p->over_window);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_pointer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_class_init (GdkMirPointerClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
|
||||
|
||||
object_class->finalize = gdk_mir_pointer_finalize;
|
||||
|
||||
device_class->get_history = gdk_mir_pointer_get_history;
|
||||
device_class->get_state = gdk_mir_pointer_get_state;
|
||||
device_class->set_window_cursor = gdk_mir_pointer_set_window_cursor;
|
||||
device_class->warp = gdk_mir_pointer_warp;
|
||||
device_class->query_state = gdk_mir_pointer_query_state;
|
||||
device_class->grab = gdk_mir_pointer_grab;
|
||||
device_class->ungrab = gdk_mir_pointer_ungrab;
|
||||
device_class->window_at_position = gdk_mir_pointer_window_at_position;
|
||||
device_class->select_window_events = gdk_mir_pointer_select_window_events;
|
||||
}
|
720
gdk/mir/gdkmirscreen.c
Normal file
@@ -0,0 +1,720 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "gdkscreenprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkvisualprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
#define VISUAL_TYPE GDK_VISUAL_TRUE_COLOR
|
||||
#define VISUAL_DEPTH 32
|
||||
|
||||
typedef struct GdkMirScreen GdkMirScreen;
|
||||
typedef struct GdkMirScreenClass GdkMirScreenClass;
|
||||
|
||||
#define GDK_TYPE_MIR_SCREEN (gdk_mir_screen_get_type ())
|
||||
#define GDK_MIR_SCREEN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_MIR_SCREEN, GdkMirScreen))
|
||||
#define GDK_MIR_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_MIR_SCREEN, GdkMirScreenClass))
|
||||
#define GDK_IS_MIR_SCREEN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_SCREEN))
|
||||
#define GDK_IS_MIR_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_MIR_SCREEN))
|
||||
#define GDK_MIR_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_MIR_SCREEN, GdkMirScreenClass))
|
||||
|
||||
struct GdkMirScreen
|
||||
{
|
||||
GdkScreen parent_instance;
|
||||
|
||||
/* Display this screen is running on */
|
||||
GdkDisplay *display;
|
||||
|
||||
/* Current monitor configuration */
|
||||
MirDisplayConfiguration *display_config;
|
||||
|
||||
GdkVisual *visual;
|
||||
|
||||
GdkWindow *root_window;
|
||||
};
|
||||
|
||||
struct GdkMirScreenClass
|
||||
{
|
||||
GdkScreenClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirScreen, gdk_mir_screen, GDK_TYPE_SCREEN)
|
||||
|
||||
static MirConnection *
|
||||
get_connection (GdkMirScreen *screen)
|
||||
{
|
||||
return gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
|
||||
}
|
||||
|
||||
static void
|
||||
get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
for (i = 0; i < config->num_outputs; i++)
|
||||
{
|
||||
MirDisplayOutput *o = &config->outputs[i];
|
||||
gint w, h;
|
||||
|
||||
if (!o->used)
|
||||
continue;
|
||||
|
||||
w = o->position_x + o->modes[o->current_mode].horizontal_resolution;
|
||||
if (w > *width)
|
||||
*width = w;
|
||||
h = o->position_y + o->modes[o->current_mode].vertical_resolution;
|
||||
if (h > *height)
|
||||
*height = h;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_display_config (GdkMirScreen *screen)
|
||||
{
|
||||
gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
|
||||
mir_display_config_destroy (screen->display_config);
|
||||
screen->display_config = mir_connection_create_display_config (get_connection (screen));
|
||||
}
|
||||
|
||||
static void
|
||||
config_changed_cb (MirConnection *connection, void *data)
|
||||
{
|
||||
GdkMirScreen *screen = data;
|
||||
gint old_width, old_height, new_width, new_height;
|
||||
|
||||
get_screen_size (screen->display_config, &old_width, &old_height);
|
||||
update_display_config (screen);
|
||||
get_screen_size (screen->display_config, &new_width, &new_height);
|
||||
|
||||
g_signal_emit_by_name (screen, "monitors-changed");
|
||||
if (old_width > 0 && (old_width != new_width || old_height != new_height))
|
||||
g_signal_emit_by_name (screen, "size-changed");
|
||||
}
|
||||
|
||||
GdkScreen *
|
||||
_gdk_mir_screen_new (GdkDisplay *display)
|
||||
{
|
||||
GdkMirScreen *screen;
|
||||
|
||||
screen = g_object_new (GDK_TYPE_MIR_SCREEN, NULL);
|
||||
screen->display = display;
|
||||
mir_connection_set_display_config_change_callback (get_connection (screen), config_changed_cb, display);
|
||||
update_display_config (screen);
|
||||
|
||||
return GDK_SCREEN (screen);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gdk_mir_screen_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_finalize (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gdk_mir_screen_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static GdkDisplay *
|
||||
gdk_mir_screen_get_display (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_display\n");
|
||||
return GDK_DISPLAY (GDK_MIR_SCREEN (screen)->display);
|
||||
}
|
||||
|
||||
static MirDisplayOutput *
|
||||
get_output (GdkScreen *screen, gint monitor_num)
|
||||
{
|
||||
MirDisplayConfiguration *config;
|
||||
uint32_t i, j;
|
||||
|
||||
config = GDK_MIR_SCREEN (screen)->display_config;
|
||||
|
||||
for (i = 0, j = 0; i < config->num_outputs; i++)
|
||||
{
|
||||
if (!config->outputs[i].used)
|
||||
continue;
|
||||
|
||||
if (j == monitor_num)
|
||||
return &config->outputs[i];
|
||||
j++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_width\n");
|
||||
gint width, height;
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_height\n");
|
||||
gint width, height;
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return height;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_width_mm\n");
|
||||
// FIXME: A combination of all screens?
|
||||
return get_output (screen, 0)->physical_width_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_height_mm\n");
|
||||
// FIXME: A combination of all screens?
|
||||
return get_output (screen, 0)->physical_height_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_number (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_number\n");
|
||||
/* There is only one screen... */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_root_window\n");
|
||||
GdkMirScreen *s = GDK_MIR_SCREEN (screen);
|
||||
gint width, height;
|
||||
|
||||
if (s->root_window)
|
||||
return s->root_window;
|
||||
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
|
||||
s->root_window = _gdk_display_create_window (s->display);
|
||||
s->root_window->impl = _gdk_mir_window_impl_new ();
|
||||
s->root_window->impl_window = s->root_window;
|
||||
s->root_window->visual = s->visual;
|
||||
s->root_window->window_type = GDK_WINDOW_ROOT;
|
||||
s->root_window->depth = VISUAL_DEPTH;
|
||||
s->root_window->x = 0;
|
||||
s->root_window->y = 0;
|
||||
s->root_window->abs_x = 0;
|
||||
s->root_window->abs_y = 0;
|
||||
s->root_window->width = width;
|
||||
s->root_window->height = height;
|
||||
s->root_window->viewable = TRUE;
|
||||
|
||||
return s->root_window;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_n_monitors (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_n_monitors\n");
|
||||
MirDisplayConfiguration *config;
|
||||
uint32_t i;
|
||||
gint count = 0;
|
||||
|
||||
config = GDK_MIR_SCREEN (screen)->display_config;
|
||||
|
||||
for (i = 0; i < config->num_outputs; i++)
|
||||
if (config->outputs[i].used)
|
||||
count++;
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_primary_monitor (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_primary_monitor\n");
|
||||
return 0; //?
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_monitor_width_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
|
||||
return get_output (screen, monitor_num)->physical_width_mm;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_monitor_height_mm (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
|
||||
return get_output (screen, monitor_num)->physical_height_mm;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
|
||||
return NULL; //?
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_get_monitor_geometry (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_monitor_geometry (%d)\n", monitor_num);
|
||||
MirDisplayOutput *output;
|
||||
MirDisplayMode *mode;
|
||||
|
||||
output = get_output (screen, monitor_num);
|
||||
mode = &output->modes[output->current_mode];
|
||||
dest->x = output->position_x;
|
||||
dest->y = output->position_y;
|
||||
dest->width = mode->horizontal_resolution;
|
||||
dest->height = mode->vertical_resolution;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_get_monitor_workarea (GdkScreen *screen,
|
||||
gint monitor_num,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_monitor_workarea (%d)\n", monitor_num);
|
||||
// FIXME: Don't know what this is
|
||||
gdk_mir_screen_get_monitor_geometry (screen, monitor_num, dest);
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_screen_list_visuals (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_list_visuals\n");
|
||||
return g_list_append (NULL, GDK_MIR_SCREEN (screen)->visual);
|
||||
}
|
||||
|
||||
static GdkVisual *
|
||||
gdk_mir_screen_get_system_visual (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_system_visual\n");
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
static GdkVisual *
|
||||
gdk_mir_screen_get_rgba_visual (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_rgba_visual\n");
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_screen_is_composited (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_is_composited\n");
|
||||
/* We're always composited */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gchar *
|
||||
gdk_mir_screen_make_display_name (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_make_display_name\n");
|
||||
return NULL; // FIXME
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_screen_get_active_window (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_active_window\n");
|
||||
return NULL; // FIXME
|
||||
}
|
||||
|
||||
static GList *
|
||||
gdk_mir_screen_get_window_stack (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_get_window_stack\n");
|
||||
return NULL; // FIXME
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_broadcast_client_message (GdkScreen *screen,
|
||||
GdkEvent *event)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_broadcast_client_message\n");
|
||||
// FIXME
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_screen_get_setting (GdkScreen *screen,
|
||||
const gchar *name,
|
||||
GValue *value)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_setting (\"%s\")\n", name);
|
||||
|
||||
if (strcmp (name, "gtk-theme-name") == 0)
|
||||
{
|
||||
g_value_set_string (value, "Ambiance");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-font-name") == 0)
|
||||
{
|
||||
g_value_set_string (value, "Ubuntu");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-enable-animations") == 0)
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-dpi") == 0)
|
||||
{
|
||||
g_value_set_int (value, 96 * 1024);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-antialias") == 0)
|
||||
{
|
||||
g_value_set_int (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-hinting") == 0)
|
||||
{
|
||||
g_value_set_int (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-hintstyle") == 0)
|
||||
{
|
||||
g_value_set_static_string (value, "hintfull");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp (name, "gtk-xft-rgba") == 0)
|
||||
{
|
||||
g_value_set_static_string (value, "rgba");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-modules"))
|
||||
{
|
||||
g_value_set_string (value, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-application-prefer-dark-theme"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-key-theme-name"))
|
||||
{
|
||||
g_value_set_string (value, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-double-click-time"))
|
||||
{
|
||||
g_value_set_int (value, 250);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-double-click-distance"))
|
||||
{
|
||||
g_value_set_int (value, 5);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-theme-name"))
|
||||
{
|
||||
g_value_set_string (value, "Raleigh");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-theme-size"))
|
||||
{
|
||||
g_value_set_int (value, 128);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-icon-theme-name"))
|
||||
{
|
||||
g_value_set_string (value, "hicolor");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-shell-shows-app-menu"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-shell-shows-menubar"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-shell-shows-desktop"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-recent-files-enabled"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-alternative-sort-arrows"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-enable-accels"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-enable-mnemonics"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-menu-images"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-button-images"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-split-cursor"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-im-module"))
|
||||
{
|
||||
g_value_set_string (value, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-menu-bar-accel"))
|
||||
{
|
||||
g_value_set_string (value, "F10");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-blink"))
|
||||
{
|
||||
g_value_set_boolean (value, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-blink-time"))
|
||||
{
|
||||
g_value_set_int (value, 1200);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-cursor-blink-timeout"))
|
||||
{
|
||||
g_value_set_int (value, 10);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-entry-select-on-focus"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-error-bell"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (g_str_equal (name, "gtk-label-select-on-focus"))
|
||||
{
|
||||
g_value_set_boolean (value, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_warning ("unknown property %s", name);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_visual_get_best_depth (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
|
||||
return VISUAL_DEPTH;
|
||||
}
|
||||
|
||||
static GdkVisualType
|
||||
gdk_mir_screen_visual_get_best_type (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_type\n");
|
||||
return VISUAL_TYPE;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best (GdkScreen *screen)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best\n");
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best_with_depth (GdkScreen *screen,
|
||||
gint depth)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best_with_type (GdkScreen *screen,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
static GdkVisual*
|
||||
gdk_mir_screen_visual_get_best_with_both (GdkScreen *screen,
|
||||
gint depth,
|
||||
GdkVisualType visual_type)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
|
||||
return GDK_MIR_SCREEN (screen)->visual;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_query_depths (GdkScreen *screen,
|
||||
gint **depths,
|
||||
gint *count)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_query_depths\n");
|
||||
static gint supported_depths[] = { VISUAL_DEPTH };
|
||||
*depths = supported_depths;
|
||||
*count = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_query_visual_types (GdkScreen *screen,
|
||||
GdkVisualType **visual_types,
|
||||
gint *count)
|
||||
{
|
||||
g_printerr ("gdk_mir_screen_query_visual_types\n");
|
||||
static GdkVisualType supported_visual_types[] = { VISUAL_TYPE };
|
||||
*visual_types = supported_visual_types;
|
||||
*count = 1;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_monitor_scale_factor (GdkScreen *screen,
|
||||
gint monitor_num)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_monitor_scale_factor (%d)\n", monitor_num);
|
||||
/* Don't support monitor scaling */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_init (GdkMirScreen *screen)
|
||||
{
|
||||
screen->visual = g_object_new (GDK_TYPE_VISUAL, NULL);
|
||||
screen->visual->screen = GDK_SCREEN (screen);
|
||||
screen->visual->type = VISUAL_TYPE;
|
||||
screen->visual->depth = VISUAL_DEPTH;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_screen_class_init (GdkMirScreenClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
|
||||
|
||||
object_class->dispose = gdk_mir_screen_dispose;
|
||||
object_class->finalize = gdk_mir_screen_finalize;
|
||||
|
||||
screen_class->get_display = gdk_mir_screen_get_display;
|
||||
screen_class->get_width = gdk_mir_screen_get_width;
|
||||
screen_class->get_height = gdk_mir_screen_get_height;
|
||||
screen_class->get_width_mm = gdk_mir_screen_get_width_mm;
|
||||
screen_class->get_height_mm = gdk_mir_screen_get_height_mm;
|
||||
screen_class->get_number = gdk_mir_screen_get_number;
|
||||
screen_class->get_root_window = gdk_mir_screen_get_root_window;
|
||||
screen_class->get_n_monitors = gdk_mir_screen_get_n_monitors;
|
||||
screen_class->get_primary_monitor = gdk_mir_screen_get_primary_monitor;
|
||||
screen_class->get_monitor_width_mm = gdk_mir_screen_get_monitor_width_mm;
|
||||
screen_class->get_monitor_height_mm = gdk_mir_screen_get_monitor_height_mm;
|
||||
screen_class->get_monitor_plug_name = gdk_mir_screen_get_monitor_plug_name;
|
||||
screen_class->get_monitor_geometry = gdk_mir_screen_get_monitor_geometry;
|
||||
screen_class->get_monitor_workarea = gdk_mir_screen_get_monitor_workarea;
|
||||
screen_class->list_visuals = gdk_mir_screen_list_visuals;
|
||||
screen_class->get_system_visual = gdk_mir_screen_get_system_visual;
|
||||
screen_class->get_rgba_visual = gdk_mir_screen_get_rgba_visual;
|
||||
screen_class->is_composited = gdk_mir_screen_is_composited;
|
||||
screen_class->make_display_name = gdk_mir_screen_make_display_name;
|
||||
screen_class->get_active_window = gdk_mir_screen_get_active_window;
|
||||
screen_class->get_window_stack = gdk_mir_screen_get_window_stack;
|
||||
screen_class->broadcast_client_message = gdk_mir_screen_broadcast_client_message;
|
||||
screen_class->get_setting = gdk_mir_screen_get_setting;
|
||||
screen_class->visual_get_best_depth = gdk_mir_screen_visual_get_best_depth;
|
||||
screen_class->visual_get_best_type = gdk_mir_screen_visual_get_best_type;
|
||||
screen_class->visual_get_best = gdk_mir_screen_visual_get_best;
|
||||
screen_class->visual_get_best_with_depth = gdk_mir_screen_visual_get_best_with_depth;
|
||||
screen_class->visual_get_best_with_type = gdk_mir_screen_visual_get_best_with_type;
|
||||
screen_class->visual_get_best_with_both = gdk_mir_screen_visual_get_best_with_both;
|
||||
screen_class->query_depths = gdk_mir_screen_query_depths;
|
||||
screen_class->query_visual_types = gdk_mir_screen_query_visual_types;
|
||||
screen_class->get_monitor_scale_factor = gdk_mir_screen_get_monitor_scale_factor;
|
||||
}
|
52
gdk/mir/gdkmirwindow.c
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
|
||||
#define GDK_MIR_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_MIR, GdkMirWindow))
|
||||
#define GDK_MIR_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_MIR, GdkMirWindowClass))
|
||||
#define GDK_IS_WINDOW_MIR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_MIR))
|
||||
#define GDK_MIR_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_MIR, GdkMirWindowClass))
|
||||
|
||||
typedef struct _GdkMirWindow GdkMirWindow;
|
||||
typedef struct _GdkMirWindowClass GdkMirWindowClass;
|
||||
|
||||
struct _GdkMirWindow
|
||||
{
|
||||
GdkWindow parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkMirWindowClass
|
||||
{
|
||||
GdkWindowClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirWindow, gdk_mir_window, GDK_TYPE_WINDOW)
|
||||
|
||||
static void
|
||||
gdk_mir_window_init (GdkMirWindow *impl)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_class_init (GdkMirWindowClass *klass)
|
||||
{
|
||||
}
|
1269
gdk/mir/gdkmirwindowimpl.c
Normal file
@@ -3076,8 +3076,27 @@ gdk_event_translate (MSG *msg,
|
||||
}
|
||||
else
|
||||
{
|
||||
mmi->ptMaxTrackSize.x = 30000;
|
||||
mmi->ptMaxTrackSize.y = 30000;
|
||||
HMONITOR winmon;
|
||||
MONITORINFO moninfo;
|
||||
|
||||
winmon = MonitorFromWindow (GDK_WINDOW_HWND (window), MONITOR_DEFAULTTONEAREST);
|
||||
|
||||
moninfo.cbSize = sizeof (moninfo);
|
||||
|
||||
if (GetMonitorInfoA (winmon, &moninfo))
|
||||
{
|
||||
mmi->ptMaxTrackSize.x = moninfo.rcWork.right - moninfo.rcWork.left;
|
||||
mmi->ptMaxTrackSize.y = moninfo.rcWork.bottom - moninfo.rcWork.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Apparently, this is just a very big number (bigger than any widget
|
||||
* could realistically be) to make sure the window is as big as
|
||||
* possible when maximized.
|
||||
*/
|
||||
mmi->ptMaxTrackSize.x = 30000;
|
||||
mmi->ptMaxTrackSize.y = 30000;
|
||||
}
|
||||
}
|
||||
|
||||
if (impl->hint_flags & (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE))
|
||||
|
@@ -146,6 +146,8 @@ handle_special (guint vk,
|
||||
*ksymp = GDK_KEY_Select; break;
|
||||
case VK_PRINT:
|
||||
*ksymp = GDK_KEY_Print; break;
|
||||
case VK_SNAPSHOT:
|
||||
*ksymp = GDK_KEY_Print; break;
|
||||
case VK_EXECUTE:
|
||||
*ksymp = GDK_KEY_Execute; break;
|
||||
case VK_INSERT:
|
||||
|
@@ -186,6 +186,12 @@ _gdk_win32_window_change_property (GdkWindow *window,
|
||||
format == 8 &&
|
||||
mode == GDK_PROP_MODE_REPLACE)
|
||||
{
|
||||
if (type == _image_bmp && nelements < sizeof (BITMAPFILEHEADER))
|
||||
{
|
||||
g_warning ("Clipboard contains invalid bitmap data");
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == _utf8_string)
|
||||
{
|
||||
if (!OpenClipboard (GDK_WINDOW_HWND (window)))
|
||||
|
@@ -1285,10 +1285,15 @@ _gdk_win32_selection_convert_to_dib (HGLOBAL hdata,
|
||||
|
||||
if (target == _image_bmp)
|
||||
{
|
||||
/* No conversion is needed, just strip the BITMAPFILEHEADER */
|
||||
HGLOBAL hdatanew;
|
||||
SIZE_T size = GlobalSize (hdata) - sizeof (BITMAPFILEHEADER);
|
||||
guchar *ptr = GlobalLock (hdata);
|
||||
SIZE_T size;
|
||||
guchar *ptr;
|
||||
|
||||
g_return_val_if_fail (GlobalSize (hdata) >= sizeof (BITMAPFILEHEADER), NULL);
|
||||
|
||||
/* No conversion is needed, just strip the BITMAPFILEHEADER */
|
||||
size = GlobalSize (hdata) - sizeof (BITMAPFILEHEADER);
|
||||
ptr = GlobalLock (hdata);
|
||||
|
||||
memmove (ptr, ptr + sizeof (BITMAPFILEHEADER), size);
|
||||
GlobalUnlock (hdata);
|
||||
|
@@ -456,7 +456,7 @@ gtk_entry_accessible_initialize (AtkObject *obj,
|
||||
gtk_entry_accessible->priv->selection_bound = start_pos;
|
||||
|
||||
/* Set up signal callbacks */
|
||||
g_signal_connect (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL);
|
||||
g_signal_connect_after (entry, "insert-text", G_CALLBACK (insert_text_cb), NULL);
|
||||
g_signal_connect (entry, "delete-text", G_CALLBACK (delete_text_cb), NULL);
|
||||
|
||||
if (gtk_entry_get_visibility (entry))
|
||||
@@ -1390,16 +1390,18 @@ insert_text_cb (GtkEditable *editable,
|
||||
gint *position)
|
||||
{
|
||||
GtkEntryAccessible *accessible;
|
||||
gint length;
|
||||
|
||||
if (new_text_length == 0)
|
||||
return;
|
||||
|
||||
accessible = GTK_ENTRY_ACCESSIBLE (gtk_widget_get_accessible (GTK_WIDGET (editable)));
|
||||
length = g_utf8_strlen (new_text, new_text_length);
|
||||
|
||||
g_signal_emit_by_name (accessible,
|
||||
"text-changed::insert",
|
||||
*position,
|
||||
g_utf8_strlen (new_text, new_text_length));
|
||||
*position - length,
|
||||
length);
|
||||
}
|
||||
|
||||
/* We connect to GtkEditable::delete-text, since it carries
|
||||
|
@@ -50,7 +50,8 @@ gtk_list_box_row_accessible_ref_state_set (AtkObject *obj)
|
||||
if (widget != NULL)
|
||||
{
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (gtk_list_box_get_selection_mode (GTK_LIST_BOX (parent)) != GTK_SELECTION_NONE)
|
||||
if (parent != NULL &&
|
||||
gtk_list_box_get_selection_mode (GTK_LIST_BOX (parent)) != GTK_SELECTION_NONE)
|
||||
atk_state_set_add_state (state_set, ATK_STATE_SELECTABLE);
|
||||
|
||||
if (widget == (GtkWidget*)gtk_list_box_get_selected_row (GTK_LIST_BOX (parent)))
|
||||
|
@@ -50,9 +50,6 @@
|
||||
* @Short_description: Manipulating stock icons
|
||||
* @Title: Themeable Stock Images
|
||||
*
|
||||
* Browse the available stock icons using
|
||||
* the “gtk3-demo” application.
|
||||
*
|
||||
* An icon factory manages a collection of #GtkIconSet; a #GtkIconSet manages a
|
||||
* set of variants of a particular icon (i.e. a #GtkIconSet contains variants for
|
||||
* different sizes and widget states). Icons in an icon factory are named by a
|
||||
|
@@ -339,7 +339,7 @@ gtk_application_impl_dbus_inhibit (GtkApplicationImpl *impl,
|
||||
"Inhibit",
|
||||
g_variant_new ("(s@usu)",
|
||||
dbus->app_id,
|
||||
gtk_application_impl_dbus_get_window_system_id (dbus, window),
|
||||
window ? gtk_application_impl_dbus_get_window_system_id (dbus, window) : g_variant_new_uint32 (0),
|
||||
reason,
|
||||
flags),
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
|
@@ -1477,10 +1477,13 @@ normalise_detailed_name (const gchar *detailed_action_name)
|
||||
* @accels: (array zero-terminated=1): a list of accelerators in the format understood by
|
||||
* gtk_accelerator_parse()
|
||||
*
|
||||
* Sets one or more keyboard accelerator that will trigger the
|
||||
* Sets zero or more keyboard accelerators that will trigger the
|
||||
* given action. The first item in @accels will be the primary
|
||||
* accelerator, which may be displayed in the UI.
|
||||
*
|
||||
* To remove all accelerators for an action, use an empty, zero-terminated
|
||||
* array for @accels.
|
||||
*
|
||||
* Since: 3.12
|
||||
*/
|
||||
void
|
||||
|
@@ -691,6 +691,18 @@ gtk_application_window_real_map (GtkWidget *widget)
|
||||
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->map (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_window_real_unmap (GtkWidget *widget)
|
||||
{
|
||||
GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
|
||||
|
||||
/* XXX could eliminate this by tweaking gtk_window_unmap */
|
||||
if (window->priv->menubar)
|
||||
gtk_widget_unmap (window->priv->menubar);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_application_window_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_application_window_real_forall_internal (GtkContainer *container,
|
||||
gboolean include_internal,
|
||||
@@ -811,6 +823,7 @@ gtk_application_window_class_init (GtkApplicationWindowClass *class)
|
||||
widget_class->realize = gtk_application_window_real_realize;
|
||||
widget_class->unrealize = gtk_application_window_real_unrealize;
|
||||
widget_class->map = gtk_application_window_real_map;
|
||||
widget_class->unmap = gtk_application_window_real_unmap;
|
||||
object_class->get_property = gtk_application_window_get_property;
|
||||
object_class->set_property = gtk_application_window_set_property;
|
||||
object_class->dispose = gtk_application_window_dispose;
|
||||
|
@@ -2425,7 +2425,7 @@ gtk_assistant_accessible_get_n_children (AtkObject *accessible)
|
||||
if (widget == NULL)
|
||||
return 0;
|
||||
|
||||
return g_list_length (GTK_ASSISTANT (widget)->priv->pages) + 1;
|
||||
return g_list_length (GTK_ASSISTANT (widget)->priv->pages) + 2;
|
||||
}
|
||||
|
||||
static AtkObject *
|
||||
@@ -2461,6 +2461,11 @@ gtk_assistant_accessible_ref_child (AtkObject *accessible,
|
||||
child = priv->action_area;
|
||||
title = NULL;
|
||||
}
|
||||
else if (index == n_pages + 1)
|
||||
{
|
||||
child = priv->headerbar;
|
||||
title = NULL;
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
|
@@ -2614,7 +2614,7 @@ gtk_box_set_center_widget (GtkBox *box,
|
||||
*
|
||||
* Retrieves the center widget of the box.
|
||||
*
|
||||
* Returns: the center widget
|
||||
* Returns: (transfer none): the center widget
|
||||
*
|
||||
* Since: 3.12
|
||||
*/
|
||||
|
@@ -101,9 +101,14 @@ select_swatch (GtkColorChooserWidget *cc,
|
||||
return;
|
||||
|
||||
if (cc->priv->current != NULL)
|
||||
gtk_widget_unset_state_flags (GTK_WIDGET (cc->priv->current), GTK_STATE_FLAG_SELECTED);
|
||||
{
|
||||
gtk_widget_unset_state_flags (GTK_WIDGET (cc->priv->current), GTK_STATE_FLAG_SELECTED);
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cc->priv->current));
|
||||
}
|
||||
|
||||
gtk_widget_set_state_flags (GTK_WIDGET (swatch), GTK_STATE_FLAG_SELECTED, FALSE);
|
||||
cc->priv->current = swatch;
|
||||
gtk_widget_queue_draw (GTK_WIDGET (cc->priv->current));
|
||||
|
||||
gtk_color_swatch_get_rgba (swatch, &color);
|
||||
g_settings_set (cc->priv->settings, "selected-color", "(bdddd)",
|
||||
|
@@ -2548,9 +2548,13 @@ gtk_combo_box_popdown (GtkComboBox *combo_box)
|
||||
if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
|
||||
return;
|
||||
|
||||
if (!gtk_widget_is_drawable (priv->popup_window))
|
||||
return;
|
||||
|
||||
if (priv->grab_keyboard)
|
||||
gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
|
||||
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
|
||||
if (priv->grab_pointer)
|
||||
gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
|
||||
|
||||
gtk_device_grab_remove (priv->popup_window, priv->grab_pointer);
|
||||
gtk_widget_hide (priv->popup_window);
|
||||
|
@@ -574,7 +574,6 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
* content area of the dialog, as returned by
|
||||
* gtk_dialog_get_content_area(), unless gtk_container_set_border_width()
|
||||
* was called on that widget directly.
|
||||
*
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("content-area-border",
|
||||
@@ -611,6 +610,14 @@ gtk_dialog_class_init (GtkDialogClass *class)
|
||||
6,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkDialog:action-area-border:
|
||||
*
|
||||
* The default border width used around the
|
||||
* action area of the dialog, as returned by
|
||||
* gtk_dialog_get_action_area(), unless gtk_container_set_border_width()
|
||||
* was called on that widget directly.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("action-area-border",
|
||||
P_("Action area border"),
|
||||
@@ -668,8 +675,11 @@ update_spacings (GtkDialog *dialog)
|
||||
NULL);
|
||||
|
||||
if (!_gtk_container_get_border_width_set (GTK_CONTAINER (priv->vbox)))
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->vbox),
|
||||
content_area_border);
|
||||
{
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->vbox),
|
||||
content_area_border);
|
||||
_gtk_container_set_border_width_set (GTK_CONTAINER (priv->vbox), FALSE);
|
||||
}
|
||||
|
||||
if (!_gtk_box_get_spacing_set (GTK_BOX (priv->vbox)))
|
||||
{
|
||||
@@ -681,8 +691,11 @@ update_spacings (GtkDialog *dialog)
|
||||
button_spacing);
|
||||
|
||||
if (!_gtk_container_get_border_width_set (GTK_CONTAINER (priv->action_area)))
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->action_area),
|
||||
action_area_border);
|
||||
{
|
||||
gtk_container_set_border_width (GTK_CONTAINER (priv->action_area),
|
||||
action_area_border);
|
||||
_gtk_container_set_border_width_set (GTK_CONTAINER (priv->action_area), FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
36
gtk/gtkdnd.c
@@ -256,9 +256,7 @@ static void gtk_drag_selection_get (GtkWidget *widget,
|
||||
guint32 time,
|
||||
gpointer data);
|
||||
static void gtk_drag_anim_destroy (GtkDragAnim *anim);
|
||||
static gboolean gtk_drag_anim_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer data);
|
||||
static gboolean gtk_drag_anim_timeout (gpointer data);
|
||||
static void gtk_drag_remove_icon (GtkDragSourceInfo *info);
|
||||
static void gtk_drag_source_info_destroy (GtkDragSourceInfo *info);
|
||||
static void gtk_drag_add_update_idle (GtkDragSourceInfo *info);
|
||||
@@ -1246,24 +1244,38 @@ gtk_drag_highlight_draw (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
int width = gtk_widget_get_allocated_width (widget);
|
||||
int height = gtk_widget_get_allocated_height (widget);
|
||||
GtkAllocation alloc;
|
||||
GtkStyleContext *context;
|
||||
|
||||
if (GTK_IS_WINDOW (widget))
|
||||
{
|
||||
/* We don't want to draw the drag highlight around the
|
||||
* CSD window decorations
|
||||
*/
|
||||
gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN (widget)), &alloc);
|
||||
}
|
||||
else
|
||||
{
|
||||
alloc.x = 0;
|
||||
alloc.y = 0;
|
||||
alloc.width = gtk_widget_get_allocated_width (widget);
|
||||
alloc.height = gtk_widget_get_allocated_height (widget);
|
||||
}
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
|
||||
|
||||
gtk_render_frame (context, cr, 0, 0, width, height);
|
||||
gtk_render_frame (context, cr, alloc.x, alloc.y, alloc.width, alloc.height);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
cairo_rectangle (cr,
|
||||
0.5, 0.5,
|
||||
width - 1, height - 1);
|
||||
alloc.x + 0.5, alloc.y + 0.5,
|
||||
alloc.width - 1, alloc.height - 1);
|
||||
cairo_stroke (cr);
|
||||
|
||||
return FALSE;
|
||||
@@ -3793,7 +3805,7 @@ gtk_drag_drop_finished (GtkDragSourceInfo *info,
|
||||
* to respond really late, we still are OK.
|
||||
*/
|
||||
gtk_drag_clear_source_info (info->context);
|
||||
gtk_widget_add_tick_callback (info->widget, gtk_drag_anim_tick, anim, (GDestroyNotify) gtk_drag_anim_destroy);
|
||||
gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT, 17, gtk_drag_anim_timeout, anim, (GDestroyNotify) gtk_drag_anim_destroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4024,13 +4036,13 @@ gtk_drag_anim_destroy (GtkDragAnim *anim)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_drag_anim_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer data)
|
||||
gtk_drag_anim_timeout (gpointer data)
|
||||
{
|
||||
GtkWidget *icon_window;
|
||||
GtkDragAnim *anim = data;
|
||||
GtkDragSourceInfo *info = anim->info;
|
||||
GtkWidget *widget = info->widget;
|
||||
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (widget);
|
||||
gint64 current_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
int hot_x, hot_y;
|
||||
double f = (current_time - anim->start_time) / (double) ANIM_TIME;
|
||||
|
@@ -3452,6 +3452,7 @@ gtk_entry_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
|
||||
_gtk_entry_get_borders (entry, &borders);
|
||||
pango_layout_get_pixel_size (layout, NULL, &height);
|
||||
|
||||
height = MAX (height, PANGO_PIXELS (priv->ascent + priv->descent));
|
||||
height += borders.top + borders.bottom;
|
||||
|
||||
baseline = pango_layout_get_baseline (layout) / PANGO_SCALE;
|
||||
|
@@ -1887,8 +1887,8 @@ gtk_header_bar_buildable_init (GtkBuildableIface *iface)
|
||||
* @bar: A #GtkHeaderBar
|
||||
* @child: the #GtkWidget to be added to @bar
|
||||
*
|
||||
* Adds @child to @box, packed with reference to the
|
||||
* start of the @box.
|
||||
* Adds @child to @bar, packed with reference to the
|
||||
* start of the @bar.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
@@ -1904,8 +1904,8 @@ gtk_header_bar_pack_start (GtkHeaderBar *bar,
|
||||
* @bar: A #GtkHeaderBar
|
||||
* @child: the #GtkWidget to be added to @bar
|
||||
*
|
||||
* Adds @child to @box, packed with reference to the
|
||||
* end of the @box.
|
||||
* Adds @child to @bar, packed with reference to the
|
||||
* end of the @bar.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
|
@@ -1256,6 +1256,7 @@ load_themes (GtkIconTheme *icon_theme)
|
||||
* in gnome is a pragmatic solution to prevent missing
|
||||
* icons in GTK+ applications when run under, e.g. KDE.
|
||||
*/
|
||||
insert_theme (icon_theme, "Adwaita");
|
||||
insert_theme (icon_theme, "gnome");
|
||||
insert_theme (icon_theme, DEFAULT_THEME_NAME);
|
||||
priv->themes = g_list_reverse (priv->themes);
|
||||
@@ -5327,8 +5328,10 @@ gtk_icon_theme_lookup_by_gicon_for_scale (GtkIconTheme *icon_theme,
|
||||
GList *list, *l;
|
||||
GtkIconInfo *base_info, *emblem_info;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (GTK_IS_NUMERABLE_ICON (icon))
|
||||
_gtk_numerable_icon_set_background_icon_size (GTK_NUMERABLE_ICON (icon), size / 2);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
base = g_emblemed_icon_get_icon (G_EMBLEMED_ICON (icon));
|
||||
base_info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme, base, size, scale, flags);
|
||||
|
@@ -496,8 +496,10 @@ gtk_list_box_get_selected_row (GtkListBox *list_box)
|
||||
* @index_: the index of the row
|
||||
*
|
||||
* Gets the n:th child in the list (not counting headers).
|
||||
* If @_index is negative or larger than the number of items in the
|
||||
* list, %NULL is returned.
|
||||
*
|
||||
* Returns: (transfer none): the child #GtkWidget
|
||||
* Returns: (transfer none): the child #GtkWidget or %NULL
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
@@ -513,7 +515,7 @@ gtk_list_box_get_row_at_index (GtkListBox *list_box,
|
||||
priv = gtk_list_box_get_instance_private (list_box);
|
||||
|
||||
iter = g_sequence_get_iter_at_pos (priv->children, index_);
|
||||
if (iter)
|
||||
if (!g_sequence_iter_is_end (iter))
|
||||
return g_sequence_get (iter);
|
||||
|
||||
return NULL;
|
||||
|
@@ -451,8 +451,10 @@ gtk_lock_button_clicked (GtkButton *button)
|
||||
{
|
||||
GtkLockButtonPrivate *priv = GTK_LOCK_BUTTON (button)->priv;
|
||||
|
||||
/* if we already have a pending interactive check, then do nothing */
|
||||
if (priv->cancellable != NULL)
|
||||
/* if we already have a pending interactive check or permission is not set,
|
||||
* then do nothing
|
||||
*/
|
||||
if (priv->cancellable != NULL || priv->permission == NULL)
|
||||
return;
|
||||
|
||||
if (g_permission_get_allowed (priv->permission))
|
||||
|