Compare commits
173 Commits
calendar-d
...
doc-scale-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7bd9adf3e | ||
|
|
5df5716871 | ||
|
|
77f465bf19 | ||
|
|
c7c8ab6624 | ||
|
|
3fe6c5caf8 | ||
|
|
235d28f02d | ||
|
|
ee448db031 | ||
|
|
a3cff0add1 | ||
|
|
2fc60a1e3f | ||
|
|
c1146db2fe | ||
|
|
e3247ed0d9 | ||
|
|
d5397dfb31 | ||
|
|
379669b153 | ||
|
|
06d1cf5e52 | ||
|
|
8b789993c3 | ||
|
|
f26b9c9f9f | ||
|
|
44c994e469 | ||
|
|
77e3ee88bd | ||
|
|
25174154b9 | ||
|
|
ebde8349cb | ||
|
|
b1bf354ade | ||
|
|
f7d57cc1eb | ||
|
|
f737908d2f | ||
|
|
e4b4305cf1 | ||
|
|
f0002ad372 | ||
|
|
61d7700c17 | ||
|
|
540d849a52 | ||
|
|
56875730d1 | ||
|
|
9d3e3eea7a | ||
|
|
a8ce096bf8 | ||
|
|
19f59cac3d | ||
|
|
31f5e8fe32 | ||
|
|
7564e43a6a | ||
|
|
5e8d4757d4 | ||
|
|
c6792a41ab | ||
|
|
1efb72210d | ||
|
|
3804d7a0ca | ||
|
|
45bcc89a01 | ||
|
|
4d34e1cfec | ||
|
|
6f6070b510 | ||
|
|
39ef5e40d0 | ||
|
|
edd490cf4d | ||
|
|
f76208808b | ||
|
|
11e5f2c473 | ||
|
|
36edb5fbf6 | ||
|
|
1a87249d1a | ||
|
|
6452d34cd7 | ||
|
|
656adece00 | ||
|
|
d5457d1b14 | ||
|
|
75475effb1 | ||
|
|
e11bdfabc0 | ||
|
|
0ade87ef92 | ||
|
|
0b4f5ba817 | ||
|
|
307a045e52 | ||
|
|
8d0138bd6b | ||
|
|
53a05daa31 | ||
|
|
089bf46d9a | ||
|
|
98b4428543 | ||
|
|
c3c8ea3e88 | ||
|
|
ef32ba3d6a | ||
|
|
cc8a634c3e | ||
|
|
5f5303f8fc | ||
|
|
3c2b5cda74 | ||
|
|
e5550439e2 | ||
|
|
b6528c9f91 | ||
|
|
f20bca5ec0 | ||
|
|
b736018843 | ||
|
|
741e9a6278 | ||
|
|
21cd322df9 | ||
|
|
4fc32b2751 | ||
|
|
1c09104dc6 | ||
|
|
9e72ec1c8a | ||
|
|
98711f8050 | ||
|
|
b25f193da3 | ||
|
|
d1936c1ae3 | ||
|
|
759ee31b0c | ||
|
|
1b18482d9f | ||
|
|
b7dfb7836f | ||
|
|
4e346076f2 | ||
|
|
f261b41d47 | ||
|
|
1051c1fcad | ||
|
|
a45a2c1de9 | ||
|
|
817e99640d | ||
|
|
afb6603d09 | ||
|
|
05b0e9a2f5 | ||
|
|
39e28ab933 | ||
|
|
ff41436b59 | ||
|
|
ba0a0ce0a0 | ||
|
|
e4049d42a5 | ||
|
|
ce5e97f720 | ||
|
|
4201a57a83 | ||
|
|
65bb9c505a | ||
|
|
85f86d1533 | ||
|
|
ffaf56d1c6 | ||
|
|
7a891eeb6d | ||
|
|
299902b008 | ||
|
|
c9a1adf2cc | ||
|
|
ebd1840802 | ||
|
|
f91b429839 | ||
|
|
da90d37b42 | ||
|
|
0ecebd89bc | ||
|
|
ac39847187 | ||
|
|
3aa9dfe16d | ||
|
|
4beed12317 | ||
|
|
fa07007389 | ||
|
|
043ec471bd | ||
|
|
1e41c723b8 | ||
|
|
e997ef60da | ||
|
|
3c161b136e | ||
|
|
d250e51018 | ||
|
|
bcd384711a | ||
|
|
d70f85d6b9 | ||
|
|
d7c95ad542 | ||
|
|
3a22e0c595 | ||
|
|
5c6ca889de | ||
|
|
e1f0a34781 | ||
|
|
914558f971 | ||
|
|
8ce68a5194 | ||
|
|
075dcc142a | ||
|
|
def95d9ebf | ||
|
|
50ffb3a4ac | ||
|
|
a3ea33baad | ||
|
|
4f2bfea6b1 | ||
|
|
a5c19887b0 | ||
|
|
fd11103cff | ||
|
|
14922f1784 | ||
|
|
57b8f759c5 | ||
|
|
d243efc127 | ||
|
|
e27f2a5c92 | ||
|
|
4b65e0ce0c | ||
|
|
e65c703741 | ||
|
|
300cef8249 | ||
|
|
ecf3fcdc90 | ||
|
|
ddd975cdb2 | ||
|
|
ca9fc93925 | ||
|
|
e58bb02acd | ||
|
|
7ff79452c1 | ||
|
|
6188a2e8c8 | ||
|
|
f9273a86bd | ||
|
|
054165d406 | ||
|
|
c05f25d968 | ||
|
|
f803b11626 | ||
|
|
91c5562b04 | ||
|
|
bdb96507bd | ||
|
|
77e0d83000 | ||
|
|
5d23819c69 | ||
|
|
62412cbcf4 | ||
|
|
bf7851f57c | ||
|
|
3203c59108 | ||
|
|
ac53fed1f2 | ||
|
|
16d8ca8ad9 | ||
|
|
a265ae2c96 | ||
|
|
8a9ffef52b | ||
|
|
f4cd637056 | ||
|
|
6e1e1991d5 | ||
|
|
70c4b66d99 | ||
|
|
6119c09535 | ||
|
|
77c41261d6 | ||
|
|
30a4d273fb | ||
|
|
d33c24b31e | ||
|
|
195a550bf4 | ||
|
|
5ca7bbfd0e | ||
|
|
10daf4c3b6 | ||
|
|
001c0a35ce | ||
|
|
ce7e99ca5e | ||
|
|
de99b2f0b8 | ||
|
|
58f57aeb3b | ||
|
|
72baf988ee | ||
|
|
31a57fe389 | ||
|
|
fbb3c146ea | ||
|
|
e18e9a7064 | ||
|
|
ef72fe750a | ||
|
|
c925221aa8 |
@@ -12,7 +12,15 @@ fedora-autotools:
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker-autotools.sh
|
||||
|
||||
fedora-meson:
|
||||
fedora-distcheck:
|
||||
variables:
|
||||
DO_DISTCHECK: "yes"
|
||||
when: manual
|
||||
stage: build
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker-autotools.sh
|
||||
|
||||
fedora-meson: &fedora-meson-defaults
|
||||
stage: build
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker-meson.sh
|
||||
@@ -21,6 +29,12 @@ fedora-meson:
|
||||
name: "gtk3-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "_build/meson-logs"
|
||||
- "_build/testsuite/reftests/output"
|
||||
|
||||
fedora-meson-staticlibs:
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
|
||||
<<: *fedora-meson-defaults
|
||||
|
||||
msys2-mingw32-meson:
|
||||
variables:
|
||||
|
||||
@@ -11,6 +11,13 @@ cd _build
|
||||
../autogen.sh \
|
||||
--enable-cloudproviders \
|
||||
--enable-broadway-backend \
|
||||
--enable-wayland-backend \
|
||||
--enable-x11-backend \
|
||||
--enable-xinerama \
|
||||
--enable-gtk-doc
|
||||
make -j8
|
||||
|
||||
if [ -n "${DO_DISTCHECK-}" ]; then
|
||||
make -j8 check SKIP_GDKTARGET="echo Not actually running tests for now"
|
||||
make -j8 distcheck SKIP_GDKTARGET="echo Not actually running tests for now"
|
||||
fi
|
||||
|
||||
@@ -12,9 +12,11 @@ python3 -m pip install --user meson==0.49.2
|
||||
meson \
|
||||
-Dgtk_doc=true \
|
||||
-Dman=true \
|
||||
-Dinstalled_tests=true \
|
||||
-Dbroadway_backend=true \
|
||||
-Dxinerama=yes \
|
||||
-Dprint_backends="file,lpr,test,cloudprint,cups" \
|
||||
${EXTRA_MESON_FLAGS:-} \
|
||||
_build
|
||||
|
||||
cd _build
|
||||
|
||||
@@ -28,8 +28,7 @@ pacman --noconfirm -S --needed \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info \
|
||||
mingw-w64-$MSYS2_ARCH-meson \
|
||||
mingw-w64-$MSYS2_ARCH-ninja \
|
||||
mingw-w64-$MSYS2_ARCH-gtk-doc \
|
||||
mingw-w64-$MSYS2_ARCH-sassc
|
||||
mingw-w64-$MSYS2_ARCH-gtk-doc
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
|
||||
10
Makefile.am
@@ -42,11 +42,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+-mir-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+-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-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-3.0.pc
|
||||
rm -f $@ && \
|
||||
cp gdk-3.0.pc $@
|
||||
|
||||
@@ -67,17 +67,19 @@ 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
|
||||
|
||||
dist-hook:
|
||||
mkdir $(distdir)/subprojects
|
||||
cp -p $(srcdir)/subprojects/*.wrap $(distdir)/subprojects
|
||||
|
||||
distclean-local:
|
||||
if test "$(srcdir)" = "."; then :; else \
|
||||
rm -f ChangeLog; \
|
||||
|
||||
77
NEWS
@@ -1,3 +1,80 @@
|
||||
Overview of Changes in GTK+ 3.24.13
|
||||
===================================
|
||||
|
||||
* listbox: Fix header row reuse
|
||||
|
||||
* wayland: Fix handling of tablets
|
||||
|
||||
* theme:
|
||||
- Adwaita: Fix menu rounding
|
||||
- Adwaita: Various improvements for the Emoji chooser
|
||||
- Adwaita: Refresh check and radio buttons
|
||||
- HighContrast: Fix entry colors
|
||||
|
||||
* input:
|
||||
- Properly handle bubbling of scroll events
|
||||
- Handle modifier key events properly
|
||||
- Run key controllers in the bubble phase
|
||||
- Do not use VIQR for Vietnamese by default
|
||||
|
||||
* statusicons: Render sharply on hi-dpi
|
||||
|
||||
* wayland: Fix handling of selection ownership
|
||||
|
||||
* win32:
|
||||
- Set WS_BORDER for fullscreen GL windows if requested
|
||||
- Fix clipboard handling
|
||||
|
||||
* quartz:
|
||||
- Handle titlebar events properly
|
||||
- Handle page up/down key events properly
|
||||
|
||||
* broadway: Fix (lack of) clipboard handling
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Chinese (Taiwan)
|
||||
Croatian
|
||||
Danish
|
||||
French
|
||||
German
|
||||
Hungarian
|
||||
Indonesian
|
||||
Russian
|
||||
Swedish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.24.12
|
||||
===================================
|
||||
|
||||
* file chooser: allow sorting by file type
|
||||
|
||||
* dnd: fix pointer offsets under X11 and Wayland
|
||||
|
||||
* broadway: Fix a font problem
|
||||
|
||||
* mir Drop this backend
|
||||
|
||||
* printing: Get PPD from original host if needed
|
||||
|
||||
* a11y: Fix interference with clutter a11y impl
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
Czech
|
||||
Danish
|
||||
Dutch
|
||||
Italian
|
||||
Greek
|
||||
Lithuanian
|
||||
Norwegian Bokmål
|
||||
Polish
|
||||
Romanian
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.24.11
|
||||
===================================
|
||||
|
||||
|
||||
@@ -116,6 +116,9 @@
|
||||
/* Define to 1 if you have the `round' function. */
|
||||
#mesondefine HAVE_ROUND
|
||||
|
||||
/* Define to 1 if SetupDiGetDevicePropertyW() is available */
|
||||
#mesondefine HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W
|
||||
|
||||
/* Define to 1 if you have the `sincos' function. */
|
||||
#mesondefine HAVE_SINCOS
|
||||
|
||||
|
||||
67
configure.ac
@@ -10,8 +10,8 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [24])
|
||||
m4_define([gtk_micro_version], [11])
|
||||
m4_define([gtk_interface_age], [7])
|
||||
m4_define([gtk_micro_version], [13])
|
||||
m4_define([gtk_interface_age], [9])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
m4_define([gtk_version],
|
||||
@@ -62,8 +62,6 @@ m4_define([gdk_pixbuf_required_version], [2.30.0])
|
||||
m4_define([introspection_required_version], [1.39.0])
|
||||
m4_define([wayland_required_version], [1.9.91])
|
||||
m4_define([wayland_protocols_required_version], [1.14])
|
||||
m4_define([mirclient_required_version], [0.22.0])
|
||||
m4_define([mircookie_required_version], [0.17.0])
|
||||
m4_define([epoxy_required_version], [1.4])
|
||||
m4_define([cloudproviders_required_version], [0.2.5])
|
||||
m4_define([sysprof_required_version], [3.33.2])
|
||||
@@ -344,11 +342,6 @@ 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])
|
||||
|
||||
AC_ARG_ENABLE(cloudproviders,
|
||||
[AS_HELP_STRING([--enable-cloudproviders],
|
||||
[enable libcloudproviders integration])],
|
||||
@@ -366,7 +359,6 @@ if test -z "$backend_set"; then
|
||||
else
|
||||
enable_x11_backend=yes
|
||||
enable_wayland_backend=maybe
|
||||
enable_mir_backend=no
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -479,30 +471,6 @@ else
|
||||
AM_CONDITIONAL(USE_WAYLAND, false)
|
||||
fi
|
||||
|
||||
MIR_DEPENDENCIES="mirclient >= mirclient_required_version mircookie >= mircookie_required_version libcontent-hub-glib"
|
||||
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#* }
|
||||
|
||||
@@ -758,6 +726,32 @@ AS_CASE([$host_os],
|
||||
[AC_MSG_ERROR([DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY is unavailable])],
|
||||
[AC_MSG_RESULT([DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY is not OK])]
|
||||
)
|
||||
AC_MSG_CHECKING([for SetupDiGetDevicePropertyW])
|
||||
gtk_save_LIBS="$LIBS"
|
||||
LIBS="-lsetupapi $LIBS"
|
||||
AC_TRY_LINK(
|
||||
[
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#include <windows.h>
|
||||
#include <devpropdef.h>
|
||||
#include <setupapi.h>
|
||||
],
|
||||
[return SetupDiGetDevicePropertyW(NULL, NULL, NULL, NULL, NULL, 0, NULL, 0);],
|
||||
[have_SetupDiGetDevicePropertyW=yes],
|
||||
[have_SetupDiGetDevicePropertyW=no]
|
||||
)
|
||||
AS_IF(
|
||||
[test x$have_SetupDiGetDevicePropertyW = xyes],
|
||||
[
|
||||
AC_DEFINE(
|
||||
[HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W],
|
||||
[1],
|
||||
[Define to 1 if SetupDiGetDevicePropertyW() is available]
|
||||
)
|
||||
]
|
||||
)
|
||||
AC_MSG_RESULT([$have_SetupDiGetDevicePropertyW])
|
||||
LIBS="$gtk_save_LIBS"
|
||||
],
|
||||
[]
|
||||
)
|
||||
@@ -1345,7 +1339,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 $MIR_PACKAGES $cairo_backends epoxy >= epoxy_required_version $CLOUDPROVIDER_PACKAGES $PROFILER_PACKAGES fribidi >= fribidi_required_version"
|
||||
GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends epoxy >= epoxy_required_version $CLOUDPROVIDER_PACKAGES $PROFILER_PACKAGES fribidi >= fribidi_required_version"
|
||||
|
||||
PKG_CHECK_MODULES(GDK_DEP, $GDK_PACKAGES $GDK_PRIVATE_PACKAGES)
|
||||
GDK_DEP_LIBS="$GDK_EXTRA_LIBS $GDK_DEP_LIBS $MATH_LIB"
|
||||
@@ -1379,7 +1373,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 $WAYLAND_PACKAGES $MIR_PACKAGES epoxy >= epoxy_required_version fribidi >= fribidi_required_version"
|
||||
GTK_PRIVATE_PACKAGES="$ATK_PACKAGES $WAYLAND_PACKAGES epoxy >= epoxy_required_version fribidi >= fribidi_required_version"
|
||||
if test "x$enable_x11_backend" = xyes -o "x$enable_wayland_backend" = xyes; then
|
||||
GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
|
||||
fi
|
||||
@@ -1966,7 +1960,6 @@ 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
|
||||
|
||||
@@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.decl
|
||||
|
||||
SUBDIRS = gtk-demo widget-factory icon-browser
|
||||
|
||||
EXTRA_DIST = \
|
||||
EXTRA_DIST += \
|
||||
meson.build
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
||||
@@ -307,7 +307,6 @@ content_files = \
|
||||
migrating-GtkStyleContext.xml \
|
||||
migrating-smclient-GtkApplication.xml \
|
||||
migrating-unique-GtkApplication.xml \
|
||||
mir.xml \
|
||||
osx.sgml \
|
||||
overview.xml \
|
||||
question_index.sgml \
|
||||
@@ -349,7 +348,6 @@ HTML_IMAGES = \
|
||||
$(srcdir)/images/box-packing.png \
|
||||
$(srcdir)/images/box-expand.png \
|
||||
$(srcdir)/images/button.png \
|
||||
$(srcdir)/images/calendar.png \
|
||||
$(srcdir)/images/check-button.png \
|
||||
$(srcdir)/images/color-button.png \
|
||||
$(srcdir)/images/colorchooser.png \
|
||||
|
||||
@@ -407,11 +407,6 @@ 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>
|
||||
@@ -609,9 +604,7 @@ How to compile GTK+ itself
|
||||
<systemitem>--enable-broadway-backend</systemitem>,
|
||||
<systemitem>--disable-broadway-backend</systemitem>,
|
||||
<systemitem>--enable-wayland-backend</systemitem>,
|
||||
<systemitem>--disable-wayland-backend</systemitem>
|
||||
<systemitem>--enable-mir-backend</systemitem>, and
|
||||
<systemitem>--disable-mir-backend</systemitem></title>
|
||||
<systemitem>--disable-wayland-backend</systemitem></title>
|
||||
|
||||
<para>
|
||||
Enables specific backends for GDK. If none of these options
|
||||
|
||||
@@ -437,7 +437,6 @@
|
||||
<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: 22 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -245,7 +245,6 @@ images = [
|
||||
'images/box-packing.png',
|
||||
'images/box-expand.png',
|
||||
'images/button.png',
|
||||
'images/calendar.png',
|
||||
'images/check-button.png',
|
||||
'images/color-button.png',
|
||||
'images/colorchooser.png',
|
||||
@@ -396,7 +395,6 @@ content_files = [
|
||||
'gtk-query-immodules-3.0.xml',
|
||||
'gtk-query-settings.xml',
|
||||
'gtk-update-icon-cache.xml',
|
||||
'mir.xml',
|
||||
'osx.sgml',
|
||||
'overview.xml',
|
||||
'resources.sgml',
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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>
|
||||
@@ -508,11 +508,6 @@ 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
|
||||
|
||||
@@ -45,9 +45,6 @@
|
||||
<link linkend="GtkGLArea">
|
||||
<inlinegraphic fileref="glarea.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
<link linkend="GtkCalendar">
|
||||
<inlinegraphic fileref="calendar.png" format="PNG"></inlinegraphic>
|
||||
</link>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -756,16 +756,6 @@ create_frame (void)
|
||||
return new_widget_info ("frame", widget, MEDIUM);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_caledar (void)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = gtk_calendar_new ();
|
||||
|
||||
return new_widget_info ("calendar", widget, MEDIUM);
|
||||
}
|
||||
|
||||
static WidgetInfo *
|
||||
create_window (void)
|
||||
{
|
||||
@@ -1562,7 +1552,6 @@ get_all_widgets (void)
|
||||
retval = g_list_prepend (retval, create_about_dialog ());
|
||||
retval = g_list_prepend (retval, create_accel_label ());
|
||||
retval = g_list_prepend (retval, create_button ());
|
||||
retval = g_list_prepend (retval, create_caledar ());
|
||||
retval = g_list_prepend (retval, create_check_button ());
|
||||
retval = g_list_prepend (retval, create_color_button ());
|
||||
retval = g_list_prepend (retval, create_combo_box ());
|
||||
|
||||
@@ -14,6 +14,7 @@ drag_begin (GtkWidget *widget,
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
int x, y;
|
||||
double sx, sy;
|
||||
|
||||
row = gtk_widget_get_ancestor (widget, GTK_TYPE_LIST_BOX_ROW);
|
||||
gtk_widget_get_allocation (row, &alloc);
|
||||
@@ -25,7 +26,8 @@ drag_begin (GtkWidget *widget,
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (row), "drag-icon");
|
||||
|
||||
gtk_widget_translate_coordinates (widget, row, 0, 0, &x, &y);
|
||||
cairo_surface_set_device_offset (surface, -x, -y);
|
||||
cairo_surface_get_device_scale (surface, &sx, &sy);
|
||||
cairo_surface_set_device_offset (surface, -x * sx, -y * sy);
|
||||
gtk_drag_set_icon_surface (context, surface);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
@@ -13,7 +13,7 @@ INTROSPECTION_COMPILER_ARGS = \
|
||||
|
||||
SUBDIRS = $(GDK_BACKENDS) .
|
||||
|
||||
DIST_SUBDIRS = win32 x11 quartz broadway wayland mir
|
||||
DIST_SUBDIRS = win32 x11 quartz broadway wayland
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
@@ -222,7 +222,6 @@ libgdk_3_la_LIBADD += x11/libgdk-x11.la
|
||||
endif # USE_X11
|
||||
|
||||
if USE_QUARTZ
|
||||
libgdk_3_la_CFLAGS += -xobjective-c
|
||||
libgdk_3_la_LIBADD += quartz/libgdk-quartz.la
|
||||
endif # USE_QUARTZ
|
||||
|
||||
@@ -240,10 +239,6 @@ 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 = \
|
||||
|
||||
@@ -38,12 +38,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
/* When the gdk_quartz_display_open function is removed We can
|
||||
* immediately include gdkquartzdisplaymanager.h here instead of
|
||||
* gdkprivate-quartz.h so that we won’t have to enable -xobjective-c
|
||||
* for the “generic” GDK source code.
|
||||
* #include "quartz/gdkquartzdisplaymanager.h"
|
||||
*/
|
||||
#include "quartz/gdkprivate-quartz.h"
|
||||
#endif
|
||||
|
||||
@@ -60,10 +54,6 @@
|
||||
#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
|
||||
@@ -276,9 +266,6 @@ 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_X11
|
||||
{ "x11", _gdk_x11_display_open },
|
||||
#endif
|
||||
|
||||
@@ -1363,7 +1363,45 @@ gdk_event_get_keycode (const GdkEvent *event,
|
||||
*
|
||||
* Extracts the scroll direction from an event.
|
||||
*
|
||||
* If @event is not of type %GDK_SCROLL, the contents of @direction
|
||||
* are undefined.
|
||||
*
|
||||
* If you wish to handle both discrete and smooth scrolling, you
|
||||
* should check the return value of this function, or of
|
||||
* gdk_event_get_scroll_deltas(); for instance:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* GdkScrollDirection direction;
|
||||
* double vscroll_factor = 0.0;
|
||||
* double x_scroll, y_scroll;
|
||||
*
|
||||
* if (gdk_event_get_scroll_direction (event, &direction))
|
||||
* {
|
||||
* // Handle discrete scrolling with a known constant delta;
|
||||
* const double delta = 12.0;
|
||||
*
|
||||
* switch (direction)
|
||||
* {
|
||||
* case GDK_SCROLL_UP:
|
||||
* vscroll_factor = -delta;
|
||||
* break;
|
||||
* case GDK_SCROLL_DOWN:
|
||||
* vscroll_factor = delta;
|
||||
* break;
|
||||
* default:
|
||||
* // no scrolling
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
* else if (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
|
||||
* {
|
||||
* // Handle smooth scrolling directly
|
||||
* vscroll_factor = y_scroll;
|
||||
* }
|
||||
* ]|
|
||||
*
|
||||
* Returns: %TRUE if the event delivered a scroll direction
|
||||
* and %FALSE otherwise
|
||||
*
|
||||
* Since: 3.2
|
||||
*/
|
||||
@@ -1401,7 +1439,10 @@ gdk_event_get_scroll_direction (const GdkEvent *event,
|
||||
*
|
||||
* Retrieves the scroll deltas from a #GdkEvent
|
||||
*
|
||||
* See also: gdk_event_get_scroll_direction()
|
||||
*
|
||||
* Returns: %TRUE if the event contains smooth scroll information
|
||||
* and %FALSE otherwise
|
||||
*
|
||||
* Since: 3.4
|
||||
**/
|
||||
|
||||
@@ -2664,6 +2664,7 @@ gdk_window_add_filter (GdkWindow *window,
|
||||
if ((filter->function == function) && (filter->data == data))
|
||||
{
|
||||
filter->ref_count++;
|
||||
filter->flags = 0;
|
||||
return;
|
||||
}
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
@@ -258,7 +258,7 @@ endif
|
||||
|
||||
gdk_backends = []
|
||||
gdk_backends_gen_headers = [] # non-public generated headers
|
||||
foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11', 'mir']
|
||||
foreach backend : ['broadway', 'quartz', 'wayland', 'win32', 'x11']
|
||||
if get_variable('@0@_enabled'.format(backend))
|
||||
subdir(backend)
|
||||
gdk_deps += get_variable('gdk_@0@_deps'.format(backend))
|
||||
@@ -286,20 +286,20 @@ if cc.get_id() == 'msvc'
|
||||
gdk_link_args += [ '-export:gdk_win32_display_manager_get_type' ]
|
||||
endif
|
||||
|
||||
libgdk = shared_library('gdk-3',
|
||||
soversion: gtk_soversion,
|
||||
version: gtk_library_version,
|
||||
sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
|
||||
dependencies: gdk_deps,
|
||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||
c_args: [
|
||||
'-DGDK_COMPILATION',
|
||||
'-DG_LOG_DOMAIN="Gdk"',
|
||||
] + common_cflags,
|
||||
link_whole: gdk_backends,
|
||||
link_args: gdk_link_args,
|
||||
darwin_versions : gtk_osxversions,
|
||||
install: true)
|
||||
libgdk = library('gdk-3',
|
||||
soversion: gtk_soversion,
|
||||
version: gtk_library_version,
|
||||
sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
|
||||
dependencies: gdk_deps,
|
||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||
c_args: [
|
||||
'-DGDK_COMPILATION',
|
||||
'-DG_LOG_DOMAIN="Gdk"',
|
||||
] + common_cflags,
|
||||
link_whole: gdk_backends,
|
||||
link_args: gdk_link_args,
|
||||
darwin_versions : gtk_osxversions,
|
||||
install: true)
|
||||
|
||||
gdk_dep_sources = [gdkconfig, gdkenum_h]
|
||||
# Introspection
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
## 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\" \
|
||||
-DG_LOG_USE_STRUCTURED=1 \
|
||||
-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 \
|
||||
gdkmirglcontext.c \
|
||||
gdkmirkeyboard.c \
|
||||
gdkmirkeymap.c \
|
||||
gdkmirpointer.c \
|
||||
gdkmirscreen.c \
|
||||
gdkmirwindow.c \
|
||||
gdkmirwindowimpl.c \
|
||||
gdkmir-debug.c \
|
||||
gdkmir-private.h \
|
||||
gdkmir.h
|
||||
|
||||
libgdkinclude_HEADERS = \
|
||||
gdkmir.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
meson.build
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
@@ -1,548 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#include <mir_toolkit/events/window_placement.h>
|
||||
|
||||
static void
|
||||
_gdk_mir_print_modifiers (unsigned int modifiers)
|
||||
{
|
||||
g_printerr (" Modifiers");
|
||||
if ((modifiers & mir_input_event_modifier_alt) != 0)
|
||||
g_printerr (" alt");
|
||||
if ((modifiers & mir_input_event_modifier_alt_left) != 0)
|
||||
g_printerr (" alt-left");
|
||||
if ((modifiers & mir_input_event_modifier_alt_right) != 0)
|
||||
g_printerr (" alt-right");
|
||||
if ((modifiers & mir_input_event_modifier_shift) != 0)
|
||||
g_printerr (" shift");
|
||||
if ((modifiers & mir_input_event_modifier_shift_left) != 0)
|
||||
g_printerr (" shift-left");
|
||||
if ((modifiers & mir_input_event_modifier_shift_right) != 0)
|
||||
g_printerr (" shift-right");
|
||||
if ((modifiers & mir_input_event_modifier_sym) != 0)
|
||||
g_printerr (" sym");
|
||||
if ((modifiers & mir_input_event_modifier_function) != 0)
|
||||
g_printerr (" function");
|
||||
if ((modifiers & mir_input_event_modifier_ctrl) != 0)
|
||||
g_printerr (" ctrl");
|
||||
if ((modifiers & mir_input_event_modifier_ctrl_left) != 0)
|
||||
g_printerr (" ctrl-left");
|
||||
if ((modifiers & mir_input_event_modifier_ctrl_right) != 0)
|
||||
g_printerr (" ctrl-right");
|
||||
if ((modifiers & mir_input_event_modifier_meta) != 0)
|
||||
g_printerr (" meta");
|
||||
if ((modifiers & mir_input_event_modifier_meta_left) != 0)
|
||||
g_printerr (" meta-left");
|
||||
if ((modifiers & mir_input_event_modifier_meta_right) != 0)
|
||||
g_printerr (" meta-right");
|
||||
if ((modifiers & mir_input_event_modifier_caps_lock) != 0)
|
||||
g_printerr (" caps-lock");
|
||||
if ((modifiers & mir_input_event_modifier_num_lock) != 0)
|
||||
g_printerr (" num-lock");
|
||||
if ((modifiers & mir_input_event_modifier_scroll_lock) != 0)
|
||||
g_printerr (" scroll-lock");
|
||||
g_printerr ("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_key_event (const MirInputEvent *event)
|
||||
{
|
||||
const MirKeyboardEvent *keyboard_event = mir_input_event_get_keyboard_event (event);
|
||||
|
||||
if (!keyboard_event)
|
||||
return;
|
||||
|
||||
g_printerr ("KEY\n");
|
||||
g_printerr (" Device %lld\n", (long long int) mir_input_event_get_device_id (event));
|
||||
g_printerr (" Action ");
|
||||
switch (mir_keyboard_event_action (keyboard_event))
|
||||
{
|
||||
case mir_keyboard_action_down:
|
||||
g_printerr ("down");
|
||||
break;
|
||||
case mir_keyboard_action_up:
|
||||
g_printerr ("up");
|
||||
break;
|
||||
case mir_keyboard_action_repeat:
|
||||
g_printerr ("repeat");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_keyboard_event_action (keyboard_event));
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
_gdk_mir_print_modifiers (mir_keyboard_event_modifiers (keyboard_event));
|
||||
g_printerr (" Key Code %i\n", mir_keyboard_event_key_code (keyboard_event));
|
||||
g_printerr (" Scan Code %i\n", mir_keyboard_event_scan_code (keyboard_event));
|
||||
g_printerr (" Event Time %lli\n", (long long int) mir_input_event_get_event_time (event));
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_touch_event (const MirInputEvent *event)
|
||||
{
|
||||
const MirTouchEvent *touch_event = mir_input_event_get_touch_event (event);
|
||||
guint i;
|
||||
guint n;
|
||||
|
||||
if (!touch_event)
|
||||
return;
|
||||
|
||||
g_printerr ("TOUCH\n");
|
||||
g_printerr (" Device %lld\n", (long long int) mir_input_event_get_device_id (event));
|
||||
g_printerr (" Event Time %lld\n", (long long int) mir_input_event_get_event_time (event));
|
||||
_gdk_mir_print_modifiers (mir_touch_event_modifiers (touch_event));
|
||||
n = mir_touch_event_point_count (touch_event);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
g_printerr (" [%u] (%u/%u) ", mir_touch_event_id (touch_event, i), i + 1, n);
|
||||
switch (mir_touch_event_action (touch_event, i))
|
||||
{
|
||||
case mir_touch_action_down:
|
||||
g_printerr ("Down");
|
||||
break;
|
||||
case mir_touch_action_up:
|
||||
g_printerr ("Up");
|
||||
break;
|
||||
case mir_touch_action_change:
|
||||
g_printerr ("Change");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_touch_event_action (touch_event, i));
|
||||
break;
|
||||
}
|
||||
switch (mir_touch_event_tooltype (touch_event, i))
|
||||
{
|
||||
default:
|
||||
case mir_touch_tooltype_unknown:
|
||||
g_printerr (" ? ");
|
||||
break;
|
||||
case mir_touch_tooltype_finger:
|
||||
g_printerr (" finger ");
|
||||
break;
|
||||
case mir_touch_tooltype_stylus:
|
||||
g_printerr (" stylus ");
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n x: %f y: %f P: %f A: %f B: %f d: %f\n",
|
||||
mir_touch_event_axis_value (touch_event, i, mir_touch_axis_x),
|
||||
mir_touch_event_axis_value (touch_event, i, mir_touch_axis_y),
|
||||
mir_touch_event_axis_value (touch_event, i, mir_touch_axis_pressure),
|
||||
mir_touch_event_axis_value (touch_event, i, mir_touch_axis_touch_major),
|
||||
mir_touch_event_axis_value (touch_event, i, mir_touch_axis_touch_minor),
|
||||
mir_touch_event_axis_value (touch_event, i, mir_touch_axis_size));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_motion_event (const MirInputEvent *event)
|
||||
{
|
||||
const MirPointerEvent *pointer_event = mir_input_event_get_pointer_event (event);
|
||||
|
||||
if (!pointer_event)
|
||||
return;
|
||||
|
||||
g_printerr ("MOTION\n");
|
||||
g_printerr (" Device %lld\n", (long long int) mir_input_event_get_device_id (event));
|
||||
g_printerr (" Action ");
|
||||
switch (mir_pointer_event_action (pointer_event))
|
||||
{
|
||||
case mir_pointer_action_button_down:
|
||||
g_printerr ("down");
|
||||
break;
|
||||
case mir_pointer_action_button_up:
|
||||
g_printerr ("up");
|
||||
break;
|
||||
case mir_pointer_action_enter:
|
||||
g_printerr ("enter");
|
||||
break;
|
||||
case mir_pointer_action_leave:
|
||||
g_printerr ("leave");
|
||||
break;
|
||||
case mir_pointer_action_motion:
|
||||
g_printerr ("motion");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_pointer_event_action (pointer_event));
|
||||
}
|
||||
g_printerr ("\n");
|
||||
_gdk_mir_print_modifiers (mir_pointer_event_modifiers (pointer_event));
|
||||
g_printerr (" Button State");
|
||||
if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_primary))
|
||||
g_printerr (" primary");
|
||||
if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_secondary))
|
||||
g_printerr (" secondary");
|
||||
if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_tertiary))
|
||||
g_printerr (" tertiary");
|
||||
if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_back))
|
||||
g_printerr (" back");
|
||||
if (mir_pointer_event_button_state (pointer_event, mir_pointer_button_forward))
|
||||
g_printerr (" forward");
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Offset (%f, %f)\n", mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_x),
|
||||
mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_y));
|
||||
g_printerr (" Scroll (%f, %f)\n", mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_hscroll),
|
||||
mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_vscroll));
|
||||
g_printerr (" Event Time %lli\n", (long long int) mir_input_event_get_event_time (event));
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_input_event (const MirInputEvent *event)
|
||||
{
|
||||
g_printerr ("INPUT\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_window_event (const MirWindowEvent *event)
|
||||
{
|
||||
g_printerr ("WINDOW\n");
|
||||
g_printerr (" Attribute ");
|
||||
switch (mir_window_event_get_attribute (event))
|
||||
{
|
||||
case mir_window_attrib_type:
|
||||
g_printerr ("type");
|
||||
break;
|
||||
case mir_window_attrib_state:
|
||||
g_printerr ("state");
|
||||
break;
|
||||
case mir_window_attrib_swapinterval:
|
||||
g_printerr ("swapinterval");
|
||||
break;
|
||||
case mir_window_attrib_focus:
|
||||
g_printerr ("focus");
|
||||
break;
|
||||
case mir_window_attrib_dpi:
|
||||
g_printerr ("dpi");
|
||||
break;
|
||||
case mir_window_attrib_visibility:
|
||||
g_printerr ("visibility");
|
||||
break;
|
||||
case mir_window_attrib_preferred_orientation:
|
||||
g_printerr ("preferred_orientation");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_window_event_get_attribute (event));
|
||||
break;
|
||||
}
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Value %i\n", mir_window_event_get_attribute_value (event));
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_resize_event (const MirResizeEvent *event)
|
||||
{
|
||||
g_printerr ("RESIZE\n");
|
||||
g_printerr (" Size (%i, %i)\n", mir_resize_event_get_width (event), mir_resize_event_get_height (event));
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_prompt_session_state_change_event (const MirPromptSessionEvent *event)
|
||||
{
|
||||
g_printerr ("PROMPT_SESSION_STATE_CHANGE\n");
|
||||
g_printerr (" State ");
|
||||
|
||||
switch (mir_prompt_session_event_get_state (event))
|
||||
{
|
||||
case mir_prompt_session_state_stopped:
|
||||
g_printerr ("stopped");
|
||||
break;
|
||||
case mir_prompt_session_state_started:
|
||||
g_printerr ("started");
|
||||
break;
|
||||
case mir_prompt_session_state_suspended:
|
||||
g_printerr ("suspended");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_prompt_session_event_get_state (event));
|
||||
break;
|
||||
}
|
||||
|
||||
g_printerr ("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_orientation_event (const MirOrientationEvent *event)
|
||||
{
|
||||
g_printerr ("ORIENTATION\n");
|
||||
g_printerr (" Direction ");
|
||||
|
||||
switch (mir_orientation_event_get_direction (event))
|
||||
{
|
||||
case mir_orientation_normal:
|
||||
g_printerr ("normal");
|
||||
break;
|
||||
case mir_orientation_left:
|
||||
g_printerr ("left");
|
||||
break;
|
||||
case mir_orientation_inverted:
|
||||
g_printerr ("inverted");
|
||||
break;
|
||||
case mir_orientation_right:
|
||||
g_printerr ("right");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_orientation_event_get_direction (event));
|
||||
break;
|
||||
}
|
||||
|
||||
g_printerr ("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_close_event (void)
|
||||
{
|
||||
g_printerr ("CLOSED\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_keymap_event (const MirKeymapEvent *event)
|
||||
{
|
||||
g_printerr ("KEYMAP\n");
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_window_output_event (const MirWindowOutputEvent *event)
|
||||
{
|
||||
g_printerr ("WINDOW_OUTPUT\n");
|
||||
g_printerr (" DPI %d\n", mir_window_output_event_get_dpi (event));
|
||||
g_printerr (" Form Factor ");
|
||||
|
||||
switch (mir_window_output_event_get_form_factor (event))
|
||||
{
|
||||
case mir_form_factor_unknown:
|
||||
g_printerr ("unknown");
|
||||
break;
|
||||
case mir_form_factor_phone:
|
||||
g_printerr ("phone");
|
||||
break;
|
||||
case mir_form_factor_tablet:
|
||||
g_printerr ("tablet");
|
||||
break;
|
||||
case mir_form_factor_monitor:
|
||||
g_printerr ("monitor");
|
||||
break;
|
||||
case mir_form_factor_tv:
|
||||
g_printerr ("tv");
|
||||
break;
|
||||
case mir_form_factor_projector:
|
||||
g_printerr ("projector");
|
||||
break;
|
||||
default:
|
||||
g_printerr ("%u", mir_window_output_event_get_form_factor (event));
|
||||
break;
|
||||
}
|
||||
|
||||
g_printerr ("\n");
|
||||
g_printerr (" Scale %f\n", mir_window_output_event_get_scale (event));
|
||||
g_printerr (" Refresh Rate %lf\n", mir_window_output_event_get_refresh_rate (event));
|
||||
g_printerr (" Output ID %u\n", mir_window_output_event_get_output_id (event));
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_input_device_state_event (const MirInputDeviceStateEvent *event)
|
||||
{
|
||||
MirPointerButtons buttons;
|
||||
MirInputEventModifiers modifiers;
|
||||
gint i;
|
||||
gint j;
|
||||
|
||||
g_printerr ("INPUT_DEVICE_STATE\n");
|
||||
g_printerr (" Pointer Buttons\n");
|
||||
buttons = mir_input_device_state_event_pointer_buttons (event);
|
||||
|
||||
if (buttons == 0)
|
||||
g_printerr (" none\n");
|
||||
else
|
||||
{
|
||||
if (buttons & mir_pointer_button_primary)
|
||||
g_printerr (" primary\n");
|
||||
if (buttons & mir_pointer_button_secondary)
|
||||
g_printerr (" secondary\n");
|
||||
if (buttons & mir_pointer_button_tertiary)
|
||||
g_printerr (" tertiary\n");
|
||||
if (buttons & mir_pointer_button_back)
|
||||
g_printerr (" back\n");
|
||||
if (buttons & mir_pointer_button_forward)
|
||||
g_printerr (" forward\n");
|
||||
if (buttons & mir_pointer_button_side)
|
||||
g_printerr (" side\n");
|
||||
if (buttons & mir_pointer_button_extra)
|
||||
g_printerr (" extra\n");
|
||||
if (buttons & mir_pointer_button_task)
|
||||
g_printerr (" task\n");
|
||||
}
|
||||
|
||||
g_printerr (" Pointer Axis\n");
|
||||
g_printerr (" X %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_x));
|
||||
g_printerr (" Y %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_y));
|
||||
g_printerr (" V Scroll %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_vscroll));
|
||||
g_printerr (" H Scroll %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_hscroll));
|
||||
g_printerr (" Relative X %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_relative_x));
|
||||
g_printerr (" Relative Y %f\n", mir_input_device_state_event_pointer_axis (event, mir_pointer_axis_relative_y));
|
||||
g_printerr (" Time %ld\n", mir_input_device_state_event_time (event));
|
||||
g_printerr (" Event Modifiers\n");
|
||||
modifiers = mir_input_device_state_event_modifiers (event);
|
||||
|
||||
if (modifiers & mir_input_event_modifier_none)
|
||||
g_printerr (" none\n");
|
||||
if (modifiers & mir_input_event_modifier_alt)
|
||||
g_printerr (" alt\n");
|
||||
if (modifiers & mir_input_event_modifier_alt_left)
|
||||
g_printerr (" alt_left\n");
|
||||
if (modifiers & mir_input_event_modifier_alt_right)
|
||||
g_printerr (" alt_right\n");
|
||||
if (modifiers & mir_input_event_modifier_shift)
|
||||
g_printerr (" shift\n");
|
||||
if (modifiers & mir_input_event_modifier_shift_left)
|
||||
g_printerr (" shift_left\n");
|
||||
if (modifiers & mir_input_event_modifier_shift_right)
|
||||
g_printerr (" shift_right\n");
|
||||
if (modifiers & mir_input_event_modifier_sym)
|
||||
g_printerr (" sym\n");
|
||||
if (modifiers & mir_input_event_modifier_function)
|
||||
g_printerr (" function\n");
|
||||
if (modifiers & mir_input_event_modifier_ctrl)
|
||||
g_printerr (" ctrl\n");
|
||||
if (modifiers & mir_input_event_modifier_ctrl_left)
|
||||
g_printerr (" ctrl_left\n");
|
||||
if (modifiers & mir_input_event_modifier_ctrl_right)
|
||||
g_printerr (" ctrl_right\n");
|
||||
if (modifiers & mir_input_event_modifier_meta)
|
||||
g_printerr (" meta\n");
|
||||
if (modifiers & mir_input_event_modifier_meta_left)
|
||||
g_printerr (" meta_left\n");
|
||||
if (modifiers & mir_input_event_modifier_meta_right)
|
||||
g_printerr (" meta_right\n");
|
||||
if (modifiers & mir_input_event_modifier_caps_lock)
|
||||
g_printerr (" caps_lock\n");
|
||||
if (modifiers & mir_input_event_modifier_num_lock)
|
||||
g_printerr (" num_lock\n");
|
||||
if (modifiers & mir_input_event_modifier_scroll_lock)
|
||||
g_printerr (" scroll_lock\n");
|
||||
|
||||
for (i = 0; i < mir_input_device_state_event_device_count (event); i++)
|
||||
{
|
||||
g_printerr (" Device %ld\n", mir_input_device_state_event_device_id (event, i));
|
||||
|
||||
for (j = 0; j < mir_input_device_state_event_device_pressed_keys_count (event, i); j++)
|
||||
g_printerr (" Pressed %u\n", mir_input_device_state_event_device_pressed_keys_for_index (event, i, j));
|
||||
|
||||
g_printerr (" Pointer Buttons\n");
|
||||
buttons = mir_input_device_state_event_device_pointer_buttons (event, i);
|
||||
|
||||
if (buttons == 0)
|
||||
g_printerr (" none\n");
|
||||
else
|
||||
{
|
||||
if (buttons & mir_pointer_button_primary)
|
||||
g_printerr (" primary\n");
|
||||
if (buttons & mir_pointer_button_secondary)
|
||||
g_printerr (" secondary\n");
|
||||
if (buttons & mir_pointer_button_tertiary)
|
||||
g_printerr (" tertiary\n");
|
||||
if (buttons & mir_pointer_button_back)
|
||||
g_printerr (" back\n");
|
||||
if (buttons & mir_pointer_button_forward)
|
||||
g_printerr (" forward\n");
|
||||
if (buttons & mir_pointer_button_side)
|
||||
g_printerr (" side\n");
|
||||
if (buttons & mir_pointer_button_extra)
|
||||
g_printerr (" extra\n");
|
||||
if (buttons & mir_pointer_button_task)
|
||||
g_printerr (" task\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_mir_print_window_placement_event (const MirWindowPlacementEvent *event)
|
||||
{
|
||||
MirRectangle rect = mir_window_placement_get_relative_position (event);
|
||||
|
||||
g_printerr ("WINDOW_PLACEMENT\n");
|
||||
g_printerr (" X %d\n", rect.left);
|
||||
g_printerr (" Y %d\n", rect.top);
|
||||
g_printerr (" Width %u\n", rect.width);
|
||||
g_printerr (" Height %u\n", rect.height);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_mir_print_event (const MirEvent *event)
|
||||
{
|
||||
const MirInputEvent *input_event;
|
||||
|
||||
switch (mir_event_get_type (event))
|
||||
{
|
||||
case mir_event_type_input:
|
||||
input_event = mir_event_get_input_event (event);
|
||||
|
||||
switch (mir_input_event_get_type (input_event))
|
||||
{
|
||||
case mir_input_event_type_key:
|
||||
_gdk_mir_print_key_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_input_event_type_touch:
|
||||
_gdk_mir_print_touch_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_input_event_type_pointer:
|
||||
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
default:
|
||||
_gdk_mir_print_input_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case mir_event_type_key:
|
||||
_gdk_mir_print_key_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_event_type_motion:
|
||||
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_event_type_window:
|
||||
_gdk_mir_print_window_event (mir_event_get_window_event (event));
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
_gdk_mir_print_resize_event (mir_event_get_resize_event (event));
|
||||
break;
|
||||
case mir_event_type_prompt_session_state_change:
|
||||
_gdk_mir_print_prompt_session_state_change_event (mir_event_get_prompt_session_event (event));
|
||||
break;
|
||||
case mir_event_type_orientation:
|
||||
_gdk_mir_print_orientation_event (mir_event_get_orientation_event (event));
|
||||
break;
|
||||
case mir_event_type_close_window:
|
||||
_gdk_mir_print_close_event ();
|
||||
break;
|
||||
case mir_event_type_keymap:
|
||||
_gdk_mir_print_keymap_event (mir_event_get_keymap_event (event));
|
||||
break;
|
||||
case mir_event_type_window_output:
|
||||
_gdk_mir_print_window_output_event (mir_event_get_window_output_event (event));
|
||||
break;
|
||||
case mir_event_type_input_device_state:
|
||||
_gdk_mir_print_input_device_state_event (mir_event_get_input_device_state_event (event));
|
||||
break;
|
||||
case mir_event_type_window_placement:
|
||||
_gdk_mir_print_window_placement_event (mir_event_get_window_placement_event (event));
|
||||
break;
|
||||
default:
|
||||
g_printerr ("EVENT %u\n", mir_event_get_type (event));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
* 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 <epoxy/egl.h>
|
||||
|
||||
#include "gdkmir.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkdevicemanager.h"
|
||||
#include "gdkglcontextprivate.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_MIR_WINDOW_IMPL, GdkMirWindowImpl))
|
||||
#define GDK_IS_WINDOW_IMPL_MIR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_WINDOW_IMPL))
|
||||
|
||||
GType gdk_mir_window_impl_get_type (void);
|
||||
|
||||
|
||||
struct _GdkMirGLContext
|
||||
{
|
||||
GdkGLContext parent_instance;
|
||||
|
||||
EGLContext egl_context;
|
||||
EGLConfig egl_config;
|
||||
gboolean is_attached;
|
||||
};
|
||||
|
||||
struct _GdkMirGLContextClass
|
||||
{
|
||||
GdkGLContextClass parent_class;
|
||||
};
|
||||
|
||||
typedef struct _GdkMirGLContext GdkMirGLContext;
|
||||
typedef struct _GdkMirGLContextClass GdkMirGLContextClass;
|
||||
|
||||
#define GDK_MIR_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_MIR_GL_CONTEXT, GdkMirGLContext))
|
||||
|
||||
|
||||
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);
|
||||
|
||||
gboolean _gdk_mir_keymap_key_is_modifier (GdkKeymap *keymap, guint keycode);
|
||||
|
||||
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_for_type (GdkDisplay *display, GdkCursorType type);
|
||||
|
||||
GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name);
|
||||
|
||||
const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
|
||||
|
||||
MirWindow *_gdk_mir_window_get_mir_window (GdkWindow *window);
|
||||
|
||||
GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask);
|
||||
|
||||
void _gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl, MirWindowState state);
|
||||
|
||||
void _gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl, MirWindowType type);
|
||||
|
||||
void _gdk_mir_window_set_scale (GdkWindow *window, gdouble scale);
|
||||
|
||||
void _gdk_mir_window_set_final_rect (GdkWindow *window, MirRectangle rect);
|
||||
|
||||
void _gdk_mir_window_impl_set_cursor_state (GdkMirWindowImpl *impl, gdouble x, gdouble y, gboolean cursor_inside, guint button_state);
|
||||
|
||||
void _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl, gdouble *x, gdouble *y, gboolean *cursor_inside, guint *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);
|
||||
|
||||
MirPixelFormat _gdk_mir_display_get_pixel_format (GdkDisplay *display, MirBufferUsage usage);
|
||||
|
||||
void _gdk_mir_display_focus_window (GdkDisplay *display, GdkWindow *window);
|
||||
|
||||
void _gdk_mir_display_unfocus_window (GdkDisplay *display, GdkWindow *window);
|
||||
|
||||
void _gdk_mir_display_create_paste (GdkDisplay *display,
|
||||
const gchar * const *paste_formats,
|
||||
gconstpointer paste_data,
|
||||
gsize paste_size);
|
||||
|
||||
gboolean _gdk_mir_display_init_egl_display (GdkDisplay *display);
|
||||
|
||||
EGLDisplay _gdk_mir_display_get_egl_display (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_mir_display_have_egl_khr_create_context (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_mir_display_have_egl_buffer_age (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_mir_display_have_egl_swap_buffers_with_damage (GdkDisplay *display);
|
||||
|
||||
gboolean _gdk_mir_display_have_egl_surfaceless_context (GdkDisplay *display);
|
||||
|
||||
EGLSurface _gdk_mir_window_get_egl_surface (GdkWindow *window, EGLConfig config);
|
||||
|
||||
EGLSurface _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window, EGLConfig config);
|
||||
|
||||
void _gdk_mir_print_event (const MirEvent *event);
|
||||
|
||||
#endif /* __GDK_PRIVATE_MIR_H__ */
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#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_GL_CONTEXT (gdk_mir_gl_context_get_type ())
|
||||
#define GDK_MIR_IS_GL_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_MIR_GL_CONTEXT))
|
||||
|
||||
#define GDK_TYPE_MIR_WINDOW (gdk_mir_window_get_type ())
|
||||
#define GDK_IS_MIR_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MIR_WINDOW))
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GType gdk_mir_display_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
MirConnection *gdk_mir_display_get_mir_connection (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GType gdk_mir_window_get_type (void);
|
||||
|
||||
GDK_DEPRECATED_IN_3_22
|
||||
MirSurface *gdk_mir_window_get_mir_surface (GdkWindow *window);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GType gdk_mir_gl_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_MIR_H__ */
|
||||
@@ -1,176 +0,0 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
struct GdkMirCursorClass
|
||||
{
|
||||
GdkCursorClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkMirCursor, gdk_mir_cursor, GDK_TYPE_CURSOR)
|
||||
|
||||
static const gchar *
|
||||
get_cursor_name_for_cursor_type (GdkCursorType cursor_type)
|
||||
{
|
||||
switch (cursor_type)
|
||||
{
|
||||
case GDK_BLANK_CURSOR:
|
||||
return mir_disabled_cursor_name;
|
||||
case GDK_X_CURSOR:
|
||||
case GDK_ARROW:
|
||||
case GDK_CENTER_PTR:
|
||||
case GDK_DRAFT_LARGE:
|
||||
case GDK_DRAFT_SMALL:
|
||||
case GDK_LEFT_PTR:
|
||||
case GDK_RIGHT_PTR:
|
||||
case GDK_TOP_LEFT_ARROW:
|
||||
return mir_arrow_cursor_name;
|
||||
case GDK_CLOCK:
|
||||
case GDK_WATCH:
|
||||
return mir_busy_cursor_name;
|
||||
case GDK_XTERM:
|
||||
return mir_caret_cursor_name;
|
||||
case GDK_HAND1:
|
||||
case GDK_HAND2:
|
||||
return mir_pointing_hand_cursor_name;
|
||||
return mir_open_hand_cursor_name;
|
||||
case GDK_FLEUR:
|
||||
return mir_closed_hand_cursor_name;
|
||||
case GDK_LEFT_SIDE:
|
||||
case GDK_LEFT_TEE:
|
||||
case GDK_RIGHT_SIDE:
|
||||
case GDK_RIGHT_TEE:
|
||||
case GDK_SB_LEFT_ARROW:
|
||||
case GDK_SB_RIGHT_ARROW:
|
||||
return mir_horizontal_resize_cursor_name;
|
||||
case GDK_BASED_ARROW_DOWN:
|
||||
case GDK_BASED_ARROW_UP:
|
||||
case GDK_BOTTOM_SIDE:
|
||||
case GDK_BOTTOM_TEE:
|
||||
case GDK_DOUBLE_ARROW:
|
||||
case GDK_SB_DOWN_ARROW:
|
||||
case GDK_SB_UP_ARROW:
|
||||
case GDK_TOP_SIDE:
|
||||
case GDK_TOP_TEE:
|
||||
return mir_vertical_resize_cursor_name;
|
||||
case GDK_BOTTOM_LEFT_CORNER:
|
||||
case GDK_LL_ANGLE:
|
||||
case GDK_TOP_RIGHT_CORNER:
|
||||
case GDK_UR_ANGLE:
|
||||
return mir_diagonal_resize_bottom_to_top_cursor_name;
|
||||
case GDK_BOTTOM_RIGHT_CORNER:
|
||||
case GDK_LR_ANGLE:
|
||||
case GDK_SIZING:
|
||||
case GDK_TOP_LEFT_CORNER:
|
||||
case GDK_UL_ANGLE:
|
||||
return mir_diagonal_resize_top_to_bottom_cursor_name;
|
||||
return mir_omnidirectional_resize_cursor_name;
|
||||
case GDK_SB_V_DOUBLE_ARROW:
|
||||
return mir_vsplit_resize_cursor_name;
|
||||
case GDK_SB_H_DOUBLE_ARROW:
|
||||
return mir_hsplit_resize_cursor_name;
|
||||
default:
|
||||
return mir_default_cursor_name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GdkCursor *
|
||||
_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name)
|
||||
{
|
||||
GdkMirCursor *cursor;
|
||||
|
||||
cursor = g_object_new (GDK_TYPE_MIR_CURSOR, "display", display, "cursor-type", GDK_CURSOR_IS_PIXMAP, NULL);
|
||||
cursor->name = g_strdup (name);
|
||||
|
||||
return GDK_CURSOR (cursor);
|
||||
}
|
||||
|
||||
GdkCursor *
|
||||
_gdk_mir_cursor_new_for_type (GdkDisplay *display, GdkCursorType type)
|
||||
{
|
||||
GdkMirCursor *cursor;
|
||||
|
||||
cursor = g_object_new (GDK_TYPE_MIR_CURSOR, "display", display, "cursor-type", type, NULL);
|
||||
cursor->name = g_strdup (get_cursor_name_for_cursor_type (type));
|
||||
|
||||
return GDK_CURSOR (cursor);
|
||||
}
|
||||
|
||||
const gchar *
|
||||
_gdk_mir_cursor_get_name (GdkCursor *cursor)
|
||||
{
|
||||
GdkMirCursor *mir_cursor = GDK_MIR_CURSOR (cursor);
|
||||
|
||||
return mir_cursor->name;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
gdk_mir_cursor_get_surface (GdkCursor *cursor,
|
||||
gdouble *x_hot,
|
||||
gdouble *y_hot)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_init (GdkMirCursor *cursor)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_finalize (GObject *object)
|
||||
{
|
||||
GdkMirCursor *mir_cursor = GDK_MIR_CURSOR (object);
|
||||
|
||||
g_free (mir_cursor->name);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_cursor_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_cursor_class_init (GdkMirCursorClass *klass)
|
||||
{
|
||||
GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
cursor_class->get_surface = gdk_mir_cursor_get_surface;
|
||||
object_class->finalize = gdk_mir_cursor_finalize;
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* 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 "gdkseatdefaultprivate.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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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);
|
||||
GdkDisplay *display;
|
||||
GdkSeat *seat;
|
||||
|
||||
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);
|
||||
|
||||
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (device_manager));
|
||||
|
||||
seat = gdk_seat_default_new_for_master_pair (device_manager->pointer, device_manager->keyboard);
|
||||
gdk_display_add_seat (display, seat);
|
||||
g_object_unref (seat);
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1,838 +0,0 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#include <mir_toolkit/events/window_placement.h>
|
||||
|
||||
#define NANO_TO_MILLI(x) ((x) / 1000000)
|
||||
|
||||
struct _GdkMirWindowReference {
|
||||
GdkMirEventSource *source;
|
||||
GdkWindow *window;
|
||||
gint ref_count;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
GdkMirWindowReference *window_ref;
|
||||
const MirEvent *event;
|
||||
} GdkMirQueuedEvent;
|
||||
|
||||
struct _GdkMirEventSource
|
||||
{
|
||||
GSource parent_instance;
|
||||
|
||||
GMutex mir_event_lock;
|
||||
GQueue mir_events;
|
||||
gboolean log_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_source_device (event, device);
|
||||
gdk_event_set_screen (event, gdk_display_get_default_screen (gdk_window_get_display (window)));
|
||||
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, guint32 event_time)
|
||||
{
|
||||
GdkEvent *event;
|
||||
GdkDisplay *display;
|
||||
GdkSeat *seat;
|
||||
GdkDevice *keyboard;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->key.state = state;
|
||||
event->key.keyval = keyval;
|
||||
event->key.hardware_keycode = keycode + 8;
|
||||
gdk_event_set_scancode (event, keycode + 8);
|
||||
event->key.is_modifier = is_modifier;
|
||||
event->key.time = event_time;
|
||||
set_key_event_string (&event->key);
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
|
||||
send_event (window, keyboard, event);
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
get_pointer (GdkWindow *window)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GdkSeat *seat;
|
||||
GdkDevice *pointer;
|
||||
|
||||
display = gdk_window_get_display (window);
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
pointer = gdk_seat_get_pointer (seat);
|
||||
|
||||
return pointer;
|
||||
}
|
||||
|
||||
static void
|
||||
generate_button_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint button, guint state, guint32 event_time)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (type);
|
||||
event->button.x = x;
|
||||
event->button.y = y;
|
||||
event->button.state = state;
|
||||
event->button.button = button;
|
||||
event->button.time = event_time;
|
||||
|
||||
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, guint32 event_time)
|
||||
{
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_SCROLL);
|
||||
event->scroll.x = x;
|
||||
event->scroll.y = y;
|
||||
event->scroll.state = state;
|
||||
event->scroll.time = event_time;
|
||||
|
||||
if (ABS (delta_x) == 1 && delta_y == 0)
|
||||
{
|
||||
event->scroll.direction = (delta_x < 0) ? GDK_SCROLL_LEFT : GDK_SCROLL_RIGHT;
|
||||
}
|
||||
else if (ABS (delta_y) == 1 && delta_x == 0)
|
||||
{
|
||||
event->scroll.direction = (delta_y < 0) ? GDK_SCROLL_DOWN : GDK_SCROLL_UP;
|
||||
}
|
||||
else
|
||||
{
|
||||
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, guint32 event_time)
|
||||
{
|
||||
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;
|
||||
event->motion.time = event_time;
|
||||
|
||||
send_event (window, get_pointer (window), event);
|
||||
}
|
||||
|
||||
static void
|
||||
generate_crossing_event (GdkWindow *window, GdkEventType type, gdouble x, gdouble y, guint32 event_time)
|
||||
{
|
||||
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;
|
||||
event->crossing.time = event_time;
|
||||
|
||||
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);
|
||||
_gdk_mir_display_focus_window (gdk_window_get_display (window), window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
|
||||
_gdk_mir_display_unfocus_window (gdk_window_get_display (window), window);
|
||||
}
|
||||
|
||||
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, guint button_state)
|
||||
{
|
||||
guint modifier_state = button_state;
|
||||
|
||||
if ((modifiers & (mir_input_event_modifier_alt |
|
||||
mir_input_event_modifier_alt_left |
|
||||
mir_input_event_modifier_alt_right)) != 0)
|
||||
modifier_state |= GDK_MOD1_MASK;
|
||||
if ((modifiers & (mir_input_event_modifier_shift |
|
||||
mir_input_event_modifier_shift_left |
|
||||
mir_input_event_modifier_shift_right)) != 0)
|
||||
modifier_state |= GDK_SHIFT_MASK;
|
||||
if ((modifiers & (mir_input_event_modifier_ctrl |
|
||||
mir_input_event_modifier_ctrl_left |
|
||||
mir_input_event_modifier_ctrl_right)) != 0)
|
||||
modifier_state |= GDK_CONTROL_MASK;
|
||||
if ((modifiers & (mir_input_event_modifier_meta |
|
||||
mir_input_event_modifier_meta_left |
|
||||
mir_input_event_modifier_meta_right)) != 0)
|
||||
modifier_state |= GDK_META_MASK;
|
||||
if ((modifiers & mir_input_event_modifier_caps_lock) != 0)
|
||||
modifier_state |= GDK_LOCK_MASK;
|
||||
|
||||
return modifier_state;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_key_event (GdkWindow *window, const MirInputEvent *event)
|
||||
{
|
||||
const MirKeyboardEvent *keyboard_event = mir_input_event_get_keyboard_event (event);
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
GdkKeymap *keymap;
|
||||
guint modifier_state;
|
||||
guint button_state;
|
||||
|
||||
if (!keyboard_event)
|
||||
return;
|
||||
|
||||
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state);
|
||||
modifier_state = get_modifier_state (mir_keyboard_event_modifiers (keyboard_event), button_state);
|
||||
keymap = gdk_keymap_get_for_display (gdk_window_get_display (window));
|
||||
|
||||
generate_key_event (window,
|
||||
mir_keyboard_event_action (keyboard_event) == mir_keyboard_action_up ? GDK_KEY_RELEASE : GDK_KEY_PRESS,
|
||||
modifier_state,
|
||||
mir_keyboard_event_key_code (keyboard_event),
|
||||
mir_keyboard_event_scan_code (keyboard_event),
|
||||
_gdk_mir_keymap_key_is_modifier (keymap, mir_keyboard_event_key_code (keyboard_event)),
|
||||
NANO_TO_MILLI (mir_input_event_get_event_time (event)));
|
||||
}
|
||||
|
||||
static void
|
||||
handle_touch_event (GdkWindow *window,
|
||||
const MirTouchEvent *mir_touch_event)
|
||||
{
|
||||
const MirInputEvent *mir_input_event = mir_touch_event_input_event (mir_touch_event);
|
||||
guint n = mir_touch_event_point_count (mir_touch_event);
|
||||
GdkEvent *gdk_event;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
MirTouchAction action = mir_touch_event_action (mir_touch_event, i);
|
||||
if (action == mir_touch_action_up)
|
||||
gdk_event = gdk_event_new (GDK_TOUCH_END);
|
||||
else if (action == mir_touch_action_down)
|
||||
gdk_event = gdk_event_new (GDK_TOUCH_BEGIN);
|
||||
else
|
||||
gdk_event = gdk_event_new (GDK_TOUCH_UPDATE);
|
||||
|
||||
gdk_event->touch.window = window;
|
||||
gdk_event->touch.sequence = GINT_TO_POINTER (mir_touch_event_id (mir_touch_event, i));
|
||||
gdk_event->touch.time = mir_input_event_get_event_time (mir_input_event);
|
||||
gdk_event->touch.state = get_modifier_state (mir_touch_event_modifiers (mir_touch_event), 0);
|
||||
gdk_event->touch.x = mir_touch_event_axis_value (mir_touch_event, i, mir_touch_axis_x);
|
||||
gdk_event->touch.y = mir_touch_event_axis_value (mir_touch_event, i, mir_touch_axis_y);
|
||||
gdk_event->touch.x_root = mir_touch_event_axis_value (mir_touch_event, i, mir_touch_axis_x);
|
||||
gdk_event->touch.y_root = mir_touch_event_axis_value (mir_touch_event, i, mir_touch_axis_y);
|
||||
gdk_event->touch.emulating_pointer = TRUE;
|
||||
gdk_event_set_pointer_emulated (gdk_event, TRUE);
|
||||
|
||||
send_event (window, get_pointer (window), gdk_event);
|
||||
}
|
||||
}
|
||||
|
||||
static guint
|
||||
get_button_state (const MirPointerEvent *event)
|
||||
{
|
||||
guint state = 0;
|
||||
|
||||
if (mir_pointer_event_button_state (event, mir_pointer_button_primary)) /* left */
|
||||
state |= GDK_BUTTON1_MASK;
|
||||
if (mir_pointer_event_button_state (event, mir_pointer_button_secondary)) /* right */
|
||||
state |= GDK_BUTTON3_MASK;
|
||||
if (mir_pointer_event_button_state (event, mir_pointer_button_tertiary)) /* middle */
|
||||
state |= GDK_BUTTON2_MASK;
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static void
|
||||
handle_motion_event (GdkWindow *window, const MirInputEvent *event)
|
||||
{
|
||||
const MirPointerEvent *pointer_event = mir_input_event_get_pointer_event (event);
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
gdouble x, y;
|
||||
gboolean cursor_inside;
|
||||
guint button_state;
|
||||
guint new_button_state;
|
||||
guint modifier_state;
|
||||
guint32 event_time;
|
||||
GdkEventType event_type;
|
||||
guint changed_button_state;
|
||||
|
||||
if (!pointer_event)
|
||||
return;
|
||||
|
||||
_gdk_mir_window_impl_get_cursor_state (impl, &x, &y, &cursor_inside, &button_state);
|
||||
new_button_state = get_button_state (pointer_event);
|
||||
modifier_state = get_modifier_state (mir_pointer_event_modifiers (pointer_event), new_button_state);
|
||||
event_time = NANO_TO_MILLI (mir_input_event_get_event_time (event));
|
||||
|
||||
if (window)
|
||||
{
|
||||
gdouble new_x;
|
||||
gdouble new_y;
|
||||
gdouble hscroll;
|
||||
gdouble vscroll;
|
||||
|
||||
/* Update which window has focus */
|
||||
_gdk_mir_pointer_set_location (get_pointer (window), x, y, window, modifier_state);
|
||||
switch (mir_pointer_event_action (pointer_event))
|
||||
{
|
||||
case mir_pointer_action_button_up:
|
||||
case mir_pointer_action_button_down:
|
||||
event_type = mir_pointer_event_action (pointer_event) == mir_pointer_action_button_down ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE;
|
||||
changed_button_state = button_state ^ new_button_state;
|
||||
if (changed_button_state == 0 || (changed_button_state & GDK_BUTTON1_MASK) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_PRIMARY, modifier_state, event_time);
|
||||
if ((changed_button_state & GDK_BUTTON2_MASK) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_MIDDLE, modifier_state, event_time);
|
||||
if ((changed_button_state & GDK_BUTTON3_MASK) != 0)
|
||||
generate_button_event (window, event_type, x, y, GDK_BUTTON_SECONDARY, modifier_state, event_time);
|
||||
button_state = new_button_state;
|
||||
break;
|
||||
case mir_pointer_action_motion:
|
||||
new_x = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_x);
|
||||
new_y = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_y);
|
||||
hscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_hscroll);
|
||||
vscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_vscroll);
|
||||
|
||||
if (hscroll != 0.0 || vscroll != 0.0)
|
||||
generate_scroll_event (window, x, y, hscroll, vscroll, modifier_state, event_time);
|
||||
if (ABS (new_x - x) > 0.5 || ABS (new_y - y) > 0.5)
|
||||
{
|
||||
generate_motion_event (window, new_x, new_y, modifier_state, event_time);
|
||||
x = new_x;
|
||||
y = new_y;
|
||||
}
|
||||
|
||||
break;
|
||||
case mir_pointer_action_enter:
|
||||
if (!cursor_inside)
|
||||
{
|
||||
cursor_inside = TRUE;
|
||||
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
|
||||
}
|
||||
break;
|
||||
case mir_pointer_action_leave:
|
||||
if (cursor_inside)
|
||||
{
|
||||
cursor_inside = FALSE;
|
||||
generate_crossing_event (window, GDK_LEAVE_NOTIFY, x, y, event_time);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_gdk_mir_window_impl_set_cursor_state (impl, x, y, cursor_inside, button_state);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_window_event (GdkWindow *window,
|
||||
const MirWindowEvent *event)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
MirWindowState state;
|
||||
|
||||
switch (mir_window_event_get_attribute (event))
|
||||
{
|
||||
case mir_window_attrib_type:
|
||||
_gdk_mir_window_impl_set_window_type (impl, mir_window_event_get_attribute_value (event));
|
||||
break;
|
||||
case mir_window_attrib_state:
|
||||
state = mir_window_event_get_attribute_value (event);
|
||||
_gdk_mir_window_impl_set_window_state (impl, state);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case mir_window_state_restored:
|
||||
case mir_window_state_hidden:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_ICONIFIED |
|
||||
GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN,
|
||||
0);
|
||||
break;
|
||||
case mir_window_state_minimized:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_MAXIMIZED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN,
|
||||
GDK_WINDOW_STATE_ICONIFIED);
|
||||
break;
|
||||
case mir_window_state_maximized:
|
||||
case mir_window_state_vertmaximized:
|
||||
case mir_window_state_horizmaximized:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_ICONIFIED |
|
||||
GDK_WINDOW_STATE_FULLSCREEN,
|
||||
GDK_WINDOW_STATE_MAXIMIZED);
|
||||
break;
|
||||
case mir_window_state_fullscreen:
|
||||
gdk_synthesize_window_state (window,
|
||||
GDK_WINDOW_STATE_ICONIFIED |
|
||||
GDK_WINDOW_STATE_MAXIMIZED,
|
||||
GDK_WINDOW_STATE_FULLSCREEN);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case mir_window_attrib_swapinterval:
|
||||
break;
|
||||
case mir_window_attrib_focus:
|
||||
generate_focus_event (window, mir_window_event_get_attribute_value (event) != 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 = mir_resize_event_get_width (event);
|
||||
window->height = mir_resize_event_get_height (event);
|
||||
_gdk_window_update_size (window);
|
||||
|
||||
generate_configure_event (window, mir_resize_event_get_width (event), mir_resize_event_get_height (event));
|
||||
}
|
||||
|
||||
static void
|
||||
handle_close_event (GdkWindow *window)
|
||||
{
|
||||
send_event (window, get_pointer (window), gdk_event_new (GDK_DESTROY));
|
||||
gdk_window_destroy_notify (window);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_window_output_event (GdkWindow *window,
|
||||
const MirWindowOutputEvent *event)
|
||||
{
|
||||
_gdk_mir_window_set_scale (window, mir_window_output_event_get_scale (event));
|
||||
}
|
||||
|
||||
static void
|
||||
handle_window_placement_event (GdkWindow *window,
|
||||
const MirWindowPlacementEvent *event)
|
||||
{
|
||||
_gdk_mir_window_set_final_rect (window, mir_window_placement_get_relative_position (event));
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GdkWindow *window;
|
||||
MirEvent *event;
|
||||
} EventData;
|
||||
|
||||
static void
|
||||
gdk_mir_event_source_queue_event (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
const MirEvent *event)
|
||||
{
|
||||
const MirInputEvent *input_event;
|
||||
|
||||
// FIXME: Only generate events if the window wanted them?
|
||||
switch (mir_event_get_type (event))
|
||||
{
|
||||
case mir_event_type_input:
|
||||
input_event = mir_event_get_input_event (event);
|
||||
|
||||
switch (mir_input_event_get_type (input_event))
|
||||
{
|
||||
case mir_input_event_type_key:
|
||||
handle_key_event (window, input_event);
|
||||
break;
|
||||
case mir_input_event_type_touch:
|
||||
handle_touch_event (window, mir_input_event_get_touch_event (input_event));
|
||||
break;
|
||||
case mir_input_event_type_pointer:
|
||||
handle_motion_event (window, input_event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case mir_event_type_key:
|
||||
handle_key_event (window, mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_event_type_motion:
|
||||
handle_motion_event (window, mir_event_get_input_event (event));
|
||||
break;
|
||||
case mir_event_type_window:
|
||||
handle_window_event (window, mir_event_get_window_event (event));
|
||||
break;
|
||||
case mir_event_type_resize:
|
||||
handle_resize_event (window, mir_event_get_resize_event (event));
|
||||
break;
|
||||
case mir_event_type_prompt_session_state_change:
|
||||
break;
|
||||
case mir_event_type_orientation:
|
||||
break;
|
||||
case mir_event_type_close_window:
|
||||
handle_close_event (window);
|
||||
break;
|
||||
case mir_event_type_keymap:
|
||||
break;
|
||||
case mir_event_type_window_output:
|
||||
handle_window_output_event (window, mir_event_get_window_output_event (event));
|
||||
break;
|
||||
case mir_event_type_input_device_state:
|
||||
break;
|
||||
case mir_event_type_window_placement:
|
||||
handle_window_placement_event (window, mir_event_get_window_placement_event (event));
|
||||
break;
|
||||
default:
|
||||
g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));
|
||||
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);
|
||||
mir_event_unref (event->event);
|
||||
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)
|
||||
{
|
||||
if (source->log_events)
|
||||
_gdk_mir_print_event (event->event);
|
||||
|
||||
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;
|
||||
char *name;
|
||||
|
||||
g_source = g_source_new (&gdk_mir_event_source_funcs, sizeof (GdkMirEventSource));
|
||||
name = g_strdup_printf ("GDK Mir Event source (%s)", gdk_display_get_name (display));
|
||||
g_source_set_name (g_source, name);
|
||||
g_free (name);
|
||||
g_source_set_priority (g_source, GDK_PRIORITY_EVENTS);
|
||||
g_source_set_can_recurse (g_source, TRUE);
|
||||
g_source_attach (g_source, NULL);
|
||||
|
||||
source = (GdkMirEventSource *) g_source;
|
||||
g_mutex_init (&source->mir_event_lock);
|
||||
source->display = display;
|
||||
source->log_events = (g_getenv ("GDK_MIR_LOG_EVENTS") != NULL);
|
||||
|
||||
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 = mir_event_ref (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);
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkmirglcontext.c: Mir specific OpenGL wrappers
|
||||
*
|
||||
* Copyright © 2014 Canonical Ltd
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkmir-private.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkMirGLContext, gdk_mir_gl_context, GDK_TYPE_GL_CONTEXT)
|
||||
|
||||
#define N_EGL_ATTRS 16
|
||||
|
||||
static gboolean
|
||||
gdk_mir_gl_context_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkMirGLContext *context_mir = GDK_MIR_GL_CONTEXT (context);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
GdkGLContext *share = gdk_gl_context_get_shared_context (context);
|
||||
EGLContext ctx;
|
||||
EGLint context_attribs[N_EGL_ATTRS];
|
||||
int major, minor, flags;
|
||||
gboolean debug_bit, forward_bit;
|
||||
int i = 0;
|
||||
|
||||
if (!_gdk_mir_display_init_egl_display (display))
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No GL implementation is available"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_gl_context_get_required_version (context, &major, &minor);
|
||||
debug_bit = gdk_gl_context_get_debug_enabled (context);
|
||||
forward_bit = gdk_gl_context_get_forward_compatible (context);
|
||||
|
||||
flags = 0;
|
||||
|
||||
if (debug_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR;
|
||||
if (forward_bit)
|
||||
flags |= EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR;
|
||||
|
||||
/* We want a core profile */
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
|
||||
context_attribs[i++] = EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR;
|
||||
|
||||
/* Specify the version */
|
||||
context_attribs[i++] = EGL_CONTEXT_MAJOR_VERSION_KHR;
|
||||
context_attribs[i++] = major;
|
||||
context_attribs[i++] = EGL_CONTEXT_MINOR_VERSION_KHR;
|
||||
context_attribs[i++] = minor;
|
||||
|
||||
/* Specify the flags */
|
||||
context_attribs[i++] = EGL_CONTEXT_FLAGS_KHR;
|
||||
context_attribs[i++] = flags;
|
||||
|
||||
context_attribs[i++] = EGL_NONE;
|
||||
g_assert (i < N_EGL_ATTRS);
|
||||
|
||||
ctx = eglCreateContext (_gdk_mir_display_get_egl_display (display),
|
||||
context_mir->egl_config,
|
||||
share != NULL ? GDK_MIR_GL_CONTEXT (share)->egl_context
|
||||
: EGL_NO_CONTEXT,
|
||||
context_attribs);
|
||||
if (ctx == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Unable to create a GL context"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GDK_NOTE (OPENGL, g_print ("Created EGL context[%p]\n", ctx));
|
||||
|
||||
context_mir->egl_context = ctx;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkWindow *window = gdk_gl_context_get_window (context);
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkMirGLContext *context_mir = GDK_MIR_GL_CONTEXT (context);
|
||||
EGLDisplay egl_display = _gdk_mir_display_get_egl_display (display);
|
||||
EGLSurface egl_surface;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
egl_surface = _gdk_mir_window_get_egl_surface (window,
|
||||
context_mir->egl_config);
|
||||
|
||||
if (_gdk_mir_display_have_egl_swap_buffers_with_damage (display))
|
||||
{
|
||||
int i, j, n_rects = cairo_region_num_rectangles (damage);
|
||||
EGLint *rects = g_new (EGLint, n_rects * 4);
|
||||
cairo_rectangle_int_t rect;
|
||||
int window_height = gdk_window_get_height (window);
|
||||
|
||||
for (i = 0, j = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (damage, i, &rect);
|
||||
rects[j++] = rect.x;
|
||||
rects[j++] = window_height - rect.height - rect.y;
|
||||
rects[j++] = rect.width;
|
||||
rects[j++] = rect.height;
|
||||
}
|
||||
eglSwapBuffersWithDamageEXT (egl_display, egl_surface, rects, n_rects);
|
||||
g_free (rects);
|
||||
}
|
||||
else
|
||||
{
|
||||
eglSwapBuffers (egl_display, egl_surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_gl_context_dispose (GObject *gobject)
|
||||
{
|
||||
GdkMirGLContext *context_mir = GDK_MIR_GL_CONTEXT (gobject);
|
||||
|
||||
if (context_mir->egl_context != NULL)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (gobject);
|
||||
GdkWindow *window = gdk_gl_context_get_window (context);
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
EGLDisplay egl_display = _gdk_mir_display_get_egl_display (display);
|
||||
|
||||
if (eglGetCurrentContext () == context_mir->egl_context)
|
||||
eglMakeCurrent (egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
GDK_NOTE (OPENGL, g_print ("Destroying EGL context\n"));
|
||||
|
||||
eglDestroyContext (egl_display, context_mir->egl_context);
|
||||
context_mir->egl_context = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_gl_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_gl_context_class_init (GdkMirGLContextClass *klass)
|
||||
{
|
||||
GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->realize = gdk_mir_gl_context_realize;
|
||||
context_class->end_frame = gdk_mir_gl_context_end_frame;
|
||||
gobject_class->dispose = gdk_mir_gl_context_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_gl_context_init (GdkMirGLContext *self)
|
||||
{
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_get_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_set_window_cursor (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
/* Keyboards don't have cursors... */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_keyboard_warp (GdkDevice *device,
|
||||
GdkScreen *screen,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
}
|
||||
|
||||
static GdkGrabStatus
|
||||
gdk_mir_keyboard_grab (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time_)
|
||||
{
|
||||
/* 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_)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1,476 +0,0 @@
|
||||
/*
|
||||
* 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))
|
||||
|
||||
#define IsModifierKey(keysym) \
|
||||
(((keysym) >= XKB_KEY_Shift_L && (keysym) <= XKB_KEY_Hyper_R) || \
|
||||
((keysym) >= XKB_KEY_ISO_Lock && (keysym) <= XKB_KEY_ISO_Last_Group_Lock) || \
|
||||
((keysym) == XKB_KEY_Mode_switch) || \
|
||||
((keysym) == XKB_KEY_Num_Lock))
|
||||
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_caps_lock_state (GdkKeymap *keymap)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_NUM);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_scroll_lock_state (GdkKeymap *keymap)
|
||||
{
|
||||
return xkb_state_led_name_is_active (GDK_MIR_KEYMAP (keymap)->xkb_state, XKB_LED_NAME_SCROLL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_get_entries_for_keyval (GdkKeymap *keymap,
|
||||
guint keyval,
|
||||
GdkKeymapKey **keys,
|
||||
gint *n_keys)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// FIXME: What is this?
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
// FIXME: What is this?
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_mir_keymap_get_modifier_state (GdkKeymap *keymap)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_mir_keymap_key_is_modifier (GdkKeymap *keymap,
|
||||
guint keycode)
|
||||
{
|
||||
// FIXME: use xkb_state
|
||||
return IsModifierKey (keycode);
|
||||
}
|
||||
|
||||
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_scroll_lock_state = gdk_mir_keymap_get_scroll_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;
|
||||
}
|
||||
@@ -1,247 +0,0 @@
|
||||
/*
|
||||
* 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 "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)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_get_state (GdkDevice *device,
|
||||
GdkWindow *window,
|
||||
gdouble *axes,
|
||||
GdkModifierType *mask)
|
||||
{
|
||||
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)
|
||||
{
|
||||
/* Mir doesn't support cursors */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_pointer_warp (GdkDevice *device,
|
||||
GdkScreen *screen,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
/* 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)
|
||||
{
|
||||
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_)
|
||||
{
|
||||
/* 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_)
|
||||
{
|
||||
/* Mir doesn't do grabs */
|
||||
|
||||
GdkDeviceGrabInfo *grab = _gdk_display_get_last_device_grab (gdk_device_get_display (device), device);
|
||||
|
||||
if (grab)
|
||||
grab->serial_end = grab->serial_start;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_pointer_window_at_position (GdkDevice *device,
|
||||
gdouble *win_x,
|
||||
gdouble *win_y,
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
error('Mir gdk backend not ported to meson yet')
|
||||
@@ -21,6 +21,8 @@
|
||||
#include "gdkquartzwindow.h"
|
||||
#include "gdkdnd-quartz.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
#include "gdkquartzdnd.h"
|
||||
|
||||
@implementation GdkQuartzNSWindow
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gdkquartzwindow.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkquartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
@implementation GdkQuartzView
|
||||
|
||||
@@ -532,6 +533,20 @@
|
||||
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
|
||||
}
|
||||
|
||||
-(void)scrollPageDown: (id)sender
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_message ("scrollPageDown"));
|
||||
g_object_set_data (G_OBJECT (gdk_window), GIC_FILTER_KEY,
|
||||
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
|
||||
}
|
||||
|
||||
-(void)scrollPageUp: (id)sender
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_message ("scrollPageUp"));
|
||||
g_object_set_data (G_OBJECT (gdk_window), GIC_FILTER_KEY,
|
||||
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
|
||||
}
|
||||
|
||||
-(void)selectAll: (id)sender
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_message ("selectAll"));
|
||||
|
||||
@@ -38,7 +38,9 @@ libgdk_quartz_la_SOURCES = \
|
||||
gdkglcontext-quartz.c \
|
||||
gdkglcontext-quartz.h \
|
||||
gdkglobals-quartz.c \
|
||||
gdkinternal-quartz.h \
|
||||
gdkkeys-quartz.c \
|
||||
gdkkeys-quartz.h \
|
||||
gdkmonitor-quartz.c \
|
||||
gdkmonitor-quartz.h \
|
||||
gdkprivate-quartz.h \
|
||||
@@ -58,6 +60,7 @@ libgdkinclude_HEADERS = \
|
||||
gdkquartz.h
|
||||
|
||||
libgdkquartzinclude_HEADERS = \
|
||||
gdkquartz-gtk-only.h \
|
||||
gdkquartzcursor.h \
|
||||
gdkquartzdevice-core.h \
|
||||
gdkquartzdevicemanager-core.h \
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdkquartzcursor.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
#include "xcursors.h"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "gdkquartzcursor.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkquartzdevice-core.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
struct _GdkQuartzDeviceCore
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkmain.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
#include "gdkdnd.h"
|
||||
#include "gdkquartzdnd.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
|
||||
#include "gdkinternal-quartz.h"
|
||||
#include "gdkquartz-gtk-only.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkQuartzDragContext, gdk_quartz_drag_context, GDK_TYPE_DRAG_CONTEXT)
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define __GDK_QUARTZ_DND__
|
||||
|
||||
#include <gdkdndprivate.h>
|
||||
#include "gdkquartzdnd.h"
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
#include <gdk/gdkdisplayprivate.h>
|
||||
|
||||
/*
|
||||
@@ -152,6 +153,18 @@ static const char *const state_names[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_EVENT_MASK_ANY = NSAnyEventMask,
|
||||
} GdkQuartzEventMask;
|
||||
#else
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_EVENT_MASK_ANY = NSEventMaskAny,
|
||||
} GdkQuartzEventMask;
|
||||
#endif
|
||||
|
||||
static SelectThreadState select_thread_state = BEFORE_START;
|
||||
|
||||
static pthread_t select_thread;
|
||||
|
||||
@@ -34,8 +34,10 @@
|
||||
#include "gdkquartz.h"
|
||||
#include "gdkquartzdisplay.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
#include "gdkquartzdevicemanager-core.h"
|
||||
#include "gdkquartzkeys.h"
|
||||
#include "gdkkeys-quartz.h"
|
||||
|
||||
#define GRIP_WIDTH 15
|
||||
#define GRIP_HEIGHT 15
|
||||
@@ -51,6 +53,7 @@
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
|
||||
|
||||
|
||||
/* This is the window corresponding to the key window */
|
||||
static GdkWindow *current_keyboard_window;
|
||||
|
||||
@@ -457,6 +460,29 @@ get_toplevel_from_ns_event (NSEvent *nsevent,
|
||||
* here, not very nice.
|
||||
*/
|
||||
_gdk_quartz_events_break_all_grabs (get_time_from_ns_event (nsevent));
|
||||
|
||||
/* Check if the event occurred on the titlebar. If it did,
|
||||
* explicitly return NULL to prevent going through the
|
||||
* fallback path, which could match the window that is
|
||||
* directly under the titlebar.
|
||||
*/
|
||||
if (view_point.y < 0 &&
|
||||
view_point.x >= view_frame.origin.x &&
|
||||
view_point.x < view_frame.origin.x + view_frame.size.width)
|
||||
{
|
||||
NSView *superview = [view superview];
|
||||
if (superview)
|
||||
{
|
||||
NSRect superview_frame = [superview frame];
|
||||
int titlebar_height = superview_frame.size.height -
|
||||
view_frame.size.height;
|
||||
|
||||
if (titlebar_height > 0 && view_point.y >= -titlebar_height)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "gdktypes.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkquartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
GdkDisplay *_gdk_display = NULL;
|
||||
GdkScreen *_gdk_screen = NULL;
|
||||
|
||||
265
gdk/quartz/gdkinternal-quartz.h
Normal file
@@ -0,0 +1,265 @@
|
||||
/* gdkinternal-quartz.h
|
||||
*
|
||||
* Copyright (C) 2005-2007 Imendio AB
|
||||
*
|
||||
* 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_INTERNAL_QUARTZ_H__
|
||||
#define __GDK_INTERNAL_QUARTZ_H__
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
/* This is mostly a pot of function prototypes to avoid having
|
||||
* separate include file for each implementation file that exports
|
||||
* functions to one other file in GdkQuartz.
|
||||
*/
|
||||
|
||||
/* NSInteger only exists in Leopard and newer. This check has to be
|
||||
* done after inclusion of the system headers. If NSInteger has not
|
||||
* been defined, we know for sure that we are on 32-bit.
|
||||
*/
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
typedef float CGFloat;
|
||||
#endif
|
||||
|
||||
#define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
|
||||
#define GDK_QUARTZ_RELEASE_POOL [pool release]
|
||||
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/quartz/gdkquartz.h>
|
||||
#include <gdk/quartz/gdkdevicemanager-core-quartz.h>
|
||||
#include <gdk/quartz/gdkdnd-quartz.h>
|
||||
#include <gdk/quartz/gdkscreen-quartz.h>
|
||||
#include <gdk/quartz/gdkwindow-quartz.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
extern GdkDisplay *_gdk_display;
|
||||
extern GdkScreen *_gdk_screen;
|
||||
extern GdkWindow *_gdk_root;
|
||||
|
||||
extern GdkDragContext *_gdk_quartz_drag_source_context;
|
||||
|
||||
#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindow *)win)->impl))
|
||||
|
||||
/* Initialization */
|
||||
void _gdk_quartz_window_init_windowing (GdkDisplay *display,
|
||||
GdkScreen *screen);
|
||||
void _gdk_quartz_events_init (void);
|
||||
void _gdk_quartz_event_loop_init (void);
|
||||
|
||||
/* Cursor */
|
||||
NSCursor *_gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor);
|
||||
|
||||
/* Events */
|
||||
typedef enum {
|
||||
GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
|
||||
} GdkQuartzEventSubType;
|
||||
|
||||
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
|
||||
gboolean got_focus);
|
||||
void _gdk_quartz_events_send_map_event (GdkWindow *window);
|
||||
|
||||
GdkModifierType _gdk_quartz_events_get_current_keyboard_modifiers (void);
|
||||
GdkModifierType _gdk_quartz_events_get_current_mouse_modifiers (void);
|
||||
|
||||
void _gdk_quartz_events_break_all_grabs (guint32 time);
|
||||
|
||||
/* Event loop */
|
||||
gboolean _gdk_quartz_event_loop_check_pending (void);
|
||||
NSEvent * _gdk_quartz_event_loop_get_pending (void);
|
||||
void _gdk_quartz_event_loop_release_event (NSEvent *event);
|
||||
|
||||
/* Keys */
|
||||
GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
|
||||
gboolean _gdk_quartz_keys_is_modifier (guint keycode);
|
||||
void _gdk_quartz_synthesize_null_key_event (GdkWindow *window);
|
||||
|
||||
/* Drag and Drop */
|
||||
void _gdk_quartz_window_register_dnd (GdkWindow *window);
|
||||
GdkDragContext * _gdk_quartz_window_drag_begin (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GList *targets,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
|
||||
/* Display */
|
||||
|
||||
GdkDisplay * _gdk_quartz_display_open (const gchar *name);
|
||||
|
||||
/* Display methods - events */
|
||||
void _gdk_quartz_display_queue_events (GdkDisplay *display);
|
||||
gboolean _gdk_quartz_display_has_pending (GdkDisplay *display);
|
||||
|
||||
void _gdk_quartz_display_event_data_copy (GdkDisplay *display,
|
||||
const GdkEvent *src,
|
||||
GdkEvent *dst);
|
||||
void _gdk_quartz_display_event_data_free (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
|
||||
/* Display methods - cursor */
|
||||
GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType type);
|
||||
GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
|
||||
const gchar *name);
|
||||
GdkCursor *_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
|
||||
cairo_surface_t *surface,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
|
||||
gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
|
||||
void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
|
||||
/* Display methods - keymap */
|
||||
GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
/* Display methods - selection */
|
||||
gboolean _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
|
||||
GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
guint32 time,
|
||||
gboolean send_event);
|
||||
GdkWindow * _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
gint _gdk_quartz_display_get_selection_property (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format);
|
||||
void _gdk_quartz_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time);
|
||||
gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
|
||||
const gchar *str);
|
||||
|
||||
/* Screen */
|
||||
GdkScreen *_gdk_quartz_screen_new (void);
|
||||
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
|
||||
|
||||
/* Screen methods - visual */
|
||||
GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen);
|
||||
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
|
||||
gint _gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen);
|
||||
GdkVisualType _gdk_quartz_screen_visual_get_best_type (GdkScreen *screen);
|
||||
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best (GdkScreen *screen);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
|
||||
gint depth);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
|
||||
GdkVisualType visual_type);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
|
||||
gint depth,
|
||||
GdkVisualType visual_type);
|
||||
void _gdk_quartz_screen_query_depths (GdkScreen *screen,
|
||||
gint **depths,
|
||||
gint *count);
|
||||
void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
|
||||
GdkVisualType **visual_types,
|
||||
gint *count);
|
||||
void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
|
||||
GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);
|
||||
|
||||
/* Screen methods - events */
|
||||
void _gdk_quartz_screen_broadcast_client_message (GdkScreen *screen,
|
||||
GdkEvent *event);
|
||||
gboolean _gdk_quartz_screen_get_setting (GdkScreen *screen,
|
||||
const gchar *name,
|
||||
GValue *value);
|
||||
|
||||
gboolean _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
|
||||
GdkWindow *window);
|
||||
void _gdk_quartz_window_gdk_xy_to_xy (gint gdk_x,
|
||||
gint gdk_y,
|
||||
gint *ns_x,
|
||||
gint *ns_y);
|
||||
void _gdk_quartz_window_xy_to_gdk_xy (gint ns_x,
|
||||
gint ns_y,
|
||||
gint *gdk_x,
|
||||
gint *gdk_y);
|
||||
void _gdk_quartz_window_nspoint_to_gdk_xy (NSPoint point,
|
||||
gint *x,
|
||||
gint *y);
|
||||
GdkWindow *_gdk_quartz_window_find_child (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean get_toplevel);
|
||||
void _gdk_quartz_window_attach_to_parent (GdkWindow *window);
|
||||
void _gdk_quartz_window_detach_from_parent (GdkWindow *window);
|
||||
void _gdk_quartz_window_did_become_main (GdkWindow *window);
|
||||
void _gdk_quartz_window_did_resign_main (GdkWindow *window);
|
||||
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
|
||||
gint number);
|
||||
|
||||
void _gdk_quartz_window_update_position (GdkWindow *window);
|
||||
void _gdk_quartz_window_update_fullscreen_state (GdkWindow *window);
|
||||
|
||||
/* Window methods - testing */
|
||||
void _gdk_quartz_window_sync_rendering (GdkWindow *window);
|
||||
gboolean _gdk_quartz_window_simulate_key (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers,
|
||||
GdkEventType key_pressrelease);
|
||||
gboolean _gdk_quartz_window_simulate_button (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
guint button,
|
||||
GdkModifierType modifiers,
|
||||
GdkEventType button_pressrelease);
|
||||
|
||||
/* Window methods - property */
|
||||
gboolean _gdk_quartz_window_get_property (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gulong offset,
|
||||
gulong length,
|
||||
gint pdelete,
|
||||
GdkAtom *actual_property_type,
|
||||
gint *actual_format_type,
|
||||
gint *actual_length,
|
||||
guchar **data);
|
||||
void _gdk_quartz_window_change_property (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
GdkPropMode mode,
|
||||
const guchar *data,
|
||||
gint nelements);
|
||||
void _gdk_quartz_window_delete_property (GdkWindow *window,
|
||||
GdkAtom property);
|
||||
|
||||
|
||||
#endif /* __GDK_INTERNAL_QUARTZ_H__ */
|
||||
@@ -55,6 +55,8 @@
|
||||
#include "gdkquartzkeys.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdkkeys-quartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
#define NUM_KEYCODES 128
|
||||
#define KEYVALS_PER_KEYCODE 4
|
||||
|
||||
85
gdk/quartz/gdkkeys-quartz.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* gdkkeys-quartz.h
|
||||
*
|
||||
* Copyright (C) 2005-2007 Imendio AB
|
||||
*
|
||||
* 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_KEYS_QUARTZ_H__
|
||||
#define __GDK_KEYS_QUARTZ_H__
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_FLAGS_CHANGED = NSFlagsChanged,
|
||||
GDK_QUARTZ_KEY_UP = NSKeyUp,
|
||||
GDK_QUARTZ_KEY_DOWN = NSKeyDown,
|
||||
GDK_QUARTZ_MOUSE_ENTERED = NSMouseEntered,
|
||||
GDK_QUARTZ_MOUSE_EXITED = NSMouseExited,
|
||||
GDK_QUARTZ_SCROLL_WHEEL = NSScrollWheel,
|
||||
GDK_QUARTZ_MOUSE_MOVED = NSMouseMoved,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSOtherMouseDragged,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSRightMouseDragged,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSLeftMouseDragged,
|
||||
GDK_QUARTZ_OTHER_MOUSE_UP = NSOtherMouseUp,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_UP = NSRightMouseUp,
|
||||
GDK_QUARTZ_LEFT_MOUSE_UP = NSLeftMouseUp,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSOtherMouseDown,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSRightMouseDown,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSLeftMouseDown,
|
||||
} GdkQuartzEventType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSAlternateKeyMask,
|
||||
GDK_QUARTZ_CONTROL_KEY_MASK = NSControlKeyMask,
|
||||
GDK_QUARTZ_SHIFT_KEY_MASK = NSShiftKeyMask,
|
||||
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSAlphaShiftKeyMask,
|
||||
GDK_QUARTZ_COMMAND_KEY_MASK = NSCommandKeyMask,
|
||||
GDK_QUARTZ_ANY_EVENT_MASK = NSAnyEventMask,
|
||||
} GdkQuartzEventModifierFlags;
|
||||
|
||||
|
||||
#else
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_FLAGS_CHANGED = NSEventTypeFlagsChanged,
|
||||
GDK_QUARTZ_KEY_UP = NSEventTypeKeyUp,
|
||||
GDK_QUARTZ_KEY_DOWN = NSEventTypeKeyDown,
|
||||
GDK_QUARTZ_MOUSE_ENTERED = NSEventTypeMouseEntered,
|
||||
GDK_QUARTZ_MOUSE_EXITED = NSEventTypeMouseExited,
|
||||
GDK_QUARTZ_SCROLL_WHEEL = NSEventTypeScrollWheel,
|
||||
GDK_QUARTZ_MOUSE_MOVED = NSEventTypeMouseMoved,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSEventTypeOtherMouseDragged,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSEventTypeRightMouseDragged,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSEventTypeLeftMouseDragged,
|
||||
GDK_QUARTZ_OTHER_MOUSE_UP = NSEventTypeOtherMouseUp,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_UP = NSEventTypeRightMouseUp,
|
||||
GDK_QUARTZ_LEFT_MOUSE_UP = NSEventTypeLeftMouseUp,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSEventTypeOtherMouseDown,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSEventTypeRightMouseDown,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSEventTypeLeftMouseDown,
|
||||
} GdkQuartzEventType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSEventModifierFlagOption,
|
||||
GDK_QUARTZ_CONTROL_KEY_MASK = NSEventModifierFlagControl,
|
||||
GDK_QUARTZ_SHIFT_KEY_MASK = NSEventModifierFlagShift,
|
||||
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSEventModifierFlagCapsLock,
|
||||
GDK_QUARTZ_COMMAND_KEY_MASK = NSEventModifierFlagCommand,
|
||||
} GdkQuartzEventModifierFlags;
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __GDK_KEYS_QUARTZ_H__ */
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "gdkmonitor-quartz.h"
|
||||
#include "gdkdisplay-quartz.h"
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GdkQuartzMonitor, gdk_quartz_monitor, GDK_TYPE_MONITOR)
|
||||
|
||||
static void
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "gdkquartzmonitor.h"
|
||||
#include "gdkprivate-quartz.h"
|
||||
#include "gdkinternal-quartz.h"
|
||||
|
||||
struct _GdkQuartzMonitor
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* gdkwindow-quartz.c
|
||||
/* gdkprivate-quartz.h
|
||||
*
|
||||
* Copyright (C) 2005-2007 Imendio AB
|
||||
*
|
||||
@@ -19,15 +19,6 @@
|
||||
#ifndef __GDK_PRIVATE_QUARTZ_H__
|
||||
#define __GDK_PRIVATE_QUARTZ_H__
|
||||
|
||||
#define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
|
||||
#define GDK_QUARTZ_RELEASE_POOL [pool release]
|
||||
|
||||
#include <gdk/gdkprivate.h>
|
||||
#include <gdk/quartz/gdkquartz.h>
|
||||
#include <gdk/quartz/gdkdevicemanager-core-quartz.h>
|
||||
#include <gdk/quartz/gdkdnd-quartz.h>
|
||||
#include <gdk/quartz/gdkscreen-quartz.h>
|
||||
#include <gdk/quartz/gdkwindow-quartz.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
@@ -35,215 +26,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
extern GdkDisplay *_gdk_display;
|
||||
extern GdkScreen *_gdk_screen;
|
||||
extern GdkWindow *_gdk_root;
|
||||
|
||||
extern GdkDragContext *_gdk_quartz_drag_source_context;
|
||||
|
||||
#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindow *)win)->impl))
|
||||
|
||||
/* Initialization */
|
||||
void _gdk_quartz_window_init_windowing (GdkDisplay *display,
|
||||
GdkScreen *screen);
|
||||
void _gdk_quartz_events_init (void);
|
||||
void _gdk_quartz_event_loop_init (void);
|
||||
|
||||
/* Cursor */
|
||||
NSCursor *_gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor);
|
||||
|
||||
/* Events */
|
||||
typedef enum {
|
||||
GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
|
||||
} GdkQuartzEventSubType;
|
||||
|
||||
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
|
||||
gboolean got_focus);
|
||||
void _gdk_quartz_events_send_map_event (GdkWindow *window);
|
||||
|
||||
GdkModifierType _gdk_quartz_events_get_current_keyboard_modifiers (void);
|
||||
GdkModifierType _gdk_quartz_events_get_current_mouse_modifiers (void);
|
||||
|
||||
void _gdk_quartz_events_break_all_grabs (guint32 time);
|
||||
|
||||
/* Event loop */
|
||||
gboolean _gdk_quartz_event_loop_check_pending (void);
|
||||
NSEvent * _gdk_quartz_event_loop_get_pending (void);
|
||||
void _gdk_quartz_event_loop_release_event (NSEvent *event);
|
||||
|
||||
/* Keys */
|
||||
GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
|
||||
gboolean _gdk_quartz_keys_is_modifier (guint keycode);
|
||||
void _gdk_quartz_synthesize_null_key_event (GdkWindow *window);
|
||||
|
||||
/* Drag and Drop */
|
||||
void _gdk_quartz_window_register_dnd (GdkWindow *window);
|
||||
GdkDragContext * _gdk_quartz_window_drag_begin (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GList *targets,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
|
||||
/* Display */
|
||||
|
||||
GdkDisplay * _gdk_quartz_display_open (const gchar *name);
|
||||
|
||||
/* Display methods - events */
|
||||
void _gdk_quartz_display_queue_events (GdkDisplay *display);
|
||||
gboolean _gdk_quartz_display_has_pending (GdkDisplay *display);
|
||||
|
||||
void _gdk_quartz_display_event_data_copy (GdkDisplay *display,
|
||||
const GdkEvent *src,
|
||||
GdkEvent *dst);
|
||||
void _gdk_quartz_display_event_data_free (GdkDisplay *display,
|
||||
GdkEvent *event);
|
||||
|
||||
/* Display methods - cursor */
|
||||
GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType type);
|
||||
GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
|
||||
const gchar *name);
|
||||
GdkCursor *_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
|
||||
cairo_surface_t *surface,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
|
||||
gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
|
||||
void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
|
||||
/* Display methods - keymap */
|
||||
GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
/* Display methods - selection */
|
||||
gboolean _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
|
||||
GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
guint32 time,
|
||||
gboolean send_event);
|
||||
GdkWindow * _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
|
||||
GdkAtom selection);
|
||||
gint _gdk_quartz_display_get_selection_property (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
guchar **data,
|
||||
GdkAtom *ret_type,
|
||||
gint *ret_format);
|
||||
void _gdk_quartz_display_convert_selection (GdkDisplay *display,
|
||||
GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time);
|
||||
gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
|
||||
GdkAtom encoding,
|
||||
gint format,
|
||||
const guchar *text,
|
||||
gint length,
|
||||
gchar ***list);
|
||||
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
|
||||
const gchar *str);
|
||||
|
||||
/* Screen */
|
||||
GdkScreen *_gdk_quartz_screen_new (void);
|
||||
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
|
||||
|
||||
/* Screen methods - visual */
|
||||
GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen);
|
||||
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
|
||||
gint _gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen);
|
||||
GdkVisualType _gdk_quartz_screen_visual_get_best_type (GdkScreen *screen);
|
||||
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best (GdkScreen *screen);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
|
||||
gint depth);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
|
||||
GdkVisualType visual_type);
|
||||
GdkVisual* _gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
|
||||
gint depth,
|
||||
GdkVisualType visual_type);
|
||||
void _gdk_quartz_screen_query_depths (GdkScreen *screen,
|
||||
gint **depths,
|
||||
gint *count);
|
||||
void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
|
||||
GdkVisualType **visual_types,
|
||||
gint *count);
|
||||
void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
|
||||
GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);
|
||||
|
||||
/* Screen methods - events */
|
||||
void _gdk_quartz_screen_broadcast_client_message (GdkScreen *screen,
|
||||
GdkEvent *event);
|
||||
gboolean _gdk_quartz_screen_get_setting (GdkScreen *screen,
|
||||
const gchar *name,
|
||||
GValue *value);
|
||||
|
||||
|
||||
/* Window */
|
||||
gboolean _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
|
||||
GdkWindow *window);
|
||||
void _gdk_quartz_window_gdk_xy_to_xy (gint gdk_x,
|
||||
gint gdk_y,
|
||||
gint *ns_x,
|
||||
gint *ns_y);
|
||||
void _gdk_quartz_window_xy_to_gdk_xy (gint ns_x,
|
||||
gint ns_y,
|
||||
gint *gdk_x,
|
||||
gint *gdk_y);
|
||||
void _gdk_quartz_window_nspoint_to_gdk_xy (NSPoint point,
|
||||
gint *x,
|
||||
gint *y);
|
||||
GdkWindow *_gdk_quartz_window_find_child (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gboolean get_toplevel);
|
||||
void _gdk_quartz_window_attach_to_parent (GdkWindow *window);
|
||||
void _gdk_quartz_window_detach_from_parent (GdkWindow *window);
|
||||
void _gdk_quartz_window_did_become_main (GdkWindow *window);
|
||||
void _gdk_quartz_window_did_resign_main (GdkWindow *window);
|
||||
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
|
||||
gint number);
|
||||
|
||||
void _gdk_quartz_window_update_position (GdkWindow *window);
|
||||
void _gdk_quartz_window_update_fullscreen_state (GdkWindow *window);
|
||||
|
||||
/* Window methods - testing */
|
||||
void _gdk_quartz_window_sync_rendering (GdkWindow *window);
|
||||
gboolean _gdk_quartz_window_simulate_key (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers,
|
||||
GdkEventType key_pressrelease);
|
||||
gboolean _gdk_quartz_window_simulate_button (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
guint button,
|
||||
GdkModifierType modifiers,
|
||||
GdkEventType button_pressrelease);
|
||||
|
||||
/* Window methods - property */
|
||||
gboolean _gdk_quartz_window_get_property (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gulong offset,
|
||||
gulong length,
|
||||
gint pdelete,
|
||||
GdkAtom *actual_property_type,
|
||||
gint *actual_format_type,
|
||||
gint *actual_length,
|
||||
guchar **data);
|
||||
void _gdk_quartz_window_change_property (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
GdkPropMode mode,
|
||||
const guchar *data,
|
||||
gint nelements);
|
||||
void _gdk_quartz_window_delete_property (GdkWindow *window,
|
||||
GdkAtom property);
|
||||
|
||||
|
||||
#endif /* __GDK_PRIVATE_QUARTZ_H__ */
|
||||
|
||||
50
gdk/quartz/gdkquartz-gtk-only.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* gdkquartz-gtk-only.h
|
||||
*
|
||||
* Copyright (C) 2005-2007 Imendio AB
|
||||
*
|
||||
* 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_QUARTZ_GTK_ONLY_H__
|
||||
#define __GDK_QUARTZ_GTK_ONLY_H__
|
||||
|
||||
#if !(defined (GTK_COMPILATION) || defined (GDK_COMPILATION))
|
||||
#error "This API is for use only in Gtk internal code."
|
||||
#endif
|
||||
|
||||
#include <Appkit/Appkit.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/quartz/gdkquartz.h>
|
||||
|
||||
/* Drag and Drop/Clipboard */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom);
|
||||
|
||||
/* Utilities */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
|
||||
|
||||
/* Window */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSWindow *gdk_quartz_window_get_nswindow (GdkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSView *gdk_quartz_window_get_nsview (GdkWindow *window);
|
||||
|
||||
#endif
|
||||
@@ -20,26 +20,11 @@
|
||||
#ifndef __GDK_QUARTZ_H__
|
||||
#define __GDK_QUARTZ_H__
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* NSInteger only exists in Leopard and newer. This check has to be
|
||||
* done after inclusion of the system headers. If NSInteger has not
|
||||
* been defined, we know for sure that we are on 32-bit.
|
||||
*/
|
||||
#ifndef NSINTEGER_DEFINED
|
||||
typedef int NSInteger;
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif
|
||||
|
||||
#ifndef CGFLOAT_DEFINED
|
||||
typedef float CGFloat;
|
||||
#endif
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_OSX_UNSUPPORTED = 0,
|
||||
@@ -62,13 +47,6 @@ typedef enum
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkOSXVersion gdk_quartz_osx_version (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#define __GDKQUARTZ_H_INSIDE__
|
||||
@@ -78,7 +56,6 @@ G_END_DECLS
|
||||
#include <gdk/quartz/gdkquartzdevicemanager-core.h>
|
||||
#include <gdk/quartz/gdkquartzdisplay.h>
|
||||
#include <gdk/quartz/gdkquartzdisplaymanager.h>
|
||||
#include <gdk/quartz/gdkquartzdnd.h>
|
||||
#include <gdk/quartz/gdkquartzkeys.h>
|
||||
#include <gdk/quartz/gdkquartzmonitor.h>
|
||||
#include <gdk/quartz/gdkquartzscreen.h>
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
#ifndef __GDK_QUARTZ_DND_H__
|
||||
#define __GDK_QUARTZ_DND_H__
|
||||
|
||||
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdkquartz.h> can be included directly."
|
||||
#if !defined (GTK_COMPILATION) && !defined (GDK_COMPILATION)
|
||||
#error "gdkquartzdnd.h is for Gtk's internal use only"
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
@@ -45,79 +45,6 @@ typedef struct _GdkQuartzKeymapClass GdkQuartzKeymapClass;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_quartz_keymap_get_type (void);
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_FLAGS_CHANGED = NSFlagsChanged,
|
||||
GDK_QUARTZ_KEY_UP = NSKeyUp,
|
||||
GDK_QUARTZ_KEY_DOWN = NSKeyDown,
|
||||
GDK_QUARTZ_MOUSE_ENTERED = NSMouseEntered,
|
||||
GDK_QUARTZ_MOUSE_EXITED = NSMouseExited,
|
||||
GDK_QUARTZ_SCROLL_WHEEL = NSScrollWheel,
|
||||
GDK_QUARTZ_MOUSE_MOVED = NSMouseMoved,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSOtherMouseDragged,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSRightMouseDragged,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSLeftMouseDragged,
|
||||
GDK_QUARTZ_OTHER_MOUSE_UP = NSOtherMouseUp,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_UP = NSRightMouseUp,
|
||||
GDK_QUARTZ_LEFT_MOUSE_UP = NSLeftMouseUp,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSOtherMouseDown,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSRightMouseDown,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSLeftMouseDown,
|
||||
} GdkQuartzEventType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSAlternateKeyMask,
|
||||
GDK_QUARTZ_CONTROL_KEY_MASK = NSControlKeyMask,
|
||||
GDK_QUARTZ_SHIFT_KEY_MASK = NSShiftKeyMask,
|
||||
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSAlphaShiftKeyMask,
|
||||
GDK_QUARTZ_COMMAND_KEY_MASK = NSCommandKeyMask,
|
||||
GDK_QUARTZ_ANY_EVENT_MASK = NSAnyEventMask,
|
||||
} GdkQuartzEventModifierFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_EVENT_MASK_ANY = NSAnyEventMask,
|
||||
} GdkQuartzEventMask;
|
||||
|
||||
#else
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_FLAGS_CHANGED = NSEventTypeFlagsChanged,
|
||||
GDK_QUARTZ_KEY_UP = NSEventTypeKeyUp,
|
||||
GDK_QUARTZ_KEY_DOWN = NSEventTypeKeyDown,
|
||||
GDK_QUARTZ_MOUSE_ENTERED = NSEventTypeMouseEntered,
|
||||
GDK_QUARTZ_MOUSE_EXITED = NSEventTypeMouseExited,
|
||||
GDK_QUARTZ_SCROLL_WHEEL = NSEventTypeScrollWheel,
|
||||
GDK_QUARTZ_MOUSE_MOVED = NSEventTypeMouseMoved,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSEventTypeOtherMouseDragged,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSEventTypeRightMouseDragged,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSEventTypeLeftMouseDragged,
|
||||
GDK_QUARTZ_OTHER_MOUSE_UP = NSEventTypeOtherMouseUp,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_UP = NSEventTypeRightMouseUp,
|
||||
GDK_QUARTZ_LEFT_MOUSE_UP = NSEventTypeLeftMouseUp,
|
||||
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSEventTypeOtherMouseDown,
|
||||
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSEventTypeRightMouseDown,
|
||||
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSEventTypeLeftMouseDown,
|
||||
} GdkQuartzEventType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSEventModifierFlagOption,
|
||||
GDK_QUARTZ_CONTROL_KEY_MASK = NSEventModifierFlagControl,
|
||||
GDK_QUARTZ_SHIFT_KEY_MASK = NSEventModifierFlagShift,
|
||||
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSEventModifierFlagCapsLock,
|
||||
GDK_QUARTZ_COMMAND_KEY_MASK = NSEventModifierFlagCommand,
|
||||
} GdkQuartzEventModifierFlags;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_QUARTZ_EVENT_MASK_ANY = NSEventMaskAny,
|
||||
} GdkQuartzEventMask;
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_QUARTZ_KEYS_H__ */
|
||||
|
||||
@@ -28,10 +28,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_3_12
|
||||
gunichar gdk_quartz_get_key_equivalent (guint key);
|
||||
|
||||
|
||||