Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen 8e9c6171b6 3.24.26 2021-02-23 09:31:37 -05:00
609 changed files with 128800 additions and 104412 deletions
+5 -7
View File
@@ -7,13 +7,13 @@ cache:
- _ccache/
fedora-autotools:
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v3
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v1
stage: build
script:
- bash -x ./.gitlab-ci/test-docker-autotools.sh
fedora-distcheck:
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v3
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v1
variables:
DO_DISTCHECK: "yes"
when: manual
@@ -22,7 +22,7 @@ fedora-distcheck:
- bash -x ./.gitlab-ci/test-docker-autotools.sh
fedora-meson:
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v3
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v1
stage: build
variables:
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
@@ -36,7 +36,7 @@ fedora-meson:
- "_build/testsuite/reftests/output"
debian-meson:
image: registry.gitlab.gnome.org/gnome/gtk/debian-gtk3:v2
image: registry.gitlab.gnome.org/gnome/gtk/debian-gtk3:v1
stage: build
variables:
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
@@ -50,7 +50,7 @@ debian-meson:
- "_build/testsuite/reftests/output"
reference:
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v3
image: registry.gitlab.gnome.org/gnome/gtk/fedora-gtk3:v1
stage: docs
variables:
EXTRA_MESON_FLAGS: "--buildtype=release -Dgtk_doc=true -Dman=true"
@@ -79,8 +79,6 @@ msys2-mingw64-meson:
name: "gtk3-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}"
paths:
- "_build/meson-logs"
- "_build/gdk/libgdk-3-0.dll"
- "_build/gtk/libgtk-3-0.dll"
msys2-mingw64-autotools:
when: manual
+1 -1
View File
@@ -1,4 +1,4 @@
FROM debian:bullseye
FROM debian:buster
RUN apt-get update -qq && apt-get install --no-install-recommends -qq -y \
adwaita-icon-theme \
+2 -2
View File
@@ -1,4 +1,4 @@
FROM fedora:35
FROM fedora:31
RUN dnf -y install \
adwaita-icon-theme \
@@ -44,7 +44,7 @@ RUN dnf -y install \
libXtst-devel \
make \
mesa-libEGL-devel \
'pkgconfig(wayland-egl)' \
mesa-libwayland-egl-devel \
meson \
ninja-build \
pango-devel \
+1 -1
View File
@@ -15,7 +15,7 @@ meson \
-Dx11_backend=true \
-Dwayland_backend=true \
-Dxinerama=yes \
-Dprint_backends="file,lpr,test,cups" \
-Dprint_backends="file,lpr,test,cloudprint,cups" \
${EXTRA_MESON_FLAGS:-} \
_build
+1 -1
View File
@@ -15,7 +15,7 @@ EXTRA_DIST += \
INSTALL.in \
NEWS.pre-1-0 \
README.commits \
README.win32.md \
README.win32 \
check-version.py \
config.h.win32 \
makefile.msc \
-371
View File
@@ -1,374 +1,3 @@
Overview of Changes in GTK+ 3.24.35, 11-22-2022
===============================================
* GtkFontChooserWidget:
- Fix a critical
* GtkAccelLabel:
- Differentiate keypad keysyms in accelerators
* Input:
- Recognize stylus devices as pens
- Fix problems with motion compression
* Windows:
- Build system improvements
* Wayland:
- Fix problems with unreliable DND
- Use GLES if required
- Add support for titlebar gestures
- Refactor handling of IM client updates
- Fix cursor hotspots with scaled surfaces
- Use the xdg-activation protocol
- Load cursors on demand
- Fix cursor size on hi-dpi displays
* MacOS:
- Use a CVDisplayLink based frame clock
- Translation updates:
Abkhazian
Bulgarian
Catalan
Chinese (Taiwan)
Croatian
Dutch
Friulian
Georgian
German
Hungarian
Indonesian
Occitan
Persian
Portuguese
Polish
Russian
Serbian
Slovenian
Swedish
Turkish
Ukrainian
Overview of Changes in GTK+ 3.24.34, 05-18-2022
===============================================
* Include legacy hicolor icons
* Fix the build with gcc 12
* MacOS:
- Restore QUARTZ_RELOCATION support
* X11:
- Trap errors when getting output properties
* Wayland:
- Ignore empty preedit updates This fixes a problem with
textview scrolling
* Translation updates
Danish
Dutch
French
German
Hungarian
Italian
Kazakh
Latvian
Lithuanian
Norwegian Bokmål
Swedish
Overview of Changes in GTK+ 3.24.33, 04-03-2022
===============================================
* No changes
Overview of Changes in GTK+ 3.24.32, 03-03-2022
===============================================
* GtkCellRendererProgress:
- Use tabular figures
* GtkFontChooser:
- Fix the build with older Pango
- Fix axis name handling
* Theme:
- Fix border color for tiled windows
* Accessibility:
- Fix cell accessible leak
* Wayland:
- Support new high-contrast setting
- Only update scale when on any outputs
* Windows:
- Various build fixes
- Fix keyboard state handling
- Fix capslock handling
- Fix AltGr not working
* MacOS:
- Fix the build on 10.11
- Make Dock "Quit" invoke the app.quit action
- Correctly handle HiDPI cursors
* Translation updates
Basque
Brazilian Portuguese
Catalan
Chinese (China)
Croatian
Czech
French
Galician
Hebrew
Indonesian
Korean
Persian
Polish
Portuguese
Romanian
Russian
Serbian
Slovenian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in GTK+ 3.24.31, 20-12-2021
===============================================
* input:
- Fix a crash with touch on GtkScale
* clipboard:
- Avoid a double-free
* css:
- Avoid a crash with radial gradients
* GtkFileChooser:
- Don't leak search results
* GtkTextView:
- Support css letterspacing
* Wayland:
- Reset position when hiding popups
- Ignore globals we did not bind ourselves
- Avoid infinite loops when hiding surfaces
- Avoid clipboard-related lockups
* X11:
- Trap errors while doing XRANDR calls
- Support touchpad gestures with XI 2.4
* win32:
- Some OpenGL setup fixes
- Fall back to GLES for OpenGL
- Fix MinGW autotools build
- Fix building on Windows 11
- Support building with Visual Studio 2022
- Improve DND across monitors
- Rewrite keymap handling code
* macOS:
- Accept NSPasteboardTypeFileURL drops
- Build on macOS 12
- Fix display on macOS 12
- Fix keyboard layout notifications
- Fix a crash
- Improve performance on Big Sur
* Translation updates:
Basque
Brazilian Portuguese
Chinese (China)
Chinese (Taiwan)
Croatian
Czech
Danish
Dutch
Finnish
French
Friulian
Galician
German
Hungarian
Icelandic
Italian
Kazakh
Korean
Latvian
Occitan
Persian
Russian
Serbian
Spanish
Swedish
Overview of Changes in GTK+ 3.24.30
===================================
* Input:
- Ignore NoSymbol key events (happens with some XKB options)
- Fix incomplete reset in some cases
* GtkEmojiChooser:
- Update data from CLDR 39
- Support translated keywords for multiple languages
- Allow inserting multiple Emoji with Ctrl
- Match keywords for search
- Fix a memory leak
* GtkFileChooser:
- Accessibility improvements
* GtkTreeView
- Fix an accessibility-related memory leak
- Fix assertion failures in some cases
* Printing:
- Remove the Google Cloud Print backend, since the
service was shut down
* Wayland:
- Work with pointer-gestures v1 protocol
* Win32:
- Fix using GL with Mesa drivers
- Add support for Windows Pointer Input stack
* MacOS:
- Fix a crash with Drag-and-Drop
* Translation updates:
Belarusian
Brazilian Portuguese
British English
Catalan
Indonesian
Lithuanian
Nepali
Norwegian Bokmål
Occitan
Portuguese
Romanian
Russian
Serbian
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in GTK+ 3.24.29
===================================
* Input:
- Look for a Compose file in the right place (~/.config/gtk-3.0)
- Revert some Compose sequence changes (mainly around dead
acute and apostrophe)
- Consume all key events during preedit, to avoid unexpected
interactions
- Ignore more modifiers during preedit, to allow using 3rd and
5th level choosers
- Fix handling of cursor positions in non-ASCII preedit text
* GtkSpinButton:
- Interpret localized digits
* GtkScale:
- Fix sporadic criticals
* GtkScrolledWindow:
- Cancel overshoot on size changes
- Avoid criticals with non-overlay scrollbars
* GtkFileChooser:
- Handle smb mounts better
* GtkListBox:
- Fix extending multi-selections
* Fix a possible crash in gtk_show_uri
* Wayland:
- Improve font settings fallback
* X11:
- Avoid log spam on exit
- Don't beep on untrusted displays
* OS X:
- Fix building on OS X 10.11
- Add gdk-quartz-cocoa-access.h with api that provides
access to native objects
* Translation updates:
Dutch
Nepali
Swedish
Overview of Changes in GTK+ 3.24.28
===================================
* Input:
- Improve dead key handling
* CSS:
- Fix rendering of scaled text shadows
* Wayland:
- Fix matching of accelerators with multiple layouts
* X11:
- Trap errors from the COW
* Build:
- Make gtk3-update-icon-cache output reproducible
* Translation updates:
Serbian
Overview of Changes in GTK+ 3.24.27
===================================
* Input: Ensure preedit-start and preedit-end
are emitted properly
* GtkScrolledWindow:
- Revert a change that broke touch scrolling
* Theme:
- Fix a problem with size changes in SSD decorations
that caused mutter crashes
- Use transparent black for window border in the dark theme
* Windows:
- Memory leak fixes
- Fix unresponsive windows after tablet input
- Add support for wheel and rotation axes
* Translation updates:
Belarusian
German
Kazakh
Korean
Latvian
Turkish
Overview of Changes in GTK+ 3.24.26
===================================
+314
View File
@@ -0,0 +1,314 @@
The Win32 backend in GTK+ is not as stable or correct as the X11 one.
For prebuilt runtime and developer packages see
http://ftp.gnome.org/pub/gnome/binaries/win32/
Building GTK+ on Win32
======================
First you obviously need developer packages for the compile-time
dependencies: GDK-Pixbuf, Pango, atk, glib, gettext-runtime, libiconv at least.
See http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
For people compiling GTK+ with Visual C++ or later, it is recommended that
the same compiler is used for at least GDK-Pixbuf, Pango, atk and glib
so that crashes and errors caused by different CRTs can be avoided. Currently
building with Visual Studio 2008 or later is supported, either via Visual Studio
project files or via the Meson build system, as described in the below sections.
Interchanging between Visual Studio 2015, 2017 and 2019 builds should be fine
as they use the same CRT (UCRT) DLLs.
After installing the dependencies, there are two ways to build GTK+
for win32.
1) GNU tools, ./configure && make install
-----------------------------------------
This requires you have mingw and MSYS.
Use the configure script, and the resulting Makefiles (which use
libtool and gcc to do the compilation). I use this myself, but it can
be hard to setup correctly.
The full script I run to build GTK+ 2.16 unpacked from a source
distribution is as below. This is from bulding GTK+ 2.16.5. I don't
use any script like this to build the development branch, as I don't
distribute any binaries from development branches.
# This is a shell script that calls functions and scripts from
# tml@iki.fi's personal work envíronment. It is not expected to be
# usable unmodified by others, and is included only for reference.
MOD=gtk+
VER=2.16.5
REV=1
ARCH=win32
THIS=${MOD}_${VER}-${REV}_${ARCH}
RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip
HEX=`echo $THIS | md5sum | cut -d' ' -f1`
TARGET=c:/devel/target/$HEX
usedev
usemsvs6
(
set -x
DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`
PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`
PKG_CONFIG_PATH=
for D in $DEPS; do
PATH=/devel/dist/${ARCH}/$D/bin:$PATH
[ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
done
LIBPNG=`latest --arch=${ARCH} libpng`
ZLIB=`latest --arch=${ARCH} zlib`
LIBTIFF=`latest --arch=${ARCH} libtiff`
JPEG=`latest --arch=${ARCH} jpeg`
patch -p0 <<'EOF'
EOF
lt_cv_deplibs_check_method='pass_all' \
CC='gcc -mtune=pentium3 -mthreads' \
CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \
-I/devel/dist/${ARCH}/${ZLIB}/include \
-I/devel/dist/${ARCH}/${LIBTIFF}/include \
-I/devel/dist/${ARCH}/${JPEG}/include \
-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \
LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
-L/devel/dist/${ARCH}/${ZLIB}/lib \
-L/devel/dist/${ARCH}/${LIBTIFF}/lib \
-L/devel/dist/${ARCH}/${JPEG}/lib \
-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \
-Wl,--enable-auto-image-base" \
LIBS=-lintl \
CFLAGS=-O2 \
./configure \
--enable-win32-backend \
--disable-gdiplus \
--with-included-immodules \
--without-libjasper \
--enable-debug=yes \
--enable-explicit-deps=no \
--disable-gtk-doc \
--disable-static \
--prefix=$TARGET &&
libtoolcacheize &&
rm gtk/gtk.def &&
(PATH="$PWD/gdk-pixbuf/.libs:/devel/target/$HEX/bin:$PATH" make -j3 install || (rm .libtool-cache* && PATH="/devel/target/$HEX/bin:$PATH" make -j3 install)) &&
PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|LoaderDir =' <$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp &&
mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
./gtk-zip.sh &&
mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&
mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP
) 2>&1 | tee /devel/src/tml/packaging/$THIS.log
(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
manifestify /tmp/$RUNZIP /tmp/$DEVZIP
You should not just copy the above blindly. There are some things in
the script that are very specific to *my* build setup on *my* current
machine. For instance the "latest" command, the "usedev" and
"usemsvs6" shell functions, the /devel/dist folder. The above script
is really just meant for reference, to give an idea. You really need
to understand what things like PKG_CONFIG_PATH are and set them up
properly after installing the dependencies before building GTK+.
As you see above, after running configure, one can just say "make
install", like on Unix. A post-build fix is needed, running
gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders
file.
For a 64-bit build you need to remove the gtk/gtk.def file and let it
be regenerated by the makefilery. This is because the 64-bit GTK dll
has a slightly different list of exported function names. This is on
purpose and not a bug. The API is the same at the source level, and
the same #defines of some function names to actually have a _utf8
suffix is used (just to keep the header simpler). But the
corresponding non-suffixed function to maintain ABI stability are not
needed in the 64-bit case (because there are no older EXEs around that
would require such for ABI stability).
2) Microsoft's tools
--------------------
There are VS 2008~2019 solution and project files to build GTK+, which
are maintained by Chun-wei Fan. They should build GTK+ out of the box,
provided that the afore-mentioned dependencies are installed. They will
build GDK with the Win32 backend, GTK+ itself (with GAIL/a11y built in),
the GAIL-Util library and the gtk-demo program. Please also refer to the
README file(s) that reside in win32 on how to enable additional features
that are not enabled by default, such as EGL support via libANGLE, which
emulate the GL/EGL calls using Direct3D 9/11.
Please refer to the following GNOME Live! page for a more detailed ouline
on the process of building the GTK+ stack and its dependencies with Visual
C++:
https://wiki.gnome.org/Projects/GTK+/Win32/MSVCCompilationOfGTKStack
Alternative 1 also generates Microsoft import libraries (.lib), if you
have lib.exe available. It might also work for cross-compilation from
Unix.
I (Tor) use method 1 myself. Hans Breuer has been taking care of the MSVC
makefiles. At times, we disagree a bit about various issues, and for
instance the makefile.msc files might not produce identically named
DLLs and import libraries as the "autoconfiscated" makefiles and
libtool do. If this bothers you, you will have to fix the makefiles.
If desiring to build binaries for ARM64 (aarch64), one needs to use the
Visual Studio 2017 or 2019 solution files, or use Meson with a
cross-compilation file, with a Windows 10 SDK that supports ARM64
builds. At this point, building the introspection files is not supported
for ARM64 builds, and you will need a Python interpreter and
glib-compile-resources binaries that run on the build machine. For Visual Studio
2017 ARM64 builds, do also check the Directory.Build.props file in $(srcroot)/win32/vs15
indicates a Windows 10 SDK version that supports ARM64 builds exists on the build machine.
For building ARM64 binaries with the Visual Studio projects, prior to the build,
you may need to update gtk3-gen-srcs.props to pass in the variables GLIB_MKENUMS,
GLIB_GENMARSHAL, GDBUS_CODEGEN and/or GLIB_COMPILE_RESOURCES in the nmake command line
indicated by <GenerateRequiredSourcesBase> so that they point to the glib-mkenums,
glib-genmarshal, gdbus-codegen and glib-compile-resources that will run on the build
machine. You may also need to update gtk3-version-paths.props to update PythonDir to
the installation of the Python interpreter that will run on the build machine. To carry
out the actual build using the solution files, use the "Configuration Manager" to add the
ARM64 build configs by copying the settings from the x64 configs, and then build the solution.
The build instructions for such builds otherwise follow the standard Win32 (x86) and
x64 builds, but you need to ensure that you have ARM64 builds of the various dependencies.
3) Using Meson (for Visual Studio and MinGW builds)
---
Meson can now be used to build GTK+-3.x with either MinGW or Visual Studio.
You will need the following items in addition to all the dependencies
listed above:
- Python 3.5 or later
- Meson build system, 0.48.0 or later
- Ninja (if not using the Visual Studio project generator for
Visual Studio 2010, 2015, 2017, 2019)
- CMake (optional, used for dependency searching)
- pkg-config (optional, or some compatible tool, highly recommended)
For all Windows builds, note that unless -Dbuiltin_immodules=no is specified,
the input modules (immodules) are built directly into the GTK DLL.
For building with Meson using Visual Studio, do the following:
Create an empty build directory somewhere that is on the same drive
as the source tree, and launch the Visual Studio command prompt that
matches the build configuration (Visual Studio version and architecture),
and run the following:
- Ensure that both the installation directory of Python and its script
directory is in your PATH, as well as the Ninja, CMake and pkg-config
executables (if used). If a pkg-config compatible drop-in replacement
tool is being used, ensure that PKG_CONFIG is set to point to the
executable of that tool as well.
- For non-GNOME dependencies (such as Cairo and Harfbuzz), where pkg-config
files or CMake files could not be properly located, set INCLUDE and LIB
to ensure that their header files and .lib files can be found respectively.
The DLLs of those dependencies should also be in the PATH during the build
as well, especially if introspection files are to be built.
- For GNOME dependencies, the pkg-config files for those dependencies should
be searchable by pkg-config (or a compatible tool). Verify this by running
$(PKG_CONFIG) --modversion <dependency>.
- Run the following:
meson <path_to_directory_of_this_file> --buildtype=... --prefix=...,
where buildtype can be release, debugoptimized, debug or plain. Please
refer to the Meson documentation for more details. You may also wish to
pass in -Dbroadway_backend=true if building the Broadway GDK backend is
desired, and/or pass in -Dbuiltin_immodules=no to build the immodules as
standalone DLLs that can be loaded by GTK dynamically. For Visual Studio
2010, 2015, 2017 and 2019 builds, you may pass in --backend=vs to generate
Visual Studio project files to be used to carry out the builds.
If you are building with Visual Studio 2008, note the following items as well:
- For x64 builds, the compiler may hang when building the certain files, due
to optimization issues in the compiler. If this happens, use the Windows
Task Manager and terminate all cl.exe processes, and the build will fail
with the source files that did not finish compiling due to the hang.
Look for them in build.ninja in the build directory, and change their compiler
flag "/O2" to "/O1", and the compilation and linking should proceed normally.
At this time of writing, the following files are known to cause this hang:
gtk\gtkfilechoosernativewin32.c
gtk\gtkfilesystemmodel.c
gtk\gtktextsegment.c
gtk\gtktextbtree.c
gtk\gtkrbtree.c
testsuite\gtk\treemodel.c
testsuite\gtk\textbuffer.c
testsuite\gtk\rbtree.c
testsuite\gtk\icontheme.c
- Upon running install (via "ninja install"), it is likely that
gtk-query-immodules-3.0.exe will fail to run as it cannot find msvcr90.dll or
msvcr90D.dll. You can ignore this if you did not specify -Dbuiltin_immodules=no
when configuring via Meson. If -Dbuiltin_immodules=no is specified, you need to
run the following after embedding the manifests as outlined in the next point:
<gtk_install_prefix>\bin\gtk-query-immodules-3.0.exe > <gtk_install_prefix>\lib\gtk-3.0\3.0.0\immodules.cache
- You will need to run the following upon completing install, from the build
directory in the Visual Studio 2008/SDK 6.0 command prompt (third line is not
needed unless -Dbuiltin_immodules=no is specified) so that the built binaries
can run:
for /r %f in (*.dll.manifest) do if exist <gtk_install_prefix>\bin\%~nf mt /manifest %f /outputresource:<gtk_install_prefix>\bin\%~nf;2
for /r %f in (*.exe.manifest) do if exist <gtk_install_prefix>\bin\%~nf mt /manifest %f /outputresource:<gtk_install_prefix>\bin\%~nf;1
for /r %f in (*.dll.manifest) do if exist <gtk_install_prefix>\lib\gtk-3.0\3.0.0\immodules\%~nf mt /manifest %f /outputresource:<gtk_install_prefix>\lib\gtk-3.0\3.0.0\immodules\%~nf;2
- The more modern visual style for the print dialog is not applied for Visual
Studio 2008 builds. Any solutions to this is really appreciated.
Using GTK+ on Win32
===================
To use GTK+ on Win32, you also need either one of the above mentioned
compilers. Other compilers might work, but don't count on it. Look for
prebuilt developer packages (DLLs, import libraries, headers) on the
above website.
Multi-threaded use of GTK+ on Win32
===================================
Multi-threaded GTK+ programs might work on Windows in special simple
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
in the same thread, it might work. Otherwise, probably not at
all. Possible ways to fix this are being investigated.
Wintab
======
The tablet support uses the Wintab API. The Wintab development kit is
no longer required. The wintab.h header file is bundled with GTK+
sources. Unfortunately it seems that only Wacom tablets come with
support for the Wintab API nowadays.
--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
--Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>
-484
View File
@@ -1,484 +0,0 @@
Notes on running GTK on Windows in general
===
The Win32 backend in GTK+ is not as stable or correct as the X11 one.
For prebuilt runtime and developer packages see
http://ftp.gnome.org/pub/gnome/binaries/win32/
Notes on using OpenGL (GtkGLArea/GdkGLArea) on Win32
===
Note that on Windows, if one is running Nahimic 3 on a system with
nVidia graphics, one needs to stop the "Nahimic service" or insert
the GTK application into the Nahimic blacklist, as noted in
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/297952/nahimic-and-nvidia-drivers-conflict/2334568/
if using programs that utilise GtkGLArea and/or GdkGLArea, or use
GDK_GL=gles if you know that GLES support is enabled for the build.
This is a known issue, as the above link indicates, and affects quite
a number of applications--sadly, since this issue lies within the
nVidia graphics driver and/or the Nahimic 3 code, we are not able
to rememdy this on the GTK side; the best bet before trying the above
workarounds is to try to update your graphics drivers and Nahimic
installation.
Building GTK+ on Win32
===
First you obviously need developer packages for the compile-time
dependencies: GDK-Pixbuf, Pango, atk, glib, gettext-runtime, libiconv at least.
See http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .
For people compiling GTK+ with Visual C++, it is recommended that
the same compiler is used for at least GDK-Pixbuf, Pango, atk and glib
so that crashes and errors caused by different CRTs can be avoided.
Currently building with Visual Studio 2008 or later is supported,
either via Visual Studio project files or via the Meson build system,
as described in the below sections.
For Visual Studio 2008 and 2010, a special setup making use of the Windows
8.0 SDK is required, see at the bottom of this document for guidance.
Interchanging between Visual Studio 2015, 2017, 2019 and 2022 builds
should be fine as they use the same CRT (UCRT) DLLs.
After installing the dependencies, there are two ways to build GTK+
for win32.
GNU tools, ./configure && make install (info here may be out of date,
consider using Meson instead)
---
This requires you have mingw and MSYS.
Use the configure script, and the resulting Makefiles (which use
libtool and gcc to do the compilation). I use this myself, but it can
be hard to setup correctly.
The full script I run to build GTK+ 2.16 unpacked from a source
distribution is as below. This is from bulding GTK+ 2.16.5. I don't
use any script like this to build the development branch, as I don't
distribute any binaries from development branches.
```
# This is a shell script that calls functions and scripts from
# tml@iki.fi's personal work envíronment. It is not expected to be
# usable unmodified by others, and is included only for reference.
MOD=gtk+
VER=2.16.5
REV=1
ARCH=win32
THIS=${MOD}_${VER}-${REV}_${ARCH}
RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip
HEX=`echo $THIS | md5sum | cut -d' ' -f1`
TARGET=c:/devel/target/$HEX
usedev
usemsvs6
(
set -x
DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`
PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`
PKG_CONFIG_PATH=
for D in $DEPS; do
PATH=/devel/dist/${ARCH}/$D/bin:$PATH
[ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
done
LIBPNG=`latest --arch=${ARCH} libpng`
ZLIB=`latest --arch=${ARCH} zlib`
LIBTIFF=`latest --arch=${ARCH} libtiff`
JPEG=`latest --arch=${ARCH} jpeg`
patch -p0 <<'EOF'
EOF
lt_cv_deplibs_check_method='pass_all' \
CC='gcc -mtune=pentium3 -mthreads' \
CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \
-I/devel/dist/${ARCH}/${ZLIB}/include \
-I/devel/dist/${ARCH}/${LIBTIFF}/include \
-I/devel/dist/${ARCH}/${JPEG}/include \
-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \
LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
-L/devel/dist/${ARCH}/${ZLIB}/lib \
-L/devel/dist/${ARCH}/${LIBTIFF}/lib \
-L/devel/dist/${ARCH}/${JPEG}/lib \
-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \
-Wl,--enable-auto-image-base" \
LIBS=-lintl \
CFLAGS=-O2 \
./configure \
--enable-win32-backend \
--disable-gdiplus \
--with-included-immodules \
--without-libjasper \
--enable-debug=yes \
--enable-explicit-deps=no \
--disable-gtk-doc \
--disable-static \
--prefix=$TARGET &&
libtoolcacheize &&
rm gtk/gtk.def &&
(PATH="$PWD/gdk-pixbuf/.libs:/devel/target/$HEX/bin:$PATH" make -j3 install || (rm .libtool-cache* && PATH="/devel/target/$HEX/bin:$PATH" make -j3 install)) &&
PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|LoaderDir =' <$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp &&
mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&
./gtk-zip.sh &&
mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&
mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP
) 2>&1 | tee /devel/src/tml/packaging/$THIS.log
(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
manifestify /tmp/$RUNZIP /tmp/$DEVZIP
```
You should not just copy the above blindly. There are some things in
the script that are very specific to *my* build setup on *my* current
machine. For instance the "latest" command, the "usedev" and
"usemsvs6" shell functions, the `/devel/dist` folder. The above script
is really just meant for reference, to give an idea. You really need
to understand what things like `PKG_CONFIG_PATH` are and set them up
properly after installing the dependencies before building GTK+.
As you see above, after running configure, one can just say "make
install", like on Unix. A post-build fix is needed, running
gdk-pixbuf-query-loaders once more to get a correct `gdk-pixbuf.loaders`
file.
For a 64-bit build you need to remove the `gtk/gtk.def` file and let it
be regenerated by the makefilery. This is because the 64-bit GTK dll
has a slightly different list of exported function names. This is on
purpose and not a bug. The API is the same at the source level, and
the same #defines of some function names to actually have a _utf8
suffix is used (just to keep the header simpler). But the
corresponding non-suffixed function to maintain ABI stability are not
needed in the 64-bit case (because there are no older EXEs around that
would require such for ABI stability).
Microsoft's tools
---
There are VS 2008~2022 solution and project files to build GTK+, which
are maintained by Chun-wei Fan. They should build GTK+ out of the box,
provided that the afore-mentioned dependencies are installed. They will
build GDK with the Win32 backend, GTK+ itself (with GAIL/a11y built in),
the GAIL-Util library and the gtk3-demo program. Please also refer to the
README_FEATURES_MSVC.md file that reside in win32 on how to enable
additional features that are not enabled by default, such as EGL support
via libANGLE, which emulate the GL/EGL calls using Direct3D 9/11.
Please refer to the following GNOME Live! page for a more detailed ouline
on the process of building the GTK+ stack and its dependencies with Visual
C++:
https://wiki.gnome.org/Projects/GTK+/Win32/MSVCCompilationOfGTKStack
Alternative 1 also generates Microsoft import libraries (.lib), if you
have lib.exe available. It might also work for cross-compilation from
Unix.
I (Tor) use method 1 myself. Hans Breuer has been taking care of the MSVC
makefiles. At times, we disagree a bit about various issues, and for
instance the makefile.msc files might not produce identically named
DLLs and import libraries as the "autoconfiscated" makefiles and
libtool do. If this bothers you, you will have to fix the makefiles.
You may need or wish to update `gtk3-build-defines.[vs]props` (under the
entry `GenerateRequiredSourcesBase` and/or `GtkIntrospectNMakeCmd` and/or
`InstallBuildsBase`) to pass in the variables if they are not in:
* `$(PREFIX)\bin` (used for generating code for the build):
* `GLIB_MKENUMS` (path to your glib-mkenums script)
* `GLIB_GENMARSHAL` (path to your glib-genmarshal script)
* `GDBUS_CODEGEN` (path to your gdbus-codegen script)
* `GLIB_COMPILE_RESOURCES` (path to your glib-compile-resources program)
* `%PATH%`:
* `PYTHON` (path to your Python interpreter, for generating code for
the build as well as for introspection; for introspection, this must
match the version series and architecture for the Python that is used
to build gobject-introspection)
* `PKG_CONFIG` (path to your pkg-config or compatible tool, for
building introspection files in the `gtk3-introspect` project)
* `MSGFMT` (path to your msgfmt program, if building translations
during install; append ` install-translations` to `InstallBuildsBase`
in `gtk3-build-defines.[vs]props])
`LIBDIR` and `INCLUDEDIR` can also be passed in if they are not under
`$(PREFIX)\lib` and `$(PREFIX)\include` respectively. Note that
`$(LIBDIR)` is architecture-dependent.
If desiring to build binaries for ARM64 (`aarch64`), one needs to use the
Visual Studio 2017 or 2019 or 2022 solution files, or use Meson with a
cross-compilation file, with a Windows 10 SDK that supports ARM64
builds. At this point, building the introspection files is not supported
for ARM64 builds, and you will need a Python 3.x interpreter and
glib-compile-resources binaries that run on the build machine.
For Visual Studio 2017 ARM64 builds, do also check the
`Directory.Build.props` file in `$(srcroot)/win32/vs15`
indicates a Windows 10 SDK version that supports ARM64 builds
exists on the build machine.
For building ARM64 binaries with the Visual Studio projects, prior to the
build, you may need to update `gtk3-build-defines.props` to pass in the variables as indicated earlier:
* GLIB_MKENUMS
* GLIB_GENMARSHAL
* GDBUS_CODEGEN
* GLIB_COMPILE_RESOURCES
* PYTHON
in the nmake command line indicated by `<GenerateRequiredSourcesBase>` so
that they point to the respective tools and scripts that will run on the
build machine. You may also need to update `gtk3-version-paths.props` to
update `<PythonDir>` to the installation of the Python 3.x interpreter
that will run on the build machine (or just update `PYTHON=...` in the
command line in `<GenerateRequiredSourcesBase>`). To carry out the actual
build using the solution files, use the "Configuration Manager" to add the
ARM64 build configs by copying the settings from the x64 configs, and then
build the solution.
The build instructions for such builds otherwise follow the standard Win32
(x86) and x64 builds, but you need to ensure that you have ARM64 builds of
the various dependencies.
It may still be possible to carry out the build and build the
introspection files with Python 2.7.x using older versions of GLib and
GObject-Introspection, but please note that this is not recommended
and one is on his/her own by doing so.
It is now supported to build with the Visual Studio projects directly
from a GIT checkout. Run in a Visual Studio command prompt, in
$(srcroot)/win32:
`nmake /f bootstrap-msvc.mak [PYTHON=...] [PERL=...] [FONT_FEATURES_DEMO=1] [FONT_FEATURES_USE_PANGOFT2=1] [USE_EGL=1]`
where `PYTHON` and `PERL` are the respective paths to the Python and PERL
interpreters, if they are not in your `%PATH%`-they are both required to
generate the full sets of project files, as well as the auxiliary build
files and headers that is not available in a GIT checkout and must be
generated prior to opening the project files.
For `FONT_FEATURES_DEMO`, `FONT_FEATURES_USE_PANGOFT2` and `USE_EGL`,
please refer to `win32\README_FEATURES_MSVC.md` for more details, to
enable features that is optional and not enabled by default (i.e. in the
release tarballs).
It is also possible to regenerate some or all of the visual studio
projects with the following, if necessary:
`nmake /f generate-msvc.mak [PYTHON=...] [FONT_FEATURES_DEMO=1] [FONT_FEATURES_USE_PANGOFT2=1] [USE_EGL=1] <target>`
Where target can be (they will update all related VS2008~2022 projects):
* `regenerate-demos-h-win32`: Regenerate the `gtk3-demo` projects along
with `demos.h.win32`, useful to enable or disable the Font Features
demo.
* `regenerate-gdk-vsproj`: Regenerate all the GDK projects with
`broadwayd`, useful to enable or disable EGL on Windows.
* `regenerate-gtk-vsproj`: Regenerate the `gtk-3` and `gailutil-3` library
projects.
* `regenerate-all-msvc-projs`: Re-generate all project files, and re-copy
all the Visual Studio 2010 project files for VS 2012~2022.
Using Meson (for Visual Studio and MinGW builds)
---
Meson can now be used to build GTK+-3.x with either MinGW or Visual Studio.
You will need the following items in addition to all the dependencies
listed above:
* Python 3.5 or later
* Meson build system, 0.48.0 or later
* Ninja (if not using the Visual Studio project generator for
Visual Studio 2010 or later)
* CMake (optional, used for dependency searching)
* pkg-config (optional, or some compatible tool, highly recommended)
For all Windows builds, note that unless `-Dbuiltin_immodules=no` is
specified, the input modules (immodules) are built directly into the GTK
DLL.
For building with Meson using Visual Studio, do the following:
* Create an empty build directory somewhere that is on the same drive
as the source tree, and launch the Visual Studio command prompt that
matches the build configuration (Visual Studio version and architecture),
and run the following:
* Ensure that both the installation directory of Python 3.5+ and its script
directory is in your `%PATH%`, as well as the Ninja, CMake and pkg-config
executables (if used). If a pkg-config compatible drop-in replacement
tool is being used, ensure that `PKG_CONFIG` is set to point to the
executable of that tool as well.
* For non-GNOME dependencies (such as Cairo and Harfbuzz), where pkg-config
files or CMake files could not be properly located, set `%INCLUDE%` and
`%LIB%` to ensure that their header files and .lib files can be found
respectively. The DLLs of those dependencies should also be in the
`%PATH%` during the build as well, especially if introspection files ar
to be built.
* For GNOME dependencies, the pkg-config files for those dependencies
should be searchable by `pkg-config` (or a compatible tool). Verify
this by running `$(PKG_CONFIG) --modversion <dependency>`.
* Run the following:
`meson <path_to_directory_of_this_file> --buildtype=... --prefix=...,
where `buildtype` can be:
* release
* debugoptimized
* debug
* plain.
Please refer to the Meson documentation for more details. You may also
wish to pass in `-Dbroadway_backend=true` if building the Broadway GDK
backend is desired, and/or pass in `-Dbuiltin_immodules=no` to build the
immodules as standalone DLLs that can be loaded by GTK dynamically. For
Visual Studio 2010 or later builds, you may pass in --backend=vs to
generate Visual Studio project files to be used to carry out the builds.
If you are building with Visual Studio 2008, note the following items as
well:
* For x64 builds, the compiler may hang when building the certain
files, due to optimization issues in the compiler. If this happens,
use the Windows Task Manager and terminate all `cl.exe` processes,
and the build will fail with the source files that did not finish
compiling due to the hang. Look for them in build.ninja in the build
directory, and change their compiler
flag `/O2` to `/O1`, and the compilation and linking should proceed
normally.
* At this time of writing, the following files are known to cause this
hang:
* gtk\gtkfilechoosernativewin32.c
* gtk\gtkfilesystemmodel.c
* gtk\gtktextsegment.c
* gtk\gtktextbtree.c
* gtk\gtkrbtree.c
* testsuite\gtk\treemodel.c
* testsuite\gtk\textbuffer.c
* testsuite\gtk\rbtree.c
* testsuite\gtk\icontheme.c
* Upon running install (via "ninja install"), it is likely that
`gtk-query-immodules-3.0.exe` will fail to run as it cannot find
`msvcr90.dll` or `msvcr90D.dll`. You can ignore this if you did not
specify `-Dbuiltin_immodules=no` when configuring via Meson.
If `-Dbuiltin_immodules=no` is specified, you need to run the
following after embedding the manifests as outlined in the next
point:
`$(gtk_install_prefix)\bin\gtk-query-immodules-3.0.exe > $(gtk_install_prefix)\lib\gtk-3.0\3.0.0\immodules.cache`
* You will need to run the following upon completing install, from the
build directory in the Visual Studio 2008/SDK 6.0 command prompt
(third line is not needed unless `-Dbuiltin_immodules=no` is
specified) so that the built binaries can run:
```
for /r %f in (*.dll.manifest) do if exist $(gtk_install_prefix)\bin\%~nf mt /manifest %f /outputresource:$(gtk_install_prefix)\bin\%~nf;2
for /r %f in (*.exe.manifest) do if exist $(gtk_install_prefix)\bin\%~nf mt /manifest %f /outputresource:$(gtk_install_prefix)\bin\%~nf;1
for /r %f in (*.dll.manifest) do if exist $(gtk_install_prefix)\lib\gtk-3.0\3.0.0\immodules\%~nf mt /manifest %f /outputresource:$(gtk_install_prefix)\lib\gtk-3.0\3.0.0\immodules\%~nf;2
```
* The more modern visual style for the print dialog is not applied for
Visual Studio 2008 builds. Any solutions to this is really
appreciated.
Support for all pre-2012 Visual Studio builds
---
This release of GTK+ requires at least the Windows 8.0 or later SDK in
order to be built successfully using Visual Studio, which means that
building with Visual Studio 2008 or 2010 is possible only with a special
setup and must be done in the command line with Ninja, if using Meson.
Please see
https://devblogs.microsoft.com/cppblog/using-the-windows-software-development-kit-sdk-for-windows-8-consumer-preview-with-visual-studio-2010/
for references; basically, assuming that your Windows 8.0 SDK is installed
in `C:\Program Files (x86)\Windows Kits\8.0` (`$(WIN8SDKDIR)` in short),
you need to ensure the following before invoking Meson to configure the build. Your project files or Visual Studio IDE must also be similarly
configured (using the Windows 8.1 SDK is also possible for Visual Studio
2008~2012, replacing `$(WIN8SDKDIR)` with `$(WIN81SDKDIR)`, which is in
`C:\Program Files (x86)\Windows Kits\8.1` unless otherwise indicated):
* Your `%INCLUDE%` (i.e. "Additional Include Directories" in the IDE)
must not include the Windows 7.0/7.1 SDK include directories,
and `$(WIN8SDKDIR)\include\um`, `$(WIN8SDKDIR)\include\um\share` and
`$(WIN8SDKDIR)\include\winrt` (in this order) must be before your stock
Visual Studio 2008/2010 header directories. If you have the DirectX
SDK (2010 June or earlier) installed, you should remove its include
directory from your `%INCLUDE%` as well.
* You must replace the Windows 7.0/7.1 SDK library directory in `%LIB%`
(i.e. "Additional Library Paths" in the IDE) with the Windows 8.0/8.1
SDK library directory, i.e. `$(WIN8SDKDIR)\lib\win8\um\[x86|x64]` or
`$(WIN81SDKDIR)\lib\winv6.3\um\[x86|x64]`.
If you have the DirectX SDK installed, you should remove its library
directory from your `%LIB%` as well.
* You must replace the Windows 7.0/7.1 SDK tools directory from your
`%PATH%` ("Executables Directories" in the IDE) with the Windows 8.0
SDK tools directory, i.e. `$(WIN8SDKDIR)\bin\[x86|x64]`. If you have
the DirectX SDK installed, you should remove its utility directory from
your `%PATH%` as well.
* The Windows 8.0 SDK headers may contain an `roapi.h` that cannot be
used under plain C, so to remedy that, change the following lines
(around lines 55-57) (this is not necessary for the Windows 8.1 or
later SDKs):
```
// RegisterActivationFactory/RevokeActivationFactory registration cookie
typedef struct {} *RO_REGISTRATION_COOKIE;
// RegisterActivationFactory/DllGetActivationFactory callback
```
to
```
// RegisterActivationFactory/RevokeActivationFactory registration cookie
#ifdef __cplusplus
typedef struct {} *RO_REGISTRATION_COOKIE;
#else
typedef struct _RO_REGISTRATION_COOKIE *RO_REGISTRATION_COOKIE; /* make this header includable in C files */
#endif
// RegisterActivationFactory/DllGetActivationFactory callback
```
This follows what is done in the Windows 8.1 SDK, which contains an
`roapi.h` that is usable under plain C. Please note that you might need
to copy that file into a location that is in your `%INCLUDE%` which
precedes the include path for the Windows 8.0 SDK headers, if you do not
have administrative privileges.
Visual Studio 2008 hacks
---
(Please see the section on Meson builds which touch on this topic)
Multi-threaded use of GTK+ on Win32
---
Multi-threaded GTK+ programs might work on Windows in special simple
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
in the same thread, it might work. Otherwise, probably not at
all. Possible ways to fix this are being investigated.
* Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
* Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>
+1 -10
View File
@@ -230,9 +230,6 @@
/* Define to the version of this package. */
#mesondefine PACKAGE_VERSION
/* Define when building a shared library for Windows */
#mesondefine DLL_EXPORT
/* Use NSBundle functions to determine load paths for libraries, translations,
etc. */
#mesondefine QUARTZ_RELOCATION
@@ -247,9 +244,6 @@
/* Define to 1 if XInput 2.2 is available */
#mesondefine XINPUT_2_2
/* Define to 1 if XInput 2.4 is available */
#mesondefine XINPUT_2_4
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
@@ -292,7 +286,4 @@
#mesondefine ISO_CODES_PREFIX
/* Define if tracker3 is available */
#mesondefine HAVE_TRACKER3
/* Define if xdg_activation's wl-protocols definition is available */
#mesondefine HAVE_XDG_ACTIVATION
#mesondefine HAVE_TRACKER3
+4 -17
View File
@@ -144,11 +144,6 @@
#define HAVE_ROUND 1
#endif
/* Define to 1 if SetupDiGetDevicePropertyW() is available */
#ifdef _MSC_VER
#define HAVE_SETUP_DI_GET_DEVICE_PROPERTY_W 1
#endif
/* Define to 1 if sincos() is available */
/* #undef HAVE_SINCOS */
@@ -300,9 +295,6 @@
/* Define to 1 if XInput 2.2 is available */
/* #undef XINPUT_2_2 */
/* Define to 1 if XInput 2.4 is available */
/* #undef XINPUT_2_4 */
/* Define to 1 if the X Window System is missing or not being used. */
/* #undef X_DISPLAY_MISSING */
@@ -314,16 +306,11 @@
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */
/* Define when building a shared library for Windows */
#define DLL_EXPORT 1
/* defines how to decorate public symbols while building */
#ifdef DLL_EXPORT
# ifdef _MSC_VER
# define _GDK_EXTERN __declspec (dllexport) extern
# else
# define _GDK_EXTERN __attribute__((visibility("default"))) __declspec (dllexport) extern
# endif
#ifdef _MSC_VER
#define _GDK_EXTERN __declspec (dllexport) extern
#else
#define _GDK_EXTERN __attribute__((visibility("default"))) __declspec (dllexport) extern
#endif
/* Define for large files, on AIX-style hosts. */
+48 -54
View File
@@ -10,8 +10,8 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [24])
m4_define([gtk_micro_version], [35])
m4_define([gtk_interface_age], [31])
m4_define([gtk_micro_version], [26])
m4_define([gtk_interface_age], [22])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
m4_define([gtk_version],
@@ -395,7 +395,7 @@ if test "$enable_win32_backend" = "yes"; then
backend_immodules="$backend_immodules,ime"
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_WIN32"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lwinspool -lcomctl32 -lcomdlg32"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32"
AM_CONDITIONAL(USE_WIN32, true)
PANGO_PACKAGES="pangowin32 pangocairo"
else
@@ -439,8 +439,7 @@ fi
PKG_PROG_PKG_CONFIG
WAYLAND_RUNTIME_DEPENDENCIES="wayland-client >= wayland_required_version xkbcommon >= 0.2.0 wayland-egl"
WAYLAND_DEPENDENCIES="wayland-protocols >= wayland_protocols_required_version $WAYLAND_RUNTIME_DEPENDENCIES"
WAYLAND_DEPENDENCIES="wayland-client >= wayland_required_version wayland-protocols >= wayland_protocols_required_version xkbcommon >= 0.2.0 wayland-cursor >= wayland_required_version wayland-egl"
if test "$enable_wayland_backend" = "maybe" ; then
AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
PKG_CHECK_EXISTS($WAYLAND_DEPENDENCIES, [have_wayland_deps=yes], [have_wayland_deps=no])
@@ -461,26 +460,15 @@ if test "$enable_wayland_backend" = "yes"; then
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_WAYLAND"
backend_immodules="$backend_immodules,wayland"
WAYLAND_PACKAGES="$WAYLAND_RUNTIME_DEPENDENCIES"
WAYLAND_PACKAGES="$WAYLAND_DEPENDENCIES"
AC_PATH_PROG([WAYLAND_SCANNER],[wayland-scanner],[no])
AS_IF([test "x$WAYLAND_SCANNER" = "xno"],
[AC_MSG_ERROR([Could not find wayland-scanner in your PATH, required for parsing wayland extension protocols])])
AC_SUBST([WAYLAND_SCANNER])
# For xdg-activation support
XDG_ACTIVATION_DEPENDENCIES="wayland-protocols >= 1.21"
PKG_CHECK_EXISTS($XDG_ACTIVATION_DEPENDENCIES, [have_xdg_activation_deps=yes], [have_xdg_activation_deps=no])
AC_MSG_CHECKING([for XDG_ACTIVATION_DEPENDENCIES])
AM_CONDITIONAL(USE_XDG_ACTIVATION, test "$have_xdg_activation_deps" = "yes")
if test "$have_xdg_activation_deps" = "yes" ; then
AC_DEFINE([HAVE_XDG_ACTIVATION], [1],
[Define if xdg_activation's wl-protocols definition is available])
fi
AM_CONDITIONAL(USE_WAYLAND, true)
else
AM_CONDITIONAL(USE_WAYLAND, false)
AM_CONDITIONAL(USE_XDG_ACTIVATION, false)
fi
# strip leading space
@@ -1178,23 +1166,13 @@ if test "x$enable_x11_backend" = xyes; then
AC_DEFINE(XINPUT_2_2, 1, [Define to 1 if XInput 2.2 is available]),
have_xinput2_2=no,
[[#include <X11/extensions/XInput2.h>]])])
LIBS="$gtk_save_LIBS"
if test "x$have_xinput2_2" = "xyes"; then
X_EXTENSIONS="$X_EXTENSIONS XI2.2"
else
X_EXTENSIONS="$X_EXTENSIONS XI2"
fi
AC_CHECK_MEMBER([XIGesturePinchEvent.type],
have_xinput2_4=yes
AC_DEFINE(XINPUT_2_4, 1, [Define to 1 if XInput 2.4 is available]),
have_xinput2_4=no,
[[#include <X11/extensions/XInput2.h>]])
if test "x$have_xinput2_4" = "xyes"; then
X_EXTENSIONS="$X_EXTENSIONS XI2.4"
fi
LIBS="$gtk_save_LIBS"
fi
AS_IF([test "x$have_xinput2" != "xyes"],
@@ -1416,35 +1394,17 @@ fi
##################################################
# Check for harfbuzz and pangoft2
##################################################
PKG_CHECK_MODULES(GTK_FONT_CHOOSER_WIDGET,
harfbuzz >= 2.2.0 pango >= 1.44.0,
harfbuzz >= 0.9 pangoft2,
build_font_demo=yes,
build_font_demo=no)
PKG_CHECK_MODULES(GTK_FONT_CHOOSER_WIDGET_FT,
harfbuzz >= 0.9 pangoft2,
build_font_demo_ft=yes,
build_font_demo_ft=no)
if test "x$build_font_demo" = xno; then
if test "x$build_font_demo_ft" = xyes; then
build_font_demo=yes
else
build_font_demo=no
fi
fi
AM_CONDITIONAL(BUILD_FONT_DEMO, [ test "x$build_font_demo" = xyes ])
if test "x$build_font_demo" = xyes; then
AC_DEFINE([HAVE_HARFBUZZ], 1, [defines whether we have HarfBuzz])
if test "x$build_font_demo_ft" = xyes; then
AC_DEFINE([HAVE_PANGOFT], 1, [defines whether we have pangoft2])
GTK_DEP_CFLAGS="$GTK_DEP_CFLAGS $GTK_FONT_CHOOSER_WIDGET_FT_CFLAGS"
GTK_DEP_LIBS="$GTK_DEP_LIBS $GTK_FONT_CHOOSER_WIDGET_FT_LIBS"
else
GTK_DEP_CFLAGS="$GTK_DEP_CFLAGS $GTK_FONT_CHOOSER_WIDGET_CFLAGS"
GTK_DEP_LIBS="$GTK_DEP_LIBS $GTK_FONT_CHOOSER_WIDGET_LIBS"
fi
AC_DEFINE([HAVE_PANGOFT], 1, [defines whether we have pangoft2])
GTK_DEP_CFLAGS="$GTK_DEP_CFLAGS $GTK_FONT_CHOOSER_WIDGET_CFLAGS"
GTK_DEP_LIBS="$GTK_DEP_LIBS $GTK_FONT_CHOOSER_WIDGET_LIBS"
fi
if $PKG_CONFIG --exists x11; then
@@ -1616,6 +1576,38 @@ fi
AM_CONDITIONAL(HAVE_TRACKER3, test "x$have_tracker3" = "xyes")
# Checks to see if we should compile with cloudprint backend for GTK+
#
AC_ARG_ENABLE(cloudprint,
[AS_HELP_STRING([--disable-cloudprint],
[disable cloudprint print backend])],,
[enable_cloudprint=auto])
if test "x$enable_cloudprint" = "xno"; then
AM_CONDITIONAL(HAVE_CLOUDPRINT, false)
else
PKG_CHECK_MODULES(REST, [rest-0.7], have_rest=yes, have_rest=no)
PKG_CHECK_MODULES(JSON_GLIB, [json-glib-1.0], have_json_glib=yes, have_json_glib=no)
if test "x$have_rest" = "xyes" -a "x$have_json_glib" = "xyes"; then
PRINT_BACKENDS="$PRINT_BACKENDS cloudprint"
have_cloudprint=yes
fi
AM_CONDITIONAL(HAVE_CLOUDPRINT, test "x$have_cloudprint" = "xyes")
fi
if test "x$enable_cloudprint" = "xyes" -a "x$have_rest" = "xno"; then
AC_MSG_ERROR([
*** rest not found.
])
fi
if test "x$enable_cloudprint" = "xyes" -a "x$have_json_glib" = "xno"; then
AC_MSG_ERROR([
*** json-glib not found.
])
fi
gtk_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS $GDK_DEP_CFLAGS"
@@ -1658,6 +1650,9 @@ fi
if test "$have_papi" != "yes" -a "$have_cups" != "yes"; then
GTK_PRINT_BACKENDS="$GTK_PRINT_BACKENDS,lpr"
fi
if test "$have_cloudprint" = "yes"; then
GTK_PRINT_BACKENDS="$GTK_PRINT_BACKENDS,cloudprint"
fi
AC_SUBST(GTK_PRINT_BACKENDS)
################################################################
@@ -1974,14 +1969,12 @@ win32/config-msvc.mak
win32/vs9/Makefile
win32/vs9/gtk3-version-paths.vsprops
win32/vs10/Makefile
win32/vs10/gtk3-version-paths.props
win32/vs11/Makefile
win32/vs12/Makefile
win32/vs14/Makefile
win32/vs15/Makefile
win32/vs16/Makefile
win32/vs17/Makefile
win32/vs1x-props/Makefile
win32/vs1x-props/gtk3-version-paths.props
gdk/Makefile
gdk/broadway/Makefile
gdk/x11/Makefile
@@ -2001,6 +1994,7 @@ modules/Makefile
modules/input/Makefile
modules/printbackends/Makefile
modules/printbackends/cups/Makefile
modules/printbackends/cloudprint/Makefile
modules/printbackends/lpr/Makefile
modules/printbackends/file/Makefile
modules/printbackends/papi/Makefile
-2
View File
@@ -1,2 +0,0 @@
demos.h.win32
demos.h
+87 -10
View File
@@ -1,15 +1,87 @@
## Makefile.am for gtk+/demos
include $(top_srcdir)/Makefile.decl
include $(srcdir)/demos-sources.mak
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos_base = \
application_demo.c \
assistant.c \
builder.c \
button_box.c \
changedisplay.c \
clipboard.c \
colorsel.c \
combobox.c \
css_accordion.c \
css_basics.c \
css_blendmodes.c \
css_multiplebgs.c \
css_pixbufs.c \
css_shadows.c \
cursors.c \
dialog.c \
drawingarea.c \
editable_cells.c \
entry_buffer.c \
entry_completion.c \
event_axes.c \
expander.c \
filtermodel.c \
fishbowl.c \
foreigndrawing.c \
gestures.c \
glarea.c \
headerbar.c \
hypertext.c \
iconview.c \
iconview_edit.c \
images.c \
infobar.c \
links.c \
listbox.c \
flowbox.c \
list_store.c \
markup.c \
menus.c \
modelbutton.c \
offscreen_window.c \
offscreen_window2.c \
overlay.c \
overlay2.c \
paint.c \
panes.c \
pickers.c \
pixbufs.c \
popover.c \
printing.c \
revealer.c \
rotated_text.c \
scale.c \
search_entry.c \
search_entry2.c \
shortcuts.c \
sidebar.c \
sizegroup.c \
spinbutton.c \
spinner.c \
stack.c \
tabs.c \
textmask.c \
textview.c \
textscroll.c \
theming_style_classes.c \
toolpalette.c \
transparent.c \
tree_store.c
demos_opt =
if BUILD_FONT_DEMO
demos_opt += $(font_features_demo)
demos_opt += font_features.c
endif
if OS_UNIX
demos_opt += $(page_setup_demo)
demos_opt += pagesetup.c
endif
demos = $(demos_base) $(demos_opt)
@@ -61,21 +133,22 @@ demos.h: $(demos) geninclude.pl
demos.h.win32: $(demos_base) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos_base)) > demos.h.win32
nodist_gtk3_demo_SOURCES = demos.h demo_resources.c
nodist_gtk3_demo_SOURCES = demos.h
gtk3_demo_SOURCES = \
$(demos) \
gtkfishbowl.c \
gtkfishbowl.h \
demo_resources.c \
main.c
gtk3_demo_DEPENDENCIES = $(DEPS)
gtk3_demo_LDADD = $(LDADDS)
gtk3_demo_LDFLAGS = -export-dynamic
nodist_gtk3_demo_application_SOURCES = demo_resources.c
gtk3_demo_application_SOURCES = application.c
gtk3_demo_application_SOURCES = \
application.c \
demo_resources.c
gtk3_demo_application_LDADD = $(LDADDS)
@@ -115,16 +188,20 @@ uninstall-update-icon-cache:
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
# ------------------- MSVC Build Items ----------------
MSVCPROJS = gtk3-demo
MSVCPROJS = gtk3-demo gtk3-demo-application
gtk3_demo_FILES = $(gtk3_demo_SOURCES)
gtk3_demo_EXCLUDES = font_features.c|pagesetup.c
gtk3_demo_application_FILES = $(gtk3_demo_application_SOURCES)
gtk3_demo_application_EXCLUDES = dummy
include $(top_srcdir)/win32/Makefile.msvcproj
dist-hook: \
$(top_builddir)/win32/vs9/gtk3-demo.vcproj
$(top_builddir)/win32/vs9/gtk3-demo.vcproj \
$(top_builddir)/win32/vs9/gtk3-demo-application.vcproj
DISTCLEANFILES = demos.h demos.h.win32 demo_resources.c
DISTCLEANFILES = demos.h demos.h.win32
-include $(top_srcdir)/git.mk
-75
View File
@@ -1,75 +0,0 @@
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos_base = \
application_demo.c \
assistant.c \
builder.c \
button_box.c \
changedisplay.c \
clipboard.c \
colorsel.c \
combobox.c \
css_accordion.c \
css_basics.c \
css_blendmodes.c \
css_multiplebgs.c \
css_pixbufs.c \
css_shadows.c \
cursors.c \
dialog.c \
drawingarea.c \
editable_cells.c \
entry_buffer.c \
entry_completion.c \
event_axes.c \
expander.c \
filtermodel.c \
fishbowl.c \
foreigndrawing.c \
gestures.c \
glarea.c \
headerbar.c \
hypertext.c \
iconview.c \
iconview_edit.c \
images.c \
infobar.c \
links.c \
listbox.c \
flowbox.c \
list_store.c \
markup.c \
menus.c \
modelbutton.c \
offscreen_window.c \
offscreen_window2.c \
overlay.c \
overlay2.c \
paint.c \
panes.c \
pickers.c \
pixbufs.c \
popover.c \
printing.c \
revealer.c \
rotated_text.c \
scale.c \
search_entry.c \
search_entry2.c \
shortcuts.c \
sidebar.c \
sizegroup.c \
spinbutton.c \
spinner.c \
stack.c \
tabs.c \
textmask.c \
textview.c \
textscroll.c \
theming_style_classes.c \
toolpalette.c \
transparent.c \
tree_store.c
font_features_demo = font_features.c
page_setup_demo = pagesetup.c
+11 -60
View File
@@ -9,23 +9,10 @@
*/
#include <gtk/gtk.h>
#if PANGO_VERSION_CHECK(1,44,0)
# if !HB_VERSION_ATLEAST(2,2,0)
# define FONT_FEATURES_USE_PANGOFT2 1
# endif
#else
# define FONT_FEATURES_USE_PANGOFT2 1
#endif
#ifdef FONT_FEATURES_USE_PANGOFT2
#include <pango/pangofc-font.h>
#include <hb.h>
#include <hb-ot.h>
#include <hb-ft.h>
#else
#include <hb-ot.h>
#endif
static GtkWidget *label;
static GtkWidget *settings;
@@ -218,32 +205,19 @@ static void
update_script_combo (void)
{
GtkListStore *store;
hb_font_t *hb_font = NULL;
hb_font_t *hb_font;
gint i, j, k, l;
FT_Face ft_face;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
gboolean cleanup_hb_face = FALSE;
#ifdef FONT_FEATURES_USE_PANGOFT2
FT_Face ft_face;
#endif
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
pango_font = get_pango_font ();
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font))
{
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
cleanup_hb_face = TRUE;
}
#else
hb_font = pango_font_get_hb_font (pango_font);
#endif
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
tags = g_hash_table_new_full (tag_pair_hash, tag_pair_equal, g_free, NULL);
@@ -290,15 +264,10 @@ update_script_combo (void)
}
}
if (cleanup_hb_face)
hb_face_destroy (hb_face);
hb_face_destroy (hb_face);
}
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font))
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
#endif
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
g_hash_table_iter_init (&iter, tags);
@@ -377,12 +346,8 @@ update_features (void)
GtkTreeIter iter;
guint script_index, lang_index;
PangoFont *pango_font;
hb_font_t *hb_font = NULL;
gboolean cleanup_hb_face = FALSE;
#ifdef FONT_FEATURES_USE_PANGOFT2
FT_Face ft_face;
#endif
hb_font_t *hb_font;
for (i = 0; i < num_features; i++)
gtk_widget_set_opacity (icon[i], 0);
@@ -399,17 +364,8 @@ update_features (void)
-1);
pango_font = get_pango_font ();
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font))
{
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
cleanup_hb_face = TRUE;
}
#else
hb_font = pango_font_get_hb_font (pango_font);
#endif
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
if (hb_font)
{
@@ -441,15 +397,10 @@ update_features (void)
}
}
if (cleanup_hb_face)
hb_face_destroy (hb_face);
hb_face_destroy (hb_face);
}
#ifdef FONT_FEATURES_USE_PANGOFT2
if (PANGO_IS_FC_FONT (pango_font))
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
#endif
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
}
+1 -1
View File
@@ -160,7 +160,7 @@ do_gestures (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (window), drawing_area);
gtk_widget_add_events (drawing_area,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK | GDK_TOUCH_MASK | GDK_TOUCHPAD_GESTURE_MASK);
GDK_POINTER_MOTION_MASK | GDK_TOUCH_MASK);
g_signal_connect (drawing_area, "draw",
G_CALLBACK (drawing_area_draw), NULL);
+1 -7
View File
@@ -76,13 +76,7 @@ demos = files([
gtkdemo_deps = [libgtk_dep]
if pango_dep.version().version_compare('>=1.44.0') and harfbuzz_dep.found() and cc.has_header_symbol(
'hb-ot.h',
'hb_ot_var_get_axis_count',
dependencies: harfbuzz_dep
)
demos += files('font_features.c')
elif harfbuzz_dep.found() and pangoft_dep.found()
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files('font_features.c')
gtkdemo_deps += [harfbuzz_dep, pangoft_dep]
endif
+12 -5
View File
@@ -16,19 +16,16 @@ bin_PROGRAMS = gtk3-icon-browser
desktopdir = $(datadir)/applications
dist_desktop_DATA = gtk3-icon-browser.desktop
nodist_gtk3_icon_browser_SOURCES = resources.c
gtk3_icon_browser_SOURCES = \
main.c \
iconbrowserapp.c iconbrowserapp.h \
iconbrowserwin.c iconbrowserwin.h \
iconstore.c iconstore.h
iconstore.c iconstore.h \
resources.c
BUILT_SOURCES = \
resources.c
DISTCLEANFILES = resources.c
resources.c: iconbrowser.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/iconbrowser.gresource.xml)
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $(srcdir)/iconbrowser.gresource.xml \
--target=$@ --sourcedir=$(srcdir) --generate-source
@@ -40,4 +37,14 @@ EXTRA_DIST = \
icon.list \
meson.build
# ------------------- MSVC Build Items ----------------
MSVCPROJS = gtk3-icon-browser
gtk3_icon_browser_FILES = $(gtk3_icon_browser_SOURCES)
gtk3_icon_browser_EXCLUDES = dummy
include $(top_srcdir)/win32/Makefile.msvcproj
dist-hook: $(top_builddir)/win32/vs9/gtk3-icon-browser.vcproj
-include $(top_srcdir)/git.mk
@@ -2,6 +2,7 @@
Name=Icon Browser
Comment=An application that shows themed icons
Exec=gtk3-icon-browser
Icon=gtk3-icon-browser
Terminal=false
Type=Application
StartupNotify=true
+3 -5
View File
@@ -5,9 +5,9 @@ bin_PROGRAMS = gtk3-widget-factory
desktopdir = $(datadir)/applications
dist_desktop_DATA = gtk3-widget-factory.desktop
nodist_gtk3_widget_factory_SOURCES = widget_factory_resources.c
gtk3_widget_factory_SOURCES = widget-factory.c
gtk3_widget_factory_SOURCES = \
widget-factory.c \
widget_factory_resources.c
BUILT_SOURCES = \
widget_factory_resources.c
@@ -69,6 +69,4 @@ EXTRA_DIST += \
data/symbolic-source.svg \
meson.build
DISTCLEANFILES = widget_factory_resources.c
-include $(top_srcdir)/git.mk
+4 -9
View File
@@ -503,19 +503,14 @@ if get_option('man') and xsltproc.found()
[ 'gtk-update-icon-cache', '1', ],
[ 'gtk-encode-symbolic-svg', '1', ],
[ 'gtk-launch', '1', ],
[ 'gtk3-demo', '1', ],
[ 'gtk3-demo-application', '1', ],
[ 'gtk3-widget-factory', '1', ],
[ 'gtk3-icon-browser', '1', ],
[ 'gtk-builder-tool', '1', ],
[ 'gtk-query-settings', '1', ],
]
if get_option('demos')
man_files += [
[ 'gtk3-demo', '1', ],
[ 'gtk3-demo-application', '1', ],
[ 'gtk3-widget-factory', '1', ],
[ 'gtk3-icon-browser', '1', ],
]
endif
if broadway_enabled
man_files += [[ 'broadwayd', '1', ]]
endif
+87 -18
View File
@@ -20,8 +20,12 @@ Getting help with GTK+
<title>Filing a bug report or feature request</title>
<para>
If you encounter a bug, misfeature, or missing feature in GTK, please
file a bug report on <ulink url="https://gitlab.gnome.org/GNOME/gtk/issues">GitLab</ulink>.
If you encounter a bug, misfeature, or missing feature in GTK+, please
file a bug report on
<ulink url="https://bugzilla.gnome.org">https://bugzilla.gnome.org</ulink>.
We'd also appreciate reports of incomplete or misleading information in
the GTK+ documentation; file those against the "docs" component of the "gtk+"
product in Bugzilla.
</para>
<para>
@@ -33,38 +37,103 @@ discussed, we'll add a note to that effect in the report.
<para>
The bug tracker should definitely be used for feature requests, it's
not only for bugs. We track all GTK development in GitLab, so it's
the way to be sure the GTK developers won't forget about an issue.
</para>
<para>
Just make sure that any issue filed is actionable, and contains clear
instructions on how to reproduce an issue, and the conditions to close
the bug report or feature request. Non-actionable, or user support
questions will be directed to Discourse.
not only for bugs. We track all GTK+ development in Bugzilla, so it's
the way to be sure the GTK+ developers won't forget about an issue.
</para>
</refsect1>
<refsect1>
<title>Contributing</title>
<title>Submitting Patches</title>
<para>
Please, follow the instructions outlined in the
<ulink url="https://gitlab.gnome.org/GNOME/gtk/-/blob/master/CONTRIBUTING.md">Contribution Guide</ulink> available in the GTK
source code repository.
If you develop a bugfix or enhancement for GTK+, please file that in
Bugzilla as well. Bugzilla allows you to attach files; please attach a
patch generated by the <command>diff</command> utility, using the
<option>-u</option> option to make the patch more readable. All patches
must be offered under the terms of the GNU LGPL license, so be sure you
are authorized to give us the patch under those terms.
</para>
<para>
If you want to discuss your patch before or after developing it, mail
<ulink url="mailto:gtk-devel-list@gnome.org">gtk-devel-list@gnome.org</ulink>.
But be sure to file the Bugzilla report as well; if the patch is only on the
list and not in Bugzilla, it's likely to slip through the cracks.
</para>
</refsect1>
<refsect1>
<title>User support</title>
<title>Mailing lists</title>
<para>
If you have questions about building, using, or contributing to GTK, please
open a topic on <ulink url="https://discourse.gnome.org/tag/gtk">Discourse</ulink>.
There are several mailing lists dedicated to GTK+ and related
libraries. Discussion of GLib, Pango, and ATK in addition to GTK+
proper is welcome on these lists. You can subscribe or view the
archives of these lists on
<ulink url="https://mail.gnome.org">http://mail.gnome.org</ulink>.
If you aren't subscribed to the list, any message you post to
the list will be held for manual moderation, which might take
some days to happen.
</para>
<para>
<variablelist>
<varlistentry>
<term><ulink url="mailto:gtk-list@gnome.org">gtk-list@gnome.org</ulink></term>
<listitem><para>
gtk-list covers general GTK+ topics; questions about using GTK+ in programs,
GTK+ from a user standpoint, announcements of GTK+-related projects
such as themes or GTK+ modules would all be on-topic. The bulk of the
traffic consists of GTK+ programming questions.
</para></listitem>
</varlistentry>
<varlistentry>
<term><ulink url="mailto:gtk-app-devel-list@gnome.org">gtk-app-devel-list@gnome.org</ulink></term>
<listitem><para>
gtk-app-devel-list covers writing applications in GTK+. It's narrower
in scope than gtk-list, but the two lists overlap quite a
bit. gtk-app-devel-list is a good place to ask questions about GTK+
programming. </para></listitem>
</varlistentry>
<varlistentry>
<term><ulink url="mailto:gtk-devel-list@gnome.org">gtk-devel-list@gnome.org</ulink></term>
<listitem><para>
gtk-devel-list is for discussion of work on GTK+ itself, it is
<emphasis>not</emphasis> for
asking questions about how to use GTK+ in applications. gtk-devel-list
is appropriate for discussion of patches, bugs, proposed features,
and so on.
</para></listitem>
</varlistentry>
<varlistentry>
<term><ulink url="mailto:gtk-i18n-list@gnome.org">gtk-i18n-list@gnome.org</ulink></term>
<listitem><para>
gtk-i18n-list is for discussion of internationalization in GTK+;
Pango is the main focus of the list. Questions about the details of
using Pango, and discussion of proposed Pango patches or features, are
all on topic.
</para></listitem>
</varlistentry>
<varlistentry>
<term><ulink url="mailto:gtk-doc-list@gnome.org">gtk-doc-list@gnome.org</ulink></term>
<listitem><para>
gtk-doc-list is for discussion of the <application>gtk-doc</application>
documentation system (used to document GTK+), and for work on the GTK+
documentation.
</para></listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
</refentry>
+1 -3
View File
@@ -5,7 +5,7 @@ app10_resources = gnome.compile_resources(
source_dir: '.'
)
app10_schemas = gnome.compile_schemas(depend_files: files(['org.gtk.exampleapp.gschema.xml']))
app10_schemas = gnome.compile_schemas()
app10 = executable(
@@ -21,5 +21,3 @@ app10 = executable(
app10_schemas,
dependencies: libgtk_dep
)
install_data('org.gtk.exampleapp.gschema.xml', install_dir: gtk_schemasdir)
+1 -3
View File
@@ -5,7 +5,7 @@ app5_resources = gnome.compile_resources(
source_dir: '.'
)
app5_schemas = gnome.compile_schemas(depend_files: files(['org.gtk.exampleapp.gschema.xml']))
app5_schemas = gnome.compile_schemas()
app5 = executable(
@@ -19,5 +19,3 @@ app5 = executable(
app5_schemas,
dependencies: libgtk_dep
)
install_data('org.gtk.exampleapp.gschema.xml', install_dir: gtk_schemasdir)
+1 -3
View File
@@ -5,7 +5,7 @@ app6_resources = gnome.compile_resources(
source_dir: '.'
)
app6_schemas = gnome.compile_schemas(depend_files: files(['org.gtk.exampleapp.gschema.xml']))
app6_schemas = gnome.compile_schemas()
app6 = executable(
@@ -21,5 +21,3 @@ app6 = executable(
app6_schemas,
dependencies: libgtk_dep
)
install_data('org.gtk.exampleapp.gschema.xml', install_dir: gtk_schemasdir)
+1 -3
View File
@@ -5,7 +5,7 @@ app7_resources = gnome.compile_resources(
source_dir: '.'
)
app7_schemas = gnome.compile_schemas(depend_files: files(['org.gtk.exampleapp.gschema.xml']))
app7_schemas = gnome.compile_schemas()
app7 = executable(
@@ -21,5 +21,3 @@ app7 = executable(
app7_schemas,
dependencies: libgtk_dep
)
install_data('org.gtk.exampleapp.gschema.xml', install_dir: gtk_schemasdir)
+1 -3
View File
@@ -5,7 +5,7 @@ app8_resources = gnome.compile_resources(
source_dir: '.'
)
app8_schemas = gnome.compile_schemas(depend_files: files(['org.gtk.exampleapp.gschema.xml']))
app8_schemas = gnome.compile_schemas()
app8 = executable(
@@ -21,5 +21,3 @@ app8 = executable(
app8_schemas,
dependencies: libgtk_dep
)
install_data('org.gtk.exampleapp.gschema.xml', install_dir: gtk_schemasdir)
+1 -3
View File
@@ -5,7 +5,7 @@ app9_resources = gnome.compile_resources(
source_dir: '.'
)
app9_schemas = gnome.compile_schemas(depend_files: files(['org.gtk.exampleapp.gschema.xml']))
app9_schemas = gnome.compile_schemas()
app9 = executable(
@@ -21,5 +21,3 @@ app9 = executable(
app9_schemas,
dependencies: libgtk_dep
)
install_data('org.gtk.exampleapp.gschema.xml', install_dir: gtk_schemasdir)
+1 -1
View File
@@ -182,7 +182,7 @@ main (int argc,
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", 0);
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
+1 -1
View File
@@ -66,7 +66,7 @@ main (int argc,
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", 0);
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
+1 -1
View File
@@ -37,7 +37,7 @@ main (int argc,
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", 0);
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
+11 -10
View File
@@ -2,15 +2,15 @@
static gboolean
window_key_press_event_cb (GtkWidget *window,
GdkEvent *event,
GtkSearchBar *search_bar)
GdkEvent *event,
GtkSearchBar *search_bar)
{
return gtk_search_bar_handle_event (search_bar, event);
}
static void
activate_cb (GtkApplication *app,
gpointer user_data)
gpointer user_data)
{
GtkWidget *window;
GtkWidget *search_bar;
@@ -40,18 +40,19 @@ activate_cb (GtkApplication *app,
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry));
g_signal_connect (window, "key-press-event",
G_CALLBACK (window_key_press_event_cb),
search_bar);
G_CALLBACK (window_key_press_event_cb), search_bar);
}
int
main (int argc,
char *argv[])
gint
main (gint argc,
gchar *argv[])
{
GtkApplication *app;
app = gtk_application_new ("org.gtk.Example.GtkSearchBar", 0);
g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
app = gtk_application_new ("org.gtk.Example.GtkSearchBar",
G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate",
G_CALLBACK (activate_cb), NULL);
return g_application_run (G_APPLICATION (app), argc, argv);
}
+1 -1
View File
@@ -19,7 +19,7 @@ main (int argc,
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", 0);
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
+263 -5
View File
@@ -1,7 +1,5 @@
## Makefile.am for gtk+/gdk
include $(top_srcdir)/Makefile.decl
include gdk-sources.inc
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ENV = \
@@ -62,6 +60,138 @@ LDADD = \
-rpath $(libdir) \
$(no_undefined)
#
# setup source file variables
#
#
# GDK header files for public installation (non-generated)
#
#
gdk_public_h_sources = \
gdk.h \
gdk-autocleanup.h \
gdkapplaunchcontext.h \
gdkcairo.h \
gdkcursor.h \
gdkdevice.h \
gdkdevicepad.h \
gdkdevicetool.h \
gdkdevicemanager.h \
gdkdisplay.h \
gdkdisplaymanager.h \
gdkdnd.h \
gdkdrawingcontext.h \
gdkevents.h \
gdkframetimings.h \
gdkglcontext.h \
gdkkeys.h \
gdkkeysyms.h \
gdkkeysyms-compat.h \
gdkmain.h \
gdkmonitor.h \
gdkpango.h \
gdkframeclock.h \
gdkpixbuf.h \
gdkprivate.h \
gdkproperty.h \
gdkrectangle.h \
gdkrgba.h \
gdkscreen.h \
gdkseat.h \
gdkselection.h \
gdktestutils.h \
gdkthreads.h \
gdktypes.h \
gdkvisual.h \
gdkwindow.h
deprecated_h_sources = \
deprecated/gdkcolor.h
gdk_h_sources = \
$(gdk_public_h_sources) \
$(deprecated_h_sources)
gdk_private_headers = \
gdk-private.h \
gdkapplaunchcontextprivate.h \
gdkconstructor.h \
gdkcursorprivate.h \
gdkdevicemanagerprivate.h \
gdkdeviceprivate.h \
gdkdevicepadprivate.h \
gdkdevicetoolprivate.h \
gdkdisplaymanagerprivate.h \
gdkdisplayprivate.h \
gdkdndprivate.h \
gdkdrawingcontextprivate.h \
gdkframeclockidle.h \
gdkframeclockprivate.h \
gdkglcontextprivate.h \
gdkmonitorprivate.h \
gdkprofilerprivate.h \
gdkscreenprivate.h \
gdkseatprivate.h \
gdkseatdefaultprivate.h \
gdkinternals.h \
gdkintl.h \
gdkkeysprivate.h \
gdkvisualprivate.h \
gdkx.h
deprecated_c_sources = \
deprecated/gdkcolor.c
gdk_c_sources = \
$(deprecated_c_sources) \
gdk-private.c \
gdk.c \
gdkapplaunchcontext.c \
gdkcairo.c \
gdkcursor.c \
gdkdeprecated.c \
gdkdevice.c \
gdkdevicepad.c \
gdkdevicetool.c \
gdkdevicemanager.c \
gdkdisplay.c \
gdkdisplaymanager.c \
gdkdnd.c \
gdkdrawingcontext.c \
gdkevents.c \
gdkframetimings.c \
gdkgl.c \
gdkglcontext.c \
gdkglobals.c \
gdkkeys.c \
gdkkeyuni.c \
gdkmonitor.c \
gdkoffscreenwindow.c \
gdkframeclock.c \
gdkframeclockidle.c \
gdkpango.c \
gdkpixbuf-drawable.c \
gdkprofiler.c \
gdkproperty.c \
gdkrectangle.c \
gdkrgba.c \
gdkscreen.c \
gdkseat.c \
gdkseatdefault.c \
gdkselection.c \
gdkvisual.c \
gdkwindow.c \
gdkwindowimpl.c
gdk_built_sources = \
gdkenumtypes.h \
gdkenumtypes.c \
gdkmarshalers.h \
gdkmarshalers.c \
gdkresources.h \
gdkresources.c \
gdkversionmacros.h
#
# setup GDK sources and their dependencies
#
@@ -71,7 +201,7 @@ gdkinclude_HEADERS = $(gdk_public_h_sources)
nodist_gdkinclude_HEADERS = gdkconfig.h gdkenumtypes.h gdkversionmacros.h
deprecatedincludedir = $(includedir)/gtk-3.0/gdk/deprecated
deprecatedinclude_HEADERS = $(gdk_deprecated_h_sources)
deprecatedinclude_HEADERS = $(deprecated_h_sources)
common_sources = \
$(gdk_private_headers) \
@@ -129,6 +259,57 @@ if OS_WIN32
Gdk_3_0_gir_CFLAGS += -I$(srcdir)/win32 -I$(srcdir)
endif
if USE_X11
x11_introspection_files = \
x11/gdkapplaunchcontext-x11.c \
x11/gdkasync.c \
x11/gdkcursor-x11.c \
x11/gdkdevice-core-x11.c \
x11/gdkdevicemanager-core-x11.c \
x11/gdkdevicemanager-x11.c \
x11/gdkdevicemanager-xi2.c \
x11/gdkdevice-xi2.c \
x11/gdkdisplay-x11.c \
x11/gdkdisplaymanager-x11.c \
x11/gdkdnd-x11.c \
x11/gdkeventsource.c \
x11/gdkeventtranslator.c \
x11/gdkgeometry-x11.c \
x11/gdkglcontext-x11.c \
x11/gdkkeys-x11.c \
x11/gdkmain-x11.c \
x11/gdkmonitor-x11.c \
x11/gdkproperty-x11.c \
x11/gdkscreen-x11.c \
x11/gdkselection-x11.c \
x11/gdksettings.c \
x11/gdktestutils-x11.c \
x11/gdkvisual-x11.c \
x11/gdkwindow-x11.c \
x11/gdkxftdefaults.c \
x11/gdkxid.c \
x11/xsettings-client.c \
x11/gdkx.h \
x11/gdkx11applaunchcontext.h \
x11/gdkx11cursor.h \
x11/gdkx11device.h \
x11/gdkx11device-core.h \
x11/gdkx11device-xi2.h \
x11/gdkx11devicemanager.h \
x11/gdkx11devicemanager-core.h \
x11/gdkx11devicemanager-xi2.h \
x11/gdkx11display.h \
x11/gdkx11displaymanager.h \
x11/gdkx11dnd.h \
x11/gdkx11glcontext.h \
x11/gdkx11keys.h \
x11/gdkx11monitor.h \
x11/gdkx11property.h \
x11/gdkx11screen.h \
x11/gdkx11selection.h \
x11/gdkx11utils.h \
x11/gdkx11visual.h \
x11/gdkx11window.h
GdkX11-3.0.gir: libgdk-3.la Gdk-3.0.gir Makefile
GdkX11_3_0_gir_SCANNERFLAGS = \
--identifier-prefix=Gdk \
@@ -143,6 +324,36 @@ INTROSPECTION_GIRS += GdkX11-3.0.gir
endif # USE_X11
w32_introspection_files = \
win32/gdkcursor-win32.c \
win32/gdkdevicemanager-win32.c \
win32/gdkdevice-virtual.c \
win32/gdkdevice-win32.c \
win32/gdkdevice-wintab.c \
win32/gdkdisplaymanager-win32.c \
win32/gdkdisplay-win32.c \
win32/gdkdnd-win32.c \
win32/gdkevents-win32.c \
win32/gdkgeometry-win32.c \
win32/gdkglobals-win32.c \
win32/gdkkeys-win32.c \
win32/gdkmain-win32.c \
win32/gdkproperty-win32.c \
win32/gdkscreen-win32.c \
win32/gdkselection-win32.c \
win32/gdktestutils-win32.c \
win32/gdkwin32.h \
win32/gdkwin32cursor.h \
win32/gdkwin32display.h \
win32/gdkwin32displaymanager.h \
win32/gdkwin32dnd.h \
win32/gdkwin32id.c \
win32/gdkwin32keys.h \
win32/gdkwin32misc.h \
win32/gdkwin32screen.h \
win32/gdkwin32window.h \
win32/gdkwindow-win32.c
if OS_WIN32
GdkWin32-3.0.gir: libgdk-3.la Gdk-3.0.gir Makefile
GdkWin32_3_0_gir_SCANNERFLAGS = \
@@ -203,6 +414,7 @@ lib_LTLIBRARIES = libgdk-3.la
MAINTAINERCLEANFILES = $(gdk_built_sources) stamp-gdkenumtypes.h
EXTRA_DIST += \
$(gdk_built_sources) \
fallback-c89.c
install-exec-hook:
@@ -287,13 +499,59 @@ gdkresources.c: gdk.gresource.xml $(resource_files)
# ------------------- MSVC Build Items ----------------
MSVCPROJS = gdk-3
gdk_3_FILES = $(gdk_c_sources)
gdk_3_FILES = $(libgdk_3_la_SOURCES)
gdk_3_EXCLUDES = dummy
gdk_3_HEADERS_DIR = $(gdkincludedir)
gdk_3_HEADERS_INST = \
$(gdkinclude_HEADERS) \
$(deprecatedinclude_HEADERS) \
$(nodist_gdkinclude_HEADERS)
gdk_3_HEADERS_EXCLUDES = dummy
include $(top_srcdir)/win32/Makefile.msvcproj
if HAVE_INTROSPECTION
# Introspection Items for MSVC
MSVC_INTROSPECT_GIRS = Gdk-3.0.gir GdkWin32-3.0.gir
BASE_MSVC_GIR_CFLAGS = \
$(GDK_CFLAGS_DEFINES) \
-I.. -I../gdk -I../gdk/win32
INTROSPECTION_INTERMEDIATE_ITEMS = \
$(top_builddir)/win32/Gdk-3.0.gir.msvc.introspect \
$(top_builddir)/win32/Gdk_3_0_gir_list \
$(top_builddir)/win32/GdkWin32-3.0.gir.msvc.introspect \
$(top_builddir)/win32/GdkWin32_3_0_gir_list
Gdk_3_0_gir_MSVC_FILES = $(introspection_files)
Gdk_3_0_gir_MSVC_EXPORT_PACKAGES = $(Gdk_3_0_gir_EXPORT_PACKAGES)
Gdk_3_0_gir_MSVC_INCLUDE_GIRS = $(Gdk_3_0_gir_INCLUDES)
Gdk_3_0_gir_MSVC_LIBS = gdk-3.0
Gdk_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS)
Gdk_3_0_gir_MSVC_SCANNERFLAGS = $(Gdk_3_0_gir_SCANNERFLAGS)
GdkWin32_3_0_gir_MSVC_FILES = $(w32_introspection_files)
GdkWin32_3_0_gir_MSVC_INCLUDE_GIRS = $(GdkWin32_3_0_gir_INCLUDES)
GdkWin32_3_0_gir_MSVC_LIBS = $(Gdk_3_0_gir_MSVC_LIBS)
GdkWin32_3_0_gir_MSVC_CFLAGS = $(BASE_MSVC_GIR_CFLAGS)
GdkWin32_3_0_gir_MSVC_SCANNERFLAGS = \
--identifier-prefix=Gdk \
--c-include="gdk/gdkwin32.h" \
--include-uninstalled='./vs$$$$(VSVER)/$$$$(CFG)/$$$$(PLAT)/bin/Gdk-3.0.gir'
include $(top_srcdir)/win32/Makefile.msvc-introspection
else
INTROSPECTION_INTERMEDIATE_ITEMS =
endif
dist-hook: \
$(top_builddir)/win32/vs9/gdk-3.vcproj
$(top_builddir)/win32/vs9/gdk-3.vcproj \
$(top_builddir)/win32/vs9/gdk-3.headers \
$(INTROSPECTION_INTERMEDIATE_ITEMS)
DISTCLEANFILES = gdkconfig.h stamp-gc-h
+57 -6
View File
@@ -1,6 +1,5 @@
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/Makefile.decl
include gdk-broadway-sources.inc
NULL =
libgdkincludedir = $(includedir)/gtk-3.0/gdk
@@ -24,7 +23,15 @@ noinst_LTLIBRARIES = libgdk-broadway.la
bin_PROGRAMS = broadwayd
libgdkinclude_HEADERS = $(GDK_PUBLIC_H_SRCS_BROADWAY)
libgdkinclude_HEADERS = \
gdkbroadway.h
libgdkbroadwayinclude_HEADERS = \
gdkbroadwaydisplay.h \
gdkbroadwaywindow.h \
gdkbroadwaycursor.h \
gdkbroadwaymonitor.h \
gdkbroadwayvisual.h
EXTRA_DIST += toarray.pl
@@ -39,12 +46,40 @@ broadwayjs.h: broadway.js rawinflate.min.js
EXTRA_DIST += broadway.js rawinflate.min.js
# built headers that don't get installed
broadway_built_private_headers = \
clienthtml.h \
broadwayjs.h
broadway_built_sources = \
$(broadway_built_private_headers)
${broadway_built_private_headers}
libgdk_broadway_la_SOURCES = \
$(broadway_built_private_headers)\
$(GDK_BROADWAY_NON_GENERATED_SOURCES)
${broadway_built_private_headers}\
gdkcursor-broadway.c \
gdkdevice-broadway.h \
gdkdevice-broadway.c \
gdkdevicemanager-broadway.h \
gdkdevicemanager-broadway.c \
gdkdisplay-broadway.c \
gdkdisplay-broadway.h \
gdkdnd-broadway.c \
gdkeventsource.c \
gdkeventsource.h \
gdkglobals-broadway.c \
gdkkeys-broadway.c \
gdkmonitor-broadway.c \
gdkmonitor-broadway.h \
gdkproperty-broadway.c \
gdkscreen-broadway.c \
gdkscreen-broadway.h \
gdkselection-broadway.c \
gdktestutils-broadway.c \
gdkvisual-broadway.c \
gdkwindow-broadway.c \
gdkwindow-broadway.h \
gdkprivate-broadway.h \
gdkbroadway-server.h \
gdkbroadway-server.c
if OS_UNIX
libgdk_broadway_la_LIBADD = \
@@ -52,6 +87,16 @@ libgdk_broadway_la_LIBADD = \
$(NULL)
endif
broadwayd_SOURCES = \
broadway-protocol.h \
broadwayd.c \
broadway-server.h \
broadway-server.c \
broadway-buffer.c \
broadway-buffer.h \
broadway-output.h \
broadway-output.c
if OS_WIN32
broadwayd_LDADD = $(GDK_DEP_LIBS) -lws2_32
else
@@ -72,6 +117,11 @@ MSVCPROJS = gdk3-broadway broadwayd
gdk3_broadway_FILES = $(libgdk_broadway_la_SOURCES)
gdk3_broadway_EXCLUDES = dummy
gdk3_broadway_HEADERS_DIR = $(libgdkbroadwayincludedir)
gdk3_broadway_HEADERS_INST = $(libgdkbroadwayinclude_HEADERS)
gdk3_broadway_HEADERS_EXCLUDES = dummy
broadwayd_FILES = $(broadwayd_SOURCES)
broadwayd_EXCLUDES = dummy
@@ -80,6 +130,7 @@ include $(top_srcdir)/win32/Makefile.msvcproj
dist-hook: \
$(top_builddir)/win32/vs9/gdk3-broadway.vcproj \
$(top_builddir)/win32/vs9/broadwayd.vcproj
$(top_builddir)/win32/vs9/broadwayd.vcproj \
$(top_builddir)/win32/vs9/gdk3-broadway.headers
-include $(top_srcdir)/git.mk
-55
View File
@@ -1,55 +0,0 @@
# Public header list for GdkBroadway
GDK_PUBLIC_H_SRCS_BROADWAY = \
gdkbroadway.h
libgdkbroadwayinclude_HEADERS = \
gdkbroadwaydisplay.h \
gdkbroadwaywindow.h \
gdkbroadwaycursor.h \
gdkbroadwaymonitor.h \
gdkbroadwayvisual.h
# built headers that don't get installed
broadway_built_private_headers = \
clienthtml.h \
broadwayjs.h
# Other non-generated sources
GDK_BROADWAY_NON_GENERATED_SOURCES = \
gdkcursor-broadway.c \
gdkdevice-broadway.h \
gdkdevice-broadway.c \
gdkdevicemanager-broadway.h \
gdkdevicemanager-broadway.c \
gdkdisplay-broadway.c \
gdkdisplay-broadway.h \
gdkdnd-broadway.c \
gdkeventsource.c \
gdkeventsource.h \
gdkglobals-broadway.c \
gdkkeys-broadway.c \
gdkmonitor-broadway.c \
gdkmonitor-broadway.h \
gdkproperty-broadway.c \
gdkscreen-broadway.c \
gdkscreen-broadway.h \
gdkselection-broadway.c \
gdktestutils-broadway.c \
gdkvisual-broadway.c \
gdkwindow-broadway.c \
gdkwindow-broadway.h \
gdkprivate-broadway.h \
gdkbroadway-server.h \
gdkbroadway-server.c
broadwayd_SOURCES = \
broadway-protocol.h \
broadwayd.c \
broadway-server.h \
broadway-server.c \
broadway-buffer.c \
broadway-buffer.h \
broadway-output.h \
broadway-output.c
+1 -1
View File
@@ -109,7 +109,7 @@ _gdk_broadway_display_open (const gchar *display_name)
broadway_display->server = _gdk_broadway_server_new (display_name, &error);
if (broadway_display->server == NULL)
{
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
g_printerr ("Unable to init server: %s\n", error->message);
g_error_free (error);
return NULL;
}
+1 -2
View File
@@ -22,8 +22,7 @@ gdk__private__ (void)
gdk_get_desktop_autostart_id,
gdk_profiler_is_running,
gdk_profiler_start,
gdk_profiler_stop,
gdk_window_titlebar_gesture,
gdk_profiler_stop
};
return &table;
-3
View File
@@ -66,9 +66,6 @@ typedef struct {
gboolean (* gdk_profiler_is_running) (void);
void (* gdk_profiler_start) (int fd);
void (* gdk_profiler_stop) (void);
gboolean (* gdk_window_titlebar_gesture) (GdkWindow *window,
GdkTitlebarGesture gesture);
} GdkPrivateVTable;
GDK_AVAILABLE_IN_ALL
-213
View File
@@ -1,213 +0,0 @@
#
# GDK header files for public installation (non-generated)
#
#
# setup source file variables
#
gdk_public_h_sources = \
gdk.h \
gdk-autocleanup.h \
gdkapplaunchcontext.h \
gdkcairo.h \
gdkcursor.h \
gdkdevice.h \
gdkdevicepad.h \
gdkdevicetool.h \
gdkdevicemanager.h \
gdkdisplay.h \
gdkdisplaymanager.h \
gdkdnd.h \
gdkdrawingcontext.h \
gdkevents.h \
gdkframetimings.h \
gdkglcontext.h \
gdkkeys.h \
gdkkeysyms.h \
gdkkeysyms-compat.h \
gdkmain.h \
gdkmonitor.h \
gdkpango.h \
gdkframeclock.h \
gdkpixbuf.h \
gdkprivate.h \
gdkproperty.h \
gdkrectangle.h \
gdkrgba.h \
gdkscreen.h \
gdkseat.h \
gdkselection.h \
gdktestutils.h \
gdkthreads.h \
gdktypes.h \
gdkvisual.h \
gdkwindow.h
gdk_deprecated_h_sources = \
deprecated/gdkcolor.h
gdk_h_sources = \
$(gdk_public_h_sources) \
$(gdk_deprecated_h_sources)
gdk_private_headers = \
gdk-private.h \
gdkapplaunchcontextprivate.h \
gdkconstructor.h \
gdkcursorprivate.h \
gdkdevicemanagerprivate.h \
gdkdeviceprivate.h \
gdkdevicepadprivate.h \
gdkdevicetoolprivate.h \
gdkdisplaymanagerprivate.h \
gdkdisplayprivate.h \
gdkdndprivate.h \
gdkdrawingcontextprivate.h \
gdkframeclockidle.h \
gdkframeclockprivate.h \
gdkglcontextprivate.h \
gdkmonitorprivate.h \
gdkprofilerprivate.h \
gdkscreenprivate.h \
gdkseatprivate.h \
gdkseatdefaultprivate.h \
gdkinternals.h \
gdkintl.h \
gdkkeysprivate.h \
gdkvisualprivate.h \
gdkx.h
gdk_deprecated_c_sources = \
deprecated/gdkcolor.c
gdk_c_sources = \
$(gdk_deprecated_c_sources) \
gdk-private.c \
gdk.c \
gdkapplaunchcontext.c \
gdkcairo.c \
gdkcursor.c \
gdkdeprecated.c \
gdkdevice.c \
gdkdevicepad.c \
gdkdevicetool.c \
gdkdevicemanager.c \
gdkdisplay.c \
gdkdisplaymanager.c \
gdkdnd.c \
gdkdrawingcontext.c \
gdkevents.c \
gdkframetimings.c \
gdkgl.c \
gdkglcontext.c \
gdkglobals.c \
gdkkeys.c \
gdkkeyuni.c \
gdkmonitor.c \
gdkoffscreenwindow.c \
gdkframeclock.c \
gdkframeclockidle.c \
gdkpango.c \
gdkpixbuf-drawable.c \
gdkprofiler.c \
gdkproperty.c \
gdkrectangle.c \
gdkrgba.c \
gdkscreen.c \
gdkseat.c \
gdkseatdefault.c \
gdkselection.c \
gdkvisual.c \
gdkwindow.c \
gdkwindowimpl.c
gdk_built_sources = \
gdkenumtypes.h \
gdkenumtypes.c \
gdkmarshalers.h \
gdkmarshalers.c \
gdkresources.h \
gdkresources.c \
gdkversionmacros.h
x11_introspection_files = \
x11/gdkapplaunchcontext-x11.c \
x11/gdkasync.c \
x11/gdkcursor-x11.c \
x11/gdkdevice-core-x11.c \
x11/gdkdevicemanager-core-x11.c \
x11/gdkdevicemanager-x11.c \
x11/gdkdevicemanager-xi2.c \
x11/gdkdevice-xi2.c \
x11/gdkdisplay-x11.c \
x11/gdkdisplaymanager-x11.c \
x11/gdkdnd-x11.c \
x11/gdkeventsource.c \
x11/gdkeventtranslator.c \
x11/gdkgeometry-x11.c \
x11/gdkglcontext-x11.c \
x11/gdkkeys-x11.c \
x11/gdkmain-x11.c \
x11/gdkmonitor-x11.c \
x11/gdkproperty-x11.c \
x11/gdkscreen-x11.c \
x11/gdkselection-x11.c \
x11/gdksettings.c \
x11/gdktestutils-x11.c \
x11/gdkvisual-x11.c \
x11/gdkwindow-x11.c \
x11/gdkxftdefaults.c \
x11/gdkxid.c \
x11/xsettings-client.c \
x11/gdkx.h \
x11/gdkx11applaunchcontext.h \
x11/gdkx11cursor.h \
x11/gdkx11device.h \
x11/gdkx11device-core.h \
x11/gdkx11device-xi2.h \
x11/gdkx11devicemanager.h \
x11/gdkx11devicemanager-core.h \
x11/gdkx11devicemanager-xi2.h \
x11/gdkx11display.h \
x11/gdkx11displaymanager.h \
x11/gdkx11dnd.h \
x11/gdkx11glcontext.h \
x11/gdkx11keys.h \
x11/gdkx11monitor.h \
x11/gdkx11property.h \
x11/gdkx11screen.h \
x11/gdkx11selection.h \
x11/gdkx11utils.h \
x11/gdkx11visual.h \
x11/gdkx11window.h
w32_introspection_files = \
win32/gdkcursor-win32.c \
win32/gdkdevicemanager-win32.c \
win32/gdkdevice-virtual.c \
win32/gdkdevice-win32.c \
win32/gdkdevice-wintab.c \
win32/gdkdisplaymanager-win32.c \
win32/gdkdisplay-win32.c \
win32/gdkdnd-win32.c \
win32/gdkevents-win32.c \
win32/gdkgeometry-win32.c \
win32/gdkglobals-win32.c \
win32/gdkkeys-win32.c \
win32/gdkmain-win32.c \
win32/gdkproperty-win32.c \
win32/gdkscreen-win32.c \
win32/gdkselection-win32.c \
win32/gdktestutils-win32.c \
win32/gdkwin32.h \
win32/gdkwin32cursor.h \
win32/gdkwin32display.h \
win32/gdkwin32displaymanager.h \
win32/gdkwin32dnd.h \
win32/gdkwin32id.c \
win32/gdkwin32keys.h \
win32/gdkwin32misc.h \
win32/gdkwin32screen.h \
win32/gdkwin32window.h \
win32/gdkwindow-win32.c
+3 -4
View File
@@ -1132,8 +1132,7 @@ gdk_unichar_direction (gunichar ch)
return PANGO_DIRECTION_LTR;
}
#if defined (G_HAS_CONSTRUCTORS) && !defined (G_OS_WIN32)
#define GDK_USE_CONSTRUCTORS
#ifdef G_HAS_CONSTRUCTORS
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_startup_id)
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_autostart_id)
@@ -1176,7 +1175,7 @@ gdk_get_desktop_startup_id (void)
if (g_once_init_enter (&init))
{
#ifndef GDK_USE_CONSTRUCTORS
#ifndef G_HAS_CONSTRUCTORS
stash_startup_id ();
#endif
/* Clear the environment variable so it won't be inherited by
@@ -1197,7 +1196,7 @@ gdk_get_desktop_autostart_id (void)
if (g_once_init_enter (&init))
{
#ifndef GDK_USE_CONSTRUCTORS
#ifndef G_HAS_CONSTRUCTORS
stash_autostart_id ();
#endif
/* Clear the environment variable so it won't be inherited by
-3
View File
@@ -205,9 +205,6 @@ gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
* Sets the screen on which applications will be launched when
* using this context. See also gdk_app_launch_context_set_display().
*
* Note that, typically, a #GdkScreen represents a logical screen,
* not a physical monitor.
*
* If both @screen and @display are set, the @screen takes priority.
* If neither @screen or @display are set, the default screen and
* display are used.
+5 -11
View File
@@ -258,7 +258,6 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
GList *pending_motions = NULL;
GdkWindow *pending_motion_window = NULL;
GdkDevice *pending_motion_device = NULL;
gboolean uncompressed_motion = FALSE;
/* If the last N events in the event queue are motion notify
* events for the same window, drop all but the last */
@@ -283,14 +282,10 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
pending_motion_device != event->event.motion.device)
break;
pending_motion_window = event->event.motion.window;
if (!event->event.motion.window->event_compression)
{
uncompressed_motion = TRUE;
break;
}
break;
pending_motion_window = event->event.motion.window;
pending_motion_device = event->event.motion.device;
pending_motions = tmp_list;
@@ -306,10 +301,9 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
pending_motions = next;
}
if (uncompressed_motion ||
(pending_motions &&
pending_motions == display->queued_events &&
pending_motions == display->queued_tail))
if (pending_motions &&
pending_motions == display->queued_events &&
pending_motions == display->queued_tail)
{
GdkFrameClock *clock = gdk_window_get_frame_clock (pending_motion_window);
if (clock) /* might be NULL if window was destroyed */
+17 -17
View File
@@ -370,7 +370,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
paint_data = gdk_gl_context_get_paint_data (paint_context);
if (paint_data->tmp_framebuffer == 0)
glGenFramebuffers (1, &paint_data->tmp_framebuffer);
glGenFramebuffersEXT (1, &paint_data->tmp_framebuffer);
if (source_type == GL_RENDERBUFFER)
{
@@ -423,10 +423,10 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
/* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
framebuffer = paint_data->tmp_framebuffer;
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, source);
glBindFramebuffer (GL_DRAW_FRAMEBUFFER, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, source);
glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, 0);
/* Translate to impl coords */
cairo_region_translate (clip_region, dx, dy);
@@ -481,11 +481,11 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
{
int clipped_src_x = x + (dest.x - dx * window_scale);
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
glBlitFramebuffer (clipped_src_x, clipped_src_y,
(clipped_src_x + dest.width), (clipped_src_y + dest.height),
dest.x, FLIP_Y(dest.y + dest.height),
dest.x + dest.width, FLIP_Y(dest.y),
GL_COLOR_BUFFER_BIT, GL_NEAREST);
glBlitFramebufferEXT(clipped_src_x, clipped_src_y,
(clipped_src_x + dest.width), (clipped_src_y + dest.height),
dest.x, FLIP_Y(dest.y + dest.height),
dest.x + dest.width, FLIP_Y(dest.y),
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (impl_window->current_paint.flushed_region)
{
cairo_rectangle_int_t flushed_rect;
@@ -505,7 +505,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glDisable (GL_SCISSOR_TEST);
glBindFramebuffer (GL_FRAMEBUFFER, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
#undef FLIP_Y
@@ -671,19 +671,19 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
framebuffer = paint_data->tmp_framebuffer;
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
if (source_type == GL_RENDERBUFFER)
{
/* Create a framebuffer with the source renderbuffer and
make it the current target for reads */
glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_RENDERBUFFER, source);
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_RENDERBUFFER_EXT, source);
}
else
{
glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, source, 0);
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, source, 0);
}
glPixelStorei (GL_PACK_ALIGNMENT, 4);
@@ -699,7 +699,7 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
glBindFramebuffer (GL_FRAMEBUFFER, 0);
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
cairo_surface_mark_dirty (image);
-3
View File
@@ -557,9 +557,6 @@ void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_win
gboolean _gdk_window_has_impl (GdkWindow *window);
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
gboolean gdk_window_titlebar_gesture (GdkWindow *window,
GdkTitlebarGesture gesture);
/*****************************
* offscreen window routines *
*****************************/
+8 -1
View File
@@ -835,13 +835,18 @@ static const struct {
/* Following items added to GTK, not in the xterm table */
/* A few ASCII control characters */
#ifndef GDK_WINDOWING_WIN32
{ 0xFF08 /* Backspace */, '\b' },
{ 0xFF09 /* Tab */, '\t' },
#endif
{ 0xFF0A /* Linefeed */, '\n' },
{ 0xFF0B /* Vert. Tab */, '\v' },
#ifndef GDK_WINDOWING_WIN32
{ 0xFF0D /* Return */, '\r' },
{ 0xFF1B /* Escape */, '\033' },
#endif
/* Numeric keypad */
@@ -866,7 +871,9 @@ static const struct {
/* End numeric keypad */
#ifndef GDK_WINDOWING_WIN32
{ 0xFFFF /* Delete */, '\177' }
#endif
};
/**
+1 -2
View File
@@ -43,8 +43,7 @@ struct _GdkSeatDefaultPrivate
GDK_ENTER_NOTIFY_MASK | \
GDK_LEAVE_NOTIFY_MASK | \
GDK_PROXIMITY_IN_MASK | \
GDK_PROXIMITY_OUT_MASK | \
GDK_TOUCHPAD_GESTURE_MASK)
GDK_PROXIMITY_OUT_MASK)
G_DEFINE_TYPE_WITH_PRIVATE (GdkSeatDefault, gdk_seat_default, GDK_TYPE_SEAT)
+1 -18
View File
@@ -1286,7 +1286,7 @@ get_native_device_event_mask (GdkWindow *private,
if (gdk_window_is_toplevel (private) ||
mask & GDK_BUTTON_PRESS_MASK)
mask |=
GDK_TOUCH_MASK | GDK_TOUCHPAD_GESTURE_MASK |
GDK_TOUCH_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_SCROLL_MASK;
@@ -11998,20 +11998,3 @@ gdk_window_show_window_menu (GdkWindow *window,
else
return FALSE;
}
gboolean
gdk_window_titlebar_gesture (GdkWindow *window,
GdkTitlebarGesture gesture)
{
GdkWindowImplClass *impl_class;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
g_return_val_if_fail (!GDK_WINDOW_DESTROYED (window), FALSE);
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (impl_class->titlebar_gesture)
return impl_class->titlebar_gesture (window, gesture);
else
return FALSE;
}
-10
View File
@@ -30,13 +30,6 @@
G_BEGIN_DECLS
typedef enum
{
GDK_TITLEBAR_GESTURE_DOUBLE_CLICK = 1,
GDK_TITLEBAR_GESTURE_RIGHT_CLICK = 2,
GDK_TITLEBAR_GESTURE_MIDDLE_CLICK = 3
} GdkTitlebarGesture;
#define GDK_TYPE_WINDOW_IMPL (gdk_window_impl_get_type ())
#define GDK_WINDOW_IMPL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WINDOW_IMPL, GdkWindowImpl))
#define GDK_WINDOW_IMPL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WINDOW_IMPL, GdkWindowImplClass))
@@ -322,9 +315,6 @@ struct _GdkWindowImplClass
const cairo_region_t *region);
void (* destroy_draw_context) (GdkWindow *window,
GdkDrawingContext *context);
gboolean (* titlebar_gesture) (GdkWindow *window,
GdkTitlebarGesture gesture);
};
/* Interface Functions */
+2 -1
View File
@@ -803,7 +803,8 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
gdk_event_free (event);
_gdk_quartz_drag_source_context_destroy_gtk_only ();
g_object_unref (_gdk_quartz_drag_source_context);
_gdk_quartz_drag_source_context = NULL;
}
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
+60 -187
View File
@@ -24,29 +24,16 @@
#include "gdkprivate-quartz.h"
#include "gdkquartz.h"
#include "gdkinternal-quartz.h"
#include <cairo/cairo-quartz.h>
#import <AppKit/AppKit.h>
#import <IOSurface/IOSurface.h>
@implementation GdkQuartzView
-(id)initWithFrame: (NSRect)frameRect
{
if ((self = [super initWithFrame: frameRect]))
{
pb_props = @{
(id)kCVPixelBufferIOSurfaceCoreAnimationCompatibilityKey: @1,
(id)kCVPixelBufferBytesPerRowAlignmentKey: @64,
};
[pb_props retain];
cfpb_props = (__bridge CFDictionaryRef)pb_props;
markedRange = NSMakeRange (NSNotFound, 0);
selectedRange = NSMakeRange (0, 0);
}
[self setValue: @(YES) forKey: @"postsFrameChangedNotifications"];
return self;
@@ -198,7 +185,7 @@
-(void)doCommandBySelector: (SEL)aSelector
{
GDK_NOTE (EVENTS, g_message ("doCommandBySelector %s", [NSStringFromSelector (aSelector) UTF8String]));
GDK_NOTE (EVENTS, g_message ("doCommandBySelector %s", aSelector));
g_object_set_data (G_OBJECT (gdk_window), GIC_FILTER_KEY,
GUINT_TO_POINTER (GIC_FILTER_PASSTHRU));
}
@@ -269,12 +256,6 @@
trackingRect = 0;
}
if (pixels)
{
CVPixelBufferRelease (pixels);
}
[pb_props release];
[super dealloc];
}
@@ -295,7 +276,7 @@
-(BOOL)isFlipped
{
return NO;
return YES;
}
-(BOOL)isOpaque
@@ -308,156 +289,74 @@
gdk_screen_get_rgba_visual (_gdk_screen);
}
- (void) viewWillDraw
{
/* MacOS 11 (Big Sur) has added a new, dynamic "accent" as default.
* This uses a 10-bit colorspace so every GIMP drawing operation
* has the additional cost of an 8-bit (ARGB) to 10-bit conversion.
* Let's disable this mode to regain the lost performance.
*/
if(gdk_quartz_osx_version() >= GDK_OSX_BIGSUR)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
CALayer* layer = self.layer;
layer.contentsFormat = kCAContentsFormatRGBA8Uint;
#endif
}
[super viewWillDraw];
}
-(BOOL)wantsUpdateLayer
{
return YES;
}
static void
nsrect_from_cairo_rect (NSRect *nsrect, cairo_rectangle_int_t *rect)
{
nsrect->origin.x = (CGFloat)rect->x;
nsrect->origin.y = (CGFloat)rect->y;
nsrect->size.width = (CGFloat)rect->width;
nsrect->size.height = (CGFloat)rect->height;
}
static void
cairo_rect_from_nsrect (cairo_rectangle_int_t *rect, NSRect *nsrect)
{
rect->x = (int)nsrect->origin.x;
rect->y = (int)nsrect->origin.y;
rect->width = (int)nsrect->size.width;
rect->height = (int)nsrect->size.height;
}
static cairo_status_t
copy_rectangle_argb32 (cairo_surface_t *dest, cairo_surface_t *source,
cairo_region_t *region)
{
cairo_surface_t *source_img, *dest_img;
cairo_status_t status;
cairo_format_t format;
int height, width, stride;
cairo_rectangle_int_t extents;
cairo_region_get_extents (region, &extents);
source_img = cairo_surface_map_to_image (source, &extents);
status = cairo_surface_status (source_img);
if (status)
{
g_warning ("Failed to map source image surface, %d %d %d %d on %d %d: %s\n",
extents.x, extents.y, extents.width, extents.height,
cairo_image_surface_get_width (source),
cairo_image_surface_get_height (source),
cairo_status_to_string (status));
return status;
}
format = cairo_image_surface_get_format (source_img);
dest_img = cairo_surface_map_to_image (dest, &extents);
status = cairo_surface_status (dest_img);
if (status)
{
g_warning ("Failed to map destination image surface, %d %d %d %d on %d %d: %s\n",
extents.x, extents.y, extents.width, extents.height,
cairo_image_surface_get_width (dest),
cairo_image_surface_get_height (dest),
cairo_status_to_string (status));
goto CLEANUP;
}
width = cairo_image_surface_get_width (source_img);
stride = cairo_format_stride_for_width (format, width);
height = cairo_image_surface_get_height (source_img);
memcpy (cairo_image_surface_get_data (dest_img),
cairo_image_surface_get_data (source_img),
stride * height);
cairo_surface_unmap_image (dest, dest_img);
CLEANUP:
cairo_surface_unmap_image (source, source_img);
return status;
}
-(void)updateLayer
-(void)drawRect: (NSRect)rect
{
GdkRectangle gdk_rect;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (gdk_window->impl);
cairo_rectangle_int_t impl_rect = {0, 0, 0, 0};
CGRect layer_bounds = [self.layer bounds];
CGRect backing_bounds = [self convertRectToBacking: layer_bounds];
cairo_rectangle_int_t bounds_rect;
cairo_region_t *bounds_region;
cairo_surface_t *cvpb_surface;
const NSRect *drawn_rects;
NSInteger count;
int i;
cairo_region_t *region;
if (GDK_WINDOW_DESTROYED (gdk_window))
return;
++impl->in_paint_rect_count;
cairo_rect_from_nsrect (&bounds_rect, &backing_bounds);
bounds_region = cairo_region_create_rectangle (&bounds_rect);
if (impl->needs_display_region)
{
cairo_region_t *region = impl->needs_display_region;
_gdk_window_process_updates_recurse (gdk_window, region);
cairo_region_destroy (region);
impl->needs_display_region = NULL;
}
else
{
cairo_rectangle_int_t bounds;
cairo_region_t *region;
cairo_rect_from_nsrect (&bounds, &layer_bounds);
region = cairo_region_create_rectangle (&bounds);
_gdk_window_process_updates_recurse (gdk_window, region);
cairo_region_destroy (region);
}
if (!impl || !impl->cairo_surface)
if (! (gdk_window->event_mask & GDK_EXPOSURE_MASK))
return;
impl_rect.width = cairo_image_surface_get_width (impl->cairo_surface);
impl_rect.height = cairo_image_surface_get_height (impl->cairo_surface);
CVPixelBufferLockBaseAddress (pixels, 0);
cvpb_surface =
cairo_image_surface_create_for_data (CVPixelBufferGetBaseAddress (pixels),
CAIRO_FORMAT_ARGB32,
(int)CVPixelBufferGetWidth (pixels),
(int)CVPixelBufferGetHeight (pixels),
(int)CVPixelBufferGetBytesPerRow (pixels));
if (NSEqualRects (rect, NSZeroRect))
return;
if (!GDK_WINDOW_IS_MAPPED (gdk_window))
{
/* If the window is not yet mapped, clip_region_with_children
* will be empty causing the usual code below to draw nothing.
* To not see garbage on the screen, we draw an aesthetic color
* here. The garbage would be visible if any widget enabled
* the NSView's CALayer in order to add sublayers for custom
* native rendering.
*/
[NSGraphicsContext saveGraphicsState];
cairo_region_intersect_rectangle (bounds_region, &impl_rect);
copy_rectangle_argb32 (cvpb_surface, impl->cairo_surface, bounds_region);
[[NSColor windowBackgroundColor] setFill];
[NSBezierPath fillRect: rect];
cairo_surface_destroy (cvpb_surface);
cairo_region_destroy (bounds_region);
_gdk_quartz_unref_cairo_surface (gdk_window); // reffed in gdk_window_impl_quartz_begin_paint
CVPixelBufferUnlockBaseAddress (pixels, 0);
--impl->in_paint_rect_count;
self.layer.contents = NULL;
self.layer.contents = (id)CVPixelBufferGetIOSurface (pixels);
[NSGraphicsContext restoreGraphicsState];
return;
}
/* Clear our own bookkeeping of regions that need display */
if (impl->needs_display_region)
{
cairo_region_destroy (impl->needs_display_region);
impl->needs_display_region = NULL;
}
[self getRectsBeingDrawn: &drawn_rects count: &count];
region = cairo_region_create ();
for (i = 0; i < count; i++)
{
gdk_rect.x = drawn_rects[i].origin.x;
gdk_rect.y = drawn_rects[i].origin.y;
gdk_rect.width = drawn_rects[i].size.width;
gdk_rect.height = drawn_rects[i].size.height;
cairo_region_union_rectangle (region, &gdk_rect);
}
impl->in_paint_rect_count++;
_gdk_window_process_updates_recurse (gdk_window, region);
impl->in_paint_rect_count--;
cairo_region_destroy (region);
if (needsInvalidateShadow)
{
[[self window] invalidateShadow];
needsInvalidateShadow = NO;
}
}
-(void)setNeedsInvalidateShadow: (BOOL)invalidate
@@ -513,37 +412,11 @@ copy_rectangle_argb32 (cairo_surface_t *dest, cairo_surface_t *source,
}
}
-(void)createBackingStoreWithWidth: (CGFloat) width andHeight: (CGFloat) height
{
CVReturn rv;
g_return_if_fail (width && height);
CVPixelBufferRelease (pixels);
rv = CVPixelBufferCreate (NULL, width, height,
kCVPixelFormatType_32BGRA,
cfpb_props, &pixels);
}
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 10700
-(BOOL)layer:(CALayer*) layer shouldInheritContentsScale: (CGFloat)scale fromWindow: (NSWindow *) window
{
if (layer == self.layer && window == self.window)
{
_gdk_quartz_unref_cairo_surface (gdk_window);
[self setNeedsDisplay: YES];
}
return YES;
}
#endif
-(void)setFrame: (NSRect)frame
{
if (GDK_WINDOW_DESTROYED (gdk_window))
return;
_gdk_quartz_unref_cairo_surface (gdk_window);
[super setFrame: frame];
if ([self window])
-9
View File
@@ -17,7 +17,6 @@
*/
#import <AppKit/AppKit.h>
#import <CoreVideo/CoreVideo.h>
#include "gdk/gdk.h"
/* Text Input Client */
@@ -34,26 +33,18 @@
#define GIC_FILTER_PASSTHRU 0
#define GIC_FILTER_FILTERED 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101400
@interface GdkQuartzView : NSView <NSTextInputClient>
#else
@interface GdkQuartzView : NSView <NSTextInputClient, NSViewLayerContentScaleDelegate>
#endif
{
GdkWindow *gdk_window;
NSTrackingRectTag trackingRect;
BOOL needsInvalidateShadow;
NSRange markedRange;
NSRange selectedRange;
CVPixelBufferRef pixels;
NSDictionary *pb_props;
CFDictionaryRef cfpb_props;
}
- (void)setGdkWindow: (GdkWindow *)window;
- (GdkWindow *)gdkWindow;
- (NSTrackingRectTag)trackingRect;
- (void)setNeedsInvalidateShadow: (BOOL)invalidate;
- (void)createBackingStoreWithWidth: (CGFloat) width andHeight: (CGFloat) height;
@end
-3
View File
@@ -30,8 +30,6 @@ libgdk_quartz_la_SOURCES = \
gdkdevicemanager-core-quartz.h \
gdkdisplay-quartz.c \
gdkdisplay-quartz.h \
gdkdisplaylinksource.c \
gdkdisplaylinksource.h \
gdkdisplaymanager-quartz.c \
gdkdnd-quartz.c \
gdkdnd-quartz.h \
@@ -62,7 +60,6 @@ libgdkinclude_HEADERS = \
gdkquartz.h
libgdkquartzinclude_HEADERS = \
gdkquartz-cocoa-access.h \
gdkquartz-gtk-only.h \
gdkquartzcursor.h \
gdkquartzdevice-core.h \
+1 -8
View File
@@ -261,21 +261,14 @@ _gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
NSCursor *nscursor;
GdkCursor *cursor;
GdkPixbuf *pixbuf;
double x_scale;
double y_scale;
GDK_QUARTZ_ALLOC_POOL;
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface));
cairo_surface_get_device_scale (surface,
&x_scale,
&y_scale);
image = gdk_quartz_pixbuf_to_ns_image_libgtk_only (pixbuf);
NSImageRep *rep = [[image representations] objectAtIndex:0];
[image setSize:NSMakeSize(rep.pixelsWide / x_scale, rep.pixelsHigh / y_scale)];
nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x / x_scale, y / y_scale)];
nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
+3 -2
View File
@@ -27,7 +27,6 @@
#include "gdkprivate-quartz.h"
#include "gdkquartzdevice-core.h"
#include "gdkinternal-quartz.h"
#include "gdkquartz-cocoa-access.h"
struct _GdkQuartzDeviceCore
{
@@ -229,9 +228,11 @@ gdk_quartz_device_core_query_state_helper (GdkWindow *window,
}
else
{
GdkWindowImplQuartz *impl;
NSWindow *nswindow;
nswindow = gdk_quartz_window_get_nswindow (window);
impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
nswindow = impl->toplevel;
point = [nswindow mouseLocationOutsideOfEventStream];
+3 -134
View File
@@ -21,7 +21,6 @@
#include <gdk/gdk.h>
#include <gdk/gdkdisplayprivate.h>
#include <gdk/gdkmonitorprivate.h>
#include <gdk/gdkframeclockprivate.h>
#include "gdkprivate-quartz.h"
#include "gdkquartzscreen.h"
@@ -30,12 +29,9 @@
#include "gdkquartzdevicemanager-core.h"
#include "gdkscreen.h"
#include "gdkmonitorprivate.h"
#include "gdkdisplaylinksource.h"
#include "gdkdisplay-quartz.h"
#include "gdkmonitor-quartz.h"
#include "gdkglcontext-quartz.h"
#include "gdkinternal-quartz.h"
#include "gdkwindow.h"
/* Note about coordinates: There are three coordinate systems at play:
*
@@ -86,112 +82,6 @@ _gdk_device_manager_new (GdkDisplay *display)
NULL);
}
void
_gdk_quartz_display_add_frame_callback (GdkDisplay *display,
GdkWindow *window)
{
GdkQuartzDisplay *display_quartz;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
display_quartz = GDK_QUARTZ_DISPLAY (display);
impl->frame_link.data = window;
impl->frame_link.prev = NULL;
impl->frame_link.next = display_quartz->windows_awaiting_frame;
display_quartz->windows_awaiting_frame = &impl->frame_link;
if (impl->frame_link.next == NULL)
gdk_display_link_source_unpause ((GdkDisplayLinkSource *)display_quartz->frame_source);
}
void
_gdk_quartz_display_remove_frame_callback (GdkDisplay *display,
GdkWindow *window)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (display);
GList *link;
link = g_list_find (display_quartz->windows_awaiting_frame, window);
if (link != NULL)
{
display_quartz->windows_awaiting_frame =
g_list_remove_link (display_quartz->windows_awaiting_frame, link);
}
if (display_quartz->windows_awaiting_frame == NULL)
gdk_display_link_source_pause ((GdkDisplayLinkSource *)display_quartz->frame_source);
}
static gboolean
gdk_quartz_display_frame_cb (gpointer data)
{
GdkDisplayLinkSource *source;
GdkQuartzDisplay *display_quartz = data;
GList *iter;
gint64 presentation_time;
gint64 now;
source = (GdkDisplayLinkSource *)display_quartz->frame_source;
iter = display_quartz->windows_awaiting_frame;
display_quartz->windows_awaiting_frame = NULL;
if (iter == NULL)
{
gdk_display_link_source_pause (source);
return G_SOURCE_CONTINUE;
}
presentation_time = source->presentation_time;
now = g_source_get_time (display_quartz->frame_source);
for (; iter != NULL; iter = iter->next)
{
GdkWindow *window = iter->data;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
GdkFrameClock *frame_clock = gdk_window_get_frame_clock (window);
GdkFrameTimings *timings;
if (frame_clock == NULL)
continue;
_gdk_frame_clock_thaw (frame_clock);
if (impl->pending_frame_counter)
{
timings = gdk_frame_clock_get_timings (frame_clock, impl->pending_frame_counter);
if (timings != NULL)
timings->presentation_time = presentation_time - source->refresh_interval;
impl->pending_frame_counter = 0;
}
timings = gdk_frame_clock_get_current_timings (frame_clock);
if (timings != NULL)
{
timings->refresh_interval = source->refresh_interval;
timings->predicted_presentation_time = source->presentation_time;
}
}
return G_SOURCE_CONTINUE;
}
static void
gdk_quartz_display_init_display_link (GdkDisplay *display)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (display);
display_quartz->frame_source = gdk_display_link_source_new ();
g_source_set_callback (display_quartz->frame_source,
gdk_quartz_display_frame_cb,
display,
NULL);
g_source_attach (display_quartz->frame_source, NULL);
}
GdkDisplay *
_gdk_quartz_display_open (const gchar *display_name)
{
@@ -210,8 +100,6 @@ _gdk_quartz_display_open (const gchar *display_name)
/* Initialize application */
[NSApplication sharedApplication];
gdk_quartz_display_init_display_link (_gdk_display);
#if 0
/* FIXME: Remove the #if 0 when we have these functions */
_gdk_quartz_dnd_init ();
@@ -564,29 +452,10 @@ static GdkMonitor *
gdk_quartz_display_get_monitor_at_window (GdkDisplay *display,
GdkWindow *window)
{
GdkWindowImplQuartz *impl = NULL;
NSWindow *nswindow = NULL;
NSScreen *screen = NULL;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
NSWindow *nswindow = impl->toplevel;
NSScreen *screen = [nswindow screen];
GdkMonitor *monitor = NULL;
GdkWindow *onscreen_window = window;
/*
* This stops crashes when there is no NSWindow available on
* an offscreen window which occurs for children of children
* of an onscreen window (children of an onscreen window do
* have NSWindow set)
* https://gitlab.gnome.org/GNOME/gimp/-/issues/7608
*/
while (onscreen_window && onscreen_window->window_type == GDK_WINDOW_OFFSCREEN)
onscreen_window = onscreen_window->parent;
if (!onscreen_window)
return NULL;
impl = GDK_WINDOW_IMPL_QUARTZ (onscreen_window->impl);
nswindow = impl->toplevel;
screen = [nswindow screen];
if (screen)
{
GdkQuartzDisplay *quartz_display = GDK_QUARTZ_DISPLAY (display);
+1 -6
View File
@@ -20,13 +20,12 @@
#ifndef __GDK_QUARTZ_DISPLAY__
#define __GDK_QUARTZ_DISPLAY__
#include <AppKit/AppKit.h>
#include "gdkdisplayprivate.h"
#include "gdkkeys.h"
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkmain.h"
#include "gdkinternal-quartz.h"
G_BEGIN_DECLS
@@ -37,10 +36,6 @@ struct _GdkQuartzDisplay
NSRect geometry; /* In AppKit coordinates. */
NSSize size; /* Aggregate size of displays in millimeters. */
GPtrArray *monitors;
/* This structure is not allocated. It points to an embedded
* GList in the GdkWindow. */
GList *windows_awaiting_frame;
GSource *frame_source;
};
struct _GdkQuartzDisplayClass
-251
View File
@@ -1,251 +0,0 @@
/* gdkdisplaylinksource.c
*
* Copyright (C) 2015 Christian Hergert <christian@hergert.me>
*
* 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/>.
*
* Authors:
* Christian Hergert <christian@hergert.me>
*/
#include "config.h"
#include <mach/mach_time.h>
#include "gdkinternal-quartz.h"
#include "gdkdisplaylinksource.h"
static gint64 host_to_frame_clock_time (gint64 host_time);
static gboolean
gdk_display_link_source_prepare (GSource *source,
gint *timeout_)
{
GdkDisplayLinkSource *impl = (GdkDisplayLinkSource *)source;
gint64 now;
now = g_source_get_time (source);
if (now < impl->presentation_time)
*timeout_ = (impl->presentation_time - now) / 1000L;
else
*timeout_ = -1;
return impl->needs_dispatch;
}
static gboolean
gdk_display_link_source_check (GSource *source)
{
GdkDisplayLinkSource *impl = (GdkDisplayLinkSource *)source;
return impl->needs_dispatch;
}
static gboolean
gdk_display_link_source_dispatch (GSource *source,
GSourceFunc callback,
gpointer user_data)
{
GdkDisplayLinkSource *impl = (GdkDisplayLinkSource *)source;
gboolean ret = G_SOURCE_CONTINUE;
impl->needs_dispatch = FALSE;
if (callback != NULL)
ret = callback (user_data);
return ret;
}
static void
gdk_display_link_source_finalize (GSource *source)
{
GdkDisplayLinkSource *impl = (GdkDisplayLinkSource *)source;
CVDisplayLinkStop (impl->display_link);
CVDisplayLinkRelease (impl->display_link);
}
static GSourceFuncs gdk_display_link_source_funcs = {
gdk_display_link_source_prepare,
gdk_display_link_source_check,
gdk_display_link_source_dispatch,
gdk_display_link_source_finalize
};
void
gdk_display_link_source_pause (GdkDisplayLinkSource *source)
{
CVDisplayLinkStop (source->display_link);
}
void
gdk_display_link_source_unpause (GdkDisplayLinkSource *source)
{
CVDisplayLinkStart (source->display_link);
}
static CVReturn
gdk_display_link_source_frame_cb (CVDisplayLinkRef display_link,
const CVTimeStamp *inNow,
const CVTimeStamp *inOutputTime,
CVOptionFlags flagsIn,
CVOptionFlags *flagsOut,
void *user_data)
{
GdkDisplayLinkSource *impl = user_data;
gint64 presentation_time;
gboolean needs_wakeup;
needs_wakeup = !g_atomic_int_get (&impl->needs_dispatch);
presentation_time = host_to_frame_clock_time (inOutputTime->hostTime);
impl->presentation_time = presentation_time;
impl->needs_dispatch = TRUE;
if (needs_wakeup)
{
NSEvent *event;
/* Post a message so we'll break out of the message loop.
*
* We don't use g_main_context_wakeup() here because that
* would result in sending a message to the pipe(2) fd in
* the select thread which would then send this message as
* well. Lots of extra work.
*/
event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
location: NSZeroPoint
modifierFlags: 0
timestamp: 0
windowNumber: 0
context: nil
subtype: GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
data1: 0
data2: 0];
[NSApp postEvent:event atStart:YES];
}
return kCVReturnSuccess;
}
/**
* gdk_display_link_source_new:
*
* Creates a new #GSource that will activate the dispatch function upon
* notification from a CVDisplayLink that a new frame should be drawn.
*
* Effort is made to keep the transition from the high-priority
* CVDisplayLink thread into this GSource lightweight. However, this is
* somewhat non-ideal since the best case would be to do the drawing
* from the high-priority thread.
*
* Returns: (transfer full): A newly created #GSource.
*/
GSource *
gdk_display_link_source_new (void)
{
GdkDisplayLinkSource *impl;
GSource *source;
CVReturn ret;
double period;
source = g_source_new (&gdk_display_link_source_funcs, sizeof *impl);
impl = (GdkDisplayLinkSource *)source;
/*
* Create our link based on currently connected displays.
* If there are multiple displays, this will be something that tries
* to work for all of them. In the future, we may want to explore multiple
* links based on the connected displays.
*/
ret = CVDisplayLinkCreateWithActiveCGDisplays (&impl->display_link);
if (ret != kCVReturnSuccess)
{
g_warning ("Failed to initialize CVDisplayLink!");
return source;
}
/*
* Determine our nominal period between frames.
*/
period = CVDisplayLinkGetActualOutputVideoRefreshPeriod (impl->display_link);
if (period == 0.0)
period = 1.0 / 60.0;
impl->refresh_interval = period * 1000000L;
/*
* Wire up our callback to be executed within the high-priority thread.
*/
CVDisplayLinkSetOutputCallback (impl->display_link,
gdk_display_link_source_frame_cb,
source);
g_source_set_name (source, "[gdk] quartz frame clock");
return source;
}
static gint64
host_to_frame_clock_time (gint64 host_time)
{
static mach_timebase_info_data_t timebase_info;
/*
* NOTE:
*
* This code is taken from GLib to match g_get_monotonic_time().
*/
if (G_UNLIKELY (timebase_info.denom == 0))
{
/* This is a fraction that we must use to scale
* mach_absolute_time() by in order to reach nanoseconds.
*
* We've only ever observed this to be 1/1, but maybe it could be
* 1000/1 if mach time is microseconds already, or 1/1000 if
* picoseconds. Try to deal nicely with that.
*/
mach_timebase_info (&timebase_info);
/* We actually want microseconds... */
if (timebase_info.numer % 1000 == 0)
timebase_info.numer /= 1000;
else
timebase_info.denom *= 1000;
/* We want to make the numer 1 to avoid having to multiply... */
if (timebase_info.denom % timebase_info.numer == 0)
{
timebase_info.denom /= timebase_info.numer;
timebase_info.numer = 1;
}
else
{
/* We could just multiply by timebase_info.numer below, but why
* bother for a case that may never actually exist...
*
* Plus -- performing the multiplication would risk integer
* overflow. If we ever actually end up in this situation, we
* should more carefully evaluate the correct course of action.
*/
mach_timebase_info (&timebase_info); /* Get a fresh copy for a better message */
g_error ("Got weird mach timebase info of %d/%d. Please file a bug against GLib.",
timebase_info.numer, timebase_info.denom);
}
}
return host_time / timebase_info.denom;
}
-48
View File
@@ -1,48 +0,0 @@
/* gdkdisplaylinksource.h
*
* Copyright (C) 2015 Christian Hergert <christian@hergert.me>
*
* 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/>.
*
* Authors:
* Christian Hergert <christian@hergert.me>
*/
#ifndef GDK_DISPLAY_LINK_SOURCE_H
#define GDK_DISPLAY_LINK_SOURCE_H
#include <glib.h>
#include <QuartzCore/QuartzCore.h>
G_BEGIN_DECLS
typedef struct
{
GSource source;
CVDisplayLinkRef display_link;
gint64 refresh_interval;
volatile gint64 presentation_time;
volatile guint needs_dispatch;
} GdkDisplayLinkSource;
GSource *gdk_display_link_source_new (void);
void gdk_display_link_source_pause (GdkDisplayLinkSource *source);
void gdk_display_link_source_unpause (GdkDisplayLinkSource *source);
G_END_DECLS
#endif /* GDK_DISPLAY_LINK_SOURCE_H */
-8
View File
@@ -59,14 +59,6 @@ _gdk_quartz_window_drag_begin (GdkWindow *window,
return _gdk_quartz_drag_source_context;
}
void
_gdk_quartz_drag_source_context_destroy_gtk_only ()
{
if (_gdk_quartz_drag_source_context)
g_object_unref (_gdk_quartz_drag_source_context);
_gdk_quartz_drag_source_context = NULL;
}
static gboolean
gdk_quartz_drag_context_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
+17 -21
View File
@@ -35,7 +35,6 @@
#include "gdkquartzdisplay.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
#include "gdkquartz-cocoa-access.h"
#include "gdkquartzdevicemanager-core.h"
#include "gdkquartzkeys.h"
#include "gdkkeys-quartz.h"
@@ -388,7 +387,7 @@ get_window_point_from_screen_point (GdkWindow *window,
NSPoint point;
GdkQuartzNSWindow *nswindow;
nswindow = gdk_quartz_window_get_nswindow (window);
nswindow = (GdkQuartzNSWindow*)(((GdkWindowImplQuartz *)window->impl)->toplevel);
point = [nswindow convertPointFromScreen:screen_point];
*x = point.x;
*y = window->height - point.y;
@@ -397,7 +396,7 @@ get_window_point_from_screen_point (GdkWindow *window,
static gboolean
is_mouse_button_press_event (NSEventType type)
{
switch ((int)type)
switch (type)
{
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
@@ -659,21 +658,18 @@ find_toplevel_under_pointer (GdkDisplay *display,
}
/* If the stored toplevel is NULL or _gdk_root it's not useful,
* return NULL to regenerate.
*/
if (toplevel == NULL || toplevel == _gdk_root )
return NULL;
get_window_point_from_screen_point (toplevel, screen_point, x, y);
/* If the coordinates are out of window bounds, this toplevel is not
* under the pointer and we thus return NULL. This can occur when
* toplevel under pointer has not yet been updated due to a very recent
* window resize. Alternatively, we should no longer be relying on
* the toplevel_under_pointer value which is maintained in gdkwindow.c.
*/
if (*x < 0 || *y < 0 || *x >= toplevel->width || *y >= toplevel->height)
return NULL;
if (toplevel)
{
get_window_point_from_screen_point (toplevel, screen_point, x, y);
/* If the coordinates are out of window bounds, this toplevel is not
* under the pointer and we thus return NULL. This can occur when
* toplevel under pointer has not yet been updated due to a very recent
* window resize. Alternatively, we should no longer be relying on
* the toplevel_under_pointer value which is maintained in gdkwindow.c.
*/
if (*x < 0 || *y < 0 || *x >= toplevel->width || *y >= toplevel->height)
return NULL;
}
return toplevel;
}
@@ -797,7 +793,7 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
toplevel = toplevel_under_pointer;
toplevel_impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
*x = x_tmp;
*y = y_tmp;
@@ -1033,7 +1029,7 @@ fill_button_event (GdkWindow *window,
state = get_keyboard_modifiers_from_ns_event (nsevent) |
_gdk_quartz_events_get_current_mouse_modifiers ();
switch ((int)[nsevent type])
switch ([nsevent type])
{
case GDK_QUARTZ_LEFT_MOUSE_DOWN:
case GDK_QUARTZ_RIGHT_MOUSE_DOWN:
@@ -1409,7 +1405,7 @@ test_resize (NSEvent *event, GdkWindow *toplevel, gint x, gint y)
/* Resizing from the resize indicator only begins if an GDK_QUARTZ_LEFT_MOUSE_BUTTON
* event is received in the resizing area.
*/
toplevel_impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
if ([toplevel_impl->toplevel showsResizeIndicator])
if ([event type] == GDK_QUARTZ_LEFT_MOUSE_DOWN &&
[toplevel_impl->toplevel showsResizeIndicator])
+1 -1
View File
@@ -28,7 +28,7 @@
#include "gdkquartzglcontext.h"
#include "gdkquartzwindow.h"
#include "gdkprivate-quartz.h"
#include "gdkquartz-cocoa-access.h"
#include "gdkquartz-gtk-only.h"
#include "gdkinternals.h"
+9 -7
View File
@@ -29,26 +29,28 @@ GdkWindow *_gdk_root = NULL;
GdkOSXVersion
gdk_quartz_osx_version (void)
{
static gint32 vkey = GDK_OSX_UNSUPPORTED;
static gint32 minor = GDK_OSX_UNSUPPORTED;
if (vkey == GDK_OSX_UNSUPPORTED)
if (minor == GDK_OSX_UNSUPPORTED)
{
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&vkey);
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
#else
NSOperatingSystemVersion version;
version = [[NSProcessInfo processInfo] operatingSystemVersion];
vkey = version.majorVersion == 10 ? version.minorVersion : version.majorVersion + 5;
minor = version.minorVersion;
if (version.majorVersion == 11)
minor += 16;
#endif
}
if (vkey < GDK_OSX_MIN)
if (minor < GDK_OSX_MIN)
return GDK_OSX_UNSUPPORTED;
else if (vkey > GDK_OSX_CURRENT)
else if (minor > GDK_OSX_CURRENT)
return GDK_OSX_NEW;
else
return vkey;
return minor;
}
+8 -13
View File
@@ -42,16 +42,16 @@ typedef float CGFloat;
#define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
#define GDK_QUARTZ_RELEASE_POOL [pool release]
#include "../gdkprivate.h"
#include "gdkquartz.h"
#include "gdkdevicemanager-core-quartz.h"
#include "gdkdnd-quartz.h"
#include "gdkscreen-quartz.h"
#include "gdkwindow-quartz.h"
#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>
#include "config.h"
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
@@ -75,7 +75,7 @@ typedef enum {
GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
} GdkQuartzEventSubType;
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 10130
#define GDK_QUARTZ_EVENT_TABLET_PROXIMITY NSEventTypeTabletProximity
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_PROXIMITY NSEventSubtypeTabletProximity
#define GDK_QUARTZ_EVENT_SUBTYPE_TABLET_POINT NSEventSubtypeTabletPoint
@@ -284,10 +284,5 @@ void _gdk_quartz_window_change_property (GdkWindow *window,
void _gdk_quartz_window_delete_property (GdkWindow *window,
GdkAtom property);
/* Display methods - frame clock */
void _gdk_quartz_display_add_frame_callback (GdkDisplay *display,
GdkWindow *window);
void _gdk_quartz_display_remove_frame_callback (GdkDisplay *display,
GdkWindow *window);
#endif /* __GDK_INTERNAL_QUARTZ_H__ */
+1 -1
View File
@@ -812,13 +812,13 @@ input_sources_changed_notification (CFNotificationCenterRef center,
static void
gdk_quartz_keymap_init (GdkQuartzKeymap *keymap)
{
update_keymap ();
CFNotificationCenterAddObserver (CFNotificationCenterGetDistributedCenter (),
keymap,
input_sources_changed_notification,
CFSTR ("AppleSelectedInputSourcesChangedNotification"),
NULL,
CFNotificationSuspensionBehaviorDeliverImmediately);
update_keymap ();
}
static void
+1 -2
View File
@@ -22,7 +22,6 @@
#include "gdkmonitor-quartz.h"
#include "gdkdisplay-quartz.h"
#include "gdkinternal-quartz.h"
G_DEFINE_TYPE (GdkQuartzMonitor, gdk_quartz_monitor, GDK_TYPE_MONITOR)
@@ -33,7 +32,7 @@ gdk_quartz_monitor_get_workarea (GdkMonitor *monitor,
GDK_QUARTZ_ALLOC_POOL;
NSArray *array = [NSScreen screens];
NSScreen* screen = NULL;
NSScreen* screen;
for (id obj in array)
{
CGDirectDisplayID screen_id =
+1 -1
View File
@@ -20,12 +20,12 @@
#include <glib.h>
#include <gio/gio.h>
#include <AppKit/AppKit.h>
#include "gdkmonitorprivate.h"
#include "gdkquartzmonitor.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
struct _GdkQuartzMonitor
{
-2
View File
@@ -33,7 +33,5 @@
GdkDisplay * _gdk_quartz_display_open (const gchar *name);
/* Window Impl */
void _gdk_quartz_unref_cairo_surface (GdkWindow *window);
#endif /* __GDK_PRIVATE_QUARTZ_H__ */
-37
View File
@@ -1,37 +0,0 @@
/* 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_COCOA_ACCESS_H__
#define __GDK_QUARTZ_COCOA_ACCESS_H__
#ifndef __OBJC__
#error "This header declares Cocoa types and can be included only from source files compiled with Objective-C."
#endif
#include <AppKit/AppKit.h>
#include <gdk/gdk.h>
#include "gdkquartz.h"
GDK_AVAILABLE_IN_ALL
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
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
+8
View File
@@ -38,5 +38,13 @@ NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom
/* 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
+1 -2
View File
@@ -42,8 +42,7 @@ typedef enum
GDK_OSX_MOJAVE = 14,
GDK_OSX_CATALINA = 15,
GDK_OSX_BIGSUR = 16,
GDK_OSX_MONTEREY = 17,
GDK_OSX_CURRENT = 17,
GDK_OSX_CURRENT = 15,
GDK_OSX_NEW = 99
} GdkOSXVersion;
-3
View File
@@ -51,9 +51,6 @@ id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext
GDK_AVAILABLE_IN_ALL
GdkDragContext *gdk_quartz_drag_source_context_libgtk_only (void);
GDK_AVAILABLE_IN_3_24
void _gdk_quartz_drag_source_context_destroy_gtk_only ();
G_END_DECLS
#endif /* __GDK_QUARTZ_DRAG_CONTEXT_H__ */
+1 -1
View File
@@ -25,7 +25,7 @@
#include "gdkprivate-quartz.h"
#include "gdkdisplay-quartz.h"
#include "gdkmonitor-quartz.h"
#include "gdkinternal-quartz.h"
/* A couple of notes about this file are in order. In GDK, a
* GdkScreen can contain multiple monitors. A GdkScreen has an
-5
View File
@@ -180,7 +180,6 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
#define GDK_QUARTZ_STRING_PBOARD_TYPE NSStringPboardType
#define GDK_QUARTZ_TIFF_PBOARD_TYPE NSTIFFPboardType
#else
#define GDK_QUARTZ_FILE_PBOARD_TYPE NSPasteboardTypeFileURL
#define GDK_QUARTZ_URL_PBOARD_TYPE NSPasteboardTypeURL
#define GDK_QUARTZ_COLOR_PBOARD_TYPE NSPasteboardTypeColor
#define GDK_QUARTZ_STRING_PBOARD_TYPE NSPasteboardTypeString
@@ -198,10 +197,6 @@ gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type)
return gdk_atom_intern_static_string ("application/x-color");
else if ([type isEqualToString:GDK_QUARTZ_URL_PBOARD_TYPE])
return gdk_atom_intern_static_string ("text/uri-list");
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
else if ([type isEqualToString:GDK_QUARTZ_FILE_PBOARD_TYPE])
return gdk_atom_intern_static_string ("text/uri-list");
#endif
else
return gdk_atom_intern ([type UTF8String], FALSE);
}
-1
View File
@@ -23,7 +23,6 @@
#include <gdkinternals.h>
#include "gdkquartz-gtk-only.h"
#include "gdkquartz-cocoa-access.h"
#include <gdkquartzutils.h>
NSImage *
File diff suppressed because it is too large Load Diff
+1 -6
View File
@@ -22,6 +22,7 @@
#import <gdk/quartz/GdkQuartzView.h>
#import <gdk/quartz/GdkQuartzNSWindow.h>
#include "gdk/gdkwindowimpl.h"
#include "gdkinternal-quartz.h"
G_BEGIN_DECLS
@@ -64,10 +65,6 @@ struct _GdkWindowImplQuartz
gint shadow_top;
gint shadow_max;
gboolean use_cg_context;
GList frame_link;
gint pending_frame_counter;
};
struct _GdkWindowImplQuartzClass
@@ -103,8 +100,6 @@ typedef struct _GdkRootWindowImplQuartzClass GdkRootWindowImplQuartzClass;
struct _GdkRootWindowImplQuartz
{
GdkWindowImplQuartz parent_instance;
CGContextRef cg_context;
GList* cg_layers;
};
struct _GdkRootWindowImplQuartzClass
+1 -5
View File
@@ -8,7 +8,6 @@ gdk_quartz_sources = files(
'gdkdevice-core-quartz.c',
'gdkdevicemanager-core-quartz.c',
'gdkdisplay-quartz.c',
'gdkdisplaylinksource.c',
'gdkdisplaymanager-quartz.c',
'gdkdnd-quartz.c',
'gdkevents-quartz.c',
@@ -27,7 +26,6 @@ gdk_quartz_sources = files(
)
gdk_quartz_public_headers = files(
'gdkquartz-cocoa-access.h',
'gdkquartzcursor.h',
'gdkquartzdevice-core.h',
'gdkquartzdevicemanager-core.h',
@@ -49,10 +47,8 @@ core_graphics_dep = dependency('appleframeworks', modules : 'CoreGraphics', requ
appkit_dep = dependency('appleframeworks', modules : 'AppKit', required : true)
cocoa_dep = dependency('appleframeworks', modules : 'Cocoa', required : true)
carbon_dep = dependency('appleframeworks', modules : 'Carbon', required : true)
quartzcore_dep = dependency('appleframeworks', modules : 'QuartzCore', required : true)
iosurface_dep = dependency('appleframeworks', modules: 'IOSurface', required: true)
gdk_quartz_deps = [ core_graphics_dep, appkit_dep, cocoa_dep, carbon_dep, quartzcore_dep, iosurface_dep ]
gdk_quartz_deps = [ core_graphics_dep, appkit_dep, cocoa_dep, carbon_dep ]
libgdk_quartz = static_library('gdk-quartz',
gdk_quartz_sources, gdkconfig, gdkenum_h,
-19
View File
@@ -10,7 +10,6 @@ AM_CPPFLAGS = \
-DGDK_COMPILATION \
-I$(top_srcdir) \
-I$(top_srcdir)/gdk \
-I$(top_srcdir)/gdk/wayland/cursor \
-I$(top_builddir)/gdk \
$(GDK_HIDDEN_VISIBILITY_CFLAGS) \
$(GTK_DEBUG_FLAGS) \
@@ -44,11 +43,6 @@ BUILT_SOURCES = \
gtk-shell-protocol.c \
primary-selection-unstable-v1-client-protocol.h \
primary-selection-unstable-v1-protocol.c
if USE_XDG_ACTIVATION
BUILT_SOURCES += \
xdg-activation-v1-client-protocol.h \
xdg-activation-v1-protocol.c
endif
nodist_libgdk_wayland_la_SOURCES = \
$(BUILT_SOURCES)
@@ -78,14 +72,6 @@ libgdk_wayland_la_SOURCES = \
wm-button-layout-translation.c \
wm-button-layout-translation.h
libgdk_wayland_la_SOURCES += \
cursor/os-compatibility.c \
cursor/os-compatibility.h \
cursor/wayland-cursor.c \
cursor/wayland-cursor.h \
cursor/xcursor.c \
cursor/xcursor.h
libgdkinclude_HEADERS = \
gdkwayland.h
@@ -112,11 +98,6 @@ endef
%-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
xdg-activation-v1-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/staging/xdg-activation/xdg-activation-v1.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) private-code < $< > $@
xdg-activation-v1-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/staging/xdg-activation/xdg-activation-v1.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
%-protocol.c : $(srcdir)/protocol/%.xml
$(AM_V_GEN)$(WAYLAND_SCANNER) private-code < $< > $@
-12
View File
@@ -1,12 +0,0 @@
wayland_cursor_sources = files([
'wayland-cursor.c',
'xcursor.c',
'os-compatibility.c'
])
libwayland_cursor = static_library('wayland+cursor',
sources: wayland_cursor_sources,
include_directories: [ confinc, ],
dependencies: [ glib_dep, wlclientdep, ],
c_args: common_cflags,
)
-172
View File
@@ -1,172 +0,0 @@
/*
* Copyright © 2012 Collabora, Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "config.h"
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#ifdef HAVE_MEMFD_CREATE
#include <sys/mman.h>
#endif
#include "os-compatibility.h"
#ifndef HAVE_MKOSTEMP
static int
set_cloexec_or_close(int fd)
{
long flags;
if (fd == -1)
return -1;
flags = fcntl(fd, F_GETFD);
if (flags == -1)
goto err;
if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1)
goto err;
return fd;
err:
close(fd);
return -1;
}
#endif
static int
create_tmpfile_cloexec(char *tmpname)
{
int fd;
#ifdef HAVE_MKOSTEMP
fd = mkostemp(tmpname, O_CLOEXEC);
if (fd >= 0)
unlink(tmpname);
#else
fd = mkstemp(tmpname);
if (fd >= 0) {
fd = set_cloexec_or_close(fd);
unlink(tmpname);
}
#endif
return fd;
}
/*
* Create a new, unique, anonymous file of the given size, and
* return the file descriptor for it. The file descriptor is set
* CLOEXEC. The file is immediately suitable for mmap()'ing
* the given size at offset zero.
*
* The file should not have a permanent backing store like a disk,
* but may have if XDG_RUNTIME_DIR is not properly implemented in OS.
*
* The file name is deleted from the file system.
*
* The file is suitable for buffer sharing between processes by
* transmitting the file descriptor over Unix sockets using the
* SCM_RIGHTS methods.
*
* If the C library implements posix_fallocate(), it is used to
* guarantee that disk space is available for the file at the
* given size. If disk space is insufficient, errno is set to ENOSPC.
* If posix_fallocate() is not supported, program may receive
* SIGBUS on accessing mmap()'ed file contents instead.
*
* If the C library implements memfd_create(), it is used to create the
* file purely in memory, without any backing file name on the file
* system, and then sealing off the possibility of shrinking it. This
* can then be checked before accessing mmap()'ed file contents, to
* make sure SIGBUS can't happen. It also avoids requiring
* XDG_RUNTIME_DIR.
*/
int
os_create_anonymous_file(off_t size)
{
static const char template[] = "/wayland-cursor-shared-XXXXXX";
const char *path;
char *name;
int fd;
int ret;
#ifdef HAVE_MEMFD_CREATE
fd = memfd_create("wayland-cursor", MFD_CLOEXEC | MFD_ALLOW_SEALING);
if (fd >= 0) {
/* We can add this seal before calling posix_fallocate(), as
* the file is currently zero-sized anyway.
*
* There is also no need to check for the return value, we
* couldn't do anything with it anyway.
*/
fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
} else
#endif
{
path = getenv("XDG_RUNTIME_DIR");
if (!path) {
errno = ENOENT;
return -1;
}
name = malloc(strlen(path) + sizeof(template));
if (!name)
return -1;
strcpy(name, path);
strcat(name, template);
fd = create_tmpfile_cloexec(name);
free(name);
if (fd < 0)
return -1;
}
#ifdef HAVE_POSIX_FALLOCATE
ret = posix_fallocate(fd, 0, size);
if (ret != 0) {
close(fd);
errno = ret;
return -1;
}
#else
ret = ftruncate(fd, size);
if (ret < 0) {
close(fd);
return -1;
}
#endif
return fd;
}
-34
View File
@@ -1,34 +0,0 @@
/*
* Copyright © 2012 Collabora, Ltd.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef OS_COMPATIBILITY_H
#define OS_COMPATIBILITY_H
#include <sys/types.h>
int
os_create_anonymous_file(off_t size);
#endif /* OS_COMPATIBILITY_H */
-423
View File
@@ -1,423 +0,0 @@
/*
* Copyright © 2012 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "config.h"
#include "xcursor.h"
#include "wayland-cursor.h"
#include "wayland-client.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <errno.h>
#include <os-compatibility.h>
#include <glib.h>
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
struct shm_pool {
struct wl_shm_pool *pool;
int fd;
unsigned int size;
unsigned int used;
char *data;
};
static struct shm_pool *
shm_pool_create(struct wl_shm *shm, int size)
{
struct shm_pool *pool;
pool = malloc(sizeof *pool);
if (!pool)
return NULL;
pool->fd = os_create_anonymous_file (size);
if (pool->fd < 0)
goto err_free;
pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
pool->fd, 0);
if (pool->data == MAP_FAILED)
goto err_close;
pool->pool = wl_shm_create_pool(shm, pool->fd, size);
pool->size = size;
pool->used = 0;
return pool;
err_close:
close(pool->fd);
err_free:
free(pool);
return NULL;
}
static int
shm_pool_resize(struct shm_pool *pool, int size)
{
if (ftruncate(pool->fd, size) < 0)
return 0;
#ifdef HAVE_POSIX_FALLOCATE
errno = posix_fallocate(pool->fd, 0, size);
if (errno != 0)
return 0;
#endif
wl_shm_pool_resize(pool->pool, size);
munmap(pool->data, pool->size);
pool->data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
pool->fd, 0);
if (pool->data == (void *)-1)
return 0;
pool->size = size;
return 1;
}
static int
shm_pool_allocate(struct shm_pool *pool, int size)
{
int offset;
if (pool->used + size > pool->size)
if (!shm_pool_resize(pool, 2 * pool->size + size))
return -1;
offset = pool->used;
pool->used += size;
return offset;
}
static void
shm_pool_destroy(struct shm_pool *pool)
{
munmap(pool->data, pool->size);
wl_shm_pool_destroy(pool->pool);
close(pool->fd);
free(pool);
}
struct wl_cursor_theme {
unsigned int cursor_count;
struct wl_cursor **cursors;
struct wl_shm *shm;
struct shm_pool *pool;
int size;
char *path;
};
struct cursor_image {
struct wl_cursor_image image;
struct wl_cursor_theme *theme;
struct wl_buffer *buffer;
int offset; /* data offset of this image in the shm pool */
};
struct cursor {
struct wl_cursor cursor;
uint32_t total_delay; /* length of the animation in ms */
};
/** Get an shm buffer for a cursor image
*
* \param image The cursor image
* \return An shm buffer for the cursor image. The user should not destroy
* the returned buffer.
*/
struct wl_buffer *
wl_cursor_image_get_buffer(struct wl_cursor_image *_img)
{
struct cursor_image *image = (struct cursor_image *) _img;
struct wl_cursor_theme *theme = image->theme;
if (!image->buffer) {
image->buffer =
wl_shm_pool_create_buffer(theme->pool->pool,
image->offset,
_img->width, _img->height,
_img->width * 4,
WL_SHM_FORMAT_ARGB8888);
};
return image->buffer;
}
static void
wl_cursor_image_destroy(struct wl_cursor_image *_img)
{
struct cursor_image *image = (struct cursor_image *) _img;
if (image->buffer)
wl_buffer_destroy(image->buffer);
free(image);
}
static void
wl_cursor_destroy(struct wl_cursor *cursor)
{
unsigned int i;
for (i = 0; i < cursor->image_count; i++)
wl_cursor_image_destroy(cursor->images[i]);
free(cursor->images);
free(cursor->name);
free(cursor);
}
static struct wl_cursor *
wl_cursor_create_from_xcursor_images(struct wl_cursor_theme *theme,
const char *name,
unsigned int size,
unsigned int scale)
{
char *path;
XcursorImages *images;
struct cursor *cursor;
struct cursor_image *image;
int i, nbytes;
unsigned int load_size;
int load_scale = 1;
load_size = size * scale;
path = g_strconcat (theme->path, "/", name, NULL);
images = xcursor_load_images (path, load_size);
if (!images)
{
g_free (path);
return NULL;
}
if (images->images[0]->width != load_size ||
images->images[0]->height != load_size)
{
xcursor_images_destroy (images);
images = xcursor_load_images (path, size);
load_scale = scale;
}
g_free (path);
cursor = malloc(sizeof *cursor);
if (!cursor) {
xcursor_images_destroy (images);
return NULL;
}
cursor->cursor.images =
malloc(images->nimage * sizeof cursor->cursor.images[0]);
if (!cursor->cursor.images) {
free(cursor);
xcursor_images_destroy (images);
return NULL;
}
cursor->cursor.name = strdup(name);
cursor->cursor.size = load_size;
cursor->total_delay = 0;
for (i = 0; i < images->nimage; i++) {
image = malloc(sizeof *image);
if (image == NULL)
break;
image->theme = theme;
image->buffer = NULL;
image->image.width = images->images[i]->width * load_scale;
image->image.height = images->images[i]->height * load_scale;
image->image.hotspot_x = images->images[i]->xhot * load_scale;
image->image.hotspot_y = images->images[i]->yhot * load_scale;
image->image.delay = images->images[i]->delay;
nbytes = image->image.width * image->image.height * 4;
image->offset = shm_pool_allocate(theme->pool, nbytes);
if (image->offset < 0) {
free(image);
break;
}
if (load_scale == 1) {
/* copy pixels to shm pool */
memcpy(theme->pool->data + image->offset,
images->images[i]->pixels, nbytes);
}
else {
/* scale image up while copying it */
for (int y = 0; y < image->image.height; y++) {
char *p = theme->pool->data + image->offset + y * image->image.width * 4;
char *q = ((char *)images->images[i]->pixels) + (y / load_scale) * images->images[i]->width * 4;
for (int x = 0; x < image->image.width; x++) {
p[4 * x] = q[4 * (x/load_scale)];
p[4 * x + 1] = q[4 * (x/load_scale) + 1];
p[4 * x + 2] = q[4 * (x/load_scale) + 2];
p[4 * x + 3] = q[4 * (x/load_scale) + 3];
}
}
}
cursor->total_delay += image->image.delay;
cursor->cursor.images[i] = (struct wl_cursor_image *) image;
}
cursor->cursor.image_count = i;
if (cursor->cursor.image_count == 0) {
free(cursor->cursor.name);
free(cursor->cursor.images);
free(cursor);
xcursor_images_destroy (images);
return NULL;
}
xcursor_images_destroy (images);
return &cursor->cursor;
}
static void
load_cursor(struct wl_cursor_theme *theme,
const char *name,
unsigned int size,
unsigned int scale)
{
struct wl_cursor *cursor;
cursor = wl_cursor_create_from_xcursor_images(theme, name, size, scale);
if (cursor) {
theme->cursor_count++;
theme->cursors =
realloc(theme->cursors,
theme->cursor_count * sizeof theme->cursors[0]);
if (theme->cursors == NULL) {
theme->cursor_count--;
free(cursor);
} else {
theme->cursors[theme->cursor_count - 1] = cursor;
}
}
}
/** Load a cursor theme to memory shared with the compositor
*
* \param name The name of the cursor theme to load. If %NULL, the default
* theme will be loaded.
* \param size Desired size of the cursor images.
* \param shm The compositor's shm interface.
*
* \return An object representing the theme that should be destroyed with
* wl_cursor_theme_destroy() or %NULL on error. If no theme with the given
* name exists, a default theme will be loaded.
*/
struct wl_cursor_theme *
wl_cursor_theme_create(const char *path, int size, struct wl_shm *shm)
{
struct wl_cursor_theme *theme;
theme = malloc(sizeof *theme);
if (!theme)
return NULL;
theme->path = strdup (path);
theme->size = size;
theme->cursor_count = 0;
theme->cursors = NULL;
theme->pool = shm_pool_create(shm, size * size * 4);
if (!theme->pool) {
free (theme->path);
free (theme);
return NULL;
}
return theme;
}
/** Destroys a cursor theme object
*
* \param theme The cursor theme to be destroyed
*/
void
wl_cursor_theme_destroy(struct wl_cursor_theme *theme)
{
unsigned int i;
for (i = 0; i < theme->cursor_count; i++)
wl_cursor_destroy(theme->cursors[i]);
shm_pool_destroy(theme->pool);
free(theme->cursors);
free(theme->path);
free(theme);
}
/** Get the cursor for a given name from a cursor theme
*
* \param theme The cursor theme
* \param name Name of the desired cursor
* \return The theme's cursor of the given name or %NULL if there is no
* such cursor
*/
struct wl_cursor *
wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
const char *name,
unsigned int scale)
{
unsigned int i;
unsigned int size;
size = theme->size * scale;
for (i = 0; i < theme->cursor_count; i++) {
if (size == theme->cursors[i]->size &&
strcmp(name, theme->cursors[i]->name) == 0)
return theme->cursors[i];
}
load_cursor (theme, name, theme->size, scale);
if (i < theme->cursor_count) {
if (size == theme->cursors[i]->size &&
strcmp (name, theme->cursors[theme->cursor_count - 1]->name) == 0)
return theme->cursors[theme->cursor_count - 1];
}
return NULL;
}
-72
View File
@@ -1,72 +0,0 @@
/*
* Copyright © 2012 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef WAYLAND_CURSOR_H
#define WAYLAND_CURSOR_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct wl_cursor_theme;
struct wl_buffer;
struct wl_shm;
struct wl_cursor_image {
uint32_t width; /* actual width */
uint32_t height; /* actual height */
uint32_t hotspot_x; /* hot spot x (must be inside image) */
uint32_t hotspot_y; /* hot spot y (must be inside image) */
uint32_t delay; /* animation delay to next frame (ms) */
};
struct wl_cursor {
unsigned int image_count;
struct wl_cursor_image **images;
char *name;
unsigned int size;
};
struct wl_cursor_theme *
wl_cursor_theme_create(const char *name, int size, struct wl_shm *shm);
void
wl_cursor_theme_destroy(struct wl_cursor_theme *theme);
struct wl_cursor *
wl_cursor_theme_get_cursor(struct wl_cursor_theme *theme,
const char *name,
unsigned int scale);
struct wl_buffer *
wl_cursor_image_get_buffer(struct wl_cursor_image *image);
#ifdef __cplusplus
}
#endif
#endif
-612
View File
@@ -1,612 +0,0 @@
/*
* Copyright © 2002 Keith Packard
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "xcursor.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
/*
* From libXcursor/include/X11/extensions/Xcursor.h
*/
#define XcursorTrue 1
#define XcursorFalse 0
/*
* Cursor files start with a header. The header
* contains a magic number, a version number and a
* table of contents which has type and offset information
* for the remaining tables in the file.
*
* File minor versions increment for compatible changes
* File major versions increment for incompatible changes (never, we hope)
*
* Chunks of the same type are always upward compatible. Incompatible
* changes are made with new chunk types; the old data can remain under
* the old type. Upward compatible changes can add header data as the
* header lengths are specified in the file.
*
* File:
* FileHeader
* LISTofChunk
*
* FileHeader:
* CARD32 magic magic number
* CARD32 header bytes in file header
* CARD32 version file version
* CARD32 ntoc number of toc entries
* LISTofFileToc toc table of contents
*
* FileToc:
* CARD32 type entry type
* CARD32 subtype entry subtype (size for images)
* CARD32 position absolute file position
*/
#define XCURSOR_MAGIC 0x72756358 /* "Xcur" LSBFirst */
/*
* Current Xcursor version number. Will be substituted by configure
* from the version in the libXcursor configure.ac file.
*/
#define XCURSOR_LIB_MAJOR 1
#define XCURSOR_LIB_MINOR 1
#define XCURSOR_LIB_REVISION 13
#define XCURSOR_LIB_VERSION ((XCURSOR_LIB_MAJOR * 10000) + \
(XCURSOR_LIB_MINOR * 100) + \
(XCURSOR_LIB_REVISION))
/*
* This version number is stored in cursor files; changes to the
* file format require updating this version number
*/
#define XCURSOR_FILE_MAJOR 1
#define XCURSOR_FILE_MINOR 0
#define XCURSOR_FILE_VERSION ((XCURSOR_FILE_MAJOR << 16) | (XCURSOR_FILE_MINOR))
#define XCURSOR_FILE_HEADER_LEN (4 * 4)
#define XCURSOR_FILE_TOC_LEN (3 * 4)
typedef struct _XcursorFileToc {
XcursorUInt type; /* chunk type */
XcursorUInt subtype; /* subtype (size for images) */
XcursorUInt position; /* absolute position in file */
} XcursorFileToc;
typedef struct _XcursorFileHeader {
XcursorUInt magic; /* magic number */
XcursorUInt header; /* byte length of header */
XcursorUInt version; /* file version number */
XcursorUInt ntoc; /* number of toc entries */
XcursorFileToc *tocs; /* table of contents */
} XcursorFileHeader;
/*
* The rest of the file is a list of chunks, each tagged by type
* and version.
*
* Chunk:
* ChunkHeader
* <extra type-specific header fields>
* <type-specific data>
*
* ChunkHeader:
* CARD32 header bytes in chunk header + type header
* CARD32 type chunk type
* CARD32 subtype chunk subtype
* CARD32 version chunk type version
*/
#define XCURSOR_CHUNK_HEADER_LEN (4 * 4)
typedef struct _XcursorChunkHeader {
XcursorUInt header; /* bytes in chunk header */
XcursorUInt type; /* chunk type */
XcursorUInt subtype; /* chunk subtype (size for images) */
XcursorUInt version; /* version of this type */
} XcursorChunkHeader;
/*
* Here's a list of the known chunk types
*/
/*
* Comments consist of a 4-byte length field followed by
* UTF-8 encoded text
*
* Comment:
* ChunkHeader header chunk header
* CARD32 length bytes in text
* LISTofCARD8 text UTF-8 encoded text
*/
#define XCURSOR_COMMENT_TYPE 0xfffe0001
#define XCURSOR_COMMENT_VERSION 1
#define XCURSOR_COMMENT_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (1 *4))
#define XCURSOR_COMMENT_COPYRIGHT 1
#define XCURSOR_COMMENT_LICENSE 2
#define XCURSOR_COMMENT_OTHER 3
#define XCURSOR_COMMENT_MAX_LEN 0x100000
typedef struct _XcursorComment {
XcursorUInt version;
XcursorUInt comment_type;
char *comment;
} XcursorComment;
/*
* Each cursor image occupies a separate image chunk.
* The length of the image header follows the chunk header
* so that future versions can extend the header without
* breaking older applications
*
* Image:
* ChunkHeader header chunk header
* CARD32 width actual width
* CARD32 height actual height
* CARD32 xhot hot spot x
* CARD32 yhot hot spot y
* CARD32 delay animation delay
* LISTofCARD32 pixels ARGB pixels
*/
#define XCURSOR_IMAGE_TYPE 0xfffd0002
#define XCURSOR_IMAGE_VERSION 1
#define XCURSOR_IMAGE_HEADER_LEN (XCURSOR_CHUNK_HEADER_LEN + (5*4))
#define XCURSOR_IMAGE_MAX_SIZE 0x7fff /* 32767x32767 max cursor size */
typedef struct _XcursorFile XcursorFile;
struct _XcursorFile {
void *closure;
int (*read) (XcursorFile *file, unsigned char *buf, int len);
int (*write) (XcursorFile *file, unsigned char *buf, int len);
int (*seek) (XcursorFile *file, long offset, int whence);
};
typedef struct _XcursorComments {
int ncomment; /* number of comments */
XcursorComment **comments; /* array of XcursorComment pointers */
} XcursorComments;
/*
* From libXcursor/src/file.c
*/
static XcursorImage *
XcursorImageCreate (int width, int height)
{
XcursorImage *image;
if (width < 0 || height < 0)
return NULL;
if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
return NULL;
image = malloc (sizeof (XcursorImage) +
width * height * sizeof (XcursorPixel));
if (!image)
return NULL;
image->version = XCURSOR_IMAGE_VERSION;
image->pixels = (XcursorPixel *) (image + 1);
image->size = width > height ? width : height;
image->width = width;
image->height = height;
image->delay = 0;
return image;
}
static void
XcursorImageDestroy (XcursorImage *image)
{
free (image);
}
static XcursorImages *
XcursorImagesCreate (int size)
{
XcursorImages *images;
images = malloc (sizeof (XcursorImages) +
size * sizeof (XcursorImage *));
if (!images)
return NULL;
images->nimage = 0;
images->images = (XcursorImage **) (images + 1);
images->name = NULL;
return images;
}
static void
XcursorImagesDestroy (XcursorImages *images)
{
int n;
if (!images)
return;
for (n = 0; n < images->nimage; n++)
XcursorImageDestroy (images->images[n]);
if (images->name)
free (images->name);
free (images);
}
static XcursorBool
_XcursorReadUInt (XcursorFile *file, XcursorUInt *u)
{
unsigned char bytes[4];
if (!file || !u)
return XcursorFalse;
if ((*file->read) (file, bytes, 4) != 4)
return XcursorFalse;
*u = ((bytes[0] << 0) |
(bytes[1] << 8) |
(bytes[2] << 16) |
(bytes[3] << 24));
return XcursorTrue;
}
static void
_XcursorFileHeaderDestroy (XcursorFileHeader *fileHeader)
{
free (fileHeader);
}
static XcursorFileHeader *
_XcursorFileHeaderCreate (int ntoc)
{
XcursorFileHeader *fileHeader;
if (ntoc > 0x10000)
return NULL;
fileHeader = malloc (sizeof (XcursorFileHeader) +
ntoc * sizeof (XcursorFileToc));
if (!fileHeader)
return NULL;
fileHeader->magic = XCURSOR_MAGIC;
fileHeader->header = XCURSOR_FILE_HEADER_LEN;
fileHeader->version = XCURSOR_FILE_VERSION;
fileHeader->ntoc = ntoc;
fileHeader->tocs = (XcursorFileToc *) (fileHeader + 1);
return fileHeader;
}
static XcursorFileHeader *
_XcursorReadFileHeader (XcursorFile *file)
{
XcursorFileHeader head, *fileHeader;
XcursorUInt skip;
unsigned int n;
if (!file)
return NULL;
if (!_XcursorReadUInt (file, &head.magic))
return NULL;
if (head.magic != XCURSOR_MAGIC)
return NULL;
if (!_XcursorReadUInt (file, &head.header))
return NULL;
if (!_XcursorReadUInt (file, &head.version))
return NULL;
if (!_XcursorReadUInt (file, &head.ntoc))
return NULL;
skip = head.header - XCURSOR_FILE_HEADER_LEN;
if (skip)
if ((*file->seek) (file, skip, SEEK_CUR) == EOF)
return NULL;
fileHeader = _XcursorFileHeaderCreate (head.ntoc);
if (!fileHeader)
return NULL;
fileHeader->magic = head.magic;
fileHeader->header = head.header;
fileHeader->version = head.version;
fileHeader->ntoc = head.ntoc;
for (n = 0; n < fileHeader->ntoc; n++)
{
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].type))
break;
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].subtype))
break;
if (!_XcursorReadUInt (file, &fileHeader->tocs[n].position))
break;
}
if (n != fileHeader->ntoc)
{
_XcursorFileHeaderDestroy (fileHeader);
return NULL;
}
return fileHeader;
}
static XcursorBool
_XcursorSeekToToc (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
if (!file || !fileHeader || \
(*file->seek) (file, fileHeader->tocs[toc].position, SEEK_SET) == EOF)
return XcursorFalse;
return XcursorTrue;
}
static XcursorBool
_XcursorFileReadChunkHeader (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc,
XcursorChunkHeader *chunkHeader)
{
if (!file || !fileHeader || !chunkHeader)
return XcursorFalse;
if (!_XcursorSeekToToc (file, fileHeader, toc))
return XcursorFalse;
if (!_XcursorReadUInt (file, &chunkHeader->header))
return XcursorFalse;
if (!_XcursorReadUInt (file, &chunkHeader->type))
return XcursorFalse;
if (!_XcursorReadUInt (file, &chunkHeader->subtype))
return XcursorFalse;
if (!_XcursorReadUInt (file, &chunkHeader->version))
return XcursorFalse;
/* sanity check */
if (chunkHeader->type != fileHeader->tocs[toc].type ||
chunkHeader->subtype != fileHeader->tocs[toc].subtype)
return XcursorFalse;
return XcursorTrue;
}
#define dist(a,b) ((a) > (b) ? (a) - (b) : (b) - (a))
static XcursorDim
_XcursorFindBestSize (XcursorFileHeader *fileHeader,
XcursorDim size,
int *nsizesp)
{
unsigned int n;
int nsizes = 0;
XcursorDim bestSize = 0;
XcursorDim thisSize;
if (!fileHeader || !nsizesp)
return 0;
for (n = 0; n < fileHeader->ntoc; n++)
{
if (fileHeader->tocs[n].type != XCURSOR_IMAGE_TYPE)
continue;
thisSize = fileHeader->tocs[n].subtype;
if (!bestSize || dist (thisSize, size) < dist (bestSize, size))
{
bestSize = thisSize;
nsizes = 1;
}
else if (thisSize == bestSize)
nsizes++;
}
*nsizesp = nsizes;
return bestSize;
}
static int
_XcursorFindImageToc (XcursorFileHeader *fileHeader,
XcursorDim size,
int count)
{
unsigned int toc;
XcursorDim thisSize;
if (!fileHeader)
return 0;
for (toc = 0; toc < fileHeader->ntoc; toc++)
{
if (fileHeader->tocs[toc].type != XCURSOR_IMAGE_TYPE)
continue;
thisSize = fileHeader->tocs[toc].subtype;
if (thisSize != size)
continue;
if (!count)
break;
count--;
}
if (toc == fileHeader->ntoc)
return -1;
return toc;
}
static XcursorImage *
_XcursorReadImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorImage head;
XcursorImage *image;
int n;
XcursorPixel *p;
if (!file || !fileHeader)
return NULL;
if (!_XcursorFileReadChunkHeader (file, fileHeader, toc, &chunkHeader))
return NULL;
if (!_XcursorReadUInt (file, &head.width))
return NULL;
if (!_XcursorReadUInt (file, &head.height))
return NULL;
if (!_XcursorReadUInt (file, &head.xhot))
return NULL;
if (!_XcursorReadUInt (file, &head.yhot))
return NULL;
if (!_XcursorReadUInt (file, &head.delay))
return NULL;
/* sanity check data */
if (head.width > XCURSOR_IMAGE_MAX_SIZE ||
head.height > XCURSOR_IMAGE_MAX_SIZE)
return NULL;
if (head.width == 0 || head.height == 0)
return NULL;
if (head.xhot > head.width || head.yhot > head.height)
return NULL;
/* Create the image and initialize it */
image = XcursorImageCreate (head.width, head.height);
if (image == NULL)
return NULL;
if (chunkHeader.version < image->version)
image->version = chunkHeader.version;
image->size = chunkHeader.subtype;
image->xhot = head.xhot;
image->yhot = head.yhot;
image->delay = head.delay;
n = image->width * image->height;
p = image->pixels;
while (n--)
{
if (!_XcursorReadUInt (file, p))
{
XcursorImageDestroy (image);
return NULL;
}
p++;
}
return image;
}
static XcursorImages *
XcursorXcFileLoadImages (XcursorFile *file, int size)
{
XcursorFileHeader *fileHeader;
XcursorDim bestSize;
int nsize;
XcursorImages *images;
int n;
int toc;
if (!file || size < 0)
return NULL;
fileHeader = _XcursorReadFileHeader (file);
if (!fileHeader)
return NULL;
bestSize = _XcursorFindBestSize (fileHeader, (XcursorDim) size, &nsize);
if (!bestSize)
{
_XcursorFileHeaderDestroy (fileHeader);
return NULL;
}
images = XcursorImagesCreate (nsize);
if (!images)
{
_XcursorFileHeaderDestroy (fileHeader);
return NULL;
}
for (n = 0; n < nsize; n++)
{
toc = _XcursorFindImageToc (fileHeader, bestSize, n);
if (toc < 0)
break;
images->images[images->nimage] = _XcursorReadImage (file, fileHeader,
toc);
if (!images->images[images->nimage])
break;
images->nimage++;
}
_XcursorFileHeaderDestroy (fileHeader);
if (images->nimage != nsize)
{
XcursorImagesDestroy (images);
images = NULL;
}
return images;
}
static int
_XcursorStdioFileRead (XcursorFile *file, unsigned char *buf, int len)
{
FILE *f = file->closure;
return fread (buf, 1, len, f);
}
static int
_XcursorStdioFileWrite (XcursorFile *file, unsigned char *buf, int len)
{
FILE *f = file->closure;
return fwrite (buf, 1, len, f);
}
static int
_XcursorStdioFileSeek (XcursorFile *file, long offset, int whence)
{
FILE *f = file->closure;
return fseek (f, offset, whence);
}
static void
_XcursorStdioFileInitialize (FILE *stdfile, XcursorFile *file)
{
file->closure = stdfile;
file->read = _XcursorStdioFileRead;
file->write = _XcursorStdioFileWrite;
file->seek = _XcursorStdioFileSeek;
}
static XcursorImages *
XcursorFileLoadImages (FILE *file, int size)
{
XcursorFile f;
if (!file)
return NULL;
_XcursorStdioFileInitialize (file, &f);
return XcursorXcFileLoadImages (&f, size);
}
XcursorImages *
xcursor_load_images (const char *path, int size)
{
FILE *f;
XcursorImages *images;
f = fopen (path, "r");
if (!f)
return NULL;
images = XcursorFileLoadImages (f, size);
fclose (f);
return images;
}
void
xcursor_images_destroy (XcursorImages *images)
{
XcursorImagesDestroy (images);
}
-61
View File
@@ -1,61 +0,0 @@
/*
* Copyright © 2002 Keith Packard
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef XCURSOR_H
#define XCURSOR_H
typedef int XcursorBool;
typedef unsigned int XcursorUInt;
typedef XcursorUInt XcursorDim;
typedef XcursorUInt XcursorPixel;
typedef struct _XcursorImage {
XcursorUInt version; /* version of the image data */
XcursorDim size; /* nominal size for matching */
XcursorDim width; /* actual width */
XcursorDim height; /* actual height */
XcursorDim xhot; /* hot spot x (must be inside image) */
XcursorDim yhot; /* hot spot y (must be inside image) */
XcursorUInt delay; /* animation delay to next frame (ms) */
XcursorPixel *pixels; /* pointer to pixels */
} XcursorImage;
/*
* Other data structures exposed by the library API
*/
typedef struct _XcursorImages {
int nimage; /* number of images */
XcursorImage **images; /* array of XcursorImage pointers */
char *name; /* name used to load images */
} XcursorImages;
void
xcursor_images_destroy (XcursorImages *images);
XcursorImages *
xcursor_load_images (const char *path, int size);
#endif
-60
View File
@@ -30,26 +30,6 @@
#include "gdkinternals.h"
#include "gdkintl.h"
#ifdef HAVE_XDG_ACTIVATION
typedef struct {
gchar *token;
} AppLaunchData;
static void
token_done (gpointer data,
struct xdg_activation_token_v1 *provider,
const char *token)
{
AppLaunchData *app_launch_data = data;
app_launch_data->token = g_strdup (token);
}
static const struct xdg_activation_token_v1_listener token_listener = {
token_done,
};
#endif
static char *
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
@@ -60,46 +40,6 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
g_object_get (context, "display", &display, NULL);
#ifdef HAVE_XDG_ACTIVATION
if (display->xdg_activation)
{
struct xdg_activation_token_v1 *token;
struct wl_event_queue *event_queue;
struct wl_surface *wl_surface = NULL;
GdkSeat *seat;
GdkWindow *focus_window;
AppLaunchData app_launch_data = { 0 };
event_queue = wl_display_create_queue (display->wl_display);
seat = gdk_display_get_default_seat (GDK_DISPLAY (display));
token = xdg_activation_v1_get_activation_token (display->xdg_activation);
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
xdg_activation_token_v1_add_listener (token,
&token_listener,
&app_launch_data);
xdg_activation_token_v1_set_serial (token,
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (seat));
focus_window = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (seat));
if (focus_window)
wl_surface = gdk_wayland_window_get_wl_surface (focus_window);
if (wl_surface)
xdg_activation_token_v1_set_surface (token, wl_surface);
xdg_activation_token_v1_commit (token);
while (app_launch_data.token == NULL)
wl_display_dispatch_queue (display->wl_display, event_queue);
xdg_activation_token_v1_destroy (token);
id = app_launch_data.token;
wl_event_queue_destroy (event_queue);
}
else
#endif
if (display->gtk_shell_version >= 3)
{
id = g_uuid_string_random ();
+12 -7
View File
@@ -34,7 +34,7 @@
#include "gdkwayland.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cursor/wayland-cursor.h>
#include <wayland-cursor.h>
#define GDK_TYPE_WAYLAND_CURSOR (_gdk_wayland_cursor_get_type ())
#define GDK_WAYLAND_CURSOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_CURSOR, GdkWaylandCursor))
@@ -149,8 +149,9 @@ _gdk_wayland_cursor_update (GdkWaylandDisplay *display_wayland,
if (cursor->name == NULL)
return FALSE;
theme = _gdk_wayland_display_get_cursor_theme (display_wayland);
c = wl_cursor_theme_get_cursor (theme, cursor->name, cursor->scale);
theme = _gdk_wayland_display_get_scaled_cursor_theme (display_wayland,
cursor->scale);
c = wl_cursor_theme_get_cursor (theme, cursor->name);
if (!c)
{
const char *fallback;
@@ -158,9 +159,9 @@ _gdk_wayland_cursor_update (GdkWaylandDisplay *display_wayland,
fallback = name_fallback (cursor->name);
if (fallback)
{
c = wl_cursor_theme_get_cursor (theme, fallback, cursor->scale);
c = wl_cursor_theme_get_cursor (theme, name_fallback (cursor->name));
if (!c)
c = wl_cursor_theme_get_cursor (theme, "left_ptr", cursor->scale);
c = wl_cursor_theme_get_cursor (theme, "left_ptr");
}
}
@@ -304,6 +305,12 @@ _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
GDK_WAYLAND_DISPLAY (gdk_cursor_get_display (cursor));
GdkWaylandCursor *wayland_cursor = GDK_WAYLAND_CURSOR (cursor);
if (scale > GDK_WAYLAND_MAX_THEME_SCALE)
{
g_warning (G_STRLOC ": cursor theme size %u too large", scale);
scale = GDK_WAYLAND_MAX_THEME_SCALE;
}
if (wayland_cursor->scale == scale)
return;
@@ -458,8 +465,6 @@ _gdk_wayland_display_get_cursor_for_surface (GdkDisplay *display,
cursor->surface.scale = (int)sx;
cursor->surface.width = cairo_image_surface_get_width (surface);
cursor->surface.height = cairo_image_surface_get_height (surface);
cursor->surface.hotspot_x *= sx;
cursor->surface.hotspot_y *= sx;
}
else
{
+10 -12
View File
@@ -732,7 +732,7 @@ device_emit_grab_crossing (GdkDevice *device,
}
}
GdkWindow *
static GdkWindow *
gdk_wayland_device_get_focus (GdkDevice *device)
{
GdkWaylandSeat *wayland_seat = GDK_WAYLAND_SEAT (gdk_device_get_seat (device));
@@ -1188,16 +1188,14 @@ data_device_enter (void *data,
seat->pointer_info.surface_x = wl_fixed_to_double (x);
seat->pointer_info.surface_y = wl_fixed_to_double (y);
gdk_wayland_drop_context_update_targets (seat->drop_context);
selection = gdk_drag_get_selection (seat->drop_context);
dnd_owner = gdk_selection_owner_get_for_display (seat->display, selection);
if (!dnd_owner)
dnd_owner = seat->foreign_dnd_window;
gdk_wayland_selection_set_offer (seat->display, selection, offer);
gdk_wayland_drop_context_update_targets (seat->drop_context);
_gdk_wayland_drag_context_set_source_window (seat->drop_context, dnd_owner);
_gdk_wayland_drag_context_set_dest_window (seat->drop_context,
@@ -1208,6 +1206,8 @@ data_device_enter (void *data,
_gdk_wayland_drag_context_emit_event (seat->drop_context, GDK_DRAG_ENTER,
GDK_CURRENT_TIME);
gdk_wayland_selection_set_offer (seat->display, selection, offer);
emit_selection_owner_change (dest_window, selection);
}
@@ -2195,7 +2195,6 @@ deliver_key_event (GdkWaylandSeat *seat,
struct xkb_keymap *xkb_keymap;
GdkKeymap *keymap;
xkb_keysym_t sym;
int layout;
guint delay, interval, timeout;
gint64 begin_time, now;
@@ -2208,7 +2207,6 @@ deliver_key_event (GdkWaylandSeat *seat,
xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (keymap);
sym = xkb_state_key_get_one_sym (xkb_state, key);
layout = xkb_state_key_get_layout (xkb_state, key);
if (sym == XKB_KEY_NoSymbol)
return;
@@ -2222,7 +2220,7 @@ deliver_key_event (GdkWaylandSeat *seat,
gdk_event_set_seat (event, GDK_SEAT (seat));
event->key.time = time_;
event->key.state = device_get_modifiers (seat->master_pointer);
event->key.group = layout;
event->key.group = 0;
event->key.hardware_keycode = key;
gdk_event_set_scancode (event, key);
event->key.keyval = sym;
@@ -4937,7 +4935,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
native,
GDK_OWNERSHIP_NONE,
owner_events,
GDK_ALL_EVENTS_MASK & ~GDK_POINTER_MOTION_HINT_MASK,
GDK_ALL_EVENTS_MASK,
_gdk_display_get_next_serial (display),
evtime,
FALSE);
@@ -4959,7 +4957,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
native,
GDK_OWNERSHIP_NONE,
owner_events,
GDK_ALL_EVENTS_MASK & ~GDK_POINTER_MOTION_HINT_MASK,
GDK_ALL_EVENTS_MASK,
_gdk_display_get_next_serial (display),
evtime,
FALSE);
@@ -4977,7 +4975,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
native,
GDK_OWNERSHIP_NONE,
owner_events,
GDK_ALL_EVENTS_MASK & ~GDK_POINTER_MOTION_HINT_MASK,
GDK_ALL_EVENTS_MASK,
_gdk_display_get_next_serial (display),
evtime,
FALSE);
@@ -5003,7 +5001,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
native,
GDK_OWNERSHIP_NONE,
owner_events,
GDK_ALL_EVENTS_MASK & ~GDK_POINTER_MOTION_HINT_MASK,
GDK_ALL_EVENTS_MASK,
_gdk_display_get_next_serial (display),
evtime,
FALSE);
+64 -81
View File
@@ -84,10 +84,7 @@
#define MIN_SYSTEM_BELL_DELAY_MS 20
#define GTK_SHELL1_VERSION 5
#ifdef HAVE_XDG_ACTIVATION
#define XDG_ACTIVATION_VERSION 1
#endif
#define GTK_SHELL1_VERSION 4
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
@@ -127,6 +124,10 @@ xdg_wm_base_ping (void *data,
struct xdg_wm_base *xdg_wm_base,
uint32_t serial)
{
GdkWaylandDisplay *display_wayland = data;
_gdk_wayland_display_update_serial (display_wayland, serial);
GDK_NOTE (EVENTS,
g_message ("ping, shell %p, serial %u\n", xdg_wm_base, serial));
@@ -433,19 +434,26 @@ gdk_registry_handle_global (void *data,
}
else if (strcmp (interface, "wl_seat") == 0)
{
SeatAddedClosure *closure;
static const char *required_device_manager_globals[] = {
"wl_compositor",
"wl_data_device_manager",
NULL
};
closure = g_new0 (SeatAddedClosure, 1);
closure->base.handler = seat_added_closure_run;
closure->base.required_globals = required_device_manager_globals;
closure->id = id;
closure->version = version;
postpone_on_globals_closure (display_wayland, &closure->base);
if (has_required_globals (display_wayland,
required_device_manager_globals))
_gdk_wayland_display_add_seat (display_wayland, id, version);
else
{
SeatAddedClosure *closure;
closure = g_new0 (SeatAddedClosure, 1);
closure->base.handler = seat_added_closure_run;
closure->base.required_globals = required_device_manager_globals;
closure->id = id;
closure->version = version;
postpone_on_globals_closure (display_wayland, &closure->base);
}
}
else if (strcmp (interface, "wl_data_device_manager") == 0)
{
@@ -459,12 +467,12 @@ gdk_registry_handle_global (void *data,
display_wayland->subcompositor =
wl_registry_bind (display_wayland->wl_registry, id, &wl_subcompositor_interface, 1);
}
else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0)
else if (strcmp (interface, "zwp_pointer_gestures_v1") == 0 &&
version == GDK_ZWP_POINTER_GESTURES_V1_VERSION)
{
display_wayland->pointer_gestures =
wl_registry_bind (display_wayland->wl_registry,
id, &zwp_pointer_gestures_v1_interface,
MIN (version, GDK_ZWP_POINTER_GESTURES_V1_VERSION));
id, &zwp_pointer_gestures_v1_interface, version);
}
else if (strcmp (interface, "gtk_primary_selection_device_manager") == 0)
{
@@ -522,20 +530,11 @@ gdk_registry_handle_global (void *data,
_gdk_wayland_screen_init_xdg_output (display_wayland->screen);
_gdk_wayland_display_async_roundtrip (display_wayland);
}
#ifdef HAVE_XDG_ACTIVATION
else if (strcmp (interface, "xdg_activation_v1") == 0)
{
display_wayland->xdg_activation_version =
MIN (version, XDG_ACTIVATION_VERSION);
display_wayland->xdg_activation =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_activation_v1_interface,
display_wayland->xdg_activation_version);
}
#endif
g_hash_table_insert (display_wayland->known_globals,
GUINT_TO_POINTER (id), g_strdup (interface));
process_on_globals_closures (display_wayland);
}
static void
@@ -626,13 +625,8 @@ _gdk_wayland_display_open (const gchar *display_name)
display_wayland->wl_registry = wl_display_get_registry (display_wayland->wl_display);
wl_registry_add_listener (display_wayland->wl_registry, &registry_listener, display_wayland);
if (wl_display_roundtrip (display_wayland->wl_display) < 0)
{
g_object_unref (display);
return NULL;
}
process_on_globals_closures (display_wayland);
_gdk_wayland_display_async_roundtrip (display_wayland);
/* Wait for initializing to complete. This means waiting for all
* asynchrounous roundtrips that were triggered during initial roundtrip. */
@@ -720,6 +714,7 @@ static void
gdk_wayland_display_finalize (GObject *object)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (object);
guint i;
_gdk_wayland_display_finalize_cursors (display_wayland);
@@ -729,10 +724,13 @@ gdk_wayland_display_finalize (GObject *object)
g_free (display_wayland->cursor_theme_name);
xkb_context_unref (display_wayland->xkb_context);
if (display_wayland->cursor_theme)
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
{
wl_cursor_theme_destroy (display_wayland->cursor_theme);
display_wayland->cursor_theme = NULL;
if (display_wayland->scaled_cursor_themes[i])
{
wl_cursor_theme_destroy (display_wayland->scaled_cursor_themes[i]);
display_wayland->scaled_cursor_themes[i] = NULL;
}
}
g_ptr_array_free (display_wayland->monitors, TRUE);
@@ -945,12 +943,6 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
#ifdef HAVE_XDG_ACTIVATION
/* Will be signaled with focus activation */
if (display_wayland->xdg_activation)
return;
#endif
if (startup_id == NULL)
{
startup_id = display_wayland->startup_notification_id;
@@ -959,10 +951,6 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
return;
}
#ifdef HAVE_XDG_ACTIVATION
if (display_wayland->xdg_activation) /* FIXME: Isn't this redundant? */
return;
#endif
if (display_wayland->gtk_shell)
gtk_shell1_set_startup_id (display_wayland->gtk_shell, startup_id);
}
@@ -1112,33 +1100,6 @@ gdk_wayland_display_init (GdkWaylandDisplay *display)
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
}
static struct wl_cursor_theme *
get_cursor_theme (GdkWaylandDisplay *display_wayland,
const char *name,
int size)
{
const char * const *xdg_data_dirs;
struct wl_cursor_theme *theme = NULL;
int i;
xdg_data_dirs = g_get_system_data_dirs ();
for (i = 0; xdg_data_dirs[i]; i++)
{
char *path = g_build_filename (xdg_data_dirs[i], "icons", name, "cursors", NULL);
if (g_file_test (path, G_FILE_TEST_IS_DIR))
theme = wl_cursor_theme_create (path, size, display_wayland->shm);
g_free (path);
if (theme)
return theme;
}
/* This may fall back to builtin cursors */
return wl_cursor_theme_create ("/usr/share/icons/default/cursors", size, display_wayland->shm);
}
void
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const gchar *name,
@@ -1146,6 +1107,7 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
struct wl_cursor_theme *theme;
int i;
g_assert (display_wayland);
g_assert (display_wayland->shm);
@@ -1154,21 +1116,22 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
display_wayland->cursor_theme_size == size)
return;
theme = get_cursor_theme (display_wayland, name, size);
theme = wl_cursor_theme_load (name, size, display_wayland->shm);
if (theme == NULL)
{
g_warning ("Failed to load cursor theme %s", name);
return;
}
if (display_wayland->cursor_theme)
for (i = 0; i < GDK_WAYLAND_THEME_SCALES_COUNT; i++)
{
wl_cursor_theme_destroy (display_wayland->cursor_theme);
display_wayland->cursor_theme = NULL;
if (display_wayland->scaled_cursor_themes[i])
{
wl_cursor_theme_destroy (display_wayland->scaled_cursor_themes[i]);
display_wayland->scaled_cursor_themes[i] = NULL;
}
}
display_wayland->cursor_theme = theme;
display_wayland->scaled_cursor_themes[0] = theme;
if (display_wayland->cursor_theme_name != NULL)
g_free (display_wayland->cursor_theme_name);
display_wayland->cursor_theme_name = g_strdup (name);
@@ -1178,11 +1141,31 @@ gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
}
struct wl_cursor_theme *
_gdk_wayland_display_get_cursor_theme (GdkWaylandDisplay *display_wayland)
_gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
guint scale)
{
g_assert (display_wayland->cursor_theme_name);
struct wl_cursor_theme *theme;
return display_wayland->cursor_theme;
g_assert (display_wayland->cursor_theme_name);
g_assert (scale <= GDK_WAYLAND_MAX_THEME_SCALE);
g_assert (scale >= 1);
theme = display_wayland->scaled_cursor_themes[scale - 1];
if (!theme)
{
theme = wl_cursor_theme_load (display_wayland->cursor_theme_name,
display_wayland->cursor_theme_size * scale,
display_wayland->shm);
if (theme == NULL)
{
g_warning ("Failed to load cursor theme %s with scale %u",
display_wayland->cursor_theme_name, scale);
return NULL;
}
display_wayland->scaled_cursor_themes[scale - 1] = theme;
}
return theme;
}
static void
+5 -11
View File
@@ -25,6 +25,7 @@
#include <config.h>
#include <stdint.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include <wayland-egl.h>
#include <gdk/wayland/tablet-unstable-v2-client-protocol.h>
#include <gdk/wayland/gtk-shell-client-protocol.h>
@@ -35,10 +36,6 @@
#include <gdk/wayland/server-decoration-client-protocol.h>
#include <gdk/wayland/xdg-output-unstable-v1-client-protocol.h>
#include <gdk/wayland/primary-selection-unstable-v1-client-protocol.h>
#ifdef HAVE_XDG_ACTIVATION
#include <gdk/wayland/xdg-activation-v1-client-protocol.h>
#endif
#include <gdk/wayland/cursor/wayland-cursor.h>
#include <glib.h>
#include <gdk/gdkkeys.h>
@@ -52,6 +49,9 @@
G_BEGIN_DECLS
#define GDK_WAYLAND_MAX_THEME_SCALE 4
#define GDK_WAYLAND_THEME_SCALES_COUNT GDK_WAYLAND_MAX_THEME_SCALE
#define GDK_ZWP_POINTER_GESTURES_V1_VERSION 1
typedef struct _GdkWaylandSelection GdkWaylandSelection;
@@ -98,9 +98,6 @@ struct _GdkWaylandDisplay
struct org_kde_kwin_server_decoration_manager *server_decoration_manager;
struct zxdg_output_manager_v1 *xdg_output_manager;
uint32_t xdg_output_version;
#ifdef HAVE_XDG_ACTIVATION
struct xdg_activation_v1 *xdg_activation;
#endif
GList *async_roundtrips;
@@ -116,7 +113,7 @@ struct _GdkWaylandDisplay
GList *current_popups;
struct wl_cursor_theme *cursor_theme;
struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
gchar *cursor_theme_name;
int cursor_theme_size;
GHashTable *cursor_cache;
@@ -128,9 +125,6 @@ struct _GdkWaylandDisplay
int data_device_manager_version;
int gtk_shell_version;
int xdg_output_manager_version;
#ifdef HAVE_XDG_ACTIVATION
int xdg_activation_version;
#endif
uint32_t server_decoration_mode;
+4 -8
View File
@@ -309,13 +309,11 @@ gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
}
gboolean
gdk_wayland_display_init_gl (GdkDisplay *display,
GdkGLContext *share)
gdk_wayland_display_init_gl (GdkDisplay *display)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
EGLint major, minor;
EGLDisplay dpy;
gboolean use_es;
if (display_wayland->have_egl)
return TRUE;
@@ -328,10 +326,8 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
if (!eglInitialize (dpy, &major, &minor))
return FALSE;
use_es = (_gdk_gl_flags & GDK_GL_GLES) != 0 ||
(share != NULL && gdk_gl_context_get_use_es (share));
if (!eglBindAPI (use_es ? EGL_OPENGL_ES_API : EGL_OPENGL_API))
return FALSE;
if (!eglBindAPI (EGL_OPENGL_API))
return FALSE;
display_wayland->egl_display = dpy;
display_wayland->egl_major_version = major;
@@ -465,7 +461,7 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
GdkWaylandGLContext *context;
EGLConfig config;
if (!gdk_wayland_display_init_gl (display, share))
if (!gdk_wayland_display_init_gl (display))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
+1 -2
View File
@@ -47,8 +47,7 @@ struct _GdkWaylandGLContextClass
GdkGLContextClass parent_class;
};
gboolean gdk_wayland_display_init_gl (GdkDisplay *display,
GdkGLContext *share);
gboolean gdk_wayland_display_init_gl (GdkDisplay *display);
GdkGLContext * gdk_wayland_window_create_gl_context (GdkWindow *window,
gboolean attach,
GdkGLContext *share,
+2 -2
View File
@@ -60,7 +60,8 @@ void _gdk_wayland_display_init_cursors (GdkWaylandDisplay *display);
void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display);
struct wl_cursor_theme * _gdk_wayland_display_get_cursor_theme (GdkWaylandDisplay *display_wayland);
struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
guint scale);
GdkCursor *_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type);
@@ -186,7 +187,6 @@ uint32_t _gdk_wayland_device_get_implicit_grab_serial(GdkWaylandDevice *device,
const GdkEvent *event);
uint32_t _gdk_wayland_seat_get_last_implicit_grab_serial (GdkSeat *seat,
GdkEventSequence **seqence);
GdkWindow * gdk_wayland_device_get_focus (GdkDevice *device);
struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_device);
void gdk_wayland_seat_set_selection (GdkSeat *seat,
struct wl_data_source *source);
+7 -71
View File
@@ -542,20 +542,19 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.privacy", "remember-recent-files", "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } },
{ FALSE, WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ FALSE, CLASSIC_WM_SETTINGS_SCHEMA, "button-layout", "gtk-decoration-layout", G_TYPE_STRING, { .s = "menu:close" } },
{ FALSE, "org.gnome.desktop.interface", "font-antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "text-scaling-factor", "gtk-xft-dpi" , G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-double-click-titlebar", "gtk-titlebar-double-click", G_TYPE_STRING, { .s = "toggle-maximize" } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contrast", G_TYPE_NONE, { .b = FALSE } },
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_INT, { .i = 0 } }
};
@@ -603,13 +602,6 @@ find_translation_entry_by_setting (const gchar *setting)
return NULL;
}
static void
high_contrast_changed (GdkScreen *screen)
{
notify_setting (screen, "gtk-theme-name");
notify_setting (screen, "gtk-icon-theme-name");
}
static void
settings_changed (GSettings *settings,
const gchar *key,
@@ -623,8 +615,6 @@ settings_changed (GSettings *settings,
{
if (entry->type != G_TYPE_NONE)
notify_setting (screen, entry->setting);
else if (strcmp (key, "high-contrast") == 0)
high_contrast_changed (screen);
else
update_xft_settings (screen);
}
@@ -755,14 +745,6 @@ init_settings (GdkScreen *screen)
goto fallback;
}
if (g_variant_n_children (ret) == 0)
{
g_debug ("Received no portal settings");
g_clear_pointer (&ret, g_variant_unref);
goto fallback;
}
g_variant_get (ret, "(a{sa{sv}})", &iter);
while (g_variant_iter_loop (iter, "{s@a{sv}}", &schema, &val))
@@ -1007,36 +989,6 @@ set_decoration_layout_from_entry (GdkScreen *screen,
}
}
static void
set_theme_from_entry (GdkScreen *screen,
TranslationEntry *entry,
GValue *value)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GSettings *settings = NULL;
GSettingsSchema *schema = NULL;
gboolean hc = FALSE;
if (screen_wayland->settings_portal == NULL)
{
settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings,
"org.gnome.desktop.a11y.interface");
}
if (settings)
g_object_get (settings, "settings-schema", &schema, NULL);
if (schema && g_settings_schema_has_key (schema, "high-contrast"))
hc = g_settings_get_boolean (settings, "high-contrast");
g_clear_pointer (&schema, g_settings_schema_unref);
if (hc)
g_value_set_static_string (value, "HighContrast");
else
set_value_from_entry (screen, entry, value);
}
static gboolean
set_capability_setting (GdkScreen *screen,
GValue *value,
@@ -1068,8 +1020,6 @@ gdk_wayland_screen_get_setting (GdkScreen *screen,
{
if (strcmp (name, "gtk-decoration-layout") == 0)
set_decoration_layout_from_entry (screen, entry, value);
else if (strcmp (name, "gtk-theme-name") == 0)
set_theme_from_entry (screen, entry, value);
else
set_value_from_entry (screen, entry, value);
return TRUE;
@@ -1680,21 +1630,7 @@ output_handle_geometry (void *data,
monitor->x = x;
monitor->y = y;
switch (transform)
{
case WL_OUTPUT_TRANSFORM_90:
case WL_OUTPUT_TRANSFORM_270:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
case WL_OUTPUT_TRANSFORM_FLIPPED_270:
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
physical_height, physical_width);
break;
default:
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
physical_width, physical_height);
}
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), physical_width, physical_height);
gdk_monitor_set_subpixel_layout (GDK_MONITOR (monitor), subpixel);
gdk_monitor_set_manufacturer (GDK_MONITOR (monitor), make);
gdk_monitor_set_model (GDK_MONITOR (monitor), model);
+20 -51
View File
@@ -34,9 +34,6 @@
#include <string.h>
#define STRING_MIMETYPE "text/plain"
#define UTF8_STRING_MIMETYPE "text/plain;charset=utf-8"
typedef struct _SelectionBuffer SelectionBuffer;
typedef struct _SelectionData SelectionData;
typedef struct _StoredSelection StoredSelection;
@@ -103,7 +100,7 @@ struct _GdkWaylandSelection
/* Source-side data */
GPtrArray *stored_selections; /* Array of StoredSelection */
StoredSelection *current_request_selection;
GdkAtom current_request_selection;
GArray *source_targets;
GdkAtom requested_target;
@@ -861,12 +858,7 @@ gdk_wayland_selection_reset_selection (GdkWaylandSelection *wayland_selection,
stored_selection = g_ptr_array_index (wayland_selection->stored_selections, i);
if (stored_selection->selection_atom == selection)
{
if (wayland_selection->current_request_selection == stored_selection)
wayland_selection->current_request_selection = NULL;
g_ptr_array_remove_index_fast (wayland_selection->stored_selections, i);
}
g_ptr_array_remove_index_fast (wayland_selection->stored_selections, i);
else
i++;
}
@@ -885,10 +877,21 @@ gdk_wayland_selection_store (GdkWindow *window,
if (type == gdk_atom_intern_static_string ("NULL"))
return;
if (!selection->current_request_selection)
if (selection->current_request_selection == GDK_NONE)
return;
stored_selection = selection->current_request_selection;
stored_selection =
gdk_wayland_selection_find_stored_selection (selection, window,
selection->current_request_selection,
type);
if (!stored_selection)
{
stored_selection = stored_selection_new (selection, window,
selection->current_request_selection,
type);
g_ptr_array_add (selection->stored_selections, stored_selection);
}
if ((mode == GDK_PROP_MODE_PREPEND ||
mode == GDK_PROP_MODE_REPLACE) &&
@@ -912,7 +915,7 @@ gdk_wayland_selection_store (GdkWindow *window,
}
/* Handle the next GDK_SELECTION_REQUEST / store, if any */
selection->current_request_selection = NULL;
selection->current_request_selection = GDK_NONE;
gdk_wayland_selection_handle_next_request (selection);
}
@@ -976,7 +979,7 @@ gdk_wayland_selection_handle_next_request (GdkWaylandSelection *wayland_selectio
gdk_wayland_selection_emit_request (stored_selection->source,
stored_selection->selection_atom,
stored_selection->type);
wayland_selection->current_request_selection = stored_selection;
wayland_selection->current_request_selection = stored_selection->selection_atom;
break;
}
}
@@ -1020,7 +1023,7 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
write_data = async_write_data_new (stored_selection, fd);
if (!wayland_selection->current_request_selection)
if (wayland_selection->current_request_selection == GDK_NONE)
gdk_wayland_selection_handle_next_request (wayland_selection);
return TRUE;
@@ -1432,29 +1435,13 @@ _gdk_wayland_display_set_selection_owner (GdkDisplay *display,
}
void
_gdk_wayland_display_send_selection_notify (GdkDisplay *display,
_gdk_wayland_display_send_selection_notify (GdkDisplay *dispay,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
GdkAtom property,
guint32 time)
{
GdkWaylandSelection *wayland_selection;
if (property != GDK_NONE)
return;
wayland_selection = gdk_wayland_display_get_selection (display);
if (!wayland_selection->current_request_selection)
return;
g_ptr_array_remove_fast (wayland_selection->stored_selections,
wayland_selection->current_request_selection);
/* Handle the next GDK_SELECTION_REQUEST / store, if any */
wayland_selection->current_request_selection = NULL;
gdk_wayland_selection_handle_next_request (wayland_selection);
}
gint
@@ -1786,25 +1773,7 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
{
gchar *mimetype = gdk_atom_name (targets[i]);
if (selection == atoms[ATOM_PRIMARY])
{
if (g_strcmp0 (mimetype, "STRING") == 0)
zwp_primary_selection_source_v1_offer (data_source, STRING_MIMETYPE);
else if (g_strcmp0 (mimetype, "UTF8_STRING") == 0)
zwp_primary_selection_source_v1_offer (data_source, UTF8_STRING_MIMETYPE);
zwp_primary_selection_source_v1_offer (data_source, mimetype);
}
else
{
if (g_strcmp0 (mimetype, "STRING") == 0)
wl_data_source_offer (data_source, STRING_MIMETYPE);
else if (g_strcmp0 (mimetype, "UTF8_STRING") == 0)
wl_data_source_offer (data_source, UTF8_STRING_MIMETYPE);
wl_data_source_offer (data_source, mimetype);
}
wl_data_source_offer (data_source, mimetype);
g_free (mimetype);
}
+18 -173
View File
@@ -753,23 +753,12 @@ window_update_scale (GdkWindow *window)
return;
}
if (!impl->display_server.outputs)
scale = 1;
for (l = impl->display_server.outputs; l != NULL; l = l->next)
{
scale = impl->scale;
}
else
{
scale = 1;
for (l = impl->display_server.outputs; l != NULL; l = l->next)
{
struct wl_output *output = l->data;
uint32_t output_scale;
output_scale =
_gdk_wayland_screen_get_output_scale (display_wayland->screen,
output);
scale = MAX (scale, output_scale);
}
guint32 output_scale =
_gdk_wayland_screen_get_output_scale (display_wayland->screen, l->data);
scale = MAX (scale, output_scale);
}
/* Notify app that scale changed */
@@ -1210,7 +1199,6 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
gboolean is_xdg_popup;
gboolean is_visible;
gboolean size_changed;
impl->unconfigured_width = calculate_width_without_margin (window, width);
impl->unconfigured_height = calculate_height_without_margin (window, height);
@@ -1218,8 +1206,9 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
if (should_inhibit_resize (window))
return;
size_changed = (window->width != width || window->height != height);
if (!size_changed && impl->scale == scale)
if (window->width == width &&
window->height == height &&
impl->scale == scale)
return;
/* For xdg_popup using an xdg_positioner, there is a race condition if
@@ -1233,7 +1222,6 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
if (is_xdg_popup &&
is_visible &&
size_changed &&
!impl->initial_configure_received &&
!impl->configuring_popup)
gdk_window_hide (window);
@@ -1242,7 +1230,6 @@ gdk_wayland_window_maybe_configure (GdkWindow *window,
if (is_xdg_popup &&
is_visible &&
size_changed &&
!impl->initial_configure_received &&
!impl->configuring_popup)
gdk_window_show (window);
@@ -1533,14 +1520,6 @@ surface_enter (void *data,
{
GdkWindow *window = GDK_WINDOW (data);
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
gboolean output_is_unmanaged;
output_is_unmanaged =
_gdk_wayland_screen_get_output_scale (display_wayland->screen, output) == 0;
if (output_is_unmanaged)
return;
GDK_NOTE (EVENTS,
g_message ("surface enter, window %p output %p", window, output));
@@ -2006,13 +1985,6 @@ create_zxdg_toplevel_v6_resources (GdkWindow *window)
window);
}
/**
* gdk_wayland_window_set_application_id:
* @window:
* @application_id:
*
* Since: 3.24.22
*/
void
gdk_wayland_window_set_application_id (GdkWindow *window, const char* application_id)
{
@@ -3358,12 +3330,6 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->display_server.xdg_popup = NULL;
display_wayland->current_popups =
g_list_remove (display_wayland->current_popups, window);
if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
{
window->x = 0;
window->y = 0;
}
}
if (impl->display_server.xdg_surface)
{
@@ -3386,12 +3352,6 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->display_server.zxdg_popup_v6 = NULL;
display_wayland->current_popups =
g_list_remove (display_wayland->current_popups, window);
if (impl->position_method == POSITION_METHOD_MOVE_TO_RECT)
{
window->x = 0;
window->y = 0;
}
}
if (impl->display_server.zxdg_surface_v6)
{
@@ -3811,84 +3771,29 @@ gdk_wayland_window_get_input_shape (GdkWindow *window)
return NULL;
}
#ifdef HAVE_XDG_ACTIVATION
static void
token_done (gpointer data,
struct xdg_activation_token_v1 *provider,
const char *token)
{
char **token_out = data;
*token_out = g_strdup (token);
}
static const struct xdg_activation_token_v1_listener token_listener = {
token_done,
};
#endif
static void
gdk_wayland_window_focus (GdkWindow *window,
guint32 timestamp)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkDisplay *display = gdk_window_get_display (window);
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
gchar *startup_id = NULL;
startup_id = g_steal_pointer (&display_wayland->startup_notification_id);
if (!impl->display_server.gtk_surface)
return;
#ifdef HAVE_XDG_ACTIVATION
if (display_wayland->xdg_activation)
if (timestamp == GDK_CURRENT_TIME)
{
GdkSeat *seat = gdk_display_get_default_seat (display);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
/* If the focus request does not have a startup ID associated, get a
* new token to activate the window.
*/
if (!startup_id)
if (display_wayland->gtk_shell_version >= 3)
{
struct xdg_activation_token_v1 *token;
struct wl_event_queue *event_queue;
event_queue = wl_display_create_queue (display_wayland->wl_display);
token = xdg_activation_v1_get_activation_token (display_wayland->xdg_activation);
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
xdg_activation_token_v1_add_listener (token,
&token_listener,
&startup_id);
xdg_activation_token_v1_set_serial (token,
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (seat));
xdg_activation_token_v1_set_surface (token,
gdk_wayland_window_get_wl_surface (window));
xdg_activation_token_v1_commit (token);
while (startup_id == NULL)
wl_display_dispatch_queue (display_wayland->wl_display, event_queue);
xdg_activation_token_v1_destroy (token);
wl_event_queue_destroy (event_queue);
gtk_surface1_request_focus (impl->display_server.gtk_surface,
display_wayland->startup_notification_id);
g_clear_pointer (&display_wayland->startup_notification_id, g_free);
}
xdg_activation_v1_activate (display_wayland->xdg_activation,
startup_id,
impl->display_server.wl_surface);
}
else
#endif
if (impl->display_server.gtk_surface)
{
if (timestamp != GDK_CURRENT_TIME)
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
else if (startup_id && display_wayland->gtk_shell_version >= 3)
gtk_surface1_request_focus (impl->display_server.gtk_surface,
startup_id);
}
g_free (startup_id);
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
}
static void
@@ -4850,65 +4755,6 @@ gdk_wayland_window_show_window_menu (GdkWindow *window,
return TRUE;
}
static gboolean
translate_gesture (GdkTitlebarGesture gesture,
enum gtk_surface1_gesture *out_gesture)
{
switch (gesture)
{
case GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_DOUBLE_CLICK;
break;
case GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_RIGHT_CLICK;
break;
case GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
*out_gesture = GTK_SURFACE1_GESTURE_MIDDLE_CLICK;
break;
default:
g_warning ("Not handling unknown titlebar gesture %u", gesture);
return FALSE;
}
return TRUE;
}
static gboolean
gdk_wayland_window_titlebar_gesture (GdkWindow *window,
GdkTitlebarGesture gesture)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
struct gtk_surface1 *gtk_surface = impl->display_server.gtk_surface;
enum gtk_surface1_gesture gtk_gesture;
GdkSeat *seat;
struct wl_seat *wl_seat;
uint32_t serial;
if (!gtk_surface)
return FALSE;
if (gtk_surface1_get_version (gtk_surface) < GTK_SURFACE1_TITLEBAR_GESTURE_SINCE_VERSION)
return FALSE;
if (!translate_gesture (gesture, &gtk_gesture))
return FALSE;
seat = gdk_display_get_default_seat (gdk_window_get_display (window));
wl_seat = gdk_wayland_seat_get_wl_seat (seat);
serial = _gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL);
gtk_surface1_titlebar_gesture (impl->display_server.gtk_surface,
serial,
wl_seat,
gtk_gesture);
return TRUE;
}
static void
_gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
{
@@ -5000,7 +4846,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->show_window_menu = gdk_wayland_window_show_window_menu;
impl_class->create_gl_context = gdk_wayland_window_create_gl_context;
impl_class->invalidate_for_new_frame = gdk_wayland_window_invalidate_for_new_frame;
impl_class->titlebar_gesture = gdk_wayland_window_titlebar_gesture;
signals[COMMITTED] = g_signal_new ("committed",
G_TYPE_FROM_CLASS (object_class),
+2 -12
View File
@@ -1,5 +1,3 @@
subdir('cursor')
gdk_wayland_sources = files(
'gdkapplaunchcontext-wayland.c',
'gdkcursor-wayland.c',
@@ -33,12 +31,12 @@ gdk_wayland_deps = [
xkbdep,
wlclientdep,
wlprotocolsdep,
wlcursordep,
wlegldep,
]
# wayland protocols
wlprotocolsdep = dependency('wayland-protocols')
proto_dir = wlprotocolsdep.get_pkgconfig_variable('pkgdatadir')
proto_dir = dependency('wayland-protocols').get_pkgconfig_variable('pkgdatadir')
assert(proto_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc')
wayland_scanner = find_program('wayland-scanner')
@@ -60,9 +58,6 @@ proto_sources = [
['xdg-output', 'unstable', 'v1', ],
['primary-selection', 'unstable', 'v1', ],
]
if wlprotocolsdep.version().version_compare('>=1.21')
proto_sources += [['xdg-activation', 'staging', 'v1', ]]
endif
gdk_wayland_gen_headers = []
@@ -73,10 +68,6 @@ foreach p: proto_sources
if proto_stability == 'stable'
output_base = proto_name
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
elif proto_stability == 'staging'
proto_version = p.get(2)
output_base = '@0@-@1@'.format(proto_name, proto_version)
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
elif proto_stability == 'private'
output_base = proto_name
input = 'protocol/@0@.xml'.format(proto_name)
@@ -113,5 +104,4 @@ libgdk_wayland = static_library('gdk-wayland',
'-DG_LOG_DOMAIN="Gdk"',
] + common_cflags,
link_args: common_ldflags,
link_with: [libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps, ])
+2 -19
View File
@@ -1,6 +1,6 @@
<protocol name="gtk">
<interface name="gtk_shell1" version="5">
<interface name="gtk_shell1" version="4">
<description summary="gtk specific extensions">
gtk_shell is a protocol extension providing additional features for
clients implementing it.
@@ -35,7 +35,7 @@
</request>
</interface>
<interface name="gtk_surface1" version="5">
<interface name="gtk_surface1" version="4">
<request name="set_dbus_properties">
<arg name="application_id" type="string" allow-null="true"/>
<arg name="app_menu_path" type="string" allow-null="true"/>
@@ -85,23 +85,6 @@
<!-- Version 4 additions -->
<request name="release" type="destructor" since="4"/>
<!-- Version 5 additions -->
<enum name="gesture" since="5">
<entry name="double_click" value="1"/>
<entry name="right_click" value="2"/>
<entry name="middle_click" value="3"/>
</enum>
<enum name="error" since="5">
<entry name="invalid_gesture" value="0"/>
</enum>
<request name="titlebar_gesture" since="5">
<arg name="serial" type="uint"/>
<arg name="seat" type="object" interface="wl_seat"/>
<arg name="gesture" type="uint" enum="gesture"/>
</request>
</interface>
</protocol>
+70 -10
View File
@@ -1,6 +1,5 @@
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/Makefile.decl
include gdk-win32-sources.inc
libgdkincludedir = $(includedir)/gtk-3.0/gdk
libgdkwin32includedir = $(includedir)/gtk-3.0/gdk/win32
@@ -22,10 +21,7 @@ if WIN32_GLES
AM_CPPFLAGS += "-DGDK_WIN32_ENABLE_EGL=1"
endif #WIN32_GLES
libgdk_win32_DEP_LIBS = \
-lhid
LDADDS = $(libgdk_win32_DEP_LIBS) $(GDK_DEP_LIBS)
LDADDS = $(GDK_DEP_LIBS)
noinst_LTLIBRARIES = libgdk-win32.la
@@ -36,21 +32,85 @@ EXTRA_DIST += \
makefile.msc \
meson.build
libgdk_win32_la_LIBADD = \
$(LDADDS) \
$(NULL)
libgdk_win32_la_SOURCES = \
gdkcursor-win32.c \
gdkdevicemanager-win32.c \
gdkdevicemanager-win32.h \
gdkdevice-virtual.c \
gdkdevice-virtual.h \
gdkdevice-win32.c \
gdkdevice-win32.h \
gdkdevice-wintab.c \
gdkdevice-wintab.h \
gdkdisplay-win32.c \
gdkdisplay-win32.h \
gdkdisplaymanager-win32.c \
gdkdnd-win32.c \
gdkevents-win32.c \
gdkgeometry-win32.c \
gdkglcontext-win32.c \
gdkglcontext-win32.h \
gdkglobals-win32.c \
gdkkeys-win32.c \
gdkmain-win32.c \
gdkmonitor-win32.c \
gdkmonitor-win32.h \
gdkprivate-win32.h \
gdkproperty-win32.c \
gdkscreen-win32.c \
gdkselection-win32.c \
gdkselection-win32.h \
gdktestutils-win32.c \
gdkwin32cursor.h \
gdkwin32display.h \
gdkwin32displaymanager.h \
gdkwin32dnd.h \
gdkwin32dnd-private.h \
gdkwin32glcontext.h \
gdkwin32langnotification.c \
gdkwin32langnotification.h \
gdkwin32.h \
gdkwin32id.c \
gdkwin32keys.h \
gdkwin32monitor.h \
gdkwin32screen.h \
gdkwin32window.h \
gdkwindow-win32.c \
gdkwindow-win32.h \
pktdef.h \
wintab.h \
xcursors.h
libgdkinclude_HEADERS = $(GDK_PUBLIC_H_SRCS_WIN32)
libgdkinclude_HEADERS = \
gdkwin32.h
libgdkwin32include_HEADERS = \
gdkwin32cursor.h \
gdkwin32display.h \
gdkwin32displaymanager.h\
gdkwin32dnd.h \
gdkwin32glcontext.h \
gdkwin32keys.h \
gdkwin32misc.h \
gdkwin32monitor.h \
gdkwin32screen.h \
gdkwin32window.h
# ------------------- MSVC Build Items ----------------
MSVCPROJS = gdk3-win32
gdk3_win32_FILES = $(libgdk_win32_la_SOURCES)
gdk3_win32_EXCLUDES = dummy
gdk3_win32_HEADERS_DIR = $(libgdkwin32includedir)
gdk3_win32_HEADERS_INST = $(libgdkwin32include_HEADERS)
gdk3_win32_HEADERS_EXCLUDES = dummy
include $(top_srcdir)/win32/Makefile.msvcproj
dist-hook: \
$(top_builddir)/win32/vs9/gdk3-win32.vcproj
$(top_builddir)/win32/vs9/gdk3-win32.vcproj \
$(top_builddir)/win32/vs9/gdk3-win32.headers
-include $(top_srcdir)/git.mk

Some files were not shown because too many files have changed in this diff Show More