Compare commits
133 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bf8faf2a0 | |||
| 391472870f | |||
| 76666a4204 | |||
| 5053c6fcec | |||
| edf85cb1b3 | |||
| 841e9b3f0e | |||
| 93f9138c9b | |||
| 1ace77b923 | |||
| dd4d6930b5 | |||
| 7fc2d9adc0 | |||
| 17dd32da88 | |||
| ec2aac5b61 | |||
| 15f7d2a27d | |||
| 3dafdcbab0 | |||
| 383fa6b0b0 | |||
| f637ab57f1 | |||
| 615b4d8c65 | |||
| 9be5c7b0c8 | |||
| 670b102553 | |||
| 9bd9a11de4 | |||
| ec26e4f6b4 | |||
| 538ab75002 | |||
| 1c99dbc70e | |||
| afd56517d1 | |||
| 3c7ba21a6a | |||
| 4b655ecd36 | |||
| 028942c8c3 | |||
| 55b171c986 | |||
| a4416e389a | |||
| d6818475d7 | |||
| 287c40276a | |||
| 5916ae5ec4 | |||
| 03829e191e | |||
| f958a6ecf7 | |||
| 71bad81aff | |||
| 75d9310986 | |||
| 93d4253c93 | |||
| c0faf0c6b6 | |||
| b63690aa6b | |||
| 1e8a58e367 | |||
| 34d7e25a1f | |||
| b353221185 | |||
| eb6edac4bd | |||
| f316fe0f58 | |||
| 12854f1428 | |||
| 309a7aa253 | |||
| 363c88cef7 | |||
| 74a1c60dd4 | |||
| a4bb81b61c | |||
| 01c0acb707 | |||
| afbc1d5b66 | |||
| 1d9e68245a | |||
| 9b98641ddd | |||
| 2c1d218749 | |||
| 716485113a | |||
| d70feb9165 | |||
| 38af49d4fd | |||
| 007de568c9 | |||
| d2913b81cb | |||
| c90078fd4a | |||
| 428e647238 | |||
| 4c7914dc49 | |||
| 5e35a4b69a | |||
| 9a30019268 | |||
| 972276436f | |||
| e81a1db48c | |||
| 33a4442988 | |||
| 3035bf1e39 | |||
| 14bf58ec5d | |||
| a2a3aab94d | |||
| 7ff9a3f3a0 | |||
| 8070bac06c | |||
| d4731a4ab4 | |||
| 0c6266fd1a | |||
| 5b0e91844b | |||
| c4363e2706 | |||
| ccaacfc8c3 | |||
| 2e9d772e66 | |||
| bac6e79614 | |||
| 2fd86ef80c | |||
| f9370d7e83 | |||
| bc75965053 | |||
| 77107f70c4 | |||
| b41aeabbec | |||
| c0ae36e943 | |||
| 5851415fca | |||
| 36b4b39619 | |||
| d7bf3605b9 | |||
| 15211556df | |||
| 13f8583934 | |||
| 350110ad9d | |||
| d771aa6fee | |||
| 4acb56d8c5 | |||
| afaa9810d1 | |||
| 6aa68fcfee | |||
| b2b2070415 | |||
| c5b2bbf01b | |||
| f4d3d8e27c | |||
| 4f6fa87f00 | |||
| 01bd6cfd17 | |||
| 000487c36c | |||
| 5870f1c90a | |||
| 30ef48143f | |||
| 0232218100 | |||
| 31cf894092 | |||
| 509db01319 | |||
| ff4552c842 | |||
| c22af88235 | |||
| 6719616c36 | |||
| 18c7284817 | |||
| 8912a6eb75 | |||
| 9b7a73268e | |||
| d4d9644409 | |||
| 80473ccd69 | |||
| b51a5446ba | |||
| d7e6fbf8a2 | |||
| acae90cc6e | |||
| dcfb4690c3 | |||
| 9e8d845a61 | |||
| 1e2b5a9c19 | |||
| 4079b782d6 | |||
| dca142d5d2 | |||
| 52c630d994 | |||
| aadd9ae201 | |||
| 3df0f95ee3 | |||
| 5dc6194b98 | |||
| d9c0d98871 | |||
| dd7d76f389 | |||
| bc88f01165 | |||
| 7ff69e9356 | |||
| 188e28e196 | |||
| 3536bdd7a6 | |||
| c0c8e93d90 |
+54
-51
@@ -27,14 +27,41 @@ variables:
|
||||
|
||||
style-check-diff:
|
||||
extends: .only-default
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v17
|
||||
stage: .pre
|
||||
allow_failure: true
|
||||
script:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
.build-fedora-default:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v17
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
paths:
|
||||
- _ccache/
|
||||
- subprojects/gdk-pixbuf/
|
||||
- subprojects/glib/
|
||||
- subprojects/graphene/
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
|
||||
@@ -47,26 +74,12 @@ fedora-x86_64:
|
||||
-Dprofiler=true
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build broadway
|
||||
|
||||
release-build:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
extends: .build-fedora-default
|
||||
stage: build
|
||||
variables:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
@@ -78,25 +91,9 @@ release-build:
|
||||
-Dvulkan=yes
|
||||
_build
|
||||
- ninja -C _build
|
||||
- .gitlab-ci/run-tests.sh _build
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
|
||||
.mingw-defaults: &mingw-defaults
|
||||
.mingw-defaults:
|
||||
stage: build
|
||||
tags:
|
||||
- win32-ps
|
||||
@@ -105,15 +102,21 @@ release-build:
|
||||
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
paths:
|
||||
- _ccache/
|
||||
- subprojects/gdk-pixbuf/
|
||||
- subprojects/glib/
|
||||
- subprojects/graphene/
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
|
||||
msys2-mingw32:
|
||||
extends: .mingw-defaults
|
||||
variables:
|
||||
MSYSTEM: "MINGW32"
|
||||
CHERE_INVOKING: "yes"
|
||||
<<: *mingw-defaults
|
||||
|
||||
.flatpak-defaults: &flatpak-defaults
|
||||
.flatpak-defaults:
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
|
||||
stage: flatpak
|
||||
allow_failure: true
|
||||
@@ -127,45 +130,45 @@ msys2-mingw32:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
|
||||
# Manual jobs, for branches and MRs
|
||||
.flatpak-manual: &flatpak-manual
|
||||
<<: *flatpak-defaults
|
||||
.flatpak-manual:
|
||||
extends: .flatpak-defaults
|
||||
when: manual
|
||||
|
||||
# Only build Flatpak bundles automatically on master
|
||||
.flatpak-master: &flatpak-master
|
||||
<<: *flatpak-defaults
|
||||
.flatpak-master:
|
||||
extends: .flatpak-defaults
|
||||
only:
|
||||
- master
|
||||
|
||||
flatpak-manual:demo:
|
||||
extends: .flatpak-manual
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
<<: *flatpak-manual
|
||||
|
||||
flatpak-master:demo:
|
||||
extends: .flatpak-master
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
<<: *flatpak-master
|
||||
|
||||
flatpak-manual:widget-factory:
|
||||
extends: .flatpak-manual
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
<<: *flatpak-manual
|
||||
|
||||
flatpak-master:widget-factory:
|
||||
extends: .flatpak-master
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
<<: *flatpak-master
|
||||
|
||||
flatpak-manual:icon-browser:
|
||||
extends: .flatpak-manual
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
<<: *flatpak-manual
|
||||
|
||||
flatpak-master:icon-browser:
|
||||
extends: .flatpak-master
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
<<: *flatpak-master
|
||||
|
||||
static-scan:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v16
|
||||
|
||||
@@ -78,6 +78,8 @@ RUN dnf -y install \
|
||||
vulkan-devel \
|
||||
wayland-devel \
|
||||
wayland-protocols-devel \
|
||||
weston \
|
||||
weston-libs \
|
||||
which \
|
||||
xorg-x11-server-Xvfb \
|
||||
&& dnf clean all
|
||||
|
||||
@@ -138,12 +138,13 @@ ul.images li {
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>{{ report.project_name }}/{{ report.branch_name }} :: Test Reports</h1>
|
||||
<h1>{{ report.project_name }}/{{ report.backend }}/{{ report.branch_name }} :: Test Reports</h1>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<section>
|
||||
<div class="report-meta">
|
||||
<p><strong>Backend:</strong> {{ report.backend }}</p>
|
||||
<p><strong>Branch:</strong> {{ report.branch_name }}</p>
|
||||
<p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p>
|
||||
{% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %}
|
||||
@@ -259,6 +260,9 @@ aparser = argparse.ArgumentParser(description='Turns a Meson test log into an HT
|
||||
aparser.add_argument('--project-name', metavar='NAME',
|
||||
help='The project name',
|
||||
default='Unknown')
|
||||
aparser.add_argument('--backend', metavar='NAME',
|
||||
help='The used backend',
|
||||
default='unknown')
|
||||
aparser.add_argument('--job-id', metavar='ID',
|
||||
help='The job ID for the report',
|
||||
default=None)
|
||||
@@ -319,6 +323,7 @@ report = {}
|
||||
report['date'] = datetime.datetime.utcnow()
|
||||
report['locale_date'] = report['date'].strftime("%c")
|
||||
report['project_name'] = args.project_name
|
||||
report['backend'] = args.backend
|
||||
report['job_id'] = args.job_id
|
||||
report['branch_name'] = args.branch
|
||||
report['total_successes'] = 0
|
||||
|
||||
@@ -19,6 +19,9 @@ aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUn
|
||||
aparser.add_argument('--project-name', metavar='NAME',
|
||||
help='The project name',
|
||||
default='unknown')
|
||||
aparser.add_argument('--backend', metavar='NAME',
|
||||
help='The used backend',
|
||||
default='unknown')
|
||||
aparser.add_argument('--job-id', metavar='ID',
|
||||
help='The job ID for the report',
|
||||
default='Unknown')
|
||||
@@ -92,18 +95,18 @@ for name, units in suites.items():
|
||||
for unit in successes:
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
testcase.set('name', unit['name'])
|
||||
testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
|
||||
testcase.set('time', str(unit['duration']))
|
||||
|
||||
for unit in failures:
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
testcase.set('name', unit['name'])
|
||||
testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
|
||||
testcase.set('time', str(unit['duration']))
|
||||
|
||||
failure = ET.SubElement(testcase, 'failure')
|
||||
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
failure.set('name', unit['name'])
|
||||
testcase.set('name', '{}/{}'.format(args.backend, unit['name']))
|
||||
failure.set('type', 'error')
|
||||
failure.text = unit['stdout']
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ fi
|
||||
|
||||
if [ -z $base_version ]; then
|
||||
base_version="latest"
|
||||
else
|
||||
elif [ $base_version != "latest" ]; then
|
||||
base_version="v$base_version"
|
||||
fi
|
||||
|
||||
@@ -95,7 +95,7 @@ if [ ! -x "$(command -v docker)" ] || [ docker --help |& grep -q podman ]; then
|
||||
else
|
||||
echo "Using: Docker"
|
||||
format=""
|
||||
CMD="sudo socker"
|
||||
CMD="sudo docker"
|
||||
fi
|
||||
|
||||
REGISTRY="registry.gitlab.gnome.org"
|
||||
|
||||
+57
-12
@@ -5,30 +5,75 @@ set +e
|
||||
|
||||
srcdir=$( pwd )
|
||||
builddir=$1
|
||||
backend=$2
|
||||
|
||||
export GDK_BACKEND=x11
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test -C ${builddir} \
|
||||
case "${backend}" in
|
||||
x11)
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test -C ${builddir} \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
# Store the exit code for the CI run, but always
|
||||
# generate the reports
|
||||
exit_code=$?
|
||||
# Store the exit code for the CI run, but always
|
||||
# generate the reports
|
||||
exit_code=$?
|
||||
;;
|
||||
|
||||
wayland)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
weston --backend=headless-backend.so --socket=wayland-5 &
|
||||
compositor=$!
|
||||
export WAYLAND_DISPLAY=wayland-5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
exit_code=$?
|
||||
kill ${compositor}
|
||||
;;
|
||||
|
||||
broadway)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
${builddir}/gdk/broadway/gtk4-broadwayd :5 &
|
||||
server=$!
|
||||
export BROADWAY_DISPLAY=:5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:a11y \
|
||||
--no-suite=gsk-compare-opengl
|
||||
|
||||
# don't let Broadway failures fail the run, for now
|
||||
exit_code=0
|
||||
kill ${server}
|
||||
;;
|
||||
esac
|
||||
|
||||
cd ${builddir}
|
||||
|
||||
$srcdir/.gitlab-ci/meson-junit-report.py \
|
||||
--project-name=gtk \
|
||||
--backend=${backend} \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--output=report.xml \
|
||||
meson-logs/testlog.json
|
||||
--output=report-${backend}.xml \
|
||||
meson-logs/testlog-${backend}.json
|
||||
$srcdir/.gitlab-ci/meson-html-report.py \
|
||||
--project-name=gtk \
|
||||
--backend=${backend} \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--reftest-output-dir="testsuite/reftests/output" \
|
||||
--output=report.html \
|
||||
meson-logs/testlog.json
|
||||
--reftest-output-dir="testsuite/reftests/output/${backend}" \
|
||||
--output=report-${backend}.html \
|
||||
meson-logs/testlog-${backend}.json
|
||||
|
||||
exit $exit_code
|
||||
|
||||
@@ -3,9 +3,9 @@ Overview of Changes in GTK 3.98.4
|
||||
|
||||
* Themes
|
||||
- Refine menu styling
|
||||
- Add public colors to HighContrast
|
||||
- Fix scale borders in HighContrast
|
||||
- Tweak visible focus behavior
|
||||
- HighConstrast: Add public colors
|
||||
- HighContrast: Fix scale borders
|
||||
|
||||
* CSS:
|
||||
- Drop the nonstandard -gtk-icon-theme property
|
||||
@@ -29,6 +29,12 @@ Overview of Changes in GTK 3.98.4
|
||||
- Drop the homogeneous property
|
||||
- Add a use-underline property to stack pages
|
||||
|
||||
* GtkScale:
|
||||
- Make area around the trough clickable
|
||||
|
||||
* GtkScrolledWindow:
|
||||
- Fix kinetic scrolling
|
||||
|
||||
* GtkTreeView:
|
||||
- Break reference cycles in unroot
|
||||
|
||||
@@ -46,11 +52,13 @@ Overview of Changes in GTK 3.98.4
|
||||
|
||||
* Remove gtk_dialog_run
|
||||
|
||||
* Wayland:
|
||||
- Provide a builtin cursor of last resort
|
||||
* GDK:
|
||||
- Wayland: Provide a builtin cursor of last resort
|
||||
- Change the monitor api to use a GListModel
|
||||
|
||||
* GSK:
|
||||
- Don't include renderer-specific headers automatically
|
||||
- GL: Fix nested rounded clips
|
||||
|
||||
* Introspection:
|
||||
- Assorted annotation fixes
|
||||
@@ -73,6 +81,7 @@ Overview of Changes in GTK 3.98.4
|
||||
* Translation updates:
|
||||
Chinese (Taiwan)
|
||||
Esperanto
|
||||
Japanese
|
||||
Romanian
|
||||
Spanish
|
||||
Ukrainian
|
||||
|
||||
@@ -146,9 +146,6 @@
|
||||
/* Have the Xcursor library */
|
||||
#mesondefine HAVE_XCURSOR
|
||||
|
||||
/* Have the XDAMAGE X extension */
|
||||
#mesondefine HAVE_XDAMAGE
|
||||
|
||||
/* Have the XFIXES X extension */
|
||||
#mesondefine HAVE_XFIXES
|
||||
|
||||
|
||||
@@ -3,4 +3,5 @@ executable('print-editor',
|
||||
c_args: common_cflags,
|
||||
dependencies: libgtk_dep,
|
||||
include_directories: confinc,
|
||||
gui_app: true)
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags)
|
||||
|
||||
@@ -1148,6 +1148,7 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
gtk_widget_add_css_class (child, "frame");
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (resources); i++)
|
||||
|
||||
@@ -86,14 +86,12 @@ gdk_display_has_pending
|
||||
gdk_display_is_rgba
|
||||
gdk_display_is_composited
|
||||
gdk_display_get_default_group
|
||||
gdk_display_supports_shapes
|
||||
gdk_display_supports_input_shapes
|
||||
gdk_display_get_app_launch_context
|
||||
gdk_display_notify_startup_complete
|
||||
gdk_display_get_default_seat
|
||||
gdk_display_list_seats
|
||||
gdk_display_get_n_monitors
|
||||
gdk_display_get_monitor
|
||||
gdk_display_get_monitors
|
||||
gdk_display_get_monitor_at_surface
|
||||
gdk_display_get_clipboard
|
||||
gdk_display_get_primary_clipboard
|
||||
@@ -184,11 +182,8 @@ gdk_surface_destroy
|
||||
gdk_surface_is_destroyed
|
||||
gdk_surface_get_display
|
||||
gdk_surface_hide
|
||||
gdk_surface_is_viewable
|
||||
gdk_surface_get_mapped
|
||||
gdk_surface_translate_coordinates
|
||||
gdk_surface_begin_resize_drag
|
||||
gdk_surface_begin_move_drag
|
||||
gdk_surface_beep
|
||||
gdk_surface_get_scale_factor
|
||||
gdk_surface_set_opaque_region
|
||||
@@ -675,6 +670,8 @@ gdk_toplevel_set_deletable
|
||||
gdk_toplevel_supports_edge_constraints
|
||||
gdk_toplevel_inhibit_system_shortcuts
|
||||
gdk_toplevel_restore_system_shortcuts
|
||||
gdk_toplevel_begin_resize
|
||||
gdk_toplevel_begin_move
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_TOPLEVEL
|
||||
gdk_toplevel_get_type
|
||||
@@ -829,7 +826,6 @@ gdk_x11_display_error_trap_pop_ignored
|
||||
gdk_x11_display_set_cursor_theme
|
||||
gdk_x11_display_set_surface_scale
|
||||
gdk_x11_display_get_glx_version
|
||||
gdk_x11_register_standard_event_type
|
||||
gdk_x11_screen_get_screen_number
|
||||
gdk_x11_screen_get_xscreen
|
||||
gdk_x11_screen_get_window_manager_name
|
||||
|
||||
@@ -47,7 +47,7 @@ How to compile GTK itself
|
||||
</para>
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
meson --prefix /opt/gtk builddir
|
||||
meson setup --prefix /opt/gtk builddir
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
<para>
|
||||
|
||||
@@ -6617,6 +6617,7 @@ gtk_native_get_for_surface
|
||||
gtk_native_get_surface
|
||||
gtk_native_get_renderer
|
||||
gtk_native_check_resize
|
||||
gtk_native_get_surface_transform
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_native_get_type
|
||||
|
||||
@@ -324,7 +324,9 @@
|
||||
<para>
|
||||
A number of minor API cleanups have happened in GdkSurface
|
||||
as well. For example, gdk_surface_input_shape_combine_region()
|
||||
has been renamed to gdk_surface_set_input_region().
|
||||
has been renamed to gdk_surface_set_input_region(), and
|
||||
gdk_surface_begin_resize_drag() has been renamed to
|
||||
gdk_toplevel_begin_resize().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -921,10 +923,11 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>The gtk_window_fullscreen_on_monitor API has changed</title>
|
||||
<title>Monitor handling has changed</title>
|
||||
<para>
|
||||
Instead of a monitor number, gtk_window_fullscreen_on_monitor() now takes a
|
||||
#GdkMonitor argument.
|
||||
Instead of a monitor number, #GdkMonitor is now used throughout.
|
||||
gdk_display_get_monitors() returns the list of monitors that can be queried
|
||||
or observed for monitors to pass to APIs like gtk_window_fullscreen_on_monitor().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ additional environment variables.
|
||||
<title><envar>GTK_DEBUG</envar></title>
|
||||
|
||||
<para>
|
||||
Unless GTK has been configured with <option>--enable-debug=no</option>,
|
||||
Unless GTK has been configured with <option>-Ddebug=false</option>,
|
||||
this variable can be set to a list of debug options, which cause GTK
|
||||
to print out different types of debugging information.
|
||||
<variablelist>
|
||||
@@ -237,7 +237,7 @@ nevertheless.
|
||||
<title><envar>GDK_DEBUG</envar></title>
|
||||
|
||||
<para>
|
||||
If GTK has been configured with <option>--enable-debug=yes</option>,
|
||||
Unless GTK has been configured with <option>-Ddebug=false</option>,
|
||||
this variable can be set to a list of debug options, which cause GDK
|
||||
to print out different types of debugging information.
|
||||
<variablelist>
|
||||
@@ -327,7 +327,7 @@ nevertheless.
|
||||
<title><envar>GSK_DEBUG</envar></title>
|
||||
|
||||
<para>
|
||||
If GTK has been configured with <option>--enable-debug=yes</option>,
|
||||
Unless GTK has been configured with <option>-Ddebug=false</option>,
|
||||
this variable can be set to a list of debug options, which cause GSK
|
||||
to print out different types of debugging information.
|
||||
<variablelist>
|
||||
@@ -432,11 +432,11 @@ nevertheless.
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
Since 3.10, this environment variable can contain a comma-separated list
|
||||
of backend names, which are tried in order. The list may also contain
|
||||
a *, which means: try all remaining backends. The special value "help" can
|
||||
be used to make GDK print out a list of all available backends.
|
||||
For more information about selecting backends, see the gdk_display_manager_get() function.
|
||||
This environment variable can contain a comma-separated list of backend names,
|
||||
which are tried in order. The list may also contain a *, which means: try all
|
||||
remaining backends. The special value "help" can be used to make GDK print out
|
||||
a list of all available backends. For more information about selecting backends,
|
||||
see the gdk_display_manager_get() function.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
|
||||
@@ -21,18 +21,17 @@ Wayland-specific aspects of using GTK
|
||||
|
||||
<para>
|
||||
The GDK Wayland backend provides support for running GTK applications
|
||||
under the Wayland display server. To run your application in this way,
|
||||
select the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
|
||||
under a Wayland compositor. To run your application in this way, select
|
||||
the Wayland backend by setting <literal>GDK_BACKEND=wayland</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, the Wayland backend does not use any additional commandline
|
||||
options or environment variables.
|
||||
On UNIX, the Wayland backend is enabled by default, so you don't need to
|
||||
do anything special when compiling it, and everything should "just work."
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For up-to-date information about the current status of this backend, see
|
||||
the <ulink url="https://wiki.gnome.org/Initiatives/Wayland/GTK%2B">project page</ulink>.
|
||||
Currently, the Wayland backend does not use any additional environment variables.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
@@ -25,65 +25,19 @@ on top of the Win32 API. When compiling GTK on Windows, this backend is
|
||||
the default.
|
||||
</para>
|
||||
|
||||
<refsect2 id="win32-cmdline">
|
||||
<title>Windows-specific commandline options</title>
|
||||
|
||||
<para>
|
||||
The Windows GDK backend can be influenced with some
|
||||
additional command line arguments.
|
||||
</para>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--sync</systemitem></title>
|
||||
|
||||
<para>
|
||||
Don't batch GDI requests. This might be a marginally useful option for
|
||||
debugging.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--no-wintab</systemitem>,
|
||||
<systemitem>--ignore-wintab</systemitem></title>
|
||||
|
||||
<para>
|
||||
Don't use the Wintab API for tablet support.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--use-wintab</systemitem></title>
|
||||
|
||||
<para>
|
||||
Use the Wintab API for tablet support. This is the default.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--max-colors <replaceable>number</replaceable></systemitem></title>
|
||||
|
||||
<para>
|
||||
In 256 color mode, restrict the size of the color palette to
|
||||
the specified number of colors. This option is obsolete.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="win32-envar">
|
||||
<title>Windows-specific environment variables</title>
|
||||
|
||||
<para>
|
||||
The Win32 GDK backend can be influenced with some
|
||||
additional environment variables.
|
||||
The Win32 GDK backend can be influenced with some additional environment
|
||||
variables.
|
||||
</para>
|
||||
|
||||
<formalpara>
|
||||
<title><envar>GDK_IGNORE_WINTAB</envar></title>
|
||||
|
||||
<para>
|
||||
If this variable is set, GTK doesn't use
|
||||
the Wintab API for tablet support.
|
||||
If this variable is set, GTK doesn't use the Wintab API for tablet support.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
@@ -91,17 +45,8 @@ the Wintab API for tablet support.
|
||||
<title><envar>GDK_USE_WINTAB</envar></title>
|
||||
|
||||
<para>
|
||||
If this variable is set, GTK uses the Wintab API for
|
||||
tablet support. This is the default.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><envar>GDK_WIN32_MAX_COLORS</envar></title>
|
||||
|
||||
<para>
|
||||
Specifies the size of the color palette used
|
||||
in 256 color mode.
|
||||
If this variable is set, GTK uses the Wintab API for tablet support.
|
||||
This is the default.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
@@ -120,7 +65,9 @@ When any other cursor theme is used, GTK will prefer cursors from that theme,
|
||||
falling back to Windows cursors and built-in X cursors.
|
||||
</para>
|
||||
<para>
|
||||
Theme can be changed by setting <literal>gtk-cursor-theme-name</literal> GTK setting. Users can override GTK settings in the <filename>settings.ini</filename> file or at runtime in the GTK Inspector.
|
||||
Theme can be changed by setting <literal>gtk-cursor-theme-name</literal> GTK
|
||||
setting. Users can override GTK settings in the <filename>settings.ini</filename>
|
||||
file or at runtime in the GTK Inspector.
|
||||
</para>
|
||||
<para>
|
||||
Themes are loaded from normal Windows variants of the XDG locations:
|
||||
@@ -129,7 +76,8 @@ Themes are loaded from normal Windows variants of the XDG locations:
|
||||
<filename>RUNTIME_PREFIX/share/icons/THEME/cursors</filename>.
|
||||
</para>
|
||||
<para>
|
||||
The <literal>gtk-cursor-theme-size</literal> setting is ignored, GTK will use the cursor size that Windows tells it to use.
|
||||
The <literal>gtk-cursor-theme-size</literal> setting is ignored, GTK will use
|
||||
the cursor size that Windows tells it to use.
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
@@ -20,35 +20,16 @@ X11-specific aspects of using GTK
|
||||
<title>GTK for the X Window System</title>
|
||||
|
||||
<para>
|
||||
On UNIX, the X backend is the default build for GTK.
|
||||
So you don't need to do anything special when compiling it,
|
||||
and everything should "just work."
|
||||
On UNIX, the X backend is enabled by default, so you don't need to do anything
|
||||
special when compiling it, and everything should "just work."
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To mix low-level Xlib routines into a GTK program,
|
||||
see <link linkend="gdk-X-Window-System-Interaction">GDK X Window
|
||||
System interaction</link> in the GDK manual.
|
||||
To mix low-level Xlib routines into a GTK program, see
|
||||
<link linkend="gdk-X-Window-System-Interaction">GDK X Window System
|
||||
interaction</link> in the GDK manual.
|
||||
</para>
|
||||
|
||||
<refsect2 id="x11-cmdline">
|
||||
<title>X11-specific commandline options</title>
|
||||
|
||||
<para>
|
||||
The X backend understands some additional command line arguments.
|
||||
</para>
|
||||
|
||||
<formalpara>
|
||||
<title><systemitem>--display <replaceable>display</replaceable></systemitem></title>
|
||||
|
||||
<para>
|
||||
The name of the X display to open instead of the one specified
|
||||
in the <envar>DISPLAY</envar> environment variable.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="x11-envar">
|
||||
<title>X11-specific environment variables</title>
|
||||
|
||||
@@ -129,9 +110,9 @@ The window manager is in charge of rendering the frame or borders
|
||||
around windows; it also has final say on the size of each window,
|
||||
and window states such as minimized, maximized, and so forth.
|
||||
On Windows and MacOS the application handles most of this.
|
||||
On X11, if you wish to modify the window's state, or
|
||||
change its frame, you must ask the window manager to do so on your
|
||||
behalf, using an established <ulink
|
||||
On X11, if you wish to modify the window's state, or change its frame,
|
||||
you must ask the window manager to do so on your behalf, using an
|
||||
established <ulink
|
||||
url="http://www.freedesktop.org/standards/">convention</ulink>.
|
||||
</para>
|
||||
|
||||
@@ -139,17 +120,11 @@ url="http://www.freedesktop.org/standards/">convention</ulink>.
|
||||
GTK has functions for asking the window manager to do various things;
|
||||
see for example <link
|
||||
linkend="gtk-window-minimize">gtk_window_minimize()</link> or <link
|
||||
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
|
||||
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
|
||||
linkend="gtk-window-maximize">gtk_window_maximize()</link>.
|
||||
Keep in mind that most window managers <emphasis>will</emphasis> ignore
|
||||
certain requests from time to time, in the interests of good user interface.
|
||||
</para>
|
||||
|
||||
<!--
|
||||
May also want to explain DESKTOP_STARTUP_ID here.
|
||||
http://www.freedesktop.org/Standards/startup-notification-spec
|
||||
-->
|
||||
|
||||
</refsect2>
|
||||
|
||||
</refsect1>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
executable('exampleapp',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c',
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -4,4 +4,5 @@ app2_resources = gnome.compile_resources('exampleapp2_resources',
|
||||
|
||||
executable('exampleapp2',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app2_resources,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -4,4 +4,5 @@ app3_resources = gnome.compile_resources('exampleapp3_resources',
|
||||
|
||||
executable('exampleapp3',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app3_resources,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -4,4 +4,5 @@ app4_resources = gnome.compile_resources('exampleapp4_resources',
|
||||
|
||||
executable('exampleapp4',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app4_resources,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -6,4 +6,5 @@ app5_schemas = gnome.compile_schemas()
|
||||
|
||||
executable('exampleapp5',
|
||||
'exampleapp.c', 'exampleappwin.c', 'main.c', app5_resources, app5_schemas,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -11,4 +11,5 @@ executable('exampleapp6',
|
||||
'exampleappprefs.c',
|
||||
app6_resources,
|
||||
app6_schemas,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -11,4 +11,5 @@ executable('exampleapp7',
|
||||
'exampleappprefs.c',
|
||||
app7_resources,
|
||||
app7_schemas,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -11,4 +11,5 @@ executable('exampleapp8',
|
||||
'exampleappprefs.c',
|
||||
app8_resources,
|
||||
app8_schemas,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -11,4 +11,5 @@ executable('exampleapp9',
|
||||
'exampleappprefs.c',
|
||||
app9_resources,
|
||||
app9_schemas,
|
||||
dependencies: libgtk_dep)
|
||||
dependencies: libgtk_dep,
|
||||
c_args: common_cflags)
|
||||
|
||||
@@ -188,12 +188,11 @@ text_buffer_changed_cb (GtkTextBuffer *buffer,
|
||||
|
||||
if (old_n < 3 && n == 3)
|
||||
{
|
||||
GNotification *n;
|
||||
n = g_notification_new ("Three lines of text");
|
||||
g_notification_set_body (n, "Keep up the good work!");
|
||||
g_notification_add_button (n, "Start over", "app.clear-all");
|
||||
g_application_send_notification (G_APPLICATION (app), "three-lines", n);
|
||||
g_object_unref (n);
|
||||
GNotification *notification = g_notification_new ("Three lines of text");
|
||||
g_notification_set_body (notification, "Keep up the good work!");
|
||||
g_notification_add_button (notification, "Start over", "app.clear-all");
|
||||
g_application_send_notification (G_APPLICATION (app), "three-lines", notification);
|
||||
g_object_unref (notification);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,7 +634,7 @@ bloat_pad_class_init (BloatPadClass *class)
|
||||
|
||||
}
|
||||
|
||||
BloatPad *
|
||||
static BloatPad *
|
||||
bloat_pad_new (void)
|
||||
{
|
||||
BloatPad *bloat_pad;
|
||||
|
||||
@@ -160,12 +160,6 @@ _gdk_broadway_server_new (GdkDisplay *display,
|
||||
return server;
|
||||
}
|
||||
|
||||
guint32
|
||||
_gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static guint32
|
||||
gdk_broadway_server_send_message_with_size (GdkBroadwayServer *server, BroadwayRequestBase *base,
|
||||
gsize size, guint32 type, int fd)
|
||||
|
||||
@@ -24,7 +24,6 @@ void _gdk_broadway_server_roundtrip (GdkBroadwaySer
|
||||
gint32 id,
|
||||
guint32 tag);
|
||||
gulong _gdk_broadway_server_get_next_serial (GdkBroadwayServer *server);
|
||||
guint32 _gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server);
|
||||
gboolean _gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
|
||||
const char *types);
|
||||
void _gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
|
||||
|
||||
@@ -46,9 +46,6 @@ typedef struct _GdkBroadwaySurfaceClass GdkBroadwaySurfaceClass;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_broadway_surface_get_type (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint32 gdk_broadway_get_last_seen_time (GdkSurface *surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_BROADWAY_SURFACE_H__ */
|
||||
|
||||
@@ -56,6 +56,8 @@ G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
|
||||
static void
|
||||
gdk_broadway_display_init (GdkBroadwayDisplay *display)
|
||||
{
|
||||
gdk_display_set_input_shapes (GDK_DISPLAY (display), FALSE);
|
||||
|
||||
display->id_ht = g_hash_table_new (NULL, NULL);
|
||||
|
||||
display->monitor = g_object_new (GDK_TYPE_BROADWAY_MONITOR,
|
||||
@@ -64,7 +66,7 @@ gdk_broadway_display_init (GdkBroadwayDisplay *display)
|
||||
gdk_monitor_set_manufacturer (display->monitor, "browser");
|
||||
gdk_monitor_set_model (display->monitor, "0");
|
||||
display->scale_factor = 1;
|
||||
gdk_monitor_set_size (display->monitor, 1024, 768);
|
||||
gdk_monitor_set_geometry (display->monitor, &(GdkRectangle) { 0, 0, 1024, 768 });
|
||||
gdk_monitor_set_physical_size (display->monitor, 1024 * 25.4 / 96, 768 * 25.4 / 96);
|
||||
gdk_monitor_set_scale_factor (display->monitor, 1);
|
||||
}
|
||||
@@ -97,7 +99,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
|
||||
|
||||
broadway_display->scale_factor = msg->scale;
|
||||
|
||||
gdk_monitor_set_size (monitor, msg->width, msg->height);
|
||||
gdk_monitor_set_geometry (monitor, &(GdkRectangle) { 0, 0, msg->width, msg->height });
|
||||
gdk_monitor_set_scale_factor (monitor, msg->scale);
|
||||
gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
|
||||
|
||||
@@ -113,7 +115,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
|
||||
}}
|
||||
|
||||
static GdkDevice *
|
||||
create_core_pointer (GdkDisplay *display)
|
||||
create_core_pointer (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Core Pointer",
|
||||
@@ -125,7 +127,7 @@ create_core_pointer (GdkDisplay *display)
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
create_core_keyboard (GdkDisplay *display)
|
||||
create_core_keyboard (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Core Keyboard",
|
||||
@@ -137,7 +139,31 @@ create_core_keyboard (GdkDisplay *display)
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
create_touchscreen (GdkDisplay *display)
|
||||
create_pointer (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Pointer",
|
||||
"type", GDK_DEVICE_TYPE_SLAVE,
|
||||
"source", GDK_SOURCE_MOUSE,
|
||||
"has-cursor", TRUE,
|
||||
"display", display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
create_keyboard (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Keyboard",
|
||||
"type", GDK_DEVICE_TYPE_SLAVE,
|
||||
"source", GDK_SOURCE_KEYBOARD,
|
||||
"has-cursor", FALSE,
|
||||
"display", display,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static GdkDevice *
|
||||
create_touchscreen (GdkDisplay *display)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DEVICE,
|
||||
"name", "Touchscreen",
|
||||
@@ -161,16 +187,23 @@ _gdk_broadway_display_open (const gchar *display_name)
|
||||
|
||||
broadway_display->core_pointer = create_core_pointer (display);
|
||||
broadway_display->core_keyboard = create_core_keyboard (display);
|
||||
broadway_display->pointer = create_pointer (display);
|
||||
broadway_display->keyboard = create_keyboard (display);
|
||||
broadway_display->touchscreen = create_touchscreen (display);
|
||||
|
||||
_gdk_device_set_associated_device (broadway_display->core_pointer, broadway_display->core_keyboard);
|
||||
_gdk_device_set_associated_device (broadway_display->core_keyboard, broadway_display->core_pointer);
|
||||
_gdk_device_set_associated_device (broadway_display->pointer, broadway_display->core_pointer);
|
||||
_gdk_device_set_associated_device (broadway_display->keyboard, broadway_display->core_keyboard);
|
||||
_gdk_device_set_associated_device (broadway_display->touchscreen, broadway_display->core_pointer);
|
||||
_gdk_device_add_slave (broadway_display->core_pointer, broadway_display->touchscreen);
|
||||
|
||||
seat = gdk_seat_default_new_for_master_pair (broadway_display->core_pointer,
|
||||
broadway_display->core_keyboard);
|
||||
|
||||
gdk_display_add_seat (display, seat);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->pointer);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->keyboard);
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), broadway_display->touchscreen);
|
||||
g_object_unref (seat);
|
||||
|
||||
@@ -243,13 +276,18 @@ gdk_broadway_display_get_default_group (GdkDisplay *display)
|
||||
static void
|
||||
gdk_broadway_display_dispose (GObject *object)
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
|
||||
GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (object);
|
||||
|
||||
if (broadway_display->event_source)
|
||||
if (self->event_source)
|
||||
{
|
||||
g_source_destroy (broadway_display->event_source);
|
||||
g_source_unref (broadway_display->event_source);
|
||||
broadway_display->event_source = NULL;
|
||||
g_source_destroy (self->event_source);
|
||||
g_source_unref (self->event_source);
|
||||
self->event_source = NULL;
|
||||
}
|
||||
if (self->monitors)
|
||||
{
|
||||
g_list_store_remove_all (self->monitors);
|
||||
g_clear_object (&self->monitors);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object);
|
||||
@@ -277,18 +315,6 @@ gdk_broadway_display_notify_startup_complete (GdkDisplay *display,
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_broadway_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@@ -314,22 +340,18 @@ gdk_broadway_display_hide_keyboard (GdkBroadwayDisplay *display)
|
||||
_gdk_broadway_server_set_show_keyboard (display->server, FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_broadway_display_get_n_monitors (GdkDisplay *display)
|
||||
static GListModel *
|
||||
gdk_broadway_display_get_monitors (GdkDisplay *display)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
GdkBroadwayDisplay *self = GDK_BROADWAY_DISPLAY (display);
|
||||
|
||||
static GdkMonitor *
|
||||
gdk_broadway_display_get_monitor (GdkDisplay *display,
|
||||
int monitor_num)
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
if (self->monitors == NULL)
|
||||
{
|
||||
self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
|
||||
g_list_store_append (self->monitors, self->monitor);
|
||||
}
|
||||
|
||||
if (monitor_num == 0)
|
||||
return broadway_display->monitor;
|
||||
|
||||
return NULL;
|
||||
return G_LIST_MODEL (self->monitors);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -340,12 +362,6 @@ gdk_broadway_display_get_setting (GdkDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static guint32
|
||||
gdk_broadway_display_get_last_seen_time (GdkDisplay *display)
|
||||
{
|
||||
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
GdkDisplay *display;
|
||||
@@ -426,16 +442,12 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
display_class->has_pending = gdk_broadway_display_has_pending;
|
||||
display_class->queue_events = _gdk_broadway_display_queue_events;
|
||||
display_class->get_default_group = gdk_broadway_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_broadway_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes;
|
||||
|
||||
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
|
||||
display_class->create_surface = _gdk_broadway_display_create_surface;
|
||||
display_class->get_keymap = _gdk_broadway_display_get_keymap;
|
||||
|
||||
display_class->get_n_monitors = gdk_broadway_display_get_n_monitors;
|
||||
display_class->get_monitor = gdk_broadway_display_get_monitor;
|
||||
display_class->get_monitors = gdk_broadway_display_get_monitors;
|
||||
display_class->get_setting = gdk_broadway_display_get_setting;
|
||||
display_class->get_last_seen_time = gdk_broadway_display_get_last_seen_time;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ struct _GdkBroadwayDisplay
|
||||
|
||||
GdkDevice *core_pointer;
|
||||
GdkDevice *core_keyboard;
|
||||
GdkDevice *pointer;
|
||||
GdkDevice *keyboard;
|
||||
GdkDevice *touchscreen;
|
||||
|
||||
GSource *event_source;
|
||||
@@ -52,6 +54,7 @@ struct _GdkBroadwayDisplay
|
||||
GdkBroadwayServer *server;
|
||||
gpointer move_resize_data;
|
||||
|
||||
GListStore *monitors;
|
||||
GdkMonitor *monitor;
|
||||
int scale_factor;
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
GdkDrag *new_context;
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkeventsource.h"
|
||||
#include "gdkseat.h"
|
||||
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
@@ -87,13 +86,11 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
BroadwayInputMsg *message)
|
||||
{
|
||||
GdkBroadwayDisplay *display_broadway;
|
||||
GdkSeat *seat;
|
||||
GdkSurface *surface;
|
||||
GdkEvent *event = NULL;
|
||||
GList *node;
|
||||
|
||||
display_broadway = GDK_BROADWAY_DISPLAY (display);
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
|
||||
switch (message->base.type) {
|
||||
case BROADWAY_EVENT_ENTER:
|
||||
@@ -102,8 +99,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
event = gdk_crossing_event_new (GDK_ENTER_NOTIFY,
|
||||
surface,
|
||||
gdk_seat_get_pointer (seat),
|
||||
gdk_seat_get_pointer (seat),
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
message->pointer.win_x,
|
||||
@@ -121,8 +118,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
event = gdk_crossing_event_new (GDK_LEAVE_NOTIFY,
|
||||
surface,
|
||||
gdk_seat_get_pointer (seat),
|
||||
gdk_seat_get_pointer (seat),
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
message->pointer.win_x,
|
||||
@@ -142,8 +139,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
if (surface)
|
||||
{
|
||||
event = gdk_motion_event_new (surface,
|
||||
gdk_seat_get_pointer (seat),
|
||||
gdk_seat_get_pointer (seat),
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
NULL,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
@@ -169,8 +166,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
? GDK_BUTTON_PRESS
|
||||
: GDK_BUTTON_RELEASE,
|
||||
surface,
|
||||
gdk_seat_get_pointer (seat),
|
||||
gdk_seat_get_pointer (seat),
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
NULL,
|
||||
message->base.time,
|
||||
message->pointer.state,
|
||||
@@ -189,8 +186,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
if (surface)
|
||||
{
|
||||
event = gdk_scroll_event_new_discrete (surface,
|
||||
gdk_seat_get_pointer (seat),
|
||||
gdk_seat_get_pointer (seat),
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
NULL,
|
||||
message->base.time,
|
||||
0,
|
||||
@@ -198,7 +195,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
? GDK_SCROLL_UP
|
||||
: GDK_SCROLL_DOWN,
|
||||
FALSE);
|
||||
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
_gdk_windowing_got_event (display, node, event, message->base.serial);
|
||||
}
|
||||
@@ -210,7 +207,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
{
|
||||
GdkEventType event_type = 0;
|
||||
GdkModifierType state;
|
||||
GdkDevice *source_device;
|
||||
|
||||
switch (message->touch.touch_type) {
|
||||
case 0:
|
||||
@@ -230,15 +226,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
message->touch.is_emulated && _gdk_broadway_moveresize_handle_event (display, message))
|
||||
break;
|
||||
|
||||
source_device = gdk_seat_get_pointer (seat);
|
||||
{
|
||||
GList *devices;
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TOUCH);
|
||||
if (devices)
|
||||
source_device = GDK_DEVICE (devices->data);
|
||||
g_list_free (devices);
|
||||
}
|
||||
|
||||
state = message->touch.state;
|
||||
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
|
||||
state |= GDK_BUTTON1_MASK;
|
||||
@@ -246,8 +233,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
event = gdk_touch_event_new (event_type,
|
||||
GUINT_TO_POINTER (message->touch.sequence_id),
|
||||
surface,
|
||||
gdk_seat_get_pointer (seat),
|
||||
source_device,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->touchscreen,
|
||||
message->base.time,
|
||||
state,
|
||||
message->touch.win_x,
|
||||
@@ -275,8 +262,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
? GDK_KEY_PRESS
|
||||
: GDK_KEY_RELEASE,
|
||||
surface,
|
||||
gdk_seat_get_keyboard (seat),
|
||||
gdk_seat_get_keyboard (seat),
|
||||
display_broadway->core_keyboard,
|
||||
display_broadway->keyboard,
|
||||
message->base.time,
|
||||
message->key.key,
|
||||
message->key.state,
|
||||
@@ -291,7 +278,10 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
break;
|
||||
case BROADWAY_EVENT_GRAB_NOTIFY:
|
||||
case BROADWAY_EVENT_UNGRAB_NOTIFY:
|
||||
_gdk_display_device_grab_update (display, gdk_seat_get_pointer (seat), gdk_seat_get_pointer (seat), message->base.serial);
|
||||
_gdk_display_device_grab_update (display,
|
||||
display_broadway->core_pointer,
|
||||
display_broadway->pointer,
|
||||
message->base.serial);
|
||||
break;
|
||||
|
||||
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
|
||||
@@ -330,8 +320,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
if (surface)
|
||||
{
|
||||
event = gdk_focus_event_new (surface,
|
||||
gdk_seat_get_keyboard (seat),
|
||||
gdk_seat_get_keyboard (seat),
|
||||
display_broadway->core_keyboard,
|
||||
display_broadway->keyboard,
|
||||
FALSE);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
@@ -341,8 +331,8 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
if (surface)
|
||||
{
|
||||
event = gdk_focus_event_new (surface,
|
||||
gdk_seat_get_keyboard (seat),
|
||||
gdk_seat_get_keyboard (seat),
|
||||
display_broadway->core_keyboard,
|
||||
display_broadway->keyboard,
|
||||
TRUE);
|
||||
|
||||
node = _gdk_event_queue_append (display, event);
|
||||
|
||||
@@ -51,8 +51,8 @@ GdkDrag * _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
double dx,
|
||||
double dy);
|
||||
void _gdk_broadway_surface_translate (GdkSurface *surface,
|
||||
cairo_region_t *area,
|
||||
gint dx,
|
||||
|
||||
@@ -86,7 +86,7 @@ gdk_broadway_surface_finalize (GObject *object)
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (GDK_SURFACE (impl)));
|
||||
|
||||
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER(impl->id));
|
||||
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
|
||||
|
||||
if (impl->cursor)
|
||||
g_object_unref (impl->cursor);
|
||||
@@ -99,7 +99,8 @@ gdk_broadway_surface_finalize (GObject *object)
|
||||
static gboolean
|
||||
thaw_updates_cb (GdkSurface *surface)
|
||||
{
|
||||
gdk_surface_thaw_updates (surface);
|
||||
if (!GDK_SURFACE_DESTROYED (surface))
|
||||
gdk_surface_thaw_updates (surface);
|
||||
g_object_unref (surface);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -271,6 +272,8 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
surface->height);
|
||||
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
|
||||
|
||||
g_object_ref (surface);
|
||||
|
||||
if (!surface->parent)
|
||||
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
|
||||
|
||||
@@ -320,7 +323,6 @@ _gdk_broadway_surface_destroy (GdkSurface *surface,
|
||||
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
|
||||
|
||||
_gdk_broadway_server_destroy_surface (broadway_display->server, impl->id);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
@@ -585,7 +587,6 @@ static void
|
||||
show_popup (GdkSurface *surface)
|
||||
{
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
_gdk_surface_update_viewable (surface);
|
||||
gdk_broadway_surface_show (surface, FALSE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
@@ -777,7 +778,6 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
|
||||
{
|
||||
GdkBroadwaySurface *impl;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle geom;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
@@ -798,8 +798,7 @@ gdk_broadway_surface_maximize (GdkSurface *surface)
|
||||
impl->pre_maximize_height = surface->height;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor (display, 0);
|
||||
gdk_monitor_get_geometry (monitor, &geom);
|
||||
gdk_monitor_get_geometry (GDK_BROADWAY_DISPLAY (display)->monitor, &geom);
|
||||
|
||||
gdk_broadway_surface_move_resize (surface,
|
||||
geom.x, geom.y,
|
||||
@@ -1193,18 +1192,17 @@ calculate_unmoving_origin (MoveResizeData *mv_resize)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_broadway_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
MoveResizeData *mv_resize;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
@@ -1236,17 +1234,16 @@ gdk_broadway_surface_begin_resize_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_broadway_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
MoveResizeData *mv_resize;
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
@@ -1282,15 +1279,6 @@ gdk_broadway_surface_beep (GdkSurface *surface)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
guint32
|
||||
gdk_broadway_get_last_seen_time (GdkSurface *surface)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
return _gdk_broadway_server_get_last_seen_time (GDK_BROADWAY_DISPLAY (display)->server);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
{
|
||||
@@ -1307,8 +1295,6 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
impl_class->set_input_region = gdk_broadway_surface_set_input_region;
|
||||
impl_class->destroy = _gdk_broadway_surface_destroy;
|
||||
impl_class->beep = gdk_broadway_surface_beep;
|
||||
impl_class->begin_resize_drag = gdk_broadway_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_broadway_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_broadway_surface_get_scale_factor;
|
||||
@@ -1578,15 +1564,10 @@ show_surface (GdkSurface *surface)
|
||||
if (!was_mapped)
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
|
||||
_gdk_surface_update_viewable (surface);
|
||||
|
||||
gdk_broadway_surface_show (surface, FALSE);
|
||||
|
||||
if (!was_mapped)
|
||||
{
|
||||
if (gdk_surface_is_viewable (surface))
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1663,6 +1644,8 @@ gdk_broadway_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->lower = gdk_broadway_toplevel_lower;
|
||||
iface->focus = gdk_broadway_toplevel_focus;
|
||||
iface->show_window_menu = gdk_broadway_toplevel_show_window_menu;
|
||||
iface->begin_resize = gdk_broadway_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_broadway_toplevel_begin_move;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ void gdk_pre_parse (void);
|
||||
void gdk_surface_freeze_toplevel_updates (GdkSurface *surface);
|
||||
void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
|
||||
|
||||
guint32 gdk_display_get_last_seen_time (GdkDisplay *display);
|
||||
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
|
||||
|
||||
void gdk_display_set_double_click_time (GdkDisplay *display,
|
||||
guint msec);
|
||||
|
||||
+59
-117
@@ -71,6 +71,7 @@ enum
|
||||
PROP_0,
|
||||
PROP_COMPOSITED,
|
||||
PROP_RGBA,
|
||||
PROP_INPUT_SHAPES,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
@@ -81,8 +82,6 @@ enum {
|
||||
CLOSED,
|
||||
SEAT_ADDED,
|
||||
SEAT_REMOVED,
|
||||
MONITOR_ADDED,
|
||||
MONITOR_REMOVED,
|
||||
SETTING_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@@ -115,6 +114,10 @@ gdk_display_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gdk_display_is_rgba (display));
|
||||
break;
|
||||
|
||||
case PROP_INPUT_SHAPES:
|
||||
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -195,6 +198,19 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDisplay:input-shapes:
|
||||
*
|
||||
* %TRUE if the display supports input shapes. See
|
||||
* gdk_display_supports_input_shapes() for details.
|
||||
*/
|
||||
props[PROP_INPUT_SHAPES] =
|
||||
g_param_spec_boolean ("input-shapes",
|
||||
P_("Input shapes"),
|
||||
P_("Input shapes"),
|
||||
TRUE,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
|
||||
/**
|
||||
@@ -264,38 +280,6 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
NULL,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_SEAT);
|
||||
|
||||
/**
|
||||
* GdkDisplay::monitor-added:
|
||||
* @display: the objedct on which the signal is emitted
|
||||
* @monitor: the monitor that was just added
|
||||
*
|
||||
* The ::monitor-added signal is emitted whenever a monitor is
|
||||
* added.
|
||||
*/
|
||||
signals[MONITOR_ADDED] =
|
||||
g_signal_new (g_intern_static_string ("monitor-added"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
|
||||
|
||||
/**
|
||||
* GdkDisplay::monitor-removed:
|
||||
* @display: the object on which the signal is emitted
|
||||
* @monitor: the monitor that was just removed
|
||||
*
|
||||
* The ::monitor-removed signal is emitted whenever a monitor is
|
||||
* removed.
|
||||
*/
|
||||
signals[MONITOR_REMOVED] =
|
||||
g_signal_new (g_intern_static_string ("monitor-removed"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0, NULL, NULL,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1, GDK_TYPE_MONITOR);
|
||||
|
||||
/**
|
||||
* GdkDisplay::setting-changed:
|
||||
* @display: the object on which the signal is emitted
|
||||
@@ -356,6 +340,7 @@ gdk_display_init (GdkDisplay *display)
|
||||
|
||||
display->composited = TRUE;
|
||||
display->rgba = TRUE;
|
||||
display->input_shapes = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -494,7 +479,7 @@ gdk_display_put_event (GdkDisplay *display,
|
||||
|
||||
static void
|
||||
generate_grab_broken_event (GdkDisplay *display,
|
||||
GdkSurface *surface,
|
||||
GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gboolean implicit,
|
||||
GdkSurface *grab_surface)
|
||||
@@ -507,7 +492,7 @@ generate_grab_broken_event (GdkDisplay *display,
|
||||
|
||||
event = gdk_grab_broken_event_new (surface,
|
||||
device,
|
||||
device,
|
||||
NULL,
|
||||
grab_surface,
|
||||
implicit);
|
||||
|
||||
@@ -1128,23 +1113,6 @@ gdk_display_get_primary_clipboard (GdkDisplay *display)
|
||||
return display->primary_clipboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_shapes:
|
||||
* @display: a #GdkDisplay
|
||||
*
|
||||
* Returns %TRUE if gdk_surface_shape_combine_mask() can
|
||||
* be used to create shaped windows on @display.
|
||||
*
|
||||
* Returns: %TRUE if shaped windows are supported
|
||||
*/
|
||||
gboolean
|
||||
gdk_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->supports_shapes (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_supports_input_shapes:
|
||||
* @display: a #GdkDisplay
|
||||
@@ -1159,7 +1127,21 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->supports_input_shapes (display);
|
||||
return display->input_shapes;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
gboolean input_shapes)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
if (display->input_shapes == input_shapes)
|
||||
return;
|
||||
|
||||
display->input_shapes = input_shapes;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_INPUT_SHAPES]);
|
||||
}
|
||||
|
||||
static GdkAppLaunchContext *
|
||||
@@ -1497,7 +1479,10 @@ gdk_display_remove_seat (GdkDisplay *display,
|
||||
*
|
||||
* Returns the default #GdkSeat for this display.
|
||||
*
|
||||
* Returns: (transfer none): the default seat.
|
||||
* Note that a display may not have a seat. In this case,
|
||||
* this function will return %NULL.
|
||||
*
|
||||
* Returns: (transfer none) (nullable): the default seat.
|
||||
**/
|
||||
GdkSeat *
|
||||
gdk_display_get_default_seat (GdkDisplay *display)
|
||||
@@ -1529,44 +1514,25 @@ gdk_display_list_seats (GdkDisplay *display)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_get_n_monitors:
|
||||
* @display: a #GdkDisplay
|
||||
* gdk_display_get_monitors:
|
||||
* @self: a #GdkDisplay
|
||||
*
|
||||
* Gets the number of monitors that belong to @display.
|
||||
* Gets the list of monitors associated with this display.
|
||||
*
|
||||
* The returned number is valid until the next emission of the
|
||||
* #GdkDisplay::monitor-added or #GdkDisplay::monitor-removed signal.
|
||||
* Subsequent calls to this function will always return the same list for the
|
||||
* same display.
|
||||
*
|
||||
* Returns: the number of monitors
|
||||
* You can listen to the GListModel::items-changed signal on this list
|
||||
* to monitor changes to the monitor of this display.
|
||||
*
|
||||
* Returns: (transfer none): a #GListModel of #GdkMonitor
|
||||
*/
|
||||
int
|
||||
gdk_display_get_n_monitors (GdkDisplay *display)
|
||||
GListModel *
|
||||
gdk_display_get_monitors (GdkDisplay *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
|
||||
|
||||
if (GDK_DISPLAY_GET_CLASS (display)->get_n_monitors == NULL)
|
||||
return 1;
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->get_n_monitors (display);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_get_monitor:
|
||||
* @display: a #GdkDisplay
|
||||
* @monitor_num: number of the monitor
|
||||
*
|
||||
* Gets a monitor associated with this display.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the #GdkMonitor, or %NULL if
|
||||
* @monitor_num is not a valid monitor number
|
||||
*/
|
||||
GdkMonitor *
|
||||
gdk_display_get_monitor (GdkDisplay *display,
|
||||
gint monitor_num)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
return GDK_DISPLAY_GET_CLASS (display)->get_monitor (display, monitor_num);
|
||||
return GDK_DISPLAY_GET_CLASS (self)->get_monitors (self);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1585,7 +1551,8 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GdkRectangle win;
|
||||
int n_monitors, i;
|
||||
GListModel *monitors;
|
||||
guint i;
|
||||
int area = 0;
|
||||
GdkMonitor *best = NULL;
|
||||
GdkDisplayClass *class;
|
||||
@@ -1605,14 +1572,14 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
gdk_surface_get_geometry (surface, &win.x, &win.y, &win.width, &win.height);
|
||||
gdk_surface_get_origin (surface, &win.x, &win.y);
|
||||
|
||||
n_monitors = gdk_display_get_n_monitors (display);
|
||||
for (i = 0; i < n_monitors; i++)
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle mon, intersect;
|
||||
int overlap;
|
||||
|
||||
monitor = gdk_display_get_monitor (display, i);
|
||||
monitor = g_list_model_get_item (monitors, i);
|
||||
gdk_monitor_get_geometry (monitor, &mon);
|
||||
gdk_rectangle_intersect (&win, &mon, &intersect);
|
||||
overlap = intersect.width *intersect.height;
|
||||
@@ -1621,26 +1588,12 @@ gdk_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
area = overlap;
|
||||
best = monitor;
|
||||
}
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_monitor_added (GdkDisplay *display,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
g_signal_emit (display, signals[MONITOR_ADDED], 0, monitor);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_monitor_removed (GdkDisplay *display,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
g_signal_emit (display, signals[MONITOR_REMOVED], 0, monitor);
|
||||
gdk_monitor_invalidate (monitor);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_emit_opened (GdkDisplay *display)
|
||||
{
|
||||
@@ -1678,17 +1631,6 @@ gdk_display_setting_changed (GdkDisplay *display,
|
||||
g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
|
||||
}
|
||||
|
||||
guint32
|
||||
gdk_display_get_last_seen_time (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), GDK_CURRENT_TIME);
|
||||
|
||||
if (GDK_DISPLAY_GET_CLASS (display)->get_last_seen_time)
|
||||
return GDK_DISPLAY_GET_CLASS (display)->get_last_seen_time (display);
|
||||
|
||||
return GDK_CURRENT_TIME;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_set_double_click_time (GdkDisplay *display,
|
||||
guint msec)
|
||||
|
||||
+3
-8
@@ -65,6 +65,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_composited (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_is_rgba (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkEvent* gdk_display_get_event (GdkDisplay *display);
|
||||
@@ -87,10 +89,6 @@ GdkClipboard * gdk_display_get_clipboard (GdkDisplay
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkClipboard * gdk_display_get_primary_clipboard (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_display_notify_startup_complete (GdkDisplay *display,
|
||||
const gchar *startup_id);
|
||||
@@ -107,10 +105,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GList * gdk_display_list_seats (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
int gdk_display_get_n_monitors (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkMonitor * gdk_display_get_monitor (GdkDisplay *display,
|
||||
int monitor_num);
|
||||
GListModel * gdk_display_get_monitors (GdkDisplay *self) G_GNUC_PURE;
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
GdkSurface *surface);
|
||||
|
||||
+6
-13
@@ -102,6 +102,7 @@ struct _GdkDisplay
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint input_shapes : 1;
|
||||
|
||||
GdkDebugFlags debug_flags;
|
||||
|
||||
@@ -123,9 +124,7 @@ struct _GdkDisplayClass
|
||||
gboolean (*has_pending) (GdkDisplay *display);
|
||||
void (*queue_events) (GdkDisplay *display);
|
||||
void (*make_default) (GdkDisplay *display);
|
||||
GdkSurface * (*get_default_group) (GdkDisplay *display);
|
||||
gboolean (*supports_shapes) (GdkDisplay *display);
|
||||
gboolean (*supports_input_shapes) (GdkDisplay *display);
|
||||
GdkSurface * (*get_default_group) (GdkDisplay *display);
|
||||
|
||||
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
|
||||
|
||||
@@ -155,16 +154,12 @@ struct _GdkDisplayClass
|
||||
|
||||
GdkSeat * (*get_default_seat) (GdkDisplay *display);
|
||||
|
||||
int (*get_n_monitors) (GdkDisplay *display);
|
||||
GdkMonitor * (*get_monitor) (GdkDisplay *display,
|
||||
int index);
|
||||
GdkMonitor * (*get_primary_monitor) (GdkDisplay *display);
|
||||
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
|
||||
GListModel * (*get_monitors) (GdkDisplay *self);
|
||||
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
|
||||
GdkSurface *surface);
|
||||
gboolean (*get_setting) (GdkDisplay *display,
|
||||
const char *name,
|
||||
GValue *value);
|
||||
guint32 (*get_last_seen_time) (GdkDisplay *display);
|
||||
void (*set_cursor_theme) (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size);
|
||||
@@ -237,15 +232,13 @@ void gdk_display_set_rgba (GdkDisplay *display
|
||||
gboolean rgba);
|
||||
void gdk_display_set_composited (GdkDisplay *display,
|
||||
gboolean composited);
|
||||
void gdk_display_set_input_shapes (GdkDisplay *display,
|
||||
gboolean input_shapes);
|
||||
|
||||
void gdk_display_add_seat (GdkDisplay *display,
|
||||
GdkSeat *seat);
|
||||
void gdk_display_remove_seat (GdkDisplay *display,
|
||||
GdkSeat *seat);
|
||||
void gdk_display_monitor_added (GdkDisplay *display,
|
||||
GdkMonitor *monitor);
|
||||
void gdk_display_monitor_removed (GdkDisplay *display,
|
||||
GdkMonitor *monitor);
|
||||
void gdk_display_emit_opened (GdkDisplay *display);
|
||||
|
||||
void gdk_display_setting_changed (GdkDisplay *display,
|
||||
|
||||
+2
-2
@@ -76,8 +76,8 @@ GdkDrag * gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
double dx,
|
||||
double dy);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_drag_drop_done (GdkDrag *drag,
|
||||
|
||||
@@ -416,6 +416,11 @@ gdk_event_alloc (GdkEventType event_type,
|
||||
g_assert (event_type >= GDK_DELETE && event_type < GDK_EVENT_LAST);
|
||||
g_assert (gdk_event_types[event_type] != G_TYPE_INVALID);
|
||||
|
||||
g_assert (device == NULL ||
|
||||
gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
|
||||
g_assert (source_device == NULL ||
|
||||
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE);
|
||||
|
||||
GdkEvent *event = (GdkEvent *) g_type_create_instance (gdk_event_types[event_type]);
|
||||
|
||||
GDK_NOTE (EVENTS, {
|
||||
|
||||
+15
-1
@@ -175,7 +175,6 @@ void gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
const cairo_region_t *region);
|
||||
void _gdk_surface_clear_update_area (GdkSurface *surface);
|
||||
void _gdk_surface_update_size (GdkSurface *surface);
|
||||
gboolean _gdk_surface_update_viewable (GdkSurface *surface);
|
||||
GdkGLContext * gdk_surface_get_paint_gl_context (GdkSurface *surface,
|
||||
GError **error);
|
||||
void gdk_surface_get_unscaled_size (GdkSurface *surface,
|
||||
@@ -366,6 +365,21 @@ GdkSurface * gdk_surface_new_temp (GdkDisplay *display,
|
||||
|
||||
GdkKeymap * gdk_display_get_keymap (GdkDisplay *display);
|
||||
|
||||
void gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
void gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_INTERNALS_H__ */
|
||||
|
||||
+9
-43
@@ -31,10 +31,9 @@
|
||||
* @Short_description: Object representing an output
|
||||
*
|
||||
* GdkMonitor objects represent the individual outputs that are
|
||||
* associated with a #GdkDisplay. GdkDisplay has APIs to enumerate
|
||||
* monitors with gdk_display_get_n_monitors() and gdk_display_get_monitor(), and
|
||||
* to find particular monitors with gdk_display_get_primary_monitor() or
|
||||
* gdk_display_get_monitor_at_surface().
|
||||
* associated with a #GdkDisplay. GdkDisplay keeps a #GListModel to enumerate
|
||||
* and monitor monitors with gdk_display_get_monitors().
|
||||
* You can use gdk_display_get_monitor_at_surface() to find a particular monitor.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -531,47 +530,14 @@ gdk_monitor_set_connector (GdkMonitor *monitor,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_monitor_set_position (GdkMonitor *monitor,
|
||||
int x,
|
||||
int y)
|
||||
gdk_monitor_set_geometry (GdkMonitor *monitor,
|
||||
const GdkRectangle *geometry)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (monitor));
|
||||
if (gdk_rectangle_equal (&monitor->geometry, geometry))
|
||||
return;
|
||||
|
||||
if (monitor->geometry.x != x)
|
||||
{
|
||||
monitor->geometry.x = x;
|
||||
g_object_notify (G_OBJECT (monitor), "geometry");
|
||||
}
|
||||
|
||||
if (monitor->geometry.y != y)
|
||||
{
|
||||
monitor->geometry.y = y;
|
||||
g_object_notify (G_OBJECT (monitor), "geometry");
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (monitor));
|
||||
}
|
||||
|
||||
void
|
||||
gdk_monitor_set_size (GdkMonitor *monitor,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (monitor));
|
||||
|
||||
if (monitor->geometry.width != width)
|
||||
{
|
||||
monitor->geometry.width = width;
|
||||
g_object_notify (G_OBJECT (monitor), "geometry");
|
||||
}
|
||||
|
||||
if (monitor->geometry.height != height)
|
||||
{
|
||||
monitor->geometry.height = height;
|
||||
g_object_notify (G_OBJECT (monitor), "geometry");
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (monitor));
|
||||
monitor->geometry = *geometry;
|
||||
g_object_notify (G_OBJECT (monitor), "geometry");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -61,12 +61,8 @@ void gdk_monitor_set_model (GdkMonitor *monitor,
|
||||
const char *model);
|
||||
void gdk_monitor_set_connector (GdkMonitor *monitor,
|
||||
const char *connector);
|
||||
void gdk_monitor_set_position (GdkMonitor *monitor,
|
||||
int x,
|
||||
int y);
|
||||
void gdk_monitor_set_size (GdkMonitor *monitor,
|
||||
int width,
|
||||
int height);
|
||||
void gdk_monitor_set_geometry (GdkMonitor *monitor,
|
||||
const GdkRectangle *geometry);
|
||||
void gdk_monitor_set_physical_size (GdkMonitor *monitor,
|
||||
int width_mm,
|
||||
int height_mm);
|
||||
|
||||
+85
-134
@@ -148,11 +148,13 @@ get_monitor_for_rect (GdkDisplay *display,
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle workarea;
|
||||
GdkRectangle intersection;
|
||||
gint i;
|
||||
GListModel *monitors;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < gdk_display_get_n_monitors (display); i++)
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
|
||||
{
|
||||
monitor = gdk_display_get_monitor (display, i);
|
||||
monitor = g_list_model_get_item (monitors, i);
|
||||
gdk_monitor_get_workarea (monitor, &workarea);
|
||||
|
||||
if (gdk_rectangle_intersect (&workarea, rect, &intersection))
|
||||
@@ -163,6 +165,7 @@ get_monitor_for_rect (GdkDisplay *display,
|
||||
best_monitor = monitor;
|
||||
}
|
||||
}
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
return best_monitor;
|
||||
@@ -377,6 +380,64 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
|
||||
*out_final_rect = final_rect;
|
||||
}
|
||||
|
||||
/* Since GdkEvent is a GTypeInstance, GValue can only store it as a pointer,
|
||||
* and GClosure does not know how to handle its memory management. To avoid
|
||||
* the event going away in the middle of the signal emission, we provide a
|
||||
* marshaller that keeps the event alive for the duration of the closure.
|
||||
*/
|
||||
static void
|
||||
gdk_surface_event_marshaller (GClosure *closure,
|
||||
GValue *return_value,
|
||||
guint n_param_values,
|
||||
const GValue *param_values,
|
||||
gpointer invocation_hint,
|
||||
gpointer marshal_data)
|
||||
{
|
||||
GdkEvent *event = g_value_get_pointer (¶m_values[1]);
|
||||
|
||||
gdk_event_ref (event);
|
||||
|
||||
_gdk_marshal_BOOLEAN__POINTER (closure,
|
||||
return_value,
|
||||
n_param_values,
|
||||
param_values,
|
||||
invocation_hint,
|
||||
marshal_data);
|
||||
|
||||
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_event_marshallerv (GClosure *closure,
|
||||
GValue *return_value,
|
||||
gpointer instance,
|
||||
va_list args,
|
||||
gpointer marshal_data,
|
||||
int n_params,
|
||||
GType *param_types)
|
||||
{
|
||||
va_list args_copy;
|
||||
GdkEvent *event;
|
||||
|
||||
G_VA_COPY (args_copy, args);
|
||||
event = va_arg (args_copy, gpointer);
|
||||
|
||||
gdk_event_ref (event);
|
||||
|
||||
_gdk_marshal_BOOLEAN__POINTERv (closure,
|
||||
return_value,
|
||||
instance,
|
||||
args,
|
||||
marshal_data,
|
||||
n_params,
|
||||
param_types);
|
||||
|
||||
gdk_event_unref (event);
|
||||
|
||||
va_end (args_copy);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_surface_init (GdkSurface *surface)
|
||||
{
|
||||
@@ -530,13 +591,13 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
|
||||
0,
|
||||
g_signal_accumulator_true_handled,
|
||||
NULL,
|
||||
_gdk_marshal_BOOLEAN__POINTER,
|
||||
gdk_surface_event_marshaller,
|
||||
G_TYPE_BOOLEAN,
|
||||
1,
|
||||
GDK_TYPE_EVENT);
|
||||
G_TYPE_POINTER);
|
||||
g_signal_set_va_marshaller (signals[EVENT],
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
_gdk_marshal_BOOLEAN__POINTERv);
|
||||
gdk_surface_event_marshallerv);
|
||||
|
||||
/**
|
||||
* GdkSurface::enter-montor:
|
||||
@@ -960,28 +1021,6 @@ gdk_surface_get_mapped (GdkSurface *surface)
|
||||
return GDK_SURFACE_IS_MAPPED (surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_is_viewable:
|
||||
* @surface: a #GdkSurface
|
||||
*
|
||||
* Check if the surface and all ancestors of the surface are
|
||||
* mapped. (This is not necessarily "viewable" in the X sense, since
|
||||
* we only check as far as we have GDK surface parents, not to the root
|
||||
* surface.)
|
||||
*
|
||||
* Returns: %TRUE if the surface is viewable
|
||||
**/
|
||||
gboolean
|
||||
gdk_surface_is_viewable (GdkSurface *surface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), FALSE);
|
||||
|
||||
if (surface->destroyed)
|
||||
return FALSE;
|
||||
|
||||
return surface->viewable;
|
||||
}
|
||||
|
||||
GdkGLContext *
|
||||
gdk_surface_get_shared_data_gl_context (GdkSurface *surface)
|
||||
{
|
||||
@@ -1253,7 +1292,7 @@ gdk_surface_process_updates_internal (GdkSurface *surface)
|
||||
surface->active_update_area = surface->update_area;
|
||||
surface->update_area = NULL;
|
||||
|
||||
if (gdk_surface_is_viewable (surface))
|
||||
if (GDK_SURFACE_IS_MAPPED (surface))
|
||||
{
|
||||
cairo_region_t *expose_region;
|
||||
gboolean handled;
|
||||
@@ -1321,10 +1360,7 @@ gdk_surface_invalidate_rect (GdkSurface *surface,
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return;
|
||||
|
||||
if (!surface->viewable)
|
||||
if (!GDK_SURFACE_IS_MAPPED (surface))
|
||||
return;
|
||||
|
||||
if (!rect)
|
||||
@@ -1400,10 +1436,10 @@ gdk_surface_invalidate_region (GdkSurface *surface,
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (surface));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
if (!GDK_SURFACE_IS_MAPPED (surface))
|
||||
return;
|
||||
|
||||
if (!surface->viewable || cairo_region_is_empty (region))
|
||||
if (cairo_region_is_empty (region))
|
||||
return;
|
||||
|
||||
r.x = 0;
|
||||
@@ -1694,25 +1730,6 @@ gdk_surface_get_device_position (GdkSurface *surface,
|
||||
*mask = tmp_mask;
|
||||
}
|
||||
|
||||
/* Returns TRUE If the native surface was mapped or unmapped */
|
||||
static gboolean
|
||||
set_viewable (GdkSurface *w,
|
||||
gboolean val)
|
||||
{
|
||||
if (w->viewable == val)
|
||||
return FALSE;
|
||||
|
||||
w->viewable = val;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_surface_update_viewable (GdkSurface *surface)
|
||||
{
|
||||
return set_viewable (surface, GDK_SURFACE_IS_MAPPED (surface));
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_hide:
|
||||
* @surface: a #GdkSurface
|
||||
@@ -1746,10 +1763,14 @@ gdk_surface_hide (GdkSurface *surface)
|
||||
/* May need to break grabs on children */
|
||||
display = surface->display;
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
||||
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
||||
if (seat)
|
||||
{
|
||||
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_ALL);
|
||||
devices = g_list_prepend (devices, gdk_seat_get_keyboard (seat));
|
||||
devices = g_list_prepend (devices, gdk_seat_get_pointer (seat));
|
||||
}
|
||||
else
|
||||
devices = NULL;
|
||||
|
||||
for (d = devices; d; d = d->next)
|
||||
{
|
||||
@@ -2079,17 +2100,14 @@ gdk_surface_get_root_coords (GdkSurface *surface,
|
||||
* corresponds to an unset bit in the mask will be passed on the
|
||||
* surface below @surface.
|
||||
*
|
||||
* An input shape is typically used with RGBA surfaces.
|
||||
* An input region is typically used with RGBA surfaces.
|
||||
* The alpha channel of the surface defines which pixels are
|
||||
* invisible and allows for nicely antialiased borders,
|
||||
* and the input shape controls where the surface is
|
||||
* and the input region controls where the surface is
|
||||
* “clickable”.
|
||||
*
|
||||
* On the X11 platform, this requires version 1.1 of the
|
||||
* shape extension.
|
||||
*
|
||||
* On the Win32 platform, this functionality is not present and the
|
||||
* function does nothing.
|
||||
* Use gdk_display_support_input_shapes() to find out if
|
||||
* a particular backend supports input regions.
|
||||
*/
|
||||
void
|
||||
gdk_surface_set_input_region (GdkSurface *surface,
|
||||
@@ -2396,71 +2414,6 @@ gdk_surface_create_similar_surface (GdkSurface * surface,
|
||||
return similar_surface;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_begin_resize_drag:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @edge: the edge or corner from which the drag is started
|
||||
* @device: the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
|
||||
*
|
||||
* Begins a surface resize operation (for a toplevel surface).
|
||||
* You might use this function to implement a “window resize grip,”
|
||||
*/
|
||||
void
|
||||
gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (surface->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_SURFACE_GET_CLASS (surface)->begin_resize_drag (surface, edge, device, button, x, y, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_surface_begin_move_drag:
|
||||
* @surface: a toplevel #GdkSurface
|
||||
* @device: the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag
|
||||
*
|
||||
* Begins a surface move operation (for a toplevel surface).
|
||||
*/
|
||||
void
|
||||
gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (surface->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_SURFACE_GET_CLASS (surface)->begin_move_drag (surface, device, button, x, y, timestamp);
|
||||
}
|
||||
|
||||
/* This function is called when the XWindow is really gone.
|
||||
*/
|
||||
void
|
||||
@@ -2500,8 +2453,8 @@ gdk_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
||||
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
|
||||
@@ -2783,8 +2736,6 @@ gdk_surface_set_state (GdkSurface *surface,
|
||||
mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||
sticky = GDK_SURFACE_IS_STICKY (surface);
|
||||
|
||||
_gdk_surface_update_viewable (surface);
|
||||
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
g_object_notify (G_OBJECT (surface), "state");
|
||||
|
||||
|
||||
@@ -160,9 +160,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_set_input_region (GdkSurface *surface,
|
||||
cairo_region_t *region);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_surface_is_viewable (GdkSurface *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_surface_get_mapped (GdkSurface *surface);
|
||||
|
||||
@@ -208,23 +205,6 @@ cairo_surface_t *
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_beep (GdkSurface *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_surface_queue_expose (GdkSurface *surface);
|
||||
|
||||
|
||||
+6
-20
@@ -71,7 +71,6 @@ struct _GdkSurface
|
||||
guint destroyed : 2;
|
||||
|
||||
guint support_multidevice : 1;
|
||||
guint viewable : 1; /* mapped and all parents mapped */
|
||||
guint in_update : 1;
|
||||
guint frame_clock_events_paused : 1;
|
||||
guint autohide : 1;
|
||||
@@ -149,26 +148,13 @@ struct _GdkSurfaceClass
|
||||
/* optional */
|
||||
gboolean (* beep) (GdkSurface *surface);
|
||||
|
||||
void (* begin_resize_drag) (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move_drag) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint root_x,
|
||||
gint root_y,
|
||||
guint32 timestamp);
|
||||
void (* destroy_notify) (GdkSurface *surface);
|
||||
GdkDrag * (* drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider*content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
GdkDrag * (* drag_begin) (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
double dx,
|
||||
double dy);
|
||||
|
||||
gint (* get_scale_factor) (GdkSurface *surface);
|
||||
void (* get_unscaled_size) (GdkSurface *surface,
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "gdk-private.h"
|
||||
#include "gdktoplevelprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* SECTION:gdktoplevel
|
||||
* @Short_description: Interface for toplevel surfaces
|
||||
@@ -512,3 +514,82 @@ gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->restore_system_shortcuts (toplevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_begin_resize:
|
||||
* @toplevel: a #GdkToplevel
|
||||
* @edge: the edge or corner from which the drag is started
|
||||
* @device: (nullable): the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
|
||||
*
|
||||
* Begins an interactive resize operation (for a toplevel surface).
|
||||
* You might use this function to implement a “window resize grip.”
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
|
||||
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (GDK_SURFACE (toplevel)->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->begin_resize (toplevel,
|
||||
edge,
|
||||
device,
|
||||
button,
|
||||
x, y,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_toplevel_begin_move:
|
||||
* @toplevel: a #GdkToplevel
|
||||
* @device: the device used for the operation
|
||||
* @button: the button being used to drag, or 0 for a keyboard-initiated drag
|
||||
* @x: surface X coordinate of mouse click that began the drag
|
||||
* @y: surface Y coordinate of mouse click that began the drag
|
||||
* @timestamp: timestamp of mouse click that began the drag
|
||||
*
|
||||
* Begins an interactive move operation (for a toplevel surface).
|
||||
* You might use this function to implement draggable titlebars.
|
||||
*/
|
||||
void
|
||||
gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
|
||||
|
||||
if (device == NULL)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (GDK_SURFACE (toplevel)->display);
|
||||
if (button == 0)
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
device = gdk_seat_get_pointer (seat);
|
||||
}
|
||||
|
||||
GDK_TOPLEVEL_GET_IFACE (toplevel)->begin_move (toplevel,
|
||||
device,
|
||||
button,
|
||||
x, y,
|
||||
timestamp);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,23 @@ void gdk_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_restore_system_shortcuts (GdkToplevel *toplevel);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -24,6 +24,19 @@ struct _GdkToplevelInterface
|
||||
void (* inhibit_system_shortcuts) (GdkToplevel *toplevel,
|
||||
GdkEvent *event);
|
||||
void (* restore_system_shortcuts) (GdkToplevel *toplevel);
|
||||
void (* begin_resize) (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
void (* begin_move) (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp);
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
||||
@@ -592,7 +592,7 @@ emulate_crossing (GdkSurface *surface,
|
||||
event = gdk_crossing_event_new (type,
|
||||
surface,
|
||||
device,
|
||||
device,
|
||||
NULL,
|
||||
time_,
|
||||
state,
|
||||
x, y,
|
||||
@@ -633,7 +633,7 @@ emulate_focus (GdkSurface *surface,
|
||||
gboolean focus_in,
|
||||
guint32 time_)
|
||||
{
|
||||
GdkEvent *event = gdk_focus_event_new (surface, device, device, focus_in);
|
||||
GdkEvent *event = gdk_focus_event_new (surface, device, NULL, focus_in);
|
||||
|
||||
_gdk_wayland_display_deliver_event (gdk_surface_get_display (surface), event);
|
||||
}
|
||||
@@ -2788,6 +2788,14 @@ _gdk_wayland_seat_remove_tablet (GdkWaylandSeat *seat,
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), tablet->eraser_device);
|
||||
gdk_seat_device_removed (GDK_SEAT (seat), tablet->master);
|
||||
|
||||
while (tablet->pads)
|
||||
{
|
||||
GdkWaylandTabletPadData *pad = tablet->pads->data;
|
||||
|
||||
pad->current_tablet = NULL;
|
||||
tablet->pads = g_list_remove (tablet->pads, pad);
|
||||
}
|
||||
|
||||
zwp_tablet_v2_destroy (tablet->wp_tablet);
|
||||
|
||||
_gdk_device_set_associated_device (tablet->master, NULL);
|
||||
|
||||
@@ -741,7 +741,8 @@ gdk_wayland_display_finalize (GObject *object)
|
||||
display_wayland->cursor_theme = NULL;
|
||||
}
|
||||
|
||||
g_ptr_array_free (display_wayland->monitors, TRUE);
|
||||
g_list_store_remove_all (display_wayland->monitors);
|
||||
g_object_unref (display_wayland->monitors);
|
||||
|
||||
if (display_wayland->settings)
|
||||
g_hash_table_destroy (display_wayland->settings);
|
||||
@@ -847,18 +848,6 @@ gdk_wayland_display_get_default_group (GdkDisplay *display)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_wayland_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@@ -931,10 +920,13 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
|
||||
static GdkKeymap *
|
||||
_gdk_wayland_display_get_keymap (GdkDisplay *display)
|
||||
{
|
||||
GdkSeat *seat;
|
||||
GdkDevice *core_keyboard = NULL;
|
||||
static GdkKeymap *tmp_keymap = NULL;
|
||||
|
||||
core_keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (display));
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
if (seat)
|
||||
core_keyboard = gdk_seat_get_keyboard (seat);
|
||||
|
||||
if (core_keyboard && tmp_keymap)
|
||||
{
|
||||
@@ -951,24 +943,12 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
|
||||
return tmp_keymap;
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_wayland_display_get_n_monitors (GdkDisplay *display)
|
||||
static GListModel *
|
||||
gdk_wayland_display_get_monitors (GdkDisplay *display)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
GdkWaylandDisplay *self = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
return display_wayland->monitors->len;
|
||||
}
|
||||
|
||||
static GdkMonitor *
|
||||
gdk_wayland_display_get_monitor (GdkDisplay *display,
|
||||
int monitor_num)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
if (monitor_num < 0 || monitor_num >= display_wayland->monitors->len)
|
||||
return NULL;
|
||||
|
||||
return (GdkMonitor *)display_wayland->monitors->pdata[monitor_num];
|
||||
return G_LIST_MODEL (self->monitors);
|
||||
}
|
||||
|
||||
static GdkMonitor *
|
||||
@@ -977,7 +957,7 @@ gdk_wayland_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
struct wl_output *output;
|
||||
int i;
|
||||
guint i, n;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WAYLAND_SURFACE (window), NULL);
|
||||
|
||||
@@ -985,9 +965,12 @@ gdk_wayland_display_get_monitor_at_surface (GdkDisplay *display,
|
||||
if (output == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < display_wayland->monitors->len; i++)
|
||||
n = g_list_model_get_n_items (G_LIST_MODEL (display_wayland->monitors));
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
GdkMonitor *monitor = display_wayland->monitors->pdata[i];
|
||||
GdkMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (display_wayland->monitors), i);
|
||||
|
||||
g_object_unref (monitor);
|
||||
|
||||
if (gdk_wayland_monitor_get_wl_output (monitor) == output)
|
||||
return monitor;
|
||||
@@ -1024,8 +1007,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
display_class->has_pending = gdk_wayland_display_has_pending;
|
||||
display_class->queue_events = _gdk_wayland_display_queue_events;
|
||||
display_class->get_default_group = gdk_wayland_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_wayland_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_wayland_display_supports_input_shapes;
|
||||
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
|
||||
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
|
||||
display_class->get_startup_notification_id = gdk_wayland_display_get_startup_notification_id;
|
||||
@@ -1035,8 +1016,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
|
||||
display_class->make_gl_context_current = gdk_wayland_display_make_gl_context_current;
|
||||
|
||||
display_class->get_n_monitors = gdk_wayland_display_get_n_monitors;
|
||||
display_class->get_monitor = gdk_wayland_display_get_monitor;
|
||||
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
||||
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
||||
display_class->get_setting = gdk_wayland_display_get_setting;
|
||||
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
|
||||
@@ -1047,7 +1027,7 @@ gdk_wayland_display_init (GdkWaylandDisplay *display)
|
||||
{
|
||||
display->xkb_context = xkb_context_new (0);
|
||||
|
||||
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
display->monitors = g_list_store_new (GDK_TYPE_MONITOR);
|
||||
}
|
||||
|
||||
GList *
|
||||
@@ -2201,16 +2181,21 @@ update_scale (GdkDisplay *display)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_init_xdg_output (GdkWaylandDisplay *display_wayland)
|
||||
gdk_wayland_display_init_xdg_output (GdkWaylandDisplay *self)
|
||||
{
|
||||
int i;
|
||||
guint i, n;
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("init xdg-output support, %d monitor(s) already present",
|
||||
display_wayland->monitors->len));
|
||||
g_list_model_get_n_items (G_LIST_MODEL (self->monitors))));
|
||||
|
||||
for (i = 0; i < display_wayland->monitors->len; i++)
|
||||
gdk_wayland_display_get_xdg_output (display_wayland->monitors->pdata[i]);
|
||||
n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors));
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), i);
|
||||
gdk_wayland_display_get_xdg_output (monitor);
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2251,8 +2236,10 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height));
|
||||
|
||||
gdk_monitor_set_position (GDK_MONITOR (monitor), monitor->x, monitor->y);
|
||||
gdk_monitor_set_size (GDK_MONITOR (monitor), monitor->width, monitor->height);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor),
|
||||
&(GdkRectangle) {
|
||||
monitor->x, monitor->y,
|
||||
monitor->width, monitor->height });
|
||||
gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
|
||||
monitor->wl_output_done = FALSE;
|
||||
monitor->xdg_output_done = FALSE;
|
||||
@@ -2486,9 +2473,6 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland,
|
||||
monitor->output = output;
|
||||
monitor->version = version;
|
||||
|
||||
g_ptr_array_add (display_wayland->monitors, monitor);
|
||||
gdk_display_monitor_added (GDK_DISPLAY (display_wayland), GDK_MONITOR (monitor));
|
||||
|
||||
wl_output_add_listener (output, &output_listener, monitor);
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
@@ -2497,45 +2481,24 @@ gdk_wayland_display_add_output (GdkWaylandDisplay *display_wayland,
|
||||
|
||||
if (display_has_xdg_output_support (display_wayland))
|
||||
gdk_wayland_display_get_xdg_output (monitor);
|
||||
}
|
||||
|
||||
struct wl_output *
|
||||
gdk_wayland_display_get_wl_output (GdkDisplay *display,
|
||||
gint monitor_num)
|
||||
{
|
||||
GdkWaylandMonitor *monitor;
|
||||
g_list_store_append (display_wayland->monitors, monitor);
|
||||
|
||||
monitor = GDK_WAYLAND_DISPLAY (display)->monitors->pdata[monitor_num];
|
||||
|
||||
return monitor->output;
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
static GdkWaylandMonitor *
|
||||
get_monitor_for_id (GdkWaylandDisplay *display_wayland,
|
||||
guint32 id)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < display_wayland->monitors->len; i++)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = display_wayland->monitors->pdata[i];
|
||||
|
||||
if (monitor->id == id)
|
||||
return monitor;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GdkWaylandMonitor *
|
||||
get_monitor_for_output (GdkWaylandDisplay *display_wayland,
|
||||
get_monitor_for_output (GdkWaylandDisplay *self,
|
||||
struct wl_output *output)
|
||||
{
|
||||
int i;
|
||||
guint i, n;
|
||||
|
||||
for (i = 0; i < display_wayland->monitors->len; i++)
|
||||
n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors));
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
GdkWaylandMonitor *monitor = display_wayland->monitors->pdata[i];
|
||||
GdkWaylandMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), i);
|
||||
|
||||
g_object_unref (monitor);
|
||||
|
||||
if (monitor->output == output)
|
||||
return monitor;
|
||||
@@ -2552,18 +2515,23 @@ gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
|
||||
gdk_wayland_display_remove_output (GdkWaylandDisplay *self,
|
||||
guint32 id)
|
||||
{
|
||||
GdkWaylandMonitor *monitor;
|
||||
guint i, n;
|
||||
|
||||
monitor = get_monitor_for_id (display_wayland, id);
|
||||
if (monitor != NULL)
|
||||
n = g_list_model_get_n_items (G_LIST_MODEL (self->monitors));
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
g_object_ref (monitor);
|
||||
g_ptr_array_remove (display_wayland->monitors, monitor);
|
||||
gdk_display_monitor_removed (GDK_DISPLAY (display_wayland), GDK_MONITOR (monitor));
|
||||
update_scale (GDK_DISPLAY (display_wayland));
|
||||
GdkWaylandMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), i);
|
||||
|
||||
if (monitor->id == id)
|
||||
{
|
||||
g_list_store_remove (self->monitors, i);
|
||||
gdk_monitor_invalidate (GDK_MONITOR (monitor));
|
||||
update_scale (GDK_DISPLAY (self));
|
||||
}
|
||||
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ struct _GdkWaylandDisplay
|
||||
|
||||
struct xkb_context *xkb_context;
|
||||
|
||||
GPtrArray *monitors;
|
||||
GListStore *monitors;
|
||||
|
||||
gint64 last_bell_time_ms;
|
||||
|
||||
|
||||
@@ -352,8 +352,8 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
GdkWaylandDrag *drag_wayland;
|
||||
GdkDrag *drag;
|
||||
|
||||
@@ -103,8 +103,8 @@ GdkDrag *_gdk_wayland_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
double dx,
|
||||
double dy);
|
||||
void _gdk_wayland_surface_offset_next_wl_buffer (GdkSurface *surface,
|
||||
int x,
|
||||
int y);
|
||||
@@ -161,8 +161,6 @@ int gdk_wayland_display_get_output_refresh_rate (GdkWaylandDisplay *display_wayl
|
||||
struct wl_output *output);
|
||||
guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland,
|
||||
struct wl_output *output);
|
||||
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
|
||||
int monitor_num);
|
||||
GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
|
||||
struct wl_output *output);
|
||||
|
||||
|
||||
@@ -744,9 +744,15 @@ _gdk_wayland_display_create_surface (GdkDisplay *display,
|
||||
g_object_ref (surface);
|
||||
|
||||
/* More likely to be right than just assuming 1 */
|
||||
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE &&
|
||||
gdk_display_get_n_monitors (display) > 0)
|
||||
impl->scale = gdk_monitor_get_scale_factor (gdk_display_get_monitor (display, 0));
|
||||
if (display_wayland->compositor_version >= WL_SURFACE_HAS_BUFFER_SCALE)
|
||||
{
|
||||
GdkMonitor *monitor = g_list_model_get_item (gdk_display_get_monitors (display), 0);
|
||||
if (monitor)
|
||||
{
|
||||
impl->scale = gdk_monitor_get_scale_factor (monitor);
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_wayland_surface_set_title (surface, get_default_title ());
|
||||
|
||||
@@ -2686,11 +2692,13 @@ gdk_wayland_surface_hide (GdkSurface *surface)
|
||||
GdkSeat *seat;
|
||||
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
if (seat)
|
||||
{
|
||||
if (surface->autohide)
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
if (surface->autohide)
|
||||
gdk_seat_ungrab (seat);
|
||||
|
||||
gdk_wayland_seat_clear_touchpoints (GDK_WAYLAND_SEAT (seat), surface);
|
||||
gdk_wayland_seat_clear_touchpoints (GDK_WAYLAND_SEAT (seat), surface);
|
||||
}
|
||||
gdk_wayland_surface_hide_surface (surface);
|
||||
_gdk_surface_clear_update_area (surface);
|
||||
}
|
||||
@@ -2923,28 +2931,34 @@ gdk_wayland_surface_present_popup (GdkSurface *surface,
|
||||
{
|
||||
if (surface->autohide)
|
||||
{
|
||||
GrabPrepareData data;
|
||||
GdkGrabStatus result;
|
||||
GdkSeat *seat;
|
||||
|
||||
data = (GrabPrepareData) {
|
||||
.width = width,
|
||||
.height = height,
|
||||
.layout = layout,
|
||||
};
|
||||
|
||||
result = gdk_seat_grab (gdk_display_get_default_seat (surface->display),
|
||||
surface,
|
||||
GDK_SEAT_CAPABILITY_ALL,
|
||||
TRUE,
|
||||
NULL, NULL,
|
||||
show_grabbing_popup, &data);
|
||||
if (result != GDK_GRAB_SUCCESS)
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
if (seat)
|
||||
{
|
||||
const char *grab_status[] = {
|
||||
"success", "already grabbed", "invalid time",
|
||||
"not viewable", "frozen", "failed"
|
||||
GrabPrepareData data;
|
||||
GdkGrabStatus result;
|
||||
|
||||
data = (GrabPrepareData) {
|
||||
.width = width,
|
||||
.height = height,
|
||||
.layout = layout,
|
||||
};
|
||||
g_warning ("Grab failed: %s", grab_status[result]);
|
||||
|
||||
result = gdk_seat_grab (seat,
|
||||
surface,
|
||||
GDK_SEAT_CAPABILITY_ALL,
|
||||
TRUE,
|
||||
NULL, NULL,
|
||||
show_grabbing_popup, &data);
|
||||
if (result != GDK_GRAB_SUCCESS)
|
||||
{
|
||||
const char *grab_status[] = {
|
||||
"success", "already grabbed", "invalid time",
|
||||
"not viewable", "frozen", "failed"
|
||||
};
|
||||
g_warning ("Grab failed: %s", grab_status[result]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -3612,14 +3626,15 @@ gdk_wayland_surface_unfullscreen (GdkSurface *surface)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_wayland_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkWaylandSurface *impl;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
GdkEventSequence *sequence;
|
||||
@@ -3664,7 +3679,7 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!", edge);
|
||||
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!", edge);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3698,13 +3713,14 @@ gdk_wayland_surface_begin_resize_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_wayland_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkWaylandSurface *impl;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
GdkEventSequence *sequence;
|
||||
@@ -3887,8 +3903,6 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
|
||||
impl_class->destroy = gdk_wayland_surface_destroy;
|
||||
impl_class->beep = gdk_wayland_surface_beep;
|
||||
|
||||
impl_class->begin_resize_drag = gdk_wayland_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_wayland_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_wayland_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_wayland_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_wayland_surface_get_scale_factor;
|
||||
@@ -4603,15 +4617,10 @@ show_surface (GdkSurface *surface)
|
||||
if (!was_mapped)
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
|
||||
_gdk_surface_update_viewable (surface);
|
||||
|
||||
gdk_wayland_surface_show (surface, FALSE);
|
||||
|
||||
if (!was_mapped)
|
||||
{
|
||||
if (gdk_surface_is_viewable (surface))
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -4771,6 +4780,8 @@ gdk_wayland_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->supports_edge_constraints = gdk_wayland_toplevel_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_wayland_toplevel_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_wayland_toplevel_restore_system_shortcuts;
|
||||
iface->begin_resize = gdk_wayland_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_wayland_toplevel_begin_move;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -169,11 +169,12 @@ _gdk_win32_display_find_matching_monitor (GdkWin32Display *win32_display,
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < win32_display->monitors->len; i++)
|
||||
for (i = 0; i < g_list_model_get_n_items (win32_display->monitors); i++)
|
||||
{
|
||||
GdkWin32Monitor *m;
|
||||
|
||||
m = GDK_WIN32_MONITOR (g_ptr_array_index (win32_display->monitors, i));
|
||||
m = g_list_model_get_item (win32_display->monitors, i);
|
||||
g_object_unref (m);
|
||||
|
||||
if (_gdk_win32_monitor_compare (m, GDK_WIN32_MONITOR (needle)) == 0)
|
||||
return GDK_MONITOR (m);
|
||||
@@ -182,17 +183,21 @@ _gdk_win32_display_find_matching_monitor (GdkWin32Display *win32_display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
void
|
||||
_gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
{
|
||||
GdkDisplay *display = GDK_DISPLAY (win32_display);
|
||||
GPtrArray *new_monitors;
|
||||
gint i;
|
||||
gboolean changed = FALSE;
|
||||
GdkWin32Monitor *primary_to_move = NULL;
|
||||
|
||||
for (i = 0; i < win32_display->monitors->len; i++)
|
||||
GDK_WIN32_MONITOR (g_ptr_array_index (win32_display->monitors, i))->remove = TRUE;
|
||||
for (i = 0; i < g_list_model_get_n_items (win32_display->monitors); i++)
|
||||
{
|
||||
GdkWin32Monitor *m;
|
||||
|
||||
m = g_list_model_get_item (win32_display->monitors, i);
|
||||
m->remove = TRUE;
|
||||
g_object_unref (m);
|
||||
}
|
||||
|
||||
new_monitors = _gdk_win32_display_get_monitor_list (win32_display);
|
||||
|
||||
@@ -202,7 +207,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
GdkMonitor *m;
|
||||
GdkWin32Monitor *w32_ex_monitor;
|
||||
GdkMonitor *ex_monitor;
|
||||
GdkRectangle geometry, ex_geometry;
|
||||
GdkRectangle geometry;
|
||||
GdkRectangle workarea, ex_workarea;
|
||||
|
||||
w32_m = GDK_WIN32_MONITOR (g_ptr_array_index (new_monitors, i));
|
||||
@@ -213,7 +218,6 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
if (ex_monitor == NULL)
|
||||
{
|
||||
w32_m->add = TRUE;
|
||||
changed = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -223,22 +227,15 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
primary_to_move = w32_ex_monitor;
|
||||
|
||||
gdk_monitor_get_geometry (m, &geometry);
|
||||
gdk_monitor_get_geometry (ex_monitor, &ex_geometry);
|
||||
gdk_monitor_get_workarea (m, &workarea);
|
||||
gdk_monitor_get_workarea (ex_monitor, &ex_workarea);
|
||||
|
||||
if (memcmp (&workarea, &ex_workarea, sizeof (GdkRectangle)) != 0)
|
||||
{
|
||||
w32_ex_monitor->work_rect = workarea;
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (memcmp (&geometry, &ex_geometry, sizeof (GdkRectangle)) != 0)
|
||||
{
|
||||
gdk_monitor_set_size (ex_monitor, geometry.width, geometry.height);
|
||||
gdk_monitor_set_position (ex_monitor, geometry.x, geometry.y);
|
||||
changed = TRUE;
|
||||
}
|
||||
gdk_monitor_set_geometry (ex_monitor, &geometry);
|
||||
|
||||
if (gdk_monitor_get_width_mm (m) != gdk_monitor_get_width_mm (ex_monitor) ||
|
||||
gdk_monitor_get_height_mm (m) != gdk_monitor_get_height_mm (ex_monitor))
|
||||
@@ -246,86 +243,78 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
|
||||
gdk_monitor_set_physical_size (ex_monitor,
|
||||
gdk_monitor_get_width_mm (m),
|
||||
gdk_monitor_get_height_mm (m));
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (gdk_monitor_get_model (m), gdk_monitor_get_model (ex_monitor)) != 0)
|
||||
{
|
||||
gdk_monitor_set_model (ex_monitor,
|
||||
gdk_monitor_get_model (m));
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (gdk_monitor_get_manufacturer (m), gdk_monitor_get_manufacturer (ex_monitor)) != 0)
|
||||
{
|
||||
gdk_monitor_set_manufacturer (ex_monitor,
|
||||
gdk_monitor_get_manufacturer (m));
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (gdk_monitor_get_refresh_rate (m) != gdk_monitor_get_refresh_rate (ex_monitor))
|
||||
{
|
||||
gdk_monitor_set_refresh_rate (ex_monitor, gdk_monitor_get_refresh_rate (m));
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (gdk_monitor_get_scale_factor (m) != gdk_monitor_get_scale_factor (ex_monitor))
|
||||
{
|
||||
gdk_monitor_set_scale_factor (ex_monitor, gdk_monitor_get_scale_factor (m));
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (gdk_monitor_get_subpixel_layout (m) != gdk_monitor_get_subpixel_layout (ex_monitor))
|
||||
{
|
||||
gdk_monitor_set_subpixel_layout (ex_monitor, gdk_monitor_get_subpixel_layout (m));
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = win32_display->monitors->len - 1; i >= 0; i--)
|
||||
for (i = g_list_model_get_n_items (win32_display->monitors) - 1; i >= 0; i--)
|
||||
{
|
||||
GdkWin32Monitor *w32_ex_monitor;
|
||||
GdkMonitor *ex_monitor;
|
||||
|
||||
w32_ex_monitor = GDK_WIN32_MONITOR (g_ptr_array_index (win32_display->monitors, i));
|
||||
w32_ex_monitor = GDK_WIN32_MONITOR (g_list_model_get_item (win32_display->monitors, i));
|
||||
g_object_unref (w32_ex_monitor);
|
||||
ex_monitor = GDK_MONITOR (w32_ex_monitor);
|
||||
|
||||
if (!w32_ex_monitor->remove)
|
||||
continue;
|
||||
|
||||
changed = TRUE;
|
||||
gdk_display_monitor_removed (display, ex_monitor);
|
||||
g_ptr_array_remove_index (win32_display->monitors, i);
|
||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
|
||||
gdk_monitor_invalidate (ex_monitor);
|
||||
}
|
||||
|
||||
for (i = 0; i < new_monitors->len; i++)
|
||||
{
|
||||
GdkWin32Monitor *w32_m;
|
||||
GdkMonitor *m;
|
||||
|
||||
w32_m = GDK_WIN32_MONITOR (g_ptr_array_index (new_monitors, i));
|
||||
m = GDK_MONITOR (w32_m);
|
||||
|
||||
if (!w32_m->add)
|
||||
continue;
|
||||
|
||||
gdk_display_monitor_added (display, m);
|
||||
|
||||
if (i == 0)
|
||||
g_ptr_array_insert (win32_display->monitors, 0, g_object_ref (w32_m));
|
||||
g_list_store_insert (G_LIST_STORE (win32_display->monitors), 0, w32_m);
|
||||
else
|
||||
g_ptr_array_add (win32_display->monitors, g_object_ref (w32_m));
|
||||
g_list_store_append (G_LIST_STORE (win32_display->monitors), w32_m);
|
||||
}
|
||||
|
||||
g_ptr_array_free (new_monitors, TRUE);
|
||||
|
||||
if (primary_to_move)
|
||||
{
|
||||
g_ptr_array_remove (win32_display->monitors, g_object_ref (primary_to_move));
|
||||
g_ptr_array_insert (win32_display->monitors, 0, primary_to_move);
|
||||
changed = TRUE;
|
||||
guint pos;
|
||||
g_object_ref (primary_to_move);
|
||||
if (g_list_store_find (G_LIST_STORE (win32_display->monitors), primary_to_move, &pos))
|
||||
g_list_store_remove (G_LIST_STORE (win32_display->monitors), pos);
|
||||
g_list_store_insert (G_LIST_STORE (win32_display->monitors), 0, primary_to_move);
|
||||
g_object_unref (primary_to_move);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,23 +622,6 @@ gdk_win32_display_get_default_group (GdkDisplay *display)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||
|
||||
/* Partially supported, see WM_NCHITTEST handler. */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_beep (GdkDisplay *display)
|
||||
{
|
||||
@@ -706,7 +678,8 @@ gdk_win32_display_finalize (GObject *object)
|
||||
_gdk_win32_dnd_exit ();
|
||||
_gdk_win32_lang_notification_exit ();
|
||||
|
||||
g_ptr_array_free (display_win32->monitors, TRUE);
|
||||
g_list_store_remove_all (G_LIST_STORE (display_win32->monitors));
|
||||
g_object_unref (display_win32->monitors);
|
||||
|
||||
while (display_win32->filters)
|
||||
_gdk_win32_message_filter_unref (display_win32, display_win32->filters->data);
|
||||
@@ -911,7 +884,7 @@ gdk_win32_display_init (GdkWin32Display *display)
|
||||
{
|
||||
const gchar *scale_str = g_getenv ("GDK_SCALE");
|
||||
|
||||
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
display->monitors = G_LIST_MODEL (g_list_store_new (GDK_TYPE_MONITOR));
|
||||
|
||||
_gdk_win32_enable_hidpi (display);
|
||||
|
||||
@@ -959,37 +932,25 @@ gdk_win32_display_notify_startup_complete (GdkDisplay *display,
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_win32_display_get_n_monitors (GdkDisplay *display)
|
||||
{
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
|
||||
return win32_display->monitors->len;
|
||||
}
|
||||
|
||||
|
||||
static GdkMonitor *
|
||||
gdk_win32_display_get_monitor (GdkDisplay *display,
|
||||
int monitor_num)
|
||||
{
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
|
||||
if (monitor_num < 0 || monitor_num >= win32_display->monitors->len)
|
||||
return NULL;
|
||||
|
||||
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, monitor_num);
|
||||
}
|
||||
|
||||
GdkMonitor *
|
||||
gdk_win32_display_get_primary_monitor (GdkDisplay *display)
|
||||
{
|
||||
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
|
||||
GdkWin32Display *self = GDK_WIN32_DISPLAY (display);
|
||||
GdkMonitor *result;
|
||||
|
||||
/* We arrange for the first monitor in the array to also be the primiary monitor */
|
||||
if (win32_display->monitors->len > 0)
|
||||
return (GdkMonitor *) g_ptr_array_index (win32_display->monitors, 0);
|
||||
/* We arrange for the first monitor in the array to also be the primary monitor */
|
||||
result = g_list_model_get_item (self->monitors, 0);
|
||||
g_object_unref (result);
|
||||
|
||||
return NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
static GListModel *
|
||||
gdk_win32_display_get_monitors (GdkDisplay *display)
|
||||
{
|
||||
GdkWin32Display *self = GDK_WIN32_DISPLAY (display);
|
||||
|
||||
return self->monitors;
|
||||
}
|
||||
|
||||
guint
|
||||
@@ -1083,12 +1044,6 @@ gdk_win32_display_get_setting (GdkDisplay *display,
|
||||
return _gdk_win32_get_setting (name, value);
|
||||
}
|
||||
|
||||
static guint32
|
||||
gdk_win32_display_get_last_seen_time (GdkDisplay *display)
|
||||
{
|
||||
return GetMessageTime ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
{
|
||||
@@ -1108,9 +1063,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->queue_events = _gdk_win32_display_queue_events;
|
||||
display_class->get_default_group = gdk_win32_display_get_default_group;
|
||||
|
||||
display_class->supports_shapes = gdk_win32_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
|
||||
|
||||
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
|
||||
|
||||
display_class->get_next_serial = gdk_win32_display_get_next_serial;
|
||||
@@ -1120,8 +1072,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->get_keymap = _gdk_win32_display_get_keymap;
|
||||
display_class->make_gl_context_current = _gdk_win32_display_make_gl_context_current;
|
||||
|
||||
display_class->get_n_monitors = gdk_win32_display_get_n_monitors;
|
||||
display_class->get_monitor = gdk_win32_display_get_monitor;
|
||||
display_class->get_monitors = gdk_win32_display_get_monitors;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
display_class->vk_context_type = GDK_TYPE_WIN32_VULKAN_CONTEXT;
|
||||
@@ -1129,7 +1080,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
#endif
|
||||
|
||||
display_class->get_setting = gdk_win32_display_get_setting;
|
||||
display_class->get_last_seen_time = gdk_win32_display_get_last_seen_time;
|
||||
display_class->set_cursor_theme = gdk_win32_display_set_cursor_theme;
|
||||
|
||||
_gdk_win32_surfaceing_init ();
|
||||
|
||||
@@ -82,7 +82,7 @@ struct _GdkWin32Display
|
||||
guint gl_version;
|
||||
HWND gl_hwnd;
|
||||
|
||||
GPtrArray *monitors;
|
||||
GListModel *monitors;
|
||||
|
||||
guint hasWglARBCreateContext : 1;
|
||||
guint hasWglEXTSwapControl : 1;
|
||||
@@ -120,7 +120,7 @@ struct _GdkWin32DisplayClass
|
||||
GdkDisplayClass display_class;
|
||||
};
|
||||
|
||||
gboolean _gdk_win32_display_init_monitors (GdkWin32Display *display);
|
||||
void _gdk_win32_display_init_monitors (GdkWin32Display *display);
|
||||
|
||||
GPtrArray *_gdk_win32_display_get_monitor_list (GdkWin32Display *display);
|
||||
|
||||
|
||||
@@ -1709,8 +1709,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
GdkDrag *drag;
|
||||
GdkWin32Drag *drag_win32;
|
||||
@@ -1731,8 +1731,8 @@ _gdk_win32_surface_drag_begin (GdkSurface *surface,
|
||||
GDK_NOTE (DND, g_print ("_gdk_win32_surface_drag_begin\n"));
|
||||
|
||||
gdk_device_get_position (device, &px, &py);
|
||||
x_root = round (px) + dx;
|
||||
y_root = round (py) + dy;
|
||||
x_root = round (px + dx);
|
||||
y_root = round (py + dy);
|
||||
|
||||
drag_win32->start_x = x_root;
|
||||
drag_win32->start_y = y_root;
|
||||
|
||||
@@ -710,8 +710,7 @@ enum_monitor (HMONITOR hmonitor,
|
||||
rect.y = monitor_info.rcMonitor.top / scale;
|
||||
rect.width = (monitor_info.rcMonitor.right - monitor_info.rcMonitor.left) / scale;
|
||||
rect.height = (monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top) / scale;
|
||||
gdk_monitor_set_position (mon, rect.x, rect.y);
|
||||
gdk_monitor_set_size (mon, rect.width, rect.height);
|
||||
gdk_monitor_set_geometry (mon, &rect);
|
||||
|
||||
if (monitor_info.dwFlags & MONITORINFOF_PRIMARY && i != 0)
|
||||
{
|
||||
@@ -819,7 +818,7 @@ _gdk_win32_display_get_monitor_list (GdkWin32Display *win32_display)
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (m), &rect);
|
||||
rect.x += _gdk_offset_x;
|
||||
rect.y += _gdk_offset_y;
|
||||
gdk_monitor_set_position (GDK_MONITOR (m), rect.x, rect.y);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (m), &rect);
|
||||
|
||||
m->work_rect.x += _gdk_offset_x;
|
||||
m->work_rect.y += _gdk_offset_y;
|
||||
|
||||
@@ -395,8 +395,8 @@ GdkDrag *_gdk_win32_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint x_root,
|
||||
gint y_root);
|
||||
double x_root,
|
||||
double y_root);
|
||||
|
||||
/* Stray GdkWin32Screen members */
|
||||
gboolean _gdk_win32_get_setting (const gchar *name, GValue *value);
|
||||
|
||||
@@ -46,23 +46,22 @@ G_DEFINE_TYPE (GdkWin32Screen, gdk_win32_screen, G_TYPE_OBJECT)
|
||||
static void
|
||||
init_root_window_size (GdkWin32Screen *screen)
|
||||
{
|
||||
GdkRectangle result;
|
||||
GdkRectangle result = { 0, };
|
||||
int i;
|
||||
GdkDisplay *display = _gdk_display;
|
||||
int monitor_count;
|
||||
GListModel *monitors;
|
||||
GdkMonitor *monitor;
|
||||
|
||||
monitor_count = gdk_display_get_n_monitors (display);
|
||||
monitor = gdk_display_get_monitor (display, 0);
|
||||
gdk_monitor_get_geometry (monitor, &result);
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
|
||||
for (i = 1; i < monitor_count; i++)
|
||||
for (i = 1; i < g_list_model_get_n_items (monitors); i++)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
monitor = gdk_display_get_monitor (display, i);
|
||||
monitor = g_list_model_get_item (monitors, i);
|
||||
gdk_monitor_get_geometry (monitor, &rect);
|
||||
gdk_rectangle_union (&result, &rect, &result);
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
screen->width = result.width;
|
||||
|
||||
@@ -1327,7 +1327,6 @@ show_popup (GdkSurface *surface)
|
||||
{
|
||||
gdk_win32_surface_raise (surface);
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
_gdk_surface_update_viewable (surface);
|
||||
show_window_internal (surface, FALSE, FALSE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
@@ -2052,21 +2051,22 @@ static void
|
||||
calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
gint n_monitors, monitor_idx, other_monitor_idx;
|
||||
GListModel *monitors;
|
||||
gint monitor_idx, other_monitor_idx;
|
||||
GdkWin32Surface *impl = GDK_WIN32_SURFACE (context->window);
|
||||
#if defined(MORE_AEROSNAP_DEBUGGING)
|
||||
gint i;
|
||||
#endif
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
n_monitors = gdk_display_get_n_monitors (display);
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
|
||||
#define _M_UP 0
|
||||
#define _M_DOWN 1
|
||||
#define _M_LEFT 2
|
||||
#define _M_RIGHT 3
|
||||
|
||||
for (monitor_idx = 0; monitor_idx < n_monitors; monitor_idx++)
|
||||
for (monitor_idx = 0; monitor_idx < g_list_model_get_n_items (monitors); monitor_idx++)
|
||||
{
|
||||
GdkRectangle wa;
|
||||
GdkRectangle geometry;
|
||||
@@ -2077,12 +2077,13 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
|
||||
gint thickness, trigger_thickness;
|
||||
GdkMonitor *monitor;
|
||||
|
||||
monitor = gdk_display_get_monitor (display, monitor_idx);
|
||||
monitor = g_list_model_get_item (monitors, monitor_idx);
|
||||
g_object_unref (monitors);
|
||||
gdk_monitor_get_workarea (monitor, &wa);
|
||||
gdk_monitor_get_geometry (monitor, &geometry);
|
||||
|
||||
for (other_monitor_idx = 0;
|
||||
other_monitor_idx < n_monitors &&
|
||||
other_monitor_idx < g_list_model_get_n_items (monitors) &&
|
||||
(move_edge[_M_UP] || move_edge[_M_LEFT] ||
|
||||
move_edge[_M_RIGHT] || resize_edge[_M_DOWN]);
|
||||
other_monitor_idx++)
|
||||
@@ -2093,7 +2094,8 @@ calculate_aerosnap_regions (GdkW32DragMoveResizeContext *context)
|
||||
if (other_monitor_idx == monitor_idx)
|
||||
continue;
|
||||
|
||||
other_monitor = gdk_display_get_monitor (display, other_monitor_idx);
|
||||
other_monitor = g_list_model_get_item (monitors, other_monitor_idx);
|
||||
g_object_unref (other_monitor);
|
||||
gdk_monitor_get_workarea (other_monitor, &other_wa);
|
||||
|
||||
/* An edge triggers AeroSnap only if there are no
|
||||
@@ -2473,6 +2475,7 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
||||
{
|
||||
GdkWin32Surface *impl;
|
||||
GdkDisplay *display;
|
||||
GListModel *monitors;
|
||||
gint n_monitors;
|
||||
GdkSurfaceState surface_state = gdk_toplevel_get_state (GDK_TOPLEVEL (window));
|
||||
gboolean minimized = surface_state & GDK_SURFACE_STATE_MINIMIZED;
|
||||
@@ -2482,7 +2485,8 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
||||
|
||||
impl = GDK_WIN32_SURFACE (window);
|
||||
display = gdk_surface_get_display (window);
|
||||
n_monitors = gdk_display_get_n_monitors (display);
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
n_monitors = g_list_model_get_n_items (monitors);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, window);
|
||||
|
||||
if (minimized && maximized)
|
||||
@@ -2528,10 +2532,15 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
||||
}
|
||||
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFLEFT)
|
||||
{
|
||||
GdkMonitor *other;
|
||||
|
||||
unsnap (window, monitor);
|
||||
snap_right (window,
|
||||
monitor,
|
||||
(gdk_win32_display_get_primary_monitor (monitor->display) == monitor) ? monitor : gdk_display_get_monitor (display, n_monitors - 1));
|
||||
if (gdk_win32_display_get_primary_monitor (monitor->display) == monitor)
|
||||
other = g_object_ref (monitor);
|
||||
else
|
||||
other = g_list_model_get_item (monitors, n_monitors - 1);
|
||||
snap_right (window, monitor, other);
|
||||
g_object_unref (other);
|
||||
}
|
||||
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT)
|
||||
{
|
||||
@@ -2554,24 +2563,21 @@ _gdk_win32_surface_handle_aerosnap (GdkSurface *window,
|
||||
}
|
||||
else if (impl->snap_state == GDK_WIN32_AEROSNAP_STATE_HALFRIGHT)
|
||||
{
|
||||
GdkMonitor *other;
|
||||
gint i;
|
||||
|
||||
unsnap (window, monitor);
|
||||
if (n_monitors == 1 ||
|
||||
monitor == gdk_display_get_monitor (display, n_monitors - 1))
|
||||
{
|
||||
snap_left (window, monitor, monitor);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < n_monitors; i++)
|
||||
{
|
||||
if (monitor == gdk_display_get_monitor (display, i))
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < n_monitors; i++)
|
||||
{
|
||||
other = g_list_model_get_item (monitors, i);
|
||||
g_object_unref (other);
|
||||
if (monitor == other)
|
||||
break;
|
||||
}
|
||||
|
||||
snap_left (window, monitor, gdk_display_get_monitor (display, i + 1));
|
||||
}
|
||||
other = g_list_model_get_item (monitors, (i + 1) % n_monitors);
|
||||
snap_left (window, monitor, other);
|
||||
g_object_unref (other);
|
||||
}
|
||||
break;
|
||||
case GDK_WIN32_AEROSNAP_COMBO_SHIFTUP:
|
||||
@@ -3120,18 +3126,19 @@ get_monitor_at_point (GdkDisplay *display,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
GListModel *monitors;
|
||||
GdkMonitor *nearest = NULL;
|
||||
int nearest_dist = G_MAXINT;
|
||||
int n_monitors, i;
|
||||
guint i;
|
||||
|
||||
n_monitors = gdk_display_get_n_monitors (display);
|
||||
for (i = 0; i < n_monitors; i++)
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
|
||||
{
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle geometry;
|
||||
int dist_x, dist_y, dist;
|
||||
|
||||
monitor = gdk_display_get_monitor (display, i);
|
||||
monitor = g_list_model_get_item (monitors, i);
|
||||
gdk_monitor_get_geometry (monitor, &geometry);
|
||||
|
||||
if (x < geometry.x)
|
||||
@@ -3176,6 +3183,8 @@ get_monitor_at_point (GdkDisplay *display,
|
||||
nearest = monitor;
|
||||
}
|
||||
|
||||
g_object_unref (monitor);
|
||||
|
||||
if (nearest_dist == 0)
|
||||
break;
|
||||
}
|
||||
@@ -4135,18 +4144,17 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_begin_resize_drag (GdkSurface *window,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_win32_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *window = GDK_SURFACE (toplevel);
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (window) ||
|
||||
IsIconic (GDK_SURFACE_HWND (window)))
|
||||
return;
|
||||
@@ -4172,17 +4180,16 @@ gdk_win32_surface_begin_resize_drag (GdkSurface *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_surface_begin_move_drag (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_win32_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *window = GDK_SURFACE (toplevel);
|
||||
GdkWin32Surface *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_SURFACE (window));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (window) ||
|
||||
IsIconic (GDK_SURFACE_HWND (window)))
|
||||
return;
|
||||
@@ -4700,8 +4707,6 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
|
||||
|
||||
|
||||
impl_class->set_shadow_width = gdk_win32_surface_set_shadow_width;
|
||||
impl_class->begin_resize_drag = gdk_win32_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_win32_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_win32_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_win32_surface_drag_begin;
|
||||
impl_class->create_gl_context = _gdk_win32_surface_create_gl_context;
|
||||
@@ -4990,15 +4995,10 @@ show_surface (GdkSurface *surface)
|
||||
if (!was_mapped)
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
|
||||
_gdk_surface_update_viewable (surface);
|
||||
|
||||
gdk_win32_surface_show (surface, FALSE);
|
||||
|
||||
if (!was_mapped)
|
||||
{
|
||||
if (gdk_surface_is_viewable (surface))
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -5085,6 +5085,8 @@ gdk_win32_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->focus = gdk_win32_toplevel_focus;
|
||||
iface->show_window_menu = gdk_win32_toplevel_show_window_menu;
|
||||
iface->supports_edge_constraints = gdk_win32_toplevel_supports_edge_constraints;
|
||||
iface->begin_resize = gdk_win32_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_win32_toplevel_begin_move;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -544,7 +544,7 @@ gdk_x11_clipboard_claim (GdkClipboard *clipboard,
|
||||
Window xwindow = GDK_X11_DISPLAY (display)->leader_window;
|
||||
guint32 time;
|
||||
|
||||
time = gdk_display_get_last_seen_time (display);
|
||||
time = gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface);
|
||||
|
||||
if (content)
|
||||
{
|
||||
|
||||
@@ -1936,8 +1936,11 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
|
||||
device = g_hash_table_lookup (device_manager->id_table,
|
||||
GINT_TO_POINTER (xev->deviceid));
|
||||
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
if (xev->sourceid != xev->deviceid)
|
||||
source_device = g_hash_table_lookup (device_manager->id_table,
|
||||
GUINT_TO_POINTER (xev->sourceid));
|
||||
else
|
||||
source_device = NULL;
|
||||
|
||||
_gdk_device_manager_xi2_handle_focus (surface,
|
||||
xev->event,
|
||||
|
||||
+23
-113
@@ -73,10 +73,6 @@
|
||||
#include <X11/extensions/Xcomposite.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RANDR
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
@@ -209,9 +205,9 @@ G_DEFINE_TYPE_WITH_CODE (GdkX11Display, gdk_x11_display, GDK_TYPE_DISPLAY,
|
||||
gdk_x11_display_event_translator_init))
|
||||
|
||||
static void
|
||||
gdk_x11_display_init (GdkX11Display *display)
|
||||
gdk_x11_display_init (GdkX11Display *self)
|
||||
{
|
||||
display->monitors = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
self->monitors = g_list_store_new (GDK_TYPE_MONITOR);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1430,8 +1426,6 @@ gdk_x11_display_open (const gchar *display_name)
|
||||
display_x11->have_randr15 = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
gdk_x11_register_standard_event_type (display, display_x11->xrandr_event_base, RRNumberEvents);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1464,10 +1458,6 @@ gdk_x11_display_open (const gchar *display_name)
|
||||
&ignore))
|
||||
{
|
||||
display_x11->have_xfixes = TRUE;
|
||||
|
||||
gdk_x11_register_standard_event_type (display,
|
||||
display_x11->xfixes_event_base,
|
||||
XFixesNumberEvents);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -1491,21 +1481,6 @@ gdk_x11_display_open (const gchar *display_name)
|
||||
#endif
|
||||
display_x11->have_xcomposite = FALSE;
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
if (XDamageQueryExtension (display_x11->xdisplay,
|
||||
&display_x11->xdamage_event_base,
|
||||
&ignore))
|
||||
{
|
||||
display_x11->have_xdamage = TRUE;
|
||||
|
||||
gdk_x11_register_standard_event_type (display,
|
||||
display_x11->xdamage_event_base,
|
||||
XDamageNumberEvents);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
display_x11->have_xdamage = FALSE;
|
||||
|
||||
display_x11->have_shapes = FALSE;
|
||||
display_x11->have_input_shapes = FALSE;
|
||||
|
||||
@@ -1518,6 +1493,8 @@ gdk_x11_display_open (const gchar *display_name)
|
||||
#endif
|
||||
}
|
||||
|
||||
gdk_display_set_input_shapes (display, display_x11->have_input_shapes);
|
||||
|
||||
display_x11->trusted_client = TRUE;
|
||||
{
|
||||
Window root, child;
|
||||
@@ -1940,17 +1917,12 @@ gdk_x11_display_finalize (GObject *object)
|
||||
/* Leader Window */
|
||||
XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
|
||||
|
||||
/* List of event window extraction functions */
|
||||
g_slist_free_full (display_x11->event_types, g_free);
|
||||
|
||||
/* input GdkSurface list */
|
||||
g_list_free_full (display_x11->input_surfaces, g_free);
|
||||
|
||||
/* Free all GdkX11Screens */
|
||||
g_object_unref (display_x11->screen);
|
||||
g_list_free_full (display_x11->screens, g_object_unref);
|
||||
|
||||
g_ptr_array_free (display_x11->monitors, TRUE);
|
||||
g_list_store_remove_all (display_x11->monitors);
|
||||
g_object_unref (display_x11->monitors);
|
||||
|
||||
g_free (display_x11->startup_notification_id);
|
||||
|
||||
@@ -2339,19 +2311,6 @@ gdk_x11_display_get_user_time (GdkDisplay *display)
|
||||
return GDK_X11_DISPLAY (display)->user_time;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_display_supports_shapes (GdkDisplay *display)
|
||||
{
|
||||
return GDK_X11_DISPLAY (display)->have_shapes;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_display_supports_input_shapes (GdkDisplay *display)
|
||||
{
|
||||
return GDK_X11_DISPLAY (display)->have_input_shapes;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gdk_x11_display_get_startup_notification_id:
|
||||
* @display: (type GdkX11Display): a #GdkDisplay
|
||||
@@ -2438,39 +2397,6 @@ gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_register_standard_event_type:
|
||||
* @display: (type GdkX11Display): a #GdkDisplay
|
||||
* @event_base: first event type code to register
|
||||
* @n_events: number of event type codes to register
|
||||
*
|
||||
* Registers interest in receiving extension events with type codes
|
||||
* between @event_base and `event_base + n_events - 1`.
|
||||
* The registered events must have the window field in the same place
|
||||
* as core X events (this is not the case for e.g. XKB extension events).
|
||||
*
|
||||
* GDK may register the events of some X extensions on its own.
|
||||
*
|
||||
* This function should only be needed in unusual circumstances, e.g.
|
||||
* when filtering XInput extension events on the root window.
|
||||
**/
|
||||
void
|
||||
gdk_x11_register_standard_event_type (GdkDisplay *display,
|
||||
gint event_base,
|
||||
gint n_events)
|
||||
{
|
||||
GdkEventTypeX11 *event_type;
|
||||
GdkX11Display *display_x11;
|
||||
|
||||
display_x11 = GDK_X11_DISPLAY (display);
|
||||
event_type = g_new (GdkEventTypeX11, 1);
|
||||
|
||||
event_type->base = event_base;
|
||||
event_type->n_events = n_events;
|
||||
|
||||
display_x11->event_types = g_slist_prepend (display_x11->event_types, event_type);
|
||||
}
|
||||
|
||||
/* look up the extension name for a given major opcode. grubs around in
|
||||
* xlib to do it since a) it’s already cached there b) XQueryExtension
|
||||
* emits protocol so we can’t use it in an error handler.
|
||||
@@ -2894,30 +2820,17 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_x11_display_get_n_monitors (GdkDisplay *display)
|
||||
static GListModel *
|
||||
gdk_x11_display_get_monitors (GdkDisplay *display)
|
||||
{
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
|
||||
GdkX11Display *self = GDK_X11_DISPLAY (display);
|
||||
|
||||
return x11_display->monitors->len;
|
||||
}
|
||||
|
||||
|
||||
static GdkMonitor *
|
||||
gdk_x11_display_get_monitor (GdkDisplay *display,
|
||||
int monitor_num)
|
||||
{
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (0 <= monitor_num && monitor_num < x11_display->monitors->len)
|
||||
return (GdkMonitor *)x11_display->monitors->pdata[monitor_num];
|
||||
|
||||
return NULL;
|
||||
return G_LIST_MODEL (self->monitors);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_display_get_primary_monitor:
|
||||
* @display: a #GdkDisplay
|
||||
* @self: a #GdkDisplay
|
||||
*
|
||||
* Gets the primary monitor for the display.
|
||||
*
|
||||
@@ -2935,12 +2848,19 @@ gdk_x11_display_get_monitor (GdkDisplay *display,
|
||||
GdkMonitor *
|
||||
gdk_x11_display_get_primary_monitor (GdkDisplay *display)
|
||||
{
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (display);
|
||||
GdkX11Display *self = GDK_X11_DISPLAY (display);
|
||||
GdkMonitor *monitor;
|
||||
|
||||
if (0 <= x11_display->primary_monitor && x11_display->primary_monitor < x11_display->monitors->len)
|
||||
return x11_display->monitors->pdata[x11_display->primary_monitor];
|
||||
if (0 <= self->primary_monitor)
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
monitor = g_list_model_get_item (G_LIST_MODEL (self->monitors), self->primary_monitor);
|
||||
if (monitor == NULL)
|
||||
return NULL;
|
||||
|
||||
/* because g_list_model_get_item() returns a ref */
|
||||
g_object_unref (monitor);
|
||||
return monitor;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -2975,12 +2895,6 @@ gdk_x11_display_get_toplevel_windows (GdkDisplay *display)
|
||||
return GDK_X11_DISPLAY (display)->toplevels;
|
||||
}
|
||||
|
||||
static guint32
|
||||
gdk_x11_display_get_last_seen_time (GdkDisplay *display)
|
||||
{
|
||||
return gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_boolean_handled_accumulator (GSignalInvocationHint *ihint,
|
||||
GValue *return_accu,
|
||||
@@ -3020,8 +2934,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
display_class->has_pending = gdk_x11_display_has_pending;
|
||||
display_class->queue_events = _gdk_x11_display_queue_events;
|
||||
display_class->get_default_group = gdk_x11_display_get_default_group;
|
||||
display_class->supports_shapes = gdk_x11_display_supports_shapes;
|
||||
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
|
||||
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
|
||||
|
||||
display_class->get_next_serial = gdk_x11_display_get_next_serial;
|
||||
@@ -3034,10 +2946,8 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
|
||||
display_class->get_default_seat = gdk_x11_display_get_default_seat;
|
||||
|
||||
display_class->get_n_monitors = gdk_x11_display_get_n_monitors;
|
||||
display_class->get_monitor = gdk_x11_display_get_monitor;
|
||||
display_class->get_monitors = gdk_x11_display_get_monitors;
|
||||
display_class->get_setting = gdk_x11_display_get_setting;
|
||||
display_class->get_last_seen_time = gdk_x11_display_get_last_seen_time;
|
||||
display_class->set_cursor_theme = gdk_x11_display_set_cursor_theme;
|
||||
|
||||
class->xevent = gdk_event_source_xevent;
|
||||
|
||||
@@ -72,8 +72,6 @@ struct _GdkX11Display
|
||||
gint xfixes_event_base;
|
||||
|
||||
gboolean have_xcomposite;
|
||||
gboolean have_xdamage;
|
||||
gint xdamage_event_base;
|
||||
|
||||
gboolean have_randr12;
|
||||
gboolean have_randr13;
|
||||
@@ -99,22 +97,16 @@ struct _GdkX11Display
|
||||
GdkSurface *leader_gdk_surface;
|
||||
gboolean leader_window_title_set;
|
||||
|
||||
/* List of functions to go from extension event => X window */
|
||||
GSList *event_types;
|
||||
|
||||
/* X ID hashtable */
|
||||
GHashTable *xid_ht;
|
||||
|
||||
/* streams reading selections */
|
||||
GSList *streams;
|
||||
|
||||
/* input GdkSurface list */
|
||||
GList *input_surfaces;
|
||||
|
||||
/* GdkCursor => XCursor */
|
||||
GHashTable *cursors;
|
||||
|
||||
GPtrArray *monitors;
|
||||
GListStore *monitors;
|
||||
int primary_monitor;
|
||||
|
||||
/* Startup notification */
|
||||
|
||||
@@ -665,12 +665,12 @@ is_pointer_within_shape (GdkDisplay *display,
|
||||
cairo_region_t *input_shape;
|
||||
|
||||
child->shape = NULL;
|
||||
if (gdk_display_supports_shapes (display))
|
||||
if (display_x11->have_shapes)
|
||||
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
|
||||
child->xid, 1, ShapeBounding);
|
||||
#ifdef ShapeInput
|
||||
input_shape = NULL;
|
||||
if (gdk_display_supports_input_shapes (display))
|
||||
if (display_x11->have_input_shapes)
|
||||
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
|
||||
child->xid, 1, ShapeInput);
|
||||
|
||||
@@ -1985,8 +1985,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy)
|
||||
double dx,
|
||||
double dy)
|
||||
{
|
||||
GdkX11Drag *x11_drag;
|
||||
GdkDrag *drag;
|
||||
@@ -2013,8 +2013,8 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
|
||||
_gdk_device_query_state (device, surface, NULL, &px, &py, NULL);
|
||||
|
||||
gdk_x11_surface_get_root_coords (surface,
|
||||
round (px) + dx,
|
||||
round (py) + dy,
|
||||
round (px + dx),
|
||||
round (py + dy),
|
||||
&x_root,
|
||||
&y_root);
|
||||
|
||||
@@ -2042,7 +2042,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
|
||||
|
||||
move_drag_surface (drag, x_root, y_root);
|
||||
|
||||
x11_drag->timestamp = gdk_display_get_last_seen_time (display);
|
||||
x11_drag->timestamp = gdk_x11_get_server_time (GDK_X11_DISPLAY (display)->leader_gdk_surface);
|
||||
xselection = gdk_x11_get_xatom_by_name_for_display (display, "XdndSelection");
|
||||
XSetSelectionOwner (GDK_DISPLAY_XDISPLAY (display),
|
||||
xselection,
|
||||
|
||||
@@ -223,8 +223,8 @@ GdkDrag * _gdk_x11_surface_drag_begin (GdkSurface *window,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
gint dx,
|
||||
gint dy);
|
||||
double dx,
|
||||
double dy);
|
||||
|
||||
void gdk_x11_surface_get_root_coords (GdkSurface *surface,
|
||||
gint x,
|
||||
|
||||
+87
-110
@@ -135,12 +135,16 @@ gdk_x11_screen_get_monitor_output (GdkX11Screen *x11_screen,
|
||||
{
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
|
||||
GdkX11Monitor *monitor;
|
||||
XID output;
|
||||
|
||||
g_return_val_if_fail (monitor_num >= 0, None);
|
||||
g_return_val_if_fail (monitor_num < x11_display->monitors->len, None);
|
||||
g_return_val_if_fail (monitor_num < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)), None);
|
||||
|
||||
monitor = x11_display->monitors->pdata[monitor_num];
|
||||
return monitor->output;
|
||||
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), monitor_num);
|
||||
output = monitor->output;
|
||||
g_object_unref (monitor);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -381,14 +385,35 @@ gdk_x11_screen_get_screen_number (GdkX11Screen *screen)
|
||||
return screen->screen_num;
|
||||
}
|
||||
|
||||
static void
|
||||
notify_surface_monitor_change (GdkX11Display *display,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
GdkSurface *surface;
|
||||
|
||||
/* We iterate the surfaces via the hash table here because it's the only
|
||||
* thing that contains all the surfaces.
|
||||
*/
|
||||
if (display->xid_ht == NULL)
|
||||
return;
|
||||
|
||||
g_hash_table_iter_init (&iter, display->xid_ht);
|
||||
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&surface))
|
||||
{
|
||||
gdk_x11_surface_check_monitor (surface, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
static GdkX11Monitor *
|
||||
find_monitor_by_output (GdkX11Display *x11_display, XID output)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; i++)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
g_object_unref (monitor);
|
||||
if (monitor->output == output)
|
||||
return monitor;
|
||||
}
|
||||
@@ -411,7 +436,7 @@ translate_subpixel_order (int subpixel)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
init_randr15 (GdkX11Screen *x11_screen)
|
||||
{
|
||||
#ifdef HAVE_RANDR15
|
||||
GdkDisplay *display = GDK_SCREEN_DISPLAY (x11_screen);
|
||||
@@ -422,7 +447,6 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
int i;
|
||||
XRRMonitorInfo *rr_monitors;
|
||||
int num_rr_monitors;
|
||||
int old_primary;
|
||||
|
||||
if (!x11_display->have_randr15)
|
||||
return FALSE;
|
||||
@@ -439,11 +463,12 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
if (!rr_monitors)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; i++)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
monitor->add = FALSE;
|
||||
monitor->remove = TRUE;
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_rr_monitors; i++)
|
||||
@@ -503,7 +528,7 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
NULL);
|
||||
monitor->output = output;
|
||||
monitor->add = TRUE;
|
||||
g_ptr_array_add (x11_display->monitors, monitor);
|
||||
g_list_store_append (x11_display->monitors, monitor);
|
||||
}
|
||||
|
||||
/* Fetch minimal manufacturer information (PNP ID) from EDID */
|
||||
@@ -557,17 +582,8 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
newgeo.y = rr_monitors[i].y / x11_screen->surface_scale;
|
||||
newgeo.width = rr_monitors[i].width / x11_screen->surface_scale;
|
||||
newgeo.height = rr_monitors[i].height / x11_screen->surface_scale;
|
||||
if (newgeo.x != geometry.x ||
|
||||
newgeo.y != geometry.y ||
|
||||
newgeo.width != geometry.width ||
|
||||
newgeo.height != geometry.height ||
|
||||
rr_monitors[i].mwidth != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
|
||||
rr_monitors[i].mheight != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)) ||
|
||||
g_strcmp0 (name, gdk_monitor_get_model (GDK_MONITOR (monitor))))
|
||||
*changed = TRUE;
|
||||
|
||||
gdk_monitor_set_position (GDK_MONITOR (monitor), newgeo.x, newgeo.y);
|
||||
gdk_monitor_set_size (GDK_MONITOR (monitor), newgeo.width, newgeo.height);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &newgeo);
|
||||
g_object_notify (G_OBJECT (monitor), "workarea");
|
||||
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
|
||||
rr_monitors[i].mwidth,
|
||||
@@ -591,29 +607,26 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
XRRFreeMonitors (rr_monitors);
|
||||
XRRFreeScreenResources (resources);
|
||||
|
||||
for (i = x11_display->monitors->len - 1; i >= 0; i--)
|
||||
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
if (monitor->add)
|
||||
{
|
||||
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
|
||||
*changed = TRUE;
|
||||
}
|
||||
else if (monitor->remove)
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
|
||||
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
|
||||
if (monitor->remove)
|
||||
{
|
||||
g_object_ref (monitor);
|
||||
g_ptr_array_remove (x11_display->monitors, monitor);
|
||||
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
|
||||
g_list_store_remove (x11_display->monitors, i);
|
||||
gdk_monitor_invalidate (GDK_MONITOR (monitor));
|
||||
g_object_unref (monitor);
|
||||
*changed = TRUE;
|
||||
}
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
old_primary = x11_display->primary_monitor;
|
||||
x11_display->primary_monitor = 0;
|
||||
for (i = 0; i < x11_display->monitors->len; ++i)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
g_object_unref (monitor);
|
||||
if (monitor->output == primary_output)
|
||||
{
|
||||
x11_display->primary_monitor = i;
|
||||
@@ -633,17 +646,14 @@ init_randr15 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
x11_display->primary_monitor = i;
|
||||
}
|
||||
|
||||
if (x11_display->primary_monitor != old_primary)
|
||||
*changed = TRUE;
|
||||
|
||||
return x11_display->monitors->len > 0;
|
||||
return g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) > 0;
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
init_randr13 (GdkX11Screen *x11_screen)
|
||||
{
|
||||
#ifdef HAVE_RANDR
|
||||
GdkDisplay *display = GDK_SCREEN_DISPLAY (x11_screen);
|
||||
@@ -652,7 +662,6 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
RROutput primary_output = None;
|
||||
RROutput first_output = None;
|
||||
int i;
|
||||
int old_primary;
|
||||
|
||||
if (!x11_display->have_randr13)
|
||||
return FALSE;
|
||||
@@ -662,11 +671,12 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
if (!resources)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; i++)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
monitor->add = FALSE;
|
||||
monitor->remove = TRUE;
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
for (i = 0; i < resources->noutput; ++i)
|
||||
@@ -712,7 +722,7 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
NULL);
|
||||
monitor->output = output;
|
||||
monitor->add = TRUE;
|
||||
g_ptr_array_add (x11_display->monitors, monitor);
|
||||
g_list_store_append (x11_display->monitors, monitor);
|
||||
}
|
||||
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
|
||||
@@ -722,17 +732,8 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
newgeo.y = crtc->y / x11_screen->surface_scale;
|
||||
newgeo.width = crtc->width / x11_screen->surface_scale;
|
||||
newgeo.height = crtc->height / x11_screen->surface_scale;
|
||||
if (newgeo.x != geometry.x ||
|
||||
newgeo.y != geometry.y ||
|
||||
newgeo.width != geometry.width ||
|
||||
newgeo.height != geometry.height ||
|
||||
output_info->mm_width != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
|
||||
output_info->mm_height != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)) ||
|
||||
g_strcmp0 (name, gdk_monitor_get_model (GDK_MONITOR (monitor))) != 0)
|
||||
*changed = TRUE;
|
||||
|
||||
gdk_monitor_set_position (GDK_MONITOR (monitor), newgeo.x, newgeo.y);
|
||||
gdk_monitor_set_size (GDK_MONITOR (monitor), newgeo.width, newgeo.height);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &newgeo);
|
||||
g_object_notify (G_OBJECT (monitor), "workarea");
|
||||
gdk_monitor_set_physical_size (GDK_MONITOR (monitor),
|
||||
output_info->mm_width,
|
||||
@@ -758,32 +759,28 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
|
||||
/* Which usable multihead data is not returned in non RandR 1.2+ X driver? */
|
||||
|
||||
for (i = x11_display->monitors->len - 1; i >= 0; i--)
|
||||
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
if (monitor->add)
|
||||
{
|
||||
gdk_display_monitor_added (display, GDK_MONITOR (monitor));
|
||||
*changed = TRUE;
|
||||
}
|
||||
else if (monitor->remove)
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
|
||||
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
|
||||
if (monitor->remove)
|
||||
{
|
||||
g_object_ref (monitor);
|
||||
g_ptr_array_remove (x11_display->monitors, monitor);
|
||||
gdk_display_monitor_removed (display, GDK_MONITOR (monitor));
|
||||
g_list_store_remove (x11_display->monitors, i);
|
||||
gdk_monitor_invalidate (GDK_MONITOR (monitor));
|
||||
g_object_unref (monitor);
|
||||
*changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
old_primary = x11_display->primary_monitor;
|
||||
x11_display->primary_monitor = 0;
|
||||
primary_output = XRRGetOutputPrimary (x11_screen->xdisplay,
|
||||
x11_screen->xroot_window);
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; ++i)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
GdkX11Monitor *monitor = x11_display->monitors->pdata[i];
|
||||
GdkX11Monitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
g_object_unref (monitor);
|
||||
if (monitor->output == primary_output)
|
||||
{
|
||||
x11_display->primary_monitor = i;
|
||||
@@ -803,30 +800,27 @@ init_randr13 (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
x11_display->primary_monitor = i;
|
||||
}
|
||||
|
||||
if (x11_display->primary_monitor != old_primary)
|
||||
*changed = TRUE;
|
||||
|
||||
return x11_display->monitors->len > 0;
|
||||
return g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) > 0;
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
init_no_multihead (GdkX11Screen *x11_screen)
|
||||
{
|
||||
GdkX11Display *x11_display = GDK_X11_DISPLAY (x11_screen->display);
|
||||
GdkX11Monitor *monitor;
|
||||
GdkRectangle geometry;
|
||||
int width_mm, height_mm;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; i++)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
monitor = x11_display->monitors->pdata[i];
|
||||
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
monitor->add = FALSE;
|
||||
monitor->remove = TRUE;
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
monitor = find_monitor_by_output (x11_display, 0);
|
||||
@@ -839,7 +833,7 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
NULL);
|
||||
monitor->output = 0;
|
||||
monitor->add = TRUE;
|
||||
g_ptr_array_add (x11_display->monitors, monitor);
|
||||
g_list_store_append (x11_display->monitors, monitor);
|
||||
}
|
||||
|
||||
width_mm = WidthMMOfScreen (x11_screen->xscreen);
|
||||
@@ -847,54 +841,35 @@ init_no_multihead (GdkX11Screen *x11_screen, gboolean *changed)
|
||||
width = WidthOfScreen (x11_screen->xscreen);
|
||||
height = HeightOfScreen (x11_screen->xscreen);
|
||||
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &geometry);
|
||||
if (0 != geometry.x ||
|
||||
0 != geometry.y ||
|
||||
width != geometry.width ||
|
||||
height != geometry.height ||
|
||||
width_mm != gdk_monitor_get_width_mm (GDK_MONITOR (monitor)) ||
|
||||
height_mm != gdk_monitor_get_height_mm (GDK_MONITOR (monitor)))
|
||||
*changed = TRUE;
|
||||
|
||||
gdk_monitor_set_position (GDK_MONITOR (monitor), 0, 0);
|
||||
gdk_monitor_set_size (GDK_MONITOR (monitor), width, height);
|
||||
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &(GdkRectangle) { 0, 0, width, height });
|
||||
g_object_notify (G_OBJECT (monitor), "workarea");
|
||||
gdk_monitor_set_physical_size (GDK_MONITOR (monitor), width_mm, height_mm);
|
||||
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), x11_screen->surface_scale);
|
||||
|
||||
if (x11_display->primary_monitor != 0)
|
||||
*changed = TRUE;
|
||||
x11_display->primary_monitor = 0;
|
||||
|
||||
for (i = x11_display->monitors->len - 1; i >= 0; i--)
|
||||
for (i = g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)) - 1; i >= 0; i--)
|
||||
{
|
||||
monitor = x11_display->monitors->pdata[i];
|
||||
if (monitor->add)
|
||||
{
|
||||
gdk_display_monitor_added (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor));
|
||||
*changed = TRUE;
|
||||
}
|
||||
else if (monitor->remove)
|
||||
monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
|
||||
notify_surface_monitor_change (x11_display, GDK_MONITOR (monitor));
|
||||
if (monitor->remove)
|
||||
{
|
||||
g_object_ref (monitor);
|
||||
g_ptr_array_remove (x11_display->monitors, monitor);
|
||||
gdk_display_monitor_removed (GDK_DISPLAY (x11_display), GDK_MONITOR (monitor));
|
||||
g_list_store_remove (x11_display->monitors, i);
|
||||
gdk_monitor_invalidate (GDK_MONITOR (monitor));
|
||||
g_object_unref (monitor);
|
||||
*changed = TRUE;
|
||||
}
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
static void
|
||||
init_multihead (GdkX11Screen *screen)
|
||||
{
|
||||
gboolean any_changed = FALSE;
|
||||
|
||||
if (!init_randr15 (screen, &any_changed) &&
|
||||
!init_randr13 (screen, &any_changed))
|
||||
init_no_multihead (screen, &any_changed);
|
||||
|
||||
return any_changed;
|
||||
if (!init_randr15 (screen) &&
|
||||
!init_randr13 (screen))
|
||||
init_no_multihead (screen);
|
||||
}
|
||||
|
||||
GdkX11Screen *
|
||||
@@ -958,11 +933,13 @@ _gdk_x11_screen_set_surface_scale (GdkX11Screen *x11_screen,
|
||||
_gdk_x11_surface_set_surface_scale (surface, scale);
|
||||
}
|
||||
|
||||
for (i = 0; i < x11_display->monitors->len; i++)
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (x11_display->monitors)); i++)
|
||||
{
|
||||
GdkMonitor *monitor = GDK_MONITOR (x11_display->monitors->pdata[i]);
|
||||
GdkMonitor *monitor = g_list_model_get_item (G_LIST_MODEL (x11_display->monitors), i);
|
||||
|
||||
gdk_monitor_set_scale_factor (monitor, scale);
|
||||
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
|
||||
/* We re-read the monitor sizes so we can apply the new scale */
|
||||
|
||||
+59
-77
@@ -71,10 +71,6 @@
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#endif
|
||||
|
||||
const int _gdk_x11_event_mask_table[21] =
|
||||
{
|
||||
ExposureMask,
|
||||
@@ -110,10 +106,8 @@ static void set_wm_name (GdkDisplay *display,
|
||||
const gchar *name);
|
||||
static void move_to_current_desktop (GdkSurface *surface);
|
||||
static void gdk_x11_toplevel_state_callback (GdkSurface *surface);
|
||||
static void gdk_x11_surface_on_monitor_added (GdkSurface *surface,
|
||||
GdkMonitor *monitor);
|
||||
static void gdk_x11_surface_on_monitor_removed (GdkSurface *surface,
|
||||
GdkMonitor *monitor);
|
||||
static gboolean gdk_x11_toplevel_event_callback (GdkSurface *surface,
|
||||
GdkEvent *gdk_event);
|
||||
|
||||
/* Return whether time1 is considered later than time2 as far as xserver
|
||||
* time is concerned. Accounts for wraparound.
|
||||
@@ -157,6 +151,9 @@ _gdk_x11_surface_get_toplevel (GdkSurface *surface)
|
||||
g_signal_connect (surface, "notify::state",
|
||||
G_CALLBACK (gdk_x11_toplevel_state_callback),
|
||||
NULL);
|
||||
g_signal_connect (surface, "event",
|
||||
G_CALLBACK (gdk_x11_toplevel_event_callback),
|
||||
NULL);
|
||||
}
|
||||
|
||||
return impl->toplevel;
|
||||
@@ -457,6 +454,9 @@ gdk_x11_surface_finalize (GObject *object)
|
||||
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
|
||||
gdk_x11_toplevel_state_callback,
|
||||
NULL);
|
||||
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
|
||||
gdk_x11_toplevel_event_callback,
|
||||
NULL);
|
||||
|
||||
_gdk_x11_surface_grab_check_destroy (GDK_SURFACE (impl));
|
||||
|
||||
@@ -467,13 +467,6 @@ gdk_x11_surface_finalize (GObject *object)
|
||||
_gdk_x11_display_remove_window (display, impl->xid);
|
||||
if (impl->toplevel && impl->toplevel->focus_window)
|
||||
_gdk_x11_display_remove_window (display, impl->toplevel->focus_window);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (display,
|
||||
gdk_x11_surface_on_monitor_added,
|
||||
GDK_SURFACE (object));
|
||||
g_signal_handlers_disconnect_by_func (display,
|
||||
gdk_x11_surface_on_monitor_removed,
|
||||
GDK_SURFACE (object));
|
||||
}
|
||||
|
||||
g_clear_pointer (&impl->surface_is_on_monitor, g_list_free);
|
||||
@@ -988,13 +981,6 @@ _gdk_x11_display_create_surface (GdkDisplay *display,
|
||||
|
||||
gdk_surface_freeze_updates (surface);
|
||||
|
||||
g_signal_connect_swapped (surface->display, "monitor-added",
|
||||
G_CALLBACK (gdk_x11_surface_on_monitor_added),
|
||||
surface);
|
||||
g_signal_connect_swapped (surface->display, "monitor-removed",
|
||||
G_CALLBACK (gdk_x11_surface_on_monitor_removed),
|
||||
surface);
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
@@ -1515,7 +1501,6 @@ show_popup (GdkSurface *surface)
|
||||
{
|
||||
gdk_x11_surface_raise (surface);
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
_gdk_surface_update_viewable (surface);
|
||||
gdk_x11_surface_show (surface, FALSE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
@@ -1602,7 +1587,7 @@ gdk_x11_surface_set_is_on_monitor (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
gdk_x11_surface_check_monitor (GdkSurface *surface,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
@@ -1628,36 +1613,18 @@ void
|
||||
gdk_x11_surface_enter_leave_monitors (GdkSurface *surface)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
int n_monitors, i;
|
||||
GListModel *monitors;
|
||||
guint i;
|
||||
|
||||
n_monitors = gdk_display_get_n_monitors (display);
|
||||
for (i = 0; i < n_monitors; i++)
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
|
||||
{
|
||||
GdkMonitor *monitor = gdk_display_get_monitor (display, i);
|
||||
GdkMonitor *monitor = g_list_model_get_item (monitors, i);
|
||||
gdk_x11_surface_check_monitor (surface, monitor);
|
||||
g_object_unref (monitor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_on_monitor_added (GdkSurface *surface,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
gdk_x11_surface_check_monitor (surface, monitor);
|
||||
g_signal_connect_swapped (G_OBJECT (monitor), "notify::geometry",
|
||||
G_CALLBACK (gdk_x11_surface_check_monitor),
|
||||
surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_on_monitor_removed (GdkSurface *surface,
|
||||
GdkMonitor *monitor)
|
||||
{
|
||||
gdk_x11_surface_check_monitor (surface, monitor);
|
||||
g_signal_handlers_disconnect_by_func (G_OBJECT (monitor),
|
||||
gdk_x11_surface_check_monitor,
|
||||
monitor);
|
||||
}
|
||||
|
||||
static void gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask);
|
||||
@@ -3750,7 +3717,7 @@ wmspec_resize_drag (GdkSurface *surface,
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("gdk_surface_begin_resize_drag: bad resize edge %d!",
|
||||
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!",
|
||||
edge);
|
||||
return;
|
||||
}
|
||||
@@ -4310,14 +4277,15 @@ _should_perform_ewmh_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_x11_toplevel_begin_resize (GdkToplevel *toplevel,
|
||||
GdkSurfaceEdge edge,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
int root_x, root_y;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
@@ -4333,13 +4301,14 @@ gdk_x11_surface_begin_resize_drag (GdkSurface *surface,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_surface_begin_move_drag (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
gint button,
|
||||
gint x,
|
||||
gint y,
|
||||
guint32 timestamp)
|
||||
gdk_x11_toplevel_begin_move (GdkToplevel *toplevel,
|
||||
GdkDevice *device,
|
||||
int button,
|
||||
double x,
|
||||
double y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
int root_x, root_y;
|
||||
gint direction;
|
||||
|
||||
@@ -4630,8 +4599,6 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
|
||||
impl_class->destroy = gdk_x11_surface_destroy;
|
||||
impl_class->beep = gdk_x11_surface_beep;
|
||||
|
||||
impl_class->begin_resize_drag = gdk_x11_surface_begin_resize_drag;
|
||||
impl_class->begin_move_drag = gdk_x11_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_x11_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
|
||||
@@ -4929,6 +4896,7 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
gboolean was_mapped;
|
||||
|
||||
gdk_x11_surface_unminimize (surface);
|
||||
|
||||
@@ -4964,10 +4932,6 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
|
||||
else
|
||||
gdk_x11_surface_unfullscreen (surface);
|
||||
|
||||
{
|
||||
gboolean was_mapped;
|
||||
gboolean did_show;
|
||||
|
||||
if (surface->destroyed)
|
||||
return TRUE;
|
||||
|
||||
@@ -4976,16 +4940,10 @@ gdk_x11_toplevel_present (GdkToplevel *toplevel,
|
||||
if (!was_mapped)
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
|
||||
did_show = _gdk_surface_update_viewable (surface);
|
||||
|
||||
gdk_x11_surface_show (surface, !did_show ? was_mapped : TRUE);
|
||||
gdk_x11_surface_show (surface, was_mapped);
|
||||
|
||||
if (!was_mapped)
|
||||
{
|
||||
if (gdk_surface_is_viewable (surface))
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
}
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -5083,6 +5041,29 @@ gdk_x11_toplevel_state_callback (GdkSurface *surface)
|
||||
gdk_x11_toplevel_restore_system_shortcuts (GDK_TOPLEVEL (surface));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_toplevel_event_callback (GdkSurface *surface,
|
||||
GdkEvent *gdk_event)
|
||||
{
|
||||
GdkSeat *gdk_seat;
|
||||
|
||||
if (!surface->shortcuts_inhibited)
|
||||
return FALSE;
|
||||
|
||||
if (gdk_event_get_event_type (gdk_event) != GDK_GRAB_BROKEN)
|
||||
return FALSE;
|
||||
|
||||
gdk_seat = gdk_surface_get_seat_from_event (surface, gdk_event);
|
||||
if (gdk_seat != surface->current_shortcuts_inhibited_seat)
|
||||
return FALSE;
|
||||
|
||||
surface->current_shortcuts_inhibited_seat = NULL;
|
||||
surface->shortcuts_inhibited = FALSE;
|
||||
g_object_notify (G_OBJECT (surface), "shortcuts-inhibited");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
{
|
||||
@@ -5094,6 +5075,8 @@ gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
|
||||
iface->supports_edge_constraints = gdk_x11_toplevel_supports_edge_constraints;
|
||||
iface->inhibit_system_shortcuts = gdk_x11_toplevel_inhibit_system_shortcuts;
|
||||
iface->restore_system_shortcuts = gdk_x11_toplevel_restore_system_shortcuts;
|
||||
iface->begin_resize = gdk_x11_toplevel_begin_resize;
|
||||
iface->begin_move = gdk_x11_toplevel_begin_move;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@@ -5129,7 +5112,6 @@ gdk_x11_drag_surface_present (GdkDragSurface *drag_surface,
|
||||
|
||||
gdk_x11_surface_toplevel_resize (surface, width, height);
|
||||
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
||||
_gdk_surface_update_viewable (surface);
|
||||
gdk_x11_surface_show (surface, FALSE);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
|
||||
|
||||
@@ -31,10 +31,6 @@
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#ifdef HAVE_XDAMAGE
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XSYNC
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/extensions/sync.h>
|
||||
@@ -73,10 +69,6 @@ struct _GdkX11Surface
|
||||
|
||||
cairo_surface_t *cairo_surface;
|
||||
|
||||
#if defined (HAVE_XCOMPOSITE) && defined(HAVE_XDAMAGE) && defined (HAVE_XFIXES)
|
||||
Damage damage;
|
||||
#endif
|
||||
|
||||
int abs_x;
|
||||
int abs_y;
|
||||
|
||||
@@ -190,6 +182,8 @@ void gdk_x11_surface_pre_damage (GdkSurface *surface);
|
||||
void gdk_x11_surface_move (GdkSurface *surface,
|
||||
gint x,
|
||||
gint y);
|
||||
void gdk_x11_surface_check_monitor (GdkSurface *surface,
|
||||
GdkMonitor *monitor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkX11Screen *gdk_x11_display_get_screen (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkMonitor * gdk_x11_display_get_primary_monitor (GdkDisplay *display);
|
||||
GdkMonitor * gdk_x11_display_get_primary_monitor (GdkDisplay *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_x11_display_grab (GdkDisplay *display);
|
||||
@@ -125,11 +125,6 @@ G_GNUC_WARN_UNUSED_RESULT gint gdk_x11_display_error_trap_pop (GdkDispla
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_x11_register_standard_event_type (GdkDisplay *display,
|
||||
gint event_base,
|
||||
gint n_events);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_x11_set_sm_client_id (const gchar *sm_client_id);
|
||||
|
||||
|
||||
@@ -65,7 +65,6 @@ gdk_x11_deps = [
|
||||
xext_dep,
|
||||
x11_dep,
|
||||
xcursor_dep,
|
||||
xdamage_dep,
|
||||
xfixes_dep,
|
||||
xcomposite_dep,
|
||||
xrandr_dep,
|
||||
|
||||
@@ -756,7 +756,14 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
||||
int height = ceil (node->bounds.origin.y + node->bounds.size.height) - y;
|
||||
int scale = broadway_display->scale_factor;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale);
|
||||
#define MAX_IMAGE_SIZE 32767
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
MIN (width * scale, MAX_IMAGE_SIZE),
|
||||
MIN (height * scale, MAX_IMAGE_SIZE));
|
||||
|
||||
#undef MAX_IMAGE_SIZE
|
||||
|
||||
cr = cairo_create (surface);
|
||||
cairo_scale (cr, scale, scale);
|
||||
cairo_translate (cr, -x, -y);
|
||||
|
||||
+12
-3
@@ -1177,18 +1177,27 @@ render_clipped_child (GskGLRenderer *self,
|
||||
&transformed_clip))
|
||||
{
|
||||
/* well fuck */
|
||||
const float scale = ops_get_scale (builder);
|
||||
gboolean is_offscreen;
|
||||
TextureRegion region;
|
||||
GskRoundedRect scaled_clip;
|
||||
|
||||
ops_push_clip (builder, &child_clip);
|
||||
memset (&scaled_clip, 0, sizeof (GskRoundedRect));
|
||||
|
||||
scaled_clip.bounds.origin.x = clip->origin.x * scale;
|
||||
scaled_clip.bounds.origin.y = clip->origin.y * scale;
|
||||
scaled_clip.bounds.size.width = clip->size.width * scale;
|
||||
scaled_clip.bounds.size.height = clip->size.height * scale;
|
||||
|
||||
ops_push_clip (builder, &scaled_clip);
|
||||
if (!add_offscreen_ops (self, builder, &child->bounds,
|
||||
child,
|
||||
®ion, &is_offscreen,
|
||||
RESET_OPACITY | RESET_CLIP))
|
||||
RESET_OPACITY | FORCE_OFFSCREEN))
|
||||
g_assert_not_reached ();
|
||||
|
||||
ops_pop_clip (builder);
|
||||
|
||||
|
||||
ops_set_program (builder, &self->programs->blit_program);
|
||||
ops_set_texture (builder, region.texture_id);
|
||||
|
||||
|
||||
+19
-14
@@ -98,25 +98,30 @@ typedef enum {
|
||||
* @GSK_BLEND_MODE_DEFAULT: The default blend mode, which specifies no blending
|
||||
* @GSK_BLEND_MODE_MULTIPLY: The source color is multiplied by the destination
|
||||
* and replaces the destination
|
||||
* @GSK_BLEND_MODE_SCREEN: ...
|
||||
* @GSK_BLEND_MODE_OVERLAY: ...
|
||||
* @GSK_BLEND_MODE_DARKEN: ...
|
||||
* @GSK_BLEND_MODE_LIGHTEN: ...
|
||||
* @GSK_BLEND_MODE_COLOR_DODGE: ...
|
||||
* @GSK_BLEND_MODE_COLOR_BURN: ...
|
||||
* @GSK_BLEND_MODE_HARD_LIGHT: ...
|
||||
* @GSK_BLEND_MODE_SOFT_LIGHT: ...
|
||||
* @GSK_BLEND_MODE_DIFFERENCE: ...
|
||||
* @GSK_BLEND_MODE_EXCLUSION: ...
|
||||
* @GSK_BLEND_MODE_COLOR: ...
|
||||
* @GSK_BLEND_MODE_HUE: ...
|
||||
* @GSK_BLEND_MODE_SATURATION: ...
|
||||
* @GSK_BLEND_MODE_LUMINOSITY: ...
|
||||
* @GSK_BLEND_MODE_SCREEN: Multiplies the complements of the destination and source
|
||||
* color values, then complements the result.
|
||||
* @GSK_BLEND_MODE_OVERLAY: Multiplies or screens the colors, depending on the
|
||||
* destination color value. This is the inverse of hard-list
|
||||
* @GSK_BLEND_MODE_DARKEN: Selects the darker of the destination and source colors
|
||||
* @GSK_BLEND_MODE_LIGHTEN: Selects the lighter of the destination and source colors
|
||||
* @GSK_BLEND_MODE_COLOR_DODGE: Brightens the destination color to reflect the source color
|
||||
* @GSK_BLEND_MODE_COLOR_BURN: Darkens the destination color to reflect the source color
|
||||
* @GSK_BLEND_MODE_HARD_LIGHT: Multiplies or screens the colors, depending on the source color value
|
||||
* @GSK_BLEND_MODE_SOFT_LIGHT: Darkens or lightens the colors, depending on the source color value
|
||||
* @GSK_BLEND_MODE_DIFFERENCE: Subtracts the darker of the two constituent colors from the lighter color
|
||||
* @GSK_BLEND_MODE_EXCLUSION: Produces an effect similar to that of the difference mode but lower in contrast
|
||||
* @GSK_BLEND_MODE_COLOR: Creates a color with the hue and saturation of the source color and the luminosity of the destination color
|
||||
* @GSK_BLEND_MODE_HUE: Creates a color with the hue of the source color and the saturation and luminosity of the destination color
|
||||
* @GSK_BLEND_MODE_SATURATION: Creates a color with the saturation of the source color and the hue and luminosity of the destination color
|
||||
* @GSK_BLEND_MODE_LUMINOSITY: Creates a color with the luminosity of the source color and the hue and saturation of the destination color
|
||||
*
|
||||
* The blend modes available for render nodes.
|
||||
*
|
||||
* The implementation of each blend mode is deferred to the
|
||||
* rendering pipeline.
|
||||
*
|
||||
* See https://www.w3.org/TR/compositing-1/#blending for more information
|
||||
* on blending and blend modes.
|
||||
*/
|
||||
typedef enum {
|
||||
GSK_BLEND_MODE_DEFAULT = 0,
|
||||
|
||||
+23
-1
@@ -2331,6 +2331,28 @@ gsk_color_matrix_node_draw (GskRenderNode *node,
|
||||
cairo_pattern_destroy (pattern);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_color_matrix_node_diff (GskRenderNode *node1,
|
||||
GskRenderNode *node2,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GskColorMatrixNode *self1 = (GskColorMatrixNode *) node1;
|
||||
GskColorMatrixNode *self2 = (GskColorMatrixNode *) node2;
|
||||
|
||||
if (!graphene_vec4_equal (&self1->color_offset, &self2->color_offset))
|
||||
goto nope;
|
||||
|
||||
if (!graphene_matrix_equal_fast (&self1->color_matrix, &self2->color_matrix))
|
||||
goto nope;
|
||||
|
||||
gsk_render_node_diff (self1->child, self2->child, region);
|
||||
return;
|
||||
|
||||
nope:
|
||||
gsk_render_node_diff_impossible (node1, node2, region);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_color_matrix_node_new:
|
||||
* @child: The node to draw
|
||||
@@ -4311,7 +4333,7 @@ gsk_render_node_init_types_once (void)
|
||||
gsk_color_matrix_node_finalize,
|
||||
gsk_color_matrix_node_draw,
|
||||
NULL,
|
||||
NULL,
|
||||
gsk_color_matrix_node_diff,
|
||||
};
|
||||
|
||||
GType node_type = gsk_render_node_type_register_static (I_("GskColorMatrixNode"), &node_info);
|
||||
|
||||
+1
-1
@@ -1043,7 +1043,7 @@ gtk_cell_area_real_event (GtkCellArea *area,
|
||||
GtkCellRenderer *focus_renderer;
|
||||
GdkRectangle alloc_area;
|
||||
double event_x, event_y;
|
||||
int x, y;
|
||||
double x, y;
|
||||
GtkNative *native;
|
||||
|
||||
/* We may need some semantics to tell us the offset of the event
|
||||
|
||||
@@ -274,6 +274,7 @@ get_child_position (GtkOverlay *overlay,
|
||||
GtkRequisition req;
|
||||
GtkAllocation alloc;
|
||||
gint s, e;
|
||||
double x, y;
|
||||
|
||||
gtk_widget_get_preferred_size (widget, &req, NULL);
|
||||
|
||||
@@ -287,11 +288,11 @@ get_child_position (GtkOverlay *overlay,
|
||||
gtk_widget_translate_coordinates (editor->sv_plane,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
0, -6,
|
||||
&allocation->x, &allocation->y);
|
||||
&x, &y);
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (overlay)) == GTK_TEXT_DIR_RTL)
|
||||
allocation->x = 0;
|
||||
x = 0;
|
||||
else
|
||||
allocation->x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
|
||||
x = gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width;
|
||||
}
|
||||
else if (widget == editor->h_popup)
|
||||
{
|
||||
@@ -302,12 +303,12 @@ get_child_position (GtkOverlay *overlay,
|
||||
gtk_widget_translate_coordinates (editor->h_slider,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
- req.width - 6, editor->popup_position - req.height / 2,
|
||||
&allocation->x, &allocation->y);
|
||||
&x, &y);
|
||||
else
|
||||
gtk_widget_translate_coordinates (editor->h_slider,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
alloc.width + 6, editor->popup_position - req.height / 2,
|
||||
&allocation->x, &allocation->y);
|
||||
&x, &y);
|
||||
}
|
||||
else if (widget == editor->a_popup)
|
||||
{
|
||||
@@ -317,13 +318,13 @@ get_child_position (GtkOverlay *overlay,
|
||||
gtk_widget_translate_coordinates (editor->a_slider,
|
||||
gtk_widget_get_parent (editor->grid),
|
||||
editor->popup_position - req.width / 2, - req.height - 6,
|
||||
&allocation->x, &allocation->y);
|
||||
&x, &y);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
allocation->x = CLAMP (allocation->x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
|
||||
allocation->y = CLAMP (allocation->y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
|
||||
allocation->x = CLAMP (x, 0, gtk_widget_get_width (GTK_WIDGET (overlay)) - req.width);
|
||||
allocation->y = CLAMP (y, 0, gtk_widget_get_height (GTK_WIDGET (overlay)) - req.height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "gtkcolorchooserprivate.h"
|
||||
#include "gtkgesturelongpress.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkcolorutils.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkrangeprivate.h"
|
||||
@@ -53,6 +54,12 @@ static void hold_action (GtkGestureLongPress *gesture,
|
||||
gdouble y,
|
||||
GtkWidget *scale);
|
||||
|
||||
static void click_action (GtkGestureClick *gesture,
|
||||
guint n_presses,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *scale);
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkColorScale, gtk_color_scale, GTK_TYPE_SCALE)
|
||||
|
||||
void
|
||||
@@ -160,6 +167,12 @@ gtk_color_scale_init (GtkColorScale *scale)
|
||||
GTK_PHASE_TARGET);
|
||||
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gesture = gtk_gesture_click_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (click_action), scale);
|
||||
gtk_widget_add_controller (GTK_WIDGET (scale), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (scale), "color");
|
||||
}
|
||||
|
||||
@@ -256,6 +269,18 @@ hold_action (GtkGestureLongPress *gesture,
|
||||
"s", gtk_widget_get_name (scale));
|
||||
}
|
||||
|
||||
static void
|
||||
click_action (GtkGestureClick *gesture,
|
||||
guint n_presses,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *scale)
|
||||
{
|
||||
gtk_widget_activate_action (scale,
|
||||
"color.edit",
|
||||
"s", gtk_widget_get_name (scale));
|
||||
}
|
||||
|
||||
static void
|
||||
scale_finalize (GObject *object)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ struct _GtkCssValue {
|
||||
GTK_CSS_VALUE_BASE
|
||||
};
|
||||
|
||||
static void
|
||||
static void G_GNUC_NORETURN
|
||||
gtk_css_value_inherit_free (GtkCssValue *value)
|
||||
{
|
||||
/* Can only happen if the unique value gets unreffed too often */
|
||||
|
||||
@@ -30,7 +30,7 @@ struct _GtkCssValue {
|
||||
GTK_CSS_VALUE_BASE
|
||||
};
|
||||
|
||||
static void
|
||||
static void G_GNUC_NORETURN
|
||||
gtk_css_value_initial_free (GtkCssValue *value)
|
||||
{
|
||||
/* Can only happen if the unique value gets unreffed too often */
|
||||
|
||||
+10
-10
@@ -27,6 +27,7 @@
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtknativeprivate.h"
|
||||
#include "gtkpicture.h"
|
||||
#include "gtkcssboxesimplprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
|
||||
/* for the drag icons */
|
||||
@@ -119,18 +120,17 @@ gtk_drag_icon_native_get_renderer (GtkNative *native)
|
||||
|
||||
static void
|
||||
gtk_drag_icon_native_get_surface_transform (GtkNative *native,
|
||||
int *x,
|
||||
int *y)
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
GtkCssStyle *style;
|
||||
GtkCssBoxes css_boxes;
|
||||
const graphene_rect_t *margin_rect;
|
||||
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (GTK_WIDGET (native)));
|
||||
*x = _gtk_css_number_value_get (style->size->margin_left, 100) +
|
||||
_gtk_css_number_value_get (style->border->border_left_width, 100) +
|
||||
_gtk_css_number_value_get (style->size->padding_left, 100);
|
||||
*y = _gtk_css_number_value_get (style->size->margin_top, 100) +
|
||||
_gtk_css_number_value_get (style->border->border_top_width, 100) +
|
||||
_gtk_css_number_value_get (style->size->padding_top, 100);
|
||||
gtk_css_boxes_init (&css_boxes, GTK_WIDGET (native));
|
||||
margin_rect = gtk_css_boxes_get_margin_rect (&css_boxes);
|
||||
|
||||
*x = - margin_rect->origin.x;
|
||||
*y = - margin_rect->origin.y;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+3
-3
@@ -490,7 +490,7 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GdkDevice *device;
|
||||
int x, y;
|
||||
double x, y;
|
||||
GtkNative *native;
|
||||
GdkSurface *surface;
|
||||
double px, py;
|
||||
@@ -509,8 +509,8 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
|
||||
gtk_widget_translate_coordinates (widget, GTK_WIDGET (native), source->start_x, source->start_y, &x, &y);
|
||||
gdk_surface_get_device_position (surface, device, &px, &py, NULL);
|
||||
|
||||
dx = round (px) - x;
|
||||
dy = round (py) - y;
|
||||
dx = round (px - x);
|
||||
dy = round (py - y);
|
||||
|
||||
g_signal_emit (source, signals[PREPARE], 0, source->start_x, source->start_y, &content);
|
||||
if (!content)
|
||||
|
||||
@@ -253,7 +253,7 @@ scroll_to_child (GtkWidget *child)
|
||||
GtkEmojiChooser *chooser;
|
||||
GtkAdjustment *adj;
|
||||
GtkAllocation alloc;
|
||||
int pos;
|
||||
double pos;
|
||||
double value;
|
||||
double page_size;
|
||||
|
||||
|
||||
+1
-1
@@ -2799,7 +2799,7 @@ gtk_entry_get_icon_at_pos (GtkEntry *entry,
|
||||
for (i = 0; i < MAX_ICONS; i++)
|
||||
{
|
||||
EntryIconInfo *icon_info = priv->icons[i];
|
||||
int icon_x, icon_y;
|
||||
double icon_x, icon_y;
|
||||
|
||||
if (icon_info == NULL)
|
||||
continue;
|
||||
|
||||
@@ -329,12 +329,11 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller,
|
||||
}
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
{
|
||||
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
|
||||
g_signal_emit (controller, signals[SCROLL], 0, dx, dy, &handled);
|
||||
|
||||
if (scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
|
||||
scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
|
||||
}
|
||||
if (direction == GDK_SCROLL_SMOOTH &&
|
||||
scroll->flags & GTK_EVENT_CONTROLLER_SCROLL_KINETIC)
|
||||
scroll_history_push (scroll, dx, dy, gdk_event_get_time (event));
|
||||
|
||||
if (scroll->active && gdk_scroll_event_is_stop (event))
|
||||
{
|
||||
|
||||
@@ -1428,6 +1428,7 @@ rename_selected_cb (GtkTreeModel *model,
|
||||
GtkFileChooserWidget *impl = data;
|
||||
GdkRectangle rect;
|
||||
gchar *filename;
|
||||
double x, y;
|
||||
|
||||
gtk_tree_model_get (model, iter,
|
||||
MODEL_COL_FILE, &impl->rename_file_source_file,
|
||||
@@ -1442,7 +1443,9 @@ rename_selected_cb (GtkTreeModel *model,
|
||||
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
||||
GTK_WIDGET (impl),
|
||||
rect.x, rect.y,
|
||||
&rect.x, &rect.y);
|
||||
&x, &y);
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
|
||||
filename = g_file_get_basename (impl->rename_file_source_file);
|
||||
gtk_editable_set_text (GTK_EDITABLE (impl->rename_file_name_entry), filename);
|
||||
@@ -2009,9 +2012,10 @@ file_list_show_popover (GtkFileChooserWidget *impl,
|
||||
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
||||
GTK_WIDGET (impl),
|
||||
rect.x, rect.y,
|
||||
&rect.x, &rect.y);
|
||||
&x, &y);
|
||||
|
||||
rect.x = CLAMP (x - 20, 0, bounds.size.width - 40);
|
||||
rect.y = y;
|
||||
rect.width = 40;
|
||||
|
||||
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
|
||||
@@ -2113,15 +2117,14 @@ click_cb (GtkGesture *gesture,
|
||||
GtkFileChooserWidget *impl)
|
||||
{
|
||||
PopoverData *pd;
|
||||
int xx, yy;
|
||||
|
||||
pd = g_new (PopoverData, 1);
|
||||
pd->impl = impl;
|
||||
gtk_widget_translate_coordinates (impl->browse_files_tree_view,
|
||||
GTK_WIDGET (impl),
|
||||
x, y, &xx, &yy);
|
||||
pd->x = xx;
|
||||
pd->y = yy;
|
||||
x, y, &x, &y);
|
||||
pd->x = x;
|
||||
pd->y = y;
|
||||
|
||||
g_idle_add (file_list_show_popover_in_idle, pd);
|
||||
}
|
||||
|
||||
@@ -354,6 +354,7 @@ notify_cursor_location (GtkIMContextWayland *context)
|
||||
{
|
||||
GtkIMContextWaylandGlobal *global;
|
||||
cairo_rectangle_int_t rect;
|
||||
double x, y;
|
||||
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
@@ -363,8 +364,10 @@ notify_cursor_location (GtkIMContextWayland *context)
|
||||
gtk_widget_translate_coordinates (context->widget,
|
||||
GTK_WIDGET (gtk_widget_get_root (context->widget)),
|
||||
rect.x, rect.y,
|
||||
&rect.x, &rect.y);
|
||||
&x, &y);
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
|
||||
+51
-81
@@ -291,10 +291,6 @@ struct _GtkLabel
|
||||
gint width_chars;
|
||||
gint max_width_chars;
|
||||
gint lines;
|
||||
|
||||
int min_width, min_height;
|
||||
int nat_width, nat_height;
|
||||
int min_baseline, nat_baseline;
|
||||
};
|
||||
|
||||
struct _GtkLabelClass
|
||||
@@ -1782,42 +1778,7 @@ gtk_label_recalculate (GtkLabel *self)
|
||||
g_object_notify_by_pspec (G_OBJECT (self), label_props[PROP_MNEMONIC_KEYVAL]);
|
||||
}
|
||||
|
||||
if (self->wrap)
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
else
|
||||
{
|
||||
int min_width = self->min_width;
|
||||
int min_height = self->min_height;
|
||||
int nat_width = self->nat_width;
|
||||
int nat_height = self->nat_height;
|
||||
int min_baseline = self->min_baseline;
|
||||
int nat_baseline = self->nat_baseline;
|
||||
|
||||
gtk_label_measure (GTK_WIDGET (self),
|
||||
GTK_ORIENTATION_HORIZONTAL,
|
||||
-1,
|
||||
&min_width, &nat_width,
|
||||
NULL, NULL);
|
||||
gtk_label_measure (GTK_WIDGET (self),
|
||||
GTK_ORIENTATION_VERTICAL,
|
||||
-1,
|
||||
&min_height, &nat_height,
|
||||
&min_baseline, &nat_baseline);
|
||||
|
||||
if (min_width != self->min_width ||
|
||||
min_height != self->min_height ||
|
||||
nat_width != self->nat_width ||
|
||||
nat_height != self->nat_height ||
|
||||
min_baseline != self->min_baseline ||
|
||||
nat_baseline != self->nat_baseline)
|
||||
{
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
}
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3215,19 +3176,6 @@ gtk_label_measure (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
gtk_label_get_preferred_size (widget, orientation, minimum, natural, minimum_baseline, natural_baseline);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
self->min_width = *minimum;
|
||||
self->nat_width = *natural;
|
||||
}
|
||||
else
|
||||
{
|
||||
self->min_height = *minimum;
|
||||
self->nat_height = *natural;
|
||||
self->min_baseline = *minimum_baseline;
|
||||
self->nat_baseline = *natural_baseline;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4989,25 +4937,37 @@ gtk_label_get_single_line_mode (GtkLabel *self)
|
||||
*/
|
||||
static void
|
||||
get_better_cursor (GtkLabel *self,
|
||||
gint index,
|
||||
gint *x,
|
||||
gint *y)
|
||||
int index,
|
||||
int *x,
|
||||
int *y)
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
|
||||
GdkDevice *device = gdk_seat_get_keyboard (seat);
|
||||
PangoDirection keymap_direction = gdk_device_get_direction (device);
|
||||
PangoDirection cursor_direction = get_cursor_direction (self);
|
||||
GdkSeat *seat;
|
||||
GdkDevice *keyboard;
|
||||
PangoDirection keymap_direction;
|
||||
PangoDirection cursor_direction;
|
||||
gboolean split_cursor;
|
||||
PangoRectangle strong_pos, weak_pos;
|
||||
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
|
||||
if (seat)
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
keyboard = NULL;
|
||||
if (keyboard)
|
||||
keymap_direction = gdk_device_get_direction (keyboard);
|
||||
else
|
||||
keymap_direction = PANGO_DIRECTION_LTR;
|
||||
|
||||
cursor_direction = get_cursor_direction (self);
|
||||
|
||||
g_object_get (gtk_widget_get_settings (GTK_WIDGET (self)),
|
||||
"gtk-split-cursor", &split_cursor,
|
||||
NULL);
|
||||
"gtk-split-cursor", &split_cursor,
|
||||
NULL);
|
||||
|
||||
gtk_label_ensure_layout (self);
|
||||
|
||||
|
||||
pango_layout_get_cursor_pos (self->layout, index,
|
||||
&strong_pos, &weak_pos);
|
||||
&strong_pos, &weak_pos);
|
||||
|
||||
if (split_cursor)
|
||||
{
|
||||
@@ -5017,15 +4977,15 @@ get_better_cursor (GtkLabel *self,
|
||||
else
|
||||
{
|
||||
if (keymap_direction == cursor_direction)
|
||||
{
|
||||
*x = strong_pos.x / PANGO_SCALE;
|
||||
*y = strong_pos.y / PANGO_SCALE;
|
||||
}
|
||||
{
|
||||
*x = strong_pos.x / PANGO_SCALE;
|
||||
*y = strong_pos.y / PANGO_SCALE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*x = weak_pos.x / PANGO_SCALE;
|
||||
*y = weak_pos.y / PANGO_SCALE;
|
||||
}
|
||||
{
|
||||
*x = weak_pos.x / PANGO_SCALE;
|
||||
*y = weak_pos.y / PANGO_SCALE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5093,16 +5053,26 @@ gtk_label_move_visually (GtkLabel *self,
|
||||
NULL);
|
||||
|
||||
if (split_cursor)
|
||||
strong = TRUE;
|
||||
strong = TRUE;
|
||||
else
|
||||
{
|
||||
GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
|
||||
GdkDevice *device = gdk_seat_get_keyboard (seat);
|
||||
PangoDirection keymap_direction = gdk_device_get_direction (device);
|
||||
{
|
||||
GdkSeat *seat;
|
||||
GdkDevice *keyboard;
|
||||
PangoDirection keymap_direction;
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
|
||||
if (seat)
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
keyboard = NULL;
|
||||
if (keyboard)
|
||||
keymap_direction = gdk_device_get_direction (keyboard);
|
||||
else
|
||||
keymap_direction = PANGO_DIRECTION_LTR;
|
||||
|
||||
strong = keymap_direction == get_cursor_direction (self);
|
||||
}
|
||||
|
||||
strong = keymap_direction == get_cursor_direction (self);
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
pango_layout_move_cursor_visually (self->layout, strong, index, 0, 1, &new_index, &new_trailing);
|
||||
|
||||
+22
-5
@@ -96,6 +96,7 @@
|
||||
#include "gsk/gskprivate.h"
|
||||
#include "gsk/gskrendernodeprivate.h"
|
||||
#include "gtkarrayimplprivate.h"
|
||||
#include "gtknativeprivate.h"
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
@@ -1280,8 +1281,10 @@ translate_event_coordinates (GdkEvent *event,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkWidget *event_widget;
|
||||
GtkNative *native;
|
||||
graphene_point_t p;
|
||||
double event_x, event_y;
|
||||
double native_x, native_y;
|
||||
|
||||
*x = *y = 0;
|
||||
|
||||
@@ -1289,6 +1292,11 @@ translate_event_coordinates (GdkEvent *event,
|
||||
return FALSE;
|
||||
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
native = gtk_widget_get_native (event_widget);
|
||||
|
||||
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
|
||||
event_x -= native_x;
|
||||
event_y -= native_y;
|
||||
|
||||
if (!gtk_widget_compute_point (event_widget,
|
||||
widget,
|
||||
@@ -1424,7 +1432,8 @@ update_pointer_focus_state (GtkWindow *toplevel,
|
||||
GtkWidget *old_target = NULL;
|
||||
GdkEventSequence *sequence;
|
||||
GdkDevice *device;
|
||||
gdouble x, y;
|
||||
double x, y;
|
||||
double nx, ny;
|
||||
|
||||
device = gdk_event_get_device (event);
|
||||
sequence = gdk_event_get_event_sequence (event);
|
||||
@@ -1433,6 +1442,10 @@ update_pointer_focus_state (GtkWindow *toplevel,
|
||||
return old_target;
|
||||
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
gtk_native_get_surface_transform (GTK_NATIVE (toplevel), &nx, &ny);
|
||||
x -= nx;
|
||||
y -= ny;
|
||||
|
||||
gtk_window_update_pointer_focus (toplevel, device, sequence,
|
||||
new_target, x, y);
|
||||
|
||||
@@ -1511,7 +1524,8 @@ handle_pointing_event (GdkEvent *event)
|
||||
GtkWindow *toplevel;
|
||||
GdkEventSequence *sequence;
|
||||
GdkDevice *device;
|
||||
gdouble x, y;
|
||||
double x, y;
|
||||
double native_x, native_y;
|
||||
GtkWidget *native;
|
||||
GdkEventType type;
|
||||
|
||||
@@ -1522,6 +1536,10 @@ handle_pointing_event (GdkEvent *event)
|
||||
toplevel = GTK_WINDOW (gtk_widget_get_root (event_widget));
|
||||
native = GTK_WIDGET (gtk_widget_get_native (event_widget));
|
||||
|
||||
gtk_native_get_surface_transform (GTK_NATIVE (native), &native_x, &native_y);
|
||||
x -= native_x;
|
||||
y -= native_y;
|
||||
|
||||
type = gdk_event_get_event_type (event);
|
||||
sequence = gdk_event_get_event_sequence (event);
|
||||
|
||||
@@ -1555,7 +1573,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
target = gtk_window_lookup_pointer_focus_implicit_grab (toplevel, device, sequence);
|
||||
|
||||
if (!target)
|
||||
target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
|
||||
target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
|
||||
|
||||
if (!target)
|
||||
target = GTK_WIDGET (native);
|
||||
@@ -1601,8 +1619,7 @@ handle_pointing_event (GdkEvent *event)
|
||||
|
||||
if (type == GDK_BUTTON_RELEASE)
|
||||
{
|
||||
GtkWidget *new_target;
|
||||
new_target = gtk_widget_pick (GTK_WIDGET (native), x, y, GTK_PICK_DEFAULT);
|
||||
GtkWidget *new_target = gtk_widget_pick (native, x, y, GTK_PICK_DEFAULT);
|
||||
if (new_target == NULL)
|
||||
new_target = GTK_WIDGET (toplevel);
|
||||
gtk_synthesize_crossing_events (GTK_ROOT (toplevel), GTK_CROSSING_POINTER, target, new_target,
|
||||
|
||||
+13
-4
@@ -48,8 +48,8 @@ gtk_native_default_get_renderer (GtkNative *self)
|
||||
|
||||
static void
|
||||
gtk_native_default_get_surface_transform (GtkNative *self,
|
||||
int *x,
|
||||
int *y)
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
*x = 0;
|
||||
*y = 0;
|
||||
@@ -100,10 +100,19 @@ gtk_native_get_renderer (GtkNative *self)
|
||||
return GTK_NATIVE_GET_IFACE (self)->get_renderer (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_native_get_surface_transform:
|
||||
* @self: a @GtkNative
|
||||
* @x: (out): return location for the x coordinate
|
||||
* @y: (out): return location for the y coordinate
|
||||
*
|
||||
* Retrieves the surface transform of @self. This is the translation
|
||||
* from @self's surface coordinates into @self's widget coordinates.
|
||||
*/
|
||||
void
|
||||
gtk_native_get_surface_transform (GtkNative *self,
|
||||
int *x,
|
||||
int *y)
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_NATIVE (self));
|
||||
g_return_if_fail (x != NULL);
|
||||
|
||||
+7
-2
@@ -49,8 +49,8 @@ struct _GtkNativeInterface
|
||||
GskRenderer * (* get_renderer) (GtkNative *self);
|
||||
|
||||
void (* get_surface_transform) (GtkNative *self,
|
||||
int *x,
|
||||
int *y);
|
||||
double *x,
|
||||
double *y);
|
||||
|
||||
void (* check_resize) (GtkNative *self);
|
||||
};
|
||||
@@ -67,6 +67,11 @@ GdkSurface *gtk_native_get_surface (GtkNative *self);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer *gtk_native_get_renderer (GtkNative *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_native_get_surface_transform (GtkNative *self,
|
||||
double *x,
|
||||
double *y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_NATIVE_H__ */
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_native_get_surface_transform (GtkNative *self,
|
||||
int *x,
|
||||
int *y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_NATIVE_PRIVATE_H__ */
|
||||
|
||||
+13
-4
@@ -167,12 +167,20 @@ gtk_password_entry_realize (GtkWidget *widget)
|
||||
{
|
||||
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
|
||||
GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry);
|
||||
GdkSeat *seat;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_password_entry_parent_class)->realize (widget);
|
||||
|
||||
priv->keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (gtk_widget_get_display (widget)));
|
||||
g_signal_connect (priv->keyboard, "notify::caps-lock-state", G_CALLBACK (caps_lock_state_changed), entry);
|
||||
caps_lock_state_changed (priv->keyboard, NULL, widget);
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
||||
if (seat)
|
||||
priv->keyboard = gdk_seat_get_keyboard (seat);
|
||||
|
||||
if (priv->keyboard)
|
||||
{
|
||||
g_signal_connect (priv->keyboard, "notify::caps-lock-state",
|
||||
G_CALLBACK (caps_lock_state_changed), entry);
|
||||
caps_lock_state_changed (priv->keyboard, NULL, widget);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -496,7 +504,8 @@ gtk_password_entry_set_show_peek_icon (GtkPasswordEntry *entry,
|
||||
entry);
|
||||
}
|
||||
|
||||
caps_lock_state_changed (priv->keyboard, NULL, GTK_WIDGET (entry));
|
||||
if (priv->keyboard)
|
||||
caps_lock_state_changed (priv->keyboard, NULL, GTK_WIDGET (entry));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SHOW_PEEK_ICON]);
|
||||
}
|
||||
|
||||
@@ -1686,8 +1686,6 @@ drag_motion_callback (GtkDropTarget *target,
|
||||
|
||||
if (row != NULL)
|
||||
{
|
||||
gint dest_y, dest_x;
|
||||
|
||||
g_object_get (row, "order-index", &row_index, NULL);
|
||||
g_object_get (sidebar->row_placeholder, "order-index", &row_placeholder_index, NULL);
|
||||
/* We order the bookmarks sections based on the bookmark index that we
|
||||
@@ -1703,9 +1701,9 @@ drag_motion_callback (GtkDropTarget *target,
|
||||
row_placeholder_index = row_index;
|
||||
gtk_widget_translate_coordinates (GTK_WIDGET (sidebar), GTK_WIDGET (row),
|
||||
x, y,
|
||||
&dest_x, &dest_y);
|
||||
&x, &y);
|
||||
|
||||
if (dest_y > sidebar->drag_row_height / 2 && row_index > 0)
|
||||
if (y > sidebar->drag_row_height / 2 && row_index > 0)
|
||||
row_placeholder_index++;
|
||||
}
|
||||
else
|
||||
@@ -3459,8 +3457,8 @@ on_row_dragged (GtkGestureDrag *gesture,
|
||||
|
||||
if (gtk_drag_check_threshold (GTK_WIDGET (row), 0, 0, x, y))
|
||||
{
|
||||
gdouble start_x, start_y;
|
||||
gint drag_x, drag_y;
|
||||
double start_x, start_y;
|
||||
double drag_x, drag_y;
|
||||
GdkContentProvider *content;
|
||||
GdkSurface *surface;
|
||||
GdkDevice *device;
|
||||
|
||||
+4
-1
@@ -1898,14 +1898,17 @@ on_address_entry_show_help_pressed (GtkPlacesView *view,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
double x, y;
|
||||
|
||||
/* Setup the auxiliary popover's rectangle */
|
||||
gtk_entry_get_icon_area (GTK_ENTRY (view->address_entry),
|
||||
GTK_ENTRY_ICON_SECONDARY,
|
||||
&rect);
|
||||
gtk_widget_translate_coordinates (view->address_entry, GTK_WIDGET (view),
|
||||
rect.x, rect.y, &rect.x, &rect.y);
|
||||
rect.x, rect.y, &x, &y);
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (view->server_adresses_popover), &rect);
|
||||
gtk_widget_set_visible (view->server_adresses_popover, TRUE);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user