Compare commits

..

5 Commits

Author SHA1 Message Date
Matthias Clasen 8752a7c5e6 ci: Try to fix installed tests 2022-12-16 22:07:51 -05:00
Matthias Clasen 6705ec0856 ci: Switch to v40 and drop pip install 2022-12-16 16:21:02 -05:00
Matthias Clasen 329be57fe6 ci: Back to pip install in the image
Trying to get a user-installed meson
to work is just too much of a hassle.
2022-12-16 16:21:02 -05:00
Matthias Clasen 22b16f795c ci: export the right path 2022-12-16 15:06:58 -05:00
Matthias Clasen 4a14b5f8bc ci: Try to get more info 2022-12-16 14:58:07 -05:00
211 changed files with 12059 additions and 17387 deletions
+48 -64
View File
@@ -22,9 +22,9 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v40"
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
@@ -71,6 +71,11 @@ style-check-diff:
key: "$CI_JOB_NAME"
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64:
extends: .build-fedora-default
@@ -80,10 +85,7 @@ fedora-x86_64:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- mkdir _install
- meson setup
--prefix=${CI_PROJECT_DIR}/_install
@@ -109,16 +111,8 @@ release-build:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson setup ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS} _build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build x11
@@ -140,24 +134,39 @@ fedora-mingw64:
# mingw64-graphene (rawhide)
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
# Test that mingw64-meson still fails. If it has stopped failing, the CI
# will fail and now you should remove the hack that follows this.
- FAILED=false
- mingw64-meson --version || FAILED=true
- test $FAILED = false && echo "mingw64-meson works now, remove the hack" && exit 1
# HACK: Running mingw64-meson directly fails on the CI with:
# /usr/bin/mingw64-meson: line 92: fg: no job control
# Because rpm is not evaluating %__meson and it gets interpreted as a job
# specifier. So we fix that and run it ourselves.
- rpm --eval "%{mingw64_meson}" > mingw64-meson.sh
- sed -i -e 's/%__meson/meson/' mingw64-meson.sh
- chmod +x mingw64-meson.sh
- ./mingw64-meson.sh -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- ninja -C _build
- mkdir _build && cd _build
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
- ninja
installed-tests:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "-Dinstall-tests=true"
G_TEST_ACCESSIBLE: 1
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects download
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- sudo meson install -C _build
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--parallel=0
--dirs "${CI_PROJECT_DIR}/_installed/share"
gtk-4.0
artifacts:
paths:
- "_build/installed-tests-report/"
.mingw-defaults:
extends: .only-default
@@ -190,8 +199,6 @@ msys2-mingw64:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
# Sadly, this fails regularly, and its failure is never enlightening
allow_failure: true
extends: .only-default
only:
- branches@GNOME/gtk
@@ -206,7 +213,7 @@ macos:
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
script:
- meson setup ${COMMON_MESON_FLAGS}
- meson setup
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
@@ -215,10 +222,6 @@ macos:
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Ddemos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
_build
- meson compile -C _build
artifacts:
@@ -345,20 +348,15 @@ static-scan:
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
_scan_build
- meson setup ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} _scan_build
- ninja -C _scan_build scan-build
artifacts:
paths:
- _scan_build/meson-logs
allow_failure: true
# Run tests with the address sanitizer. We need to turn off introspection
# and f16c, since they are incompatible with asan
# Run tests with the address sanitizer. We need to turn off introspection,
# since it is incompatible with asan
asan-build:
image: $FEDORA_IMAGE
tags: [ asan ]
@@ -366,9 +364,7 @@ asan-build:
needs: []
variables:
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Df16c=disabled _build
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled _build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
artifacts:
@@ -380,22 +376,10 @@ reference:
image: $FEDORA_IMAGE
stage: docs
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release --force-fallback-for=gdk-pixbuf,pango"
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
--buildtype=release
--force-fallback-for=gdk-pixbuf,pango
-Dintrospection=enabled
-Dgtk_doc=true
-Dgdk-pixbuf:gtk_doc=true
-Dpango:gtk_doc=true
-Ddemos=false
-Dbuild-examples=false
-Dbuild-tests=false
-Dbuild-testsuite=false
_build
- meson setup ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} -Dgtk_doc=true -Dgdk-pixbuf:gtk_doc=true -Dpango:gtk_doc=true _build
- meson compile -C _build
- mkdir -p _reference/
- mv _build/docs/reference/gdk/gdk4/ _reference/gdk4/
+4 -3
View File
@@ -18,9 +18,7 @@ RUN dnf -y install \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
docbook-style-xsl \
elfutils-libelf-devel \
expat-devel \
fribidi-devel \
gcc \
gcc-c++ \
@@ -33,7 +31,6 @@ RUN dnf -y install \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gnupg2 \
gobject-introspection-devel \
graphene-devel \
graphviz \
@@ -73,6 +70,7 @@ RUN dnf -y install \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
ninja-build \
pango-devel \
pcre-devel \
@@ -95,10 +93,13 @@ RUN dnf -y install \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf install -y 'dnf-command(builddep)' \
&& dnf builddep -y wayland \
&& dnf clean all
# Enable sudo for wheel users
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
RUN pip3 install meson~=0.64
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}
+1 -1
View File
@@ -8,7 +8,7 @@ builddir=$1
backend=$2
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:verbosity=1:log_threads=1
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0
export G_SLICE=always-malloc
case "${backend}" in
+1
View File
@@ -3,3 +3,4 @@
. /etc/os-release
echo $PRETTY_NAME
echo PATH=$PATH
+1 -1
View File
@@ -5,7 +5,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=0.64 || goto :error
pip3 install --upgrade --user meson==0.60.3 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
+1 -69
View File
@@ -1,74 +1,6 @@
Overview of Changes in 4.9.3, xx-xx-xxxx
Overview of Changes in 4.9.2, xx-xx-xxxx
========================================
Overview of Changes in 4.9.2, 26-12-2022
========================================
* GtkFileChooserWidget:
- Add a grid view
* GtkText, GtkTextView:
- Fix activation of the on-screen keyboard
- Prevent unexpected text direction changes
* GtkCenterBox:
- Add properties for children
* GtkTreeExpander:
- Add a hide-expander property
* GtkStringList:
- Add a construct-only strings property
* GtkBuilder:
- Support parsing Pango attributes in string form
* GtkGestureStylus:
- Add a stylus-only property
* GtkFileLauncher:
- New async-style api to replace gtk_show_uri
* GtkColorDialog, GtkFontDialog, GtkFileDialog,
GtkAlertDialog:
- APIs have seen some tweaks
- Prefer portals when available
- Fixes for cancellation
* Add GDK_DEBUG=no-portals
* Improve file DND with remote files
* GtkInfoBar has been deprecated
* gtk_widget_show/hide have been deprecated
* gtk_show_uri has been deprecated
* Wayland:
- Fix button mask handling
- Fix problems with cursor size on hi-dpi screens
- Support newer versions of some protocols
- Fix handling of surrounding text in input methods
* X11:
- Fix some ordering problems with surface destruction
* Windows:
- Improved system settings integration
- Fix window resizing work with native decorations
- Include a full hicolor index.theme file as a resource
* Translation updates
Croatian
Dutch
Hungarian
Interlingua
Persian
Turkish
Ukrainian
Overview of Changes in 4.9.1, 31-10-2022
========================================
@@ -228,9 +228,9 @@ open_cb (GtkWidget *button,
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, open_response_cb, self);
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, NULL, open_response_cb, self);
g_object_unref (dialog);
}
@@ -337,10 +337,11 @@ save_cb (GtkWidget *button,
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save constraints");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL, NULL,
NULL,
save_response_cb, self);
g_object_unref (dialog);
+1 -1
View File
@@ -124,7 +124,7 @@ activate_open (GSimpleAction *action,
GtkFileDialog *dialog;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, open_response_cb, g_object_ref (app));
gtk_file_dialog_open (dialog, NULL, NULL, NULL, open_response_cb, g_object_ref (app));
g_object_unref (dialog);
}
+2 -5
View File
@@ -244,9 +244,8 @@ open_file_cb (GtkWidget *button)
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
NULL,
file_chooser_response, button);
g_object_unref (dialog);
}
static void
@@ -278,11 +277,9 @@ open_folder_cb (GtkWidget *button)
gtk_file_dialog_select_folder (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
NULL,
folder_chooser_response, button);
g_object_unref (dialog);
}
static void
update_paste_button_sensitivity (GdkClipboard *clipboard,
GtkWidget *paste_button)
+1
View File
@@ -167,6 +167,7 @@ file_open_cb (GtkWidget *button,
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_response_cb, stringlist);
g_object_unref (dialog);
}
+1
View File
@@ -55,6 +55,7 @@ show_file_open (GtkWidget *button,
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_response_cb, picture);
}
+23 -55
View File
@@ -1,11 +1,11 @@
/* Pickers and Launchers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkFileLauncher, GtkUriLauncher
/* Pickers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog
*
* The dialogs are mainly intended for use in preference dialogs.
* These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts and applications.
*
* The launchers let you open files or URIs in applications that
* can handle them.
* This demo shows both the default appearance for these dialogs,
* as well as some of the customizations that are possible.
*/
#include <gtk/gtk.h>
@@ -66,16 +66,16 @@ open_file (GtkButton *picker,
20,
abort_mission, g_object_ref (cancellable), g_object_unref);
gtk_file_dialog_open (dialog, parent, cancellable, file_opened, label);
gtk_file_dialog_open (dialog, parent, NULL, cancellable, file_opened, label);
g_object_unref (cancellable);
g_object_unref (dialog);
}
static void
open_app_done (GObject *source,
GAsyncResult *result,
gpointer data)
launch_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFileLauncher *launcher = GTK_FILE_LAUNCHER (source);
GError *error = NULL;
@@ -97,35 +97,7 @@ open_app (GtkButton *picker)
file = G_FILE (g_object_get_data (G_OBJECT (picker), "file"));
launcher = gtk_file_launcher_new (file);
gtk_file_launcher_launch (launcher, parent, NULL, open_app_done, NULL);
g_object_unref (launcher);
}
static void
open_uri_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkUriLauncher *launcher = GTK_URI_LAUNCHER (source);
GError *error = NULL;
if (!gtk_uri_launcher_launch_finish (launcher, result, &error))
{
g_print ("%s\n", error->message);
g_error_free (error);
}
}
static void
launch_uri (GtkButton *picker)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (picker)));
GtkUriLauncher *launcher;
launcher = gtk_uri_launcher_new ("http://www.gtk.org");
gtk_uri_launcher_launch (launcher, parent, NULL, open_uri_done, NULL);
gtk_file_launcher_launch (launcher, parent, NULL, launch_done, NULL);
g_object_unref (launcher);
}
@@ -141,7 +113,7 @@ do_pickers (GtkWidget *do_widget)
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pickers and Launchers");
gtk_window_set_title (GTK_WINDOW (window), "Pickers");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
table = gtk_grid_new ();
@@ -149,8 +121,8 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_margin_end (table, 20);
gtk_widget_set_margin_top (table, 20);
gtk_widget_set_margin_bottom (table, 20);
gtk_grid_set_row_spacing (GTK_GRID (table), 6);
gtk_grid_set_column_spacing (GTK_GRID (table), 6);
gtk_grid_set_row_spacing (GTK_GRID (table), 3);
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Color:");
@@ -177,7 +149,7 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
label = gtk_label_new ("None");
gtk_label_set_xalign (GTK_LABEL (label), 0.);
@@ -186,23 +158,19 @@ do_pickers (GtkWidget *do_widget)
g_signal_connect (button, "clicked", G_CALLBACK (open_file), label);
gtk_box_append (GTK_BOX (picker), label);
gtk_box_append (GTK_BOX (picker), button);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
label = gtk_label_new ("Application:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 4, 1, 1);
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
gtk_widget_set_sensitive (app_picker, FALSE);
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
gtk_box_append (GTK_BOX (picker), app_picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
label = gtk_label_new ("URI:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
picker = gtk_button_new_with_label ("www.gtk.org");
g_signal_connect (picker, "clicked", G_CALLBACK (launch_uri), NULL);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), app_picker, 1, 4, 1, 1);
}
if (!gtk_widget_get_visible (window))
+2 -1
View File
@@ -56,7 +56,7 @@ open_clicked_cb (GtkWidget *button,
gtk_file_filter_set_name (filter, "Video");
g_list_store_append (filters, filter);
gtk_file_dialog_set_default_filter (dialog, filter);
gtk_file_dialog_set_current_filter (dialog, filter);
g_object_unref (filter);
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
@@ -65,6 +65,7 @@ open_clicked_cb (GtkWidget *button,
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_dialog_response_cb, video);
}
+7 -5
View File
@@ -569,10 +569,10 @@ show_open_filechooser (NodeEditorWindow *self)
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open node file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
gtk_file_dialog_open (dialog, GTK_WINDOW (self),
NULL, open_response_cb, self);
NULL, NULL, open_response_cb, self);
g_object_unref (dialog);
}
@@ -633,12 +633,13 @@ save_cb (GtkWidget *button,
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save node");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
gtk_file_dialog_set_initial_name (dialog, "demo.node");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
"demo.node",
NULL,
save_response_cb, self);
g_object_unref (dialog);
}
@@ -741,10 +742,11 @@ export_image_cb (GtkWidget *button,
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "");
gtk_file_dialog_set_initial_name (dialog, "example.png");
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
"example.png",
NULL,
export_image_response_cb, texture);
g_object_unref (dialog);
}
+3
View File
@@ -508,6 +508,8 @@ activate_save_as (GSimpleAction *action,
gtk_file_dialog_save (dialog,
GTK_WINDOW (main_window),
NULL,
NULL,
NULL,
on_save_response, NULL);
g_object_unref (dialog);
}
@@ -551,6 +553,7 @@ activate_open (GSimpleAction *action,
gtk_file_dialog_open (dialog,
GTK_WINDOW (main_window),
NULL,
NULL,
on_open_response, NULL);
g_object_unref (dialog);
}
+1 -69
View File
@@ -237,7 +237,7 @@ activate_open_file (GSimpleAction *action,
GtkFileDialog *dialog;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, file_chooser_response, NULL);
gtk_file_dialog_open (dialog, NULL, NULL, NULL, file_chooser_response, NULL);
g_object_unref (dialog);
}
@@ -2056,67 +2056,6 @@ hide_widget (GtkWidget *widget)
gtk_widget_set_visible (widget, FALSE);
}
static void
load_texture_thread (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
const char *resource_path = (const char *) task_data;
GBytes *bytes;
GdkTexture *texture;
GError *error = NULL;
bytes = g_resources_lookup_data (resource_path, 0, &error);
if (!bytes)
{
g_task_return_error (task, error);
return;
}
texture = gdk_texture_new_from_bytes (bytes, &error);
g_bytes_unref (bytes);
if (!texture)
{
g_task_return_error (task, error);
return;
}
g_task_return_pointer (task, texture, g_object_unref);
}
static void
load_texture_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkWidget *picture = GTK_WIDGET (source);
GdkTexture *texture;
GError *error = NULL;
texture = g_task_propagate_pointer (G_TASK (result), &error);
if (!texture)
{
g_warning ("%s", error->message);
g_error_free (error);
return;
}
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
static void
load_texture_in_thread (GtkWidget *picture,
const char *resource_path)
{
GTask *task = g_task_new (picture, NULL, load_texture_done, NULL);
g_task_set_task_data (task, (gpointer)resource_path, NULL);
g_task_run_in_thread (task, load_texture_thread);
g_object_unref (task);
}
static void
activate (GApplication *app)
{
@@ -2216,13 +2155,6 @@ activate (GApplication *app)
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
load_texture_in_thread ((GtkWidget *)gtk_builder_get_object (builder, "notebook_sunset"),
"/org/gtk/WidgetFactory4/sunset.jpg");
load_texture_in_thread ((GtkWidget *)gtk_builder_get_object (builder, "notebook_nyc"),
"/org/gtk/WidgetFactory4/nyc.jpg");
load_texture_in_thread ((GtkWidget *)gtk_builder_get_object (builder, "notebook_beach"),
"/org/gtk/WidgetFactory4/beach.jpg");
if (g_strcmp0 (PROFILE, "devel") == 0)
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
+6 -3
View File
@@ -1263,7 +1263,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture" id="notebook_sunset">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/sunset.jpg</property>
<property name="content-fit">cover</property>
<child>
<object class="GtkDragSource">
@@ -1289,7 +1290,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture" id="notebook_nyc">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/nyc.jpg</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
@@ -1314,7 +1316,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child>
<object class="GtkNotebookPage">
<property name="child">
<object class="GtkPicture" id="notebook_beach">
<object class="GtkPicture">
<property name="file">resource:///org/gtk/WidgetFactory4/beach.jpg</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="on_picture_drag_prepare" swapped="no"/>
+2 -2
View File
@@ -18,12 +18,12 @@ search_index = true
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Gio-2.0"]
name = "Gio"
name = "GIO"
description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
docs_url = "https://docs.gtk.org/gio/"
[dependencies."cairo-1.0"]
name = "cairo"
name = "Cairo"
description = "A 2D graphics library with support for multiple output devices"
docs_url = "https://www.cairographics.org/manual/"
+1 -1
View File
@@ -19,7 +19,7 @@ dependencies = ["Graphene-1.0", "Gdk-4.0"]
docs_url = "https://ebassi.github.io/graphene/docs/"
[dependencies."Gdk-4.0"]
name = "Gdk"
name = "GDK"
description = "The GTK windowing system abstraction"
docs_url = "https://docs.gtk.org/gdk4/"
+22 -16
View File
@@ -236,17 +236,23 @@ By default, GTK will try to build with support for the Vulkan graphics
API in addition to cairo and OpenGL. This option can be used to explicitly
control whether Vulkan should be used.
### `media-gstreamer` and `media-ffmpeg`
### `xinerama`
By default, GTK will try to link against the Xinerama libraries
if they are found. This option can be used to explicitly control
whether Xinerama should be used.
### `media`
By default, GTK will try to build the gstreamer backend for
media playback support. These option can be used to explicitly
media playback support. This option can be used to explicitly
control which media backends should be built.
### `print-cups`
### `print`
By default, GTK will try to build various print backends
if their dependencies are found. This option can be used
to explicitly control whether the cups print backend should be built.
to explicitly control which print backends should be built.
### `cloudproviders`
@@ -268,13 +274,18 @@ support in the file chooser.
This option controls whether GTK should use colord for color
calibration support in the cups print backend.
### `gtk_doc`, `man-pages` and `update_screenshots`
### `gtk_doc` and `man-pages`
The *gi-docgen* package is used to generate the reference documentation
included with GTK. By default support for *gi-docgen* is disabled
The *gtk-doc* package is used to generate the reference documentation
included with GTK. By default support for *gtk-doc* is disabled
because it requires various extra dependencies to be installed.
Introspection needs to be enabled, since the documentation is generated
from introspection data.
If you have *gtk-doc* and *pandoc* installed and are modifying GTK,
you may want to enable *gtk-doc* support by passing in `-Dgtk_doc=true`.
Additionally, some tools provided by GTK have their own
manual pages generated using a similar set of dependencies;
if you have *xsltproc* then you can generate manual pages by
passing `-Dman-pages=true` when configuring the build.
### `introspection`
@@ -283,14 +294,9 @@ is mainly useful for shortening turnaround times on developer
systems. Installed builds of GTK should always have introspection
support.
### `build-testsuite`
### `build-tests`, `install-tests`, `demos`
If you want to run the testsuite to ensure that your GTK build
works, you should enable it with this option.
### `build-tests`, `build-examples`, `demos`
By default, GTK will build quite a few tests, examples and demos.
By default, GTK will build quite a few tests and demos.
While these are useful on a developer system, they are not
needed when GTK is built e.g. for a flatpak runtime. These
options allow to disable building tests and demos.
+4 -4
View File
@@ -377,7 +377,7 @@ demonstrates input event handling with event controllers.
### Drawing in response to input
Create a new file with the following content named `example-3.c`.
Create a new file with the following content named `example-4.c`.
```c
#include <gtk/gtk.h>
@@ -572,7 +572,7 @@ main (int argc,
You can compile the program above with GCC using:
```
gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs gtk4 )
gcc $( pkg-config --cflags gtk4 ) -o example-4 example-4.c $( pkg-config --libs gtk4 )
```
## Building user interfaces
@@ -587,7 +587,7 @@ XML format that can be parsed by the [class@Gtk.Builder] class.
### Packing buttons with GtkBuilder
Create a new file with the following content named `example-4.c`.
Create a new file with the following content named `example-3.c`.
```c
#include <gtk/gtk.h>
@@ -697,7 +697,7 @@ Create a new file with the following content named `builder.ui`.
You can compile the program above with GCC using:
```
gcc $( pkg-config --cflags gtk4 ) -o example-4 example-4.c $( pkg-config --libs gtk4 )
gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs gtk4 )
```
Note that `GtkBuilder` can also be used to construct objects that are
+2 -2
View File
@@ -14,12 +14,12 @@ search_index = true
dependencies = ["Gdk-4.0", "Gsk-4.0"]
[dependencies."Gdk-4.0"]
name = "Gdk"
name = "GDK"
description = "The GTK windowing system abstraction"
docs_url = "https://docs.gtk.org/gdk4/"
[dependencies."Gsk-4.0"]
name = "Gsk"
name = "GSK"
description = "The GTK rendering abstraction"
docs_url = "https://docs.gtk.org/gsk4/"
-4
View File
@@ -105,7 +105,3 @@ retire it. If you need such a widget, it is relatively trivial to create one
using a [class@Gtk.Revealer] with labels and buttons.
Other libraries, such as libadwaita, may provide replacements as well.
## gtk_show_uri is being replaced
Instead of gtk_show_uri(), you should use GtkUriLauncher or GtkFileLauncher.
+1 -1
View File
@@ -1,7 +1,7 @@
toml_conf = configuration_data()
toml_conf.set('version', meson.project_version())
gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'), native: true)
gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
gidocgen_common_args = [
'--quiet',
+8 -7
View File
@@ -471,8 +471,8 @@ gdk_display_get_event (GdkDisplay *display)
* Appends the given event onto the front of the event
* queue for @display.
*
* Deprecated: 4.10: This function is only useful in very
* special situations and should not be used by applications.
* This function is only useful in very special situations
* and should not be used by applications.
**/
void
gdk_display_put_event (GdkDisplay *display,
@@ -1114,7 +1114,7 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
/**
* gdk_display_open:
* @display_name: (nullable): the name of the display to open
* @display_name: the name of the display to open
*
* Opens a display.
*
@@ -1148,8 +1148,6 @@ _gdk_display_get_next_serial (GdkDisplay *display)
* with custom startup-notification identifier unless
* [method@Gtk.Window.set_auto_startup_notification]
* is called to disable that feature.
*
* Deprecated: 4.10. Using gdk_toplevel_set_startup_id() is sufficient.
*/
void
gdk_display_notify_startup_complete (GdkDisplay *display,
@@ -1777,11 +1775,11 @@ gdk_display_init_egl (GdkDisplay *self,
gpointer
gdk_display_get_egl_display (GdkDisplay *self)
{
#ifdef HAVE_EGL
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
#ifdef HAVE_EGL
if (!priv->egl_display &&
!gdk_display_prepare_gl (self, NULL))
return NULL;
@@ -2015,7 +2013,10 @@ gdk_display_get_monitors (GdkDisplay *self)
* Gets the monitor in which the largest area of @surface
* resides.
*
* Returns: (transfer none) (nullable): the monitor with the largest
* Returns a monitor close to @surface if it is outside
* of all monitors.
*
* Returns: (transfer none): the monitor with the largest
* overlap with @surface
*/
GdkMonitor *
+2 -2
View File
@@ -83,7 +83,7 @@ GdkClipboard * gdk_display_get_clipboard (GdkDisplay
GDK_AVAILABLE_IN_ALL
GdkClipboard * gdk_display_get_primary_clipboard (GdkDisplay *display);
GDK_DEPRECATED_IN_4_10_FOR(gdk_toplevel_set_startup_id)
GDK_AVAILABLE_IN_ALL
void gdk_display_notify_startup_complete (GdkDisplay *display,
const char *startup_id);
GDK_AVAILABLE_IN_ALL
@@ -104,7 +104,7 @@ GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_display_get_monitor_at_surface (GdkDisplay *display,
GdkSurface *surface);
GDK_DEPRECATED_IN_4_10
GDK_AVAILABLE_IN_ALL
void gdk_display_put_event (GdkDisplay *display,
GdkEvent *event);
+2 -5
View File
@@ -621,11 +621,8 @@ gdk_frame_clock_paint_idle (void *data)
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
}
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (FRAMES))
{
if (timings)
timings->frame_end_time = g_get_monotonic_time ();
}
if (GDK_DEBUG_CHECK (FRAMES))
timings->frame_end_time = g_get_monotonic_time ();
#endif /* G_ENABLE_DEBUG */
G_GNUC_FALLTHROUGH;
+1 -1
View File
@@ -504,8 +504,8 @@ gdk_gl_context_real_is_shared (GdkGLContext *self,
static gboolean
gdk_gl_context_real_clear_current (GdkGLContext *context)
{
#ifdef HAVE_EGL
GdkDisplay *display = gdk_gl_context_get_display (context);
#ifdef HAVE_EGL
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
if (priv->egl_context == NULL)
+1 -1
View File
@@ -23,7 +23,7 @@ void gdk_source_set_static_name_by_id (guint tag,
#define I_(string) g_intern_static_string (string)
#endif
#if !GLIB_CHECK_VERSION (2, 75, 1)
#if !GLIB_CHECK_VERSION (2, 76, 0)
static inline gboolean
g_set_str (char **str_pointer,
const char *new_str)
+3 -3
View File
@@ -586,7 +586,7 @@ gdk_rgba_parser_parse (GtkCssParser *parser,
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_HASH_ID) ||
gtk_css_token_is (token, GTK_CSS_TOKEN_HASH_UNRESTRICTED))
{
const char *s = gtk_css_token_get_string (token);
const char *s = token->string.string;
switch (strlen (s))
{
@@ -637,13 +637,13 @@ gdk_rgba_parser_parse (GtkCssParser *parser,
{
*rgba = (GdkRGBA) { 0, 0, 0, 0 };
}
else if (gdk_rgba_parse (rgba, gtk_css_token_get_string (token)))
else if (gdk_rgba_parse (rgba, token->string.string))
{
/* everything's fine */
}
else
{
gtk_css_parser_error_syntax (parser, "\"%s\" is not a valid color name.", gtk_css_token_get_string (token));
gtk_css_parser_error_syntax (parser, "\"%s\" is not a valid color name.", token->string.string);
return FALSE;
}
+8 -18
View File
@@ -2789,10 +2789,9 @@ check_autohide (GdkEvent *event)
{
GdkDisplay *display;
GdkDevice *device;
GdkSurface *grab_surface, *event_surface;
GdkEventType evtype = gdk_event_get_event_type (event);
GdkSurface *grab_surface;
switch ((guint) evtype)
switch ((guint) gdk_event_get_event_type (event))
{
case GDK_BUTTON_PRESS:
#if 0
@@ -2811,15 +2810,13 @@ check_autohide (GdkEvent *event)
device = gdk_event_get_device (event);
if (gdk_device_grab_info (display, device, &grab_surface, NULL))
{
event_surface = gdk_event_get_surface (event);
if (event_surface->autohide &&
!event_surface->has_pointer)
event_surface = NULL;
GdkSurface *event_surface;
if (grab_surface->autohide &&
(!event_surface ||
(grab_surface != event_surface &&
grab_surface != event_surface->parent)))
event_surface = gdk_event_get_surface (event);
if (grab_surface != event_surface &&
grab_surface != event_surface->parent &&
grab_surface->autohide)
{
GdkSurface *surface = grab_surface;
@@ -2834,13 +2831,6 @@ check_autohide (GdkEvent *event)
}
}
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
event_surface = gdk_event_get_surface (event);
if (event_surface->autohide &&
gdk_crossing_event_get_mode (event) == GDK_CROSSING_NORMAL)
event_surface->has_pointer = evtype == GDK_ENTER_NOTIFY;
break;
default:;
}
-1
View File
@@ -77,7 +77,6 @@ struct _GdkSurface
guint autohide : 1;
guint shortcuts_inhibited : 1;
guint request_motion : 1;
guint has_pointer : 1;
guint request_motion_id;
+3 -3
View File
@@ -463,7 +463,7 @@ gdk_texture_new_from_resource (const char *resource_path)
* Creates a new texture by loading an image from a file.
*
* The file format is detected automatically. The supported formats
* are PNG, JPEG and TIFF, though more formats might be available.
* are PNG and JPEG, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
@@ -556,7 +556,7 @@ gdk_texture_new_from_bytes_pixbuf (GBytes *bytes,
* Creates a new texture by loading an image from memory,
*
* The file format is detected automatically. The supported formats
* are PNG, JPEG and TIFF, though more formats might be available.
* are PNG and JPEG, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
@@ -602,7 +602,7 @@ gdk_texture_new_from_bytes (GBytes *bytes,
* Creates a new texture by loading an image from a file.
*
* The file format is detected automatically. The supported formats
* are PNG, JPEG and TIFF, though more formats might be available.
* are PNG and JPEG, though more formats might be available.
*
* If %NULL is returned, then @error will be set.
*
+3 -5
View File
@@ -576,8 +576,6 @@ typedef NSString *CALayerContentsGravity;
initialResizeLocation = convert_nspoint_to_screen (self, [self mouseLocationOutsideOfEventStream]);
}
// NSDraggingDestination protocol
-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSPoint location = [sender draggingLocation];
@@ -667,9 +665,9 @@ typedef NSString *CALayerContentsGravity;
return NO;
}
// NSDraggingSource protocol
// ...
// end
-(void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
{
}
-(void)setStyleMask:(NSWindowStyleMask)styleMask
{
-4
View File
@@ -23,10 +23,6 @@
#include "gdkmacoscursor-private.h"
@interface NSCursor()
-(long long)_coreCursorType;
@end
/* OS X only exports a number of cursor types in its public NSCursor interface.
* By overriding the private _coreCursorType method, we can tell OS X to load
* one of its internal cursors instead (since cursor images are loaded on demand
+1 -11
View File
@@ -218,12 +218,6 @@ drag_ungrab (GdkMacosDrag *self)
g_assert (GDK_IS_MACOS_DRAG (self));
if (self->drag_seat)
{
gdk_seat_ungrab (self->drag_seat);
g_clear_object (&self->drag_seat);
}
display = gdk_drag_get_display (GDK_DRAG (self));
_gdk_macos_display_break_all_grabs (GDK_MACOS_DISPLAY (display), GDK_CURRENT_TIME);
}
@@ -542,11 +536,7 @@ gdk_macos_drag_finalize (GObject *object)
GdkMacosDragSurface *drag_surface = g_steal_pointer (&self->drag_surface);
g_clear_object (&self->cursor);
if (self->drag_seat)
{
gdk_seat_ungrab (self->drag_seat);
g_clear_object (&self->drag_seat);
}
g_clear_object (&self->drag_seat);
G_OBJECT_CLASS (gdk_macos_drag_parent_class)->finalize (object);
+1 -1
View File
@@ -431,7 +431,7 @@ gdk_macos_surface_drag_begin (GdkSurface *surface,
_gdk_macos_surface_get_root_coords (GDK_MACOS_SURFACE (surface), &sx, &sy);
drag_surface = _gdk_macos_surface_new (GDK_MACOS_DISPLAY (surface->display),
GDK_SURFACE_DRAG,
NULL,
surface,
sx, sy, 1, 1);
drag = g_object_new (GDK_TYPE_MACOS_DRAG,
"drag-surface", drag_surface,
-1
View File
@@ -49,7 +49,6 @@
#include "gdkvulkancontext-wayland.h"
#include "gdkwaylandmonitor.h"
#include "gdkprofilerprivate.h"
#include "gdktoplevel-wayland-private.h"
#include <wayland/pointer-gestures-unstable-v1-client-protocol.h>
#include "tablet-unstable-v2-client-protocol.h"
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
+10 -6
View File
@@ -367,10 +367,10 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
GdkWaylandDrag *drag_wayland;
GdkDrag *drag;
GdkSeat *seat;
GdkDisplay *display;
GdkWaylandDisplay *display_wayland;
GdkCursor *cursor;
display = gdk_device_get_display (device);
display_wayland = GDK_WAYLAND_DISPLAY (gdk_device_get_display (device));
seat = gdk_device_get_seat (device);
drag_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG,
@@ -382,13 +382,17 @@ _gdk_wayland_surface_drag_begin (GdkSurface *surface,
drag = GDK_DRAG (drag_wayland);
drag_wayland->dnd_surface = _gdk_wayland_display_create_surface (display, GDK_SURFACE_DRAG, NULL, 0, 0, 100, 100);
drag_wayland->dnd_surface = create_dnd_surface (gdk_surface_get_display (surface));
drag_wayland->dnd_wl_surface = gdk_wayland_surface_get_wl_surface (drag_wayland->dnd_surface);
gdk_wayland_drag_create_data_source (drag);
if (GDK_WAYLAND_DISPLAY (display)->data_device_manager_version >= WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
wl_data_source_set_actions (drag_wayland->data_source, gdk_to_wl_actions (actions));
if (display_wayland->data_device_manager_version >=
WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
{
wl_data_source_set_actions (drag_wayland->data_source,
gdk_to_wl_actions (actions));
}
gdk_wayland_seat_set_drag (seat, drag);
-136
View File
@@ -1,136 +0,0 @@
/*
* Copyright © 2022 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdksurface-wayland.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplay-wayland.h"
#include "gdkdragsurfaceprivate.h"
#include "gdkeventsprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkglcontext-wayland.h"
#include "gdkmonitor-wayland.h"
#include "gdkpopupprivate.h"
#include "gdkprivate-wayland.h"
#include "gdkprivate-wayland.h"
#include "gdkseat-wayland.h"
#include "gdksurfaceprivate.h"
#include "gdktoplevelprivate.h"
#include "gdkdevice-wayland-private.h"
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <netinet/in.h>
#include <unistd.h>
#include "gdksurface-wayland-private.h"
typedef struct
{
GdkWaylandSurface parent_instance;
} GdkWaylandDragSurface;
typedef struct
{
GdkWaylandSurfaceClass parent_class;
} GdkWaylandDragSurfaceClass;
static void gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
#define GDK_IS_WAYLAND_DRAG_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DRAG_SURFACE))
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDragSurface, gdk_wayland_drag_surface, GDK_TYPE_WAYLAND_SURFACE,
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
gdk_wayland_drag_surface_iface_init))
static void
gdk_wayland_drag_surface_init (GdkWaylandDragSurface *surface)
{
}
static gboolean
gdk_wayland_drag_surface_compute_size (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (impl->next_layout.surface_geometry_dirty)
{
gdk_wayland_surface_update_size (surface,
impl->next_layout.configured_width,
impl->next_layout.configured_height,
impl->scale);
impl->next_layout.surface_geometry_dirty = FALSE;
}
return FALSE;
}
static void
gdk_wayland_drag_surface_class_init (GdkWaylandDragSurfaceClass *class)
{
GdkSurfaceClass *surface_class = GDK_SURFACE_CLASS (class);
surface_class->compute_size = gdk_wayland_drag_surface_compute_size;
}
static void
maybe_notify_mapped (GdkSurface *surface)
{
if (surface->destroyed)
return;
if (!GDK_SURFACE_IS_MAPPED (surface))
gdk_surface_set_is_mapped (surface, TRUE);
}
static gboolean
gdk_wayland_drag_surface_present (GdkDragSurface *drag_surface,
int width,
int height)
{
GdkSurface *surface = GDK_SURFACE (drag_surface);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (!impl->display_server.wl_surface)
gdk_wayland_surface_create_wl_surface (surface);
impl->next_layout.configured_width = width;
impl->next_layout.configured_height = height;
impl->next_layout.surface_geometry_dirty = TRUE;
gdk_surface_request_layout (surface);
maybe_notify_mapped (surface);
return TRUE;
}
static void
gdk_wayland_drag_surface_iface_init (GdkDragSurfaceInterface *iface)
{
iface->present = gdk_wayland_drag_surface_present;
}
File diff suppressed because it is too large Load Diff
+2
View File
@@ -191,6 +191,8 @@ void gdk_wayland_surface_restore_shortcuts (GdkSurface *surface,
void gdk_wayland_surface_update_scale (GdkSurface *surface);
GdkSurface * create_dnd_surface (GdkDisplay *display);
GdkModifierType gdk_wayland_keymap_get_gdk_modifiers (GdkKeymap *keymap,
guint32 mods);
-121
View File
@@ -1,121 +0,0 @@
/*
* Copyright © 2022 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
typedef enum _PopupState
{
POPUP_STATE_IDLE,
POPUP_STATE_WAITING_FOR_REPOSITIONED,
POPUP_STATE_WAITING_FOR_CONFIGURE,
POPUP_STATE_WAITING_FOR_FRAME,
} PopupState;
struct _GdkWaylandSurface
{
GdkSurface parent_instance;
struct {
GSList *outputs;
struct wl_surface *wl_surface;
struct xdg_surface *xdg_surface;
struct zxdg_surface_v6 *zxdg_surface_v6;
struct wl_egl_window *egl_window;
} display_server;
struct wl_event_queue *event_queue;
unsigned int initial_configure_received : 1;
unsigned int has_uncommitted_ack_configure : 1;
unsigned int mapped : 1;
unsigned int awaiting_frame : 1;
unsigned int awaiting_frame_frozen : 1;
int pending_buffer_offset_x;
int pending_buffer_offset_y;
gint64 pending_frame_counter;
guint32 scale;
int shadow_left;
int shadow_right;
int shadow_top;
int shadow_bottom;
cairo_region_t *opaque_region;
gboolean opaque_region_dirty;
cairo_region_t *input_region;
gboolean input_region_dirty;
GdkRectangle last_sent_window_geometry;
struct {
gboolean is_initial_configure;
uint32_t serial;
gboolean is_dirty;
} pending;
struct {
int configured_width;
int configured_height;
gboolean surface_geometry_dirty;
} next_layout;
uint32_t last_configure_serial;
int state_freeze_count;
};
typedef struct _GdkWaylandSurfaceClass GdkWaylandSurfaceClass;
struct _GdkWaylandSurfaceClass
{
GdkSurfaceClass parent_class;
void (* handle_configure) (GdkWaylandSurface *surface);
void (* handle_frame) (GdkWaylandSurface *surface);
void (* hide_surface) (GdkWaylandSurface *surface);
};
#define GDK_WAYLAND_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_SURFACE, GdkWaylandSurfaceClass))
#define GDK_WAYLAND_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_SURFACE, GdkWaylandSurfaceClass))
void gdk_wayland_surface_create_wl_surface (GdkSurface *surface);
void gdk_wayland_surface_update_size (GdkSurface *surface,
int32_t width,
int32_t height,
int scale);
void gdk_wayland_surface_create_xdg_surface_resources (GdkSurface *surface);
void _gdk_wayland_surface_save_size (GdkSurface *surface);
void gdk_wayland_surface_hide_surface (GdkSurface *surface);
void gdk_wayland_surface_move_resize (GdkSurface *surface,
int x,
int y,
int width,
int height);
void gdk_wayland_surface_get_window_geometry (GdkSurface *surface,
GdkRectangle *geometry);
void gdk_wayland_surface_freeze_state (GdkSurface *surface);
void gdk_wayland_surface_thaw_state (GdkSurface *surface);
#define GDK_TYPE_WAYLAND_DRAG_SURFACE (gdk_wayland_drag_surface_get_type ())
GType gdk_wayland_drag_surface_get_type (void) G_GNUC_CONST;
File diff suppressed because it is too large Load Diff
+17 -2
View File
@@ -21,11 +21,26 @@
#pragma once
#include "gdkwaylandsurface.h"
#include "gdkwaylandtoplevel.h"
#include "gdkwaylandpopup.h"
G_BEGIN_DECLS
void gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
const char *application_id,
const char *app_menu_path,
const char *menubar_path,
const char *window_object_path,
const char *application_object_path,
const char *unique_bus_name);
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
struct gtk_surface1 * gdk_wayland_toplevel_get_gtk_surface (GdkWaylandToplevel *wayland_toplevel);
void gdk_wayland_surface_ensure_wl_egl_window (GdkSurface *surface);
G_END_DECLS
-41
View File
@@ -1,41 +0,0 @@
/*
* Copyright © 2022 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
void gdk_wayland_toplevel_set_geometry_hints (GdkWaylandToplevel *toplevel,
const GdkGeometry *geometry,
GdkSurfaceHints geom_mask);
struct gtk_surface1 *
gdk_wayland_toplevel_get_gtk_surface (GdkWaylandToplevel *wayland_toplevel);
void gdk_wayland_toplevel_set_dbus_properties (GdkToplevel *toplevel,
const char *application_id,
const char *app_menu_path,
const char *menubar_path,
const char *window_object_path,
const char *application_object_path,
const char *unique_bus_name);
void gdk_wayland_toplevel_announce_csd (GdkToplevel *toplevel);
void gdk_wayland_toplevel_announce_ssd (GdkToplevel *toplevel);
gboolean gdk_wayland_toplevel_inhibit_idle (GdkToplevel *toplevel);
void gdk_wayland_toplevel_uninhibit_idle (GdkToplevel *toplevel);
File diff suppressed because it is too large Load Diff
+1 -3
View File
@@ -31,12 +31,10 @@
#include <gdk/wayland/gdkwaylanddevice.h>
#include <gdk/wayland/gdkwaylanddisplay.h>
#include <gdk/wayland/gdkwaylandglcontext.h>
#include <gdk/wayland/gdkwaylandmonitor.h>
#include <gdk/wayland/gdkwaylandpopup.h>
#include <gdk/wayland/gdkwaylandseat.h>
#include <gdk/wayland/gdkwaylandsurface.h>
#include <gdk/wayland/gdkwaylandtoplevel.h>
#include <gdk/wayland/gdkwaylandglcontext.h>
#undef __GDKWAYLAND_H_INSIDE__
-44
View File
@@ -1,44 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2013 Jan Arne Petersen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/wayland/gdkwayland.h> can be included directly."
#endif
#include <gdk/gdk.h>
#include <gdk/wayland/gdkwaylandsurface.h>
#include <wayland-client.h>
G_BEGIN_DECLS
#ifdef GTK_COMPILATION
typedef struct _GdkWaylandPopup GdkWaylandPopup;
#else
typedef GdkPopup GdkWaylandPopup;
#endif
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type())
#define GDK_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_POPUP, GdkWaylandPopup))
#define GDK_IS_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_POPUP))
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_popup_get_type (void);
G_END_DECLS
+39
View File
@@ -30,20 +30,59 @@ G_BEGIN_DECLS
#ifdef GTK_COMPILATION
typedef struct _GdkWaylandSurface GdkWaylandSurface;
typedef struct _GdkWaylandToplevel GdkWaylandToplevel;
typedef struct _GdkWaylandPopup GdkWaylandPopup;
#else
typedef GdkSurface GdkWaylandSurface;
typedef GdkToplevel GdkWaylandToplevel;
typedef GdkPopup GdkWaylandPopup;
#endif
#define GDK_TYPE_WAYLAND_SURFACE (gdk_wayland_surface_get_type())
#define GDK_WAYLAND_SURFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_SURFACE, GdkWaylandSurface))
#define GDK_IS_WAYLAND_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_SURFACE))
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type())
#define GDK_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_TOPLEVEL, GdkWaylandToplevel))
#define GDK_IS_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_TOPLEVEL))
#define GDK_TYPE_WAYLAND_POPUP (gdk_wayland_popup_get_type())
#define GDK_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_POPUP, GdkWaylandPopup))
#define GDK_IS_WAYLAND_POPUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_POPUP))
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_surface_get_type (void);
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_toplevel_get_type (void);
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_popup_get_type (void);
GDK_AVAILABLE_IN_ALL
struct wl_surface *gdk_wayland_surface_get_wl_surface (GdkSurface *surface);
typedef void (*GdkWaylandToplevelExported) (GdkToplevel *toplevel,
const char *handle,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_toplevel_export_handle (GdkToplevel *toplevel,
GdkWaylandToplevelExported callback,
gpointer user_data,
GDestroyNotify destroy_func);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel);
GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
const char *parent_handle_str);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_toplevel_set_application_id (GdkToplevel *toplevel,
const char *application_id);
G_END_DECLS
#endif /* __GDK_WAYLAND_SURFACE_H__ */
-66
View File
@@ -1,66 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2013 Jan Arne Petersen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/wayland/gdkwayland.h> can be included directly."
#endif
#include <gdk/gdk.h>
#include <gdk/wayland/gdkwaylandsurface.h>
#include <wayland-client.h>
G_BEGIN_DECLS
#ifdef GTK_COMPILATION
typedef struct _GdkWaylandToplevel GdkWaylandToplevel;
#else
typedef GdkToplevel GdkWaylandToplevel;
#endif
#define GDK_TYPE_WAYLAND_TOPLEVEL (gdk_wayland_toplevel_get_type())
#define GDK_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_TOPLEVEL, GdkWaylandToplevel))
#define GDK_IS_WAYLAND_TOPLEVEL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_TOPLEVEL))
GDK_AVAILABLE_IN_ALL
GType gdk_wayland_toplevel_get_type (void);
typedef void (*GdkWaylandToplevelExported) (GdkToplevel *toplevel,
const char *handle,
gpointer user_data);
GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_toplevel_export_handle (GdkToplevel *toplevel,
GdkWaylandToplevelExported callback,
gpointer user_data,
GDestroyNotify destroy_func);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_toplevel_unexport_handle (GdkToplevel *toplevel);
GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
const char *parent_handle_str);
GDK_AVAILABLE_IN_ALL
void gdk_wayland_toplevel_set_application_id (GdkToplevel *toplevel,
const char *application_id);
G_END_DECLS
+1 -6
View File
@@ -8,17 +8,14 @@ gdk_wayland_sources = files([
'gdkdevice-wayland.c',
'gdkdisplay-wayland.c',
'gdkdrag-wayland.c',
'gdkdragsurface-wayland.c',
'gdkdrop-wayland.c',
'gdkeventsource.c',
'gdkglcontext-wayland.c',
'gdkkeys-wayland.c',
'gdkmonitor-wayland.c',
'gdkprimary-wayland.c',
'gdksurface-wayland.c',
'gdktoplevel-wayland.c',
'gdkpopup-wayland.c',
'gdkvulkancontext-wayland.c',
'gdksurface-wayland.c',
'wm-button-layout-translation.c',
])
@@ -27,10 +24,8 @@ gdk_wayland_public_headers = files([
'gdkwaylanddisplay.h',
'gdkwaylandglcontext.h',
'gdkwaylandmonitor.h',
'gdkwaylandpopup.h',
'gdkwaylandseat.h',
'gdkwaylandsurface.h',
'gdkwaylandtoplevel.h',
])
install_headers(gdk_wayland_public_headers, 'gdkwayland.h', subdir: 'gtk-4.0/gdk/wayland/')
+5 -19
View File
@@ -2081,30 +2081,23 @@ transmute_cf_unicodetext_to_utf8_string (const guchar *data,
gsize *set_data_length,
GDestroyNotify *set_data_destroy)
{
wchar_t *ptr, *p, *q, *endp;
wchar_t *ptr, *p, *q;
char *result;
glong wclen, u8_len;
/* Replace CR and CR+LF with LF */
/* Strip out \r */
ptr = (wchar_t *) data;
p = ptr;
q = ptr;
endp = ptr + length / 2;
wclen = 0;
while (p < endp)
while (p < ptr + length / 2)
{
if (*p != L'\r')
{
*q++ = *p;
wclen++;
}
else if (p + 1 >= endp || *(p + 1) != L'\n')
{
*q++ = L'\n';
wclen++;
}
p++;
}
@@ -2289,7 +2282,7 @@ transmute_cf_text_to_utf8_string (const guchar *data,
gsize *set_data_length,
GDestroyNotify *set_data_destroy)
{
char *ptr, *p, *q, *endp;
char *ptr, *p, *q;
char *result;
glong wclen, u8_len;
wchar_t *wstr;
@@ -2298,22 +2291,15 @@ transmute_cf_text_to_utf8_string (const guchar *data,
ptr = (char *) data;
p = ptr;
q = ptr;
endp = ptr + length / 2;
wclen = 0;
while (p < endp)
while (p < ptr + length / 2)
{
if (*p != '\r')
{
*q++ = *p;
wclen++;
}
else if (p + 1 > endp || *(p + 1) != '\n')
{
*q++ = '\n';
wclen++;
}
p++;
}
-3
View File
@@ -283,9 +283,6 @@ gdk_x11_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GFileInfo *fileinfo;
GdkAppLaunchContext *ctx;
if (!info)
return NULL;
ctx = GDK_APP_LAUNCH_CONTEXT (context);
display = ctx->display;
-2
View File
@@ -1450,9 +1450,7 @@ _gdk_device_manager_xi2_handle_focus (GdkSurface *surface,
GdkEvent *event;
event = gdk_focus_event_new (surface, device, focus_in);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_display_put_event (gdk_surface_get_display (surface), event);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_event_unref (event);
}
}
-4
View File
@@ -119,9 +119,7 @@ handle_focus_change (GdkEvent *event)
focus_event = gdk_focus_event_new (gdk_event_get_surface (event),
gdk_event_get_device (event),
focus_in);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_display_put_event (gdk_event_get_display (event), focus_event);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_event_unref (focus_event);
}
}
@@ -208,9 +206,7 @@ handle_touch_synthetic_crossing (GdkEvent *event)
if (crossing)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gdk_display_put_event (gdk_seat_get_display (seat), crossing);
G_GNUC_END_IGNORE_DEPRECATIONS
gdk_event_unref (crossing);
}
}
+1 -1
View File
@@ -982,7 +982,7 @@ gdk_x11_selection_output_streams_request (GdkDisplay *display,
GOutputStream *stream;
if (special_targets[i].mime_type)
gdk_intern_mime_type (special_targets[i].mime_type);
mime_type = gdk_intern_mime_type (special_targets[i].mime_type);
stream = gdk_x11_selection_output_stream_new (display,
notify,
requestor,
-18
View File
@@ -2648,7 +2648,6 @@ gdk_x11_surface_set_startup_id (GdkSurface *surface,
const char *startup_id)
{
GdkDisplay *display;
char *free_this = NULL;
g_return_if_fail (GDK_IS_SURFACE (surface));
@@ -2665,23 +2664,6 @@ gdk_x11_surface_set_startup_id (GdkSurface *surface,
else
XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"));
if (startup_id == NULL)
{
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
startup_id = free_this = display_x11->startup_notification_id;
display_x11->startup_notification_id = NULL;
if (startup_id == NULL)
return;
}
gdk_x11_display_broadcast_startup_message (display, "remove",
"ID", startup_id,
NULL);
g_free (free_this);
}
static void
+1 -1
View File
@@ -184,7 +184,7 @@ gsk_gl_driver_shader_weak_cb (gpointer data,
}
}
G_GNUC_UNUSED G_GNUC_NULL_TERMINATED static inline GBytes *
G_GNUC_NULL_TERMINATED static inline GBytes *
join_sources (GBytes *first_bytes,
...)
{
+3 -3
View File
@@ -418,7 +418,7 @@ parse_string (GtkCssParser *parser,
if (!gtk_css_token_is (token, GTK_CSS_TOKEN_STRING))
return FALSE;
s = g_strdup (gtk_css_token_get_string (token));
s = g_strdup (token->string.string);
gtk_css_parser_consume_token (parser);
g_free (*(char **) out_string);
@@ -931,7 +931,7 @@ parse_declarations (GtkCssParser *parser,
{
if (gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_IDENT))
gtk_css_parser_error_syntax (parser, "No variable named \"%s\"",
gtk_css_token_get_string (gtk_css_parser_get_token (parser)));
gtk_css_parser_get_token (parser)->string.string);
else
gtk_css_parser_error_syntax (parser, "Expected a variable name");
}
@@ -1894,7 +1894,7 @@ parse_node (GtkCssParser *parser,
if (gtk_css_parser_has_token (parser, GTK_CSS_TOKEN_IDENT))
gtk_css_parser_error_value (parser, "\"%s\" is not a valid node name",
gtk_css_token_get_string (gtk_css_parser_get_token (parser)));
gtk_css_parser_get_token (parser)->string.string);
else
gtk_css_parser_error_syntax (parser, "Expected a node name");
-3
View File
@@ -444,9 +444,6 @@ gtk_at_spi_cache_remove_context (GtkAtSpiCache *self,
g_return_if_fail (GTK_IS_AT_SPI_CONTEXT (context));
const char *path = gtk_at_spi_context_get_context_path (context);
if (path == NULL)
return;
if (!g_hash_table_contains (self->contexts_by_path, path))
return;
+1 -2
View File
@@ -690,8 +690,7 @@ gtk_at_spi_root_constructed (GObject *gobject)
/* No need to validate the path */
self->base_path = g_strconcat (app_path, "/a11y", NULL);
}
if (self->base_path == NULL)
else
{
const char *program_name = g_get_prgname ();
+72
View File
@@ -0,0 +1,72 @@
/* GSK - The GIMP Toolkit
* Copyright (C) 2019 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcsslocationprivate.h"
/**
* GtkCssLocation:
* @bytes: number of bytes parsed since the beginning
* @chars: number of characters parsed since the beginning
* @lines: number of full lines that have been parsed. If you want to
* display this as a line number, you need to add 1 to this.
* @line_bytes: Number of bytes parsed since the last line break
* @line_chars: Number of characters parsed since the last line break
*
* Represents a location in a file or other source of data parsed
* by the CSS engine.
*
* The @bytes and @line_bytes offsets are meant to be used to
* programmatically match data. The @lines and @line_chars offsets
* can be used for printing the location in a file.
*
* Note that the @lines parameter starts from 0 and is increased
* whenever a CSS line break is encountered. (CSS defines the C character
* sequences "\r\n", "\r", "\n" and "\f" as newlines.)
* If your document uses different rules for line breaking, you might want
* run into problems here.
*/
void
gtk_css_location_init (GtkCssLocation *location)
{
memset (location, 0, sizeof (GtkCssLocation));
}
void
gtk_css_location_advance (GtkCssLocation *location,
gsize bytes,
gsize chars)
{
location->bytes += bytes;
location->chars += chars;
location->line_bytes += bytes;
location->line_chars += chars;
}
void
gtk_css_location_advance_newline (GtkCssLocation *location,
gboolean is_windows)
{
gtk_css_location_advance (location, is_windows ? 2 : 1, is_windows ? 2 : 1);
location->lines++;
location->line_bytes = 0;
location->line_chars = 0;
}
+6 -26
View File
@@ -25,33 +25,13 @@
G_BEGIN_DECLS
static inline void
gtk_css_location_init (GtkCssLocation *location)
{
memset (location, 0, sizeof (GtkCssLocation));
}
void gtk_css_location_init (GtkCssLocation *location);
static inline void
gtk_css_location_advance (GtkCssLocation *location,
gsize bytes,
gsize chars)
{
location->bytes += bytes;
location->chars += chars;
location->line_bytes += bytes;
location->line_chars += chars;
}
static inline void
gtk_css_location_advance_newline (GtkCssLocation *location,
gboolean is_windows)
{
location->bytes += is_windows ? 2 : 1;
location->chars += is_windows ? 2 : 1;
location->line_bytes = 0;
location->line_chars = 0;
location->lines++;
}
void gtk_css_location_advance (GtkCssLocation *location,
gsize bytes,
gsize chars);
void gtk_css_location_advance_newline (GtkCssLocation *location,
gboolean is_windows);
G_END_DECLS
+12 -11
View File
@@ -642,13 +642,13 @@ gtk_css_parser_consume_function (GtkCssParser *self,
{
const GtkCssToken *token;
gboolean result = FALSE;
char function_name[64];
char *function_name;
guint arg;
token = gtk_css_parser_get_token (self);
g_return_val_if_fail (gtk_css_token_is (token, GTK_CSS_TOKEN_FUNCTION), FALSE);
g_strlcpy (function_name, gtk_css_token_get_string (token), 64);
function_name = g_strdup (token->string.string);
gtk_css_parser_start_block (self);
arg = 0;
@@ -691,6 +691,7 @@ gtk_css_parser_consume_function (GtkCssParser *self,
}
gtk_css_parser_end_block (self);
g_free (function_name);
return result;
}
@@ -733,7 +734,7 @@ gtk_css_parser_has_ident (GtkCssParser *self,
token = gtk_css_parser_get_token (self);
return gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) &&
g_ascii_strcasecmp (gtk_css_token_get_string (token), ident) == 0;
g_ascii_strcasecmp (token->string.string, ident) == 0;
}
gboolean
@@ -755,7 +756,7 @@ gtk_css_parser_has_integer (GtkCssParser *self)
* Checks if the next token is a function with the given @name.
*
* Returns: %TRUE if the next token is a function with the given @name
*/
**/
gboolean
gtk_css_parser_has_function (GtkCssParser *self,
const char *name)
@@ -765,7 +766,7 @@ gtk_css_parser_has_function (GtkCssParser *self,
token = gtk_css_parser_get_token (self);
return gtk_css_token_is (token, GTK_CSS_TOKEN_FUNCTION) &&
g_ascii_strcasecmp (gtk_css_token_get_string (token), name) == 0;
g_ascii_strcasecmp (token->string.string, name) == 0;
}
/**
@@ -818,7 +819,7 @@ gtk_css_parser_try_ident (GtkCssParser *self,
token = gtk_css_parser_get_token (self);
if (!gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) ||
g_ascii_strcasecmp (gtk_css_token_get_string (token), ident) != 0)
g_ascii_strcasecmp (token->string.string, ident) != 0)
return FALSE;
gtk_css_parser_consume_token (self);
@@ -845,7 +846,7 @@ gtk_css_parser_try_at_keyword (GtkCssParser *self,
token = gtk_css_parser_get_token (self);
if (!gtk_css_token_is (token, GTK_CSS_TOKEN_AT_KEYWORD) ||
g_ascii_strcasecmp (gtk_css_token_get_string (token), keyword) != 0)
g_ascii_strcasecmp (token->string.string, keyword) != 0)
return FALSE;
gtk_css_parser_consume_token (self);
@@ -907,7 +908,7 @@ gtk_css_parser_consume_ident (GtkCssParser *self)
return NULL;
}
ident = g_strdup (gtk_css_token_get_string (token));
ident = g_strdup (token->string.string);
gtk_css_parser_consume_token (self);
return ident;
@@ -938,7 +939,7 @@ gtk_css_parser_consume_string (GtkCssParser *self)
return NULL;
}
ident = g_strdup (gtk_css_token_get_string (token));
ident = g_strdup (token->string.string);
gtk_css_parser_consume_token (self);
return ident;
@@ -962,7 +963,7 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
* gtk_css_parser_consume_url:
* @self: a `GtkCssParser`
*
* If the parser matches the `<url>` token from the [CSS
* If the parser matches the <url> token from the [CSS
* specification](https://drafts.csswg.org/css-values-4/#url-value),
* consumes it, resolves the URL and returns the resulting `GFile`.
* On failure, an error is emitted and %NULL is returned.
@@ -979,7 +980,7 @@ gtk_css_parser_consume_url (GtkCssParser *self)
if (gtk_css_token_is (token, GTK_CSS_TOKEN_URL))
{
url = g_strdup (gtk_css_token_get_string (token));
url = g_strdup (token->string.string);
gtk_css_parser_consume_token (self);
}
else if (gtk_css_token_is_function (token, "url"))
+51 -49
View File
@@ -50,14 +50,18 @@ gtk_css_token_clear (GtkCssToken *token)
case GTK_CSS_TOKEN_HASH_UNRESTRICTED:
case GTK_CSS_TOKEN_HASH_ID:
case GTK_CSS_TOKEN_URL:
if (token->string.len >= 16)
g_free (token->string.u.string);
g_free (token->string.string);
break;
case GTK_CSS_TOKEN_SIGNED_INTEGER_DIMENSION:
case GTK_CSS_TOKEN_SIGNLESS_INTEGER_DIMENSION:
case GTK_CSS_TOKEN_SIGNED_DIMENSION:
case GTK_CSS_TOKEN_SIGNLESS_DIMENSION:
g_free (token->dimension.dimension);
break;
default:
g_assert_not_reached ();
case GTK_CSS_TOKEN_EOF:
case GTK_CSS_TOKEN_WHITESPACE:
case GTK_CSS_TOKEN_OPEN_PARENS:
@@ -87,9 +91,6 @@ gtk_css_token_clear (GtkCssToken *token)
case GTK_CSS_TOKEN_BAD_URL:
case GTK_CSS_TOKEN_COMMENT:
break;
default:
g_assert_not_reached ();
}
token->type = GTK_CSS_TOKEN_EOF;
@@ -295,7 +296,7 @@ gtk_css_token_is_ident (const GtkCssToken *token,
const char *ident)
{
return gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT)
&& (g_ascii_strcasecmp (gtk_css_token_get_string (token), ident) == 0);
&& (g_ascii_strcasecmp (token->string.string, ident) == 0);
}
gboolean
@@ -303,7 +304,7 @@ gtk_css_token_is_function (const GtkCssToken *token,
const char *ident)
{
return gtk_css_token_is (token, GTK_CSS_TOKEN_FUNCTION)
&& (g_ascii_strcasecmp (gtk_css_token_get_string (token), ident) == 0);
&& (g_ascii_strcasecmp (token->string.string, ident) == 0);
}
gboolean
@@ -323,33 +324,33 @@ gtk_css_token_print (const GtkCssToken *token,
switch (token->type)
{
case GTK_CSS_TOKEN_STRING:
append_string (string, gtk_css_token_get_string (token));
append_string (string, token->string.string);
break;
case GTK_CSS_TOKEN_IDENT:
append_ident (string, gtk_css_token_get_string (token));
append_ident (string, token->string.string);
break;
case GTK_CSS_TOKEN_URL:
g_string_append (string, "url(");
append_ident (string, gtk_css_token_get_string (token));
append_ident (string, token->string.string);
g_string_append (string, ")");
break;
case GTK_CSS_TOKEN_FUNCTION:
append_ident (string, gtk_css_token_get_string (token));
append_ident (string, token->string.string);
g_string_append_c (string, '(');
break;
case GTK_CSS_TOKEN_AT_KEYWORD:
g_string_append_c (string, '@');
append_ident (string, gtk_css_token_get_string (token));
append_ident (string, token->string.string);
break;
case GTK_CSS_TOKEN_HASH_UNRESTRICTED:
case GTK_CSS_TOKEN_HASH_ID:
g_string_append_c (string, '#');
append_ident (string, gtk_css_token_get_string (token));
append_ident (string, token->string.string);
break;
case GTK_CSS_TOKEN_DELIM:
@@ -491,7 +492,7 @@ gtk_css_token_to_string (const GtkCssToken *token)
static void
gtk_css_token_init_string (GtkCssToken *token,
GtkCssTokenType type,
GString *string)
char *string)
{
token->type = type;
@@ -504,11 +505,7 @@ gtk_css_token_init_string (GtkCssToken *token,
case GTK_CSS_TOKEN_HASH_UNRESTRICTED:
case GTK_CSS_TOKEN_HASH_ID:
case GTK_CSS_TOKEN_URL:
token->string.len = string->len;
if (string->len < 16)
g_strlcpy (token->string.u.buf, string->str, 16);
else
token->string.u.string = g_strdup (string->str);
token->string.string = string;
break;
default:
g_assert_not_reached ();
@@ -548,7 +545,7 @@ static void
gtk_css_token_init_dimension (GtkCssToken *token,
GtkCssTokenType type,
double value,
GString *string)
char *dimension)
{
token->type = type;
@@ -559,7 +556,7 @@ gtk_css_token_init_dimension (GtkCssToken *token,
case GTK_CSS_TOKEN_SIGNED_DIMENSION:
case GTK_CSS_TOKEN_SIGNLESS_DIMENSION:
token->dimension.value = value;
g_strlcpy (token->dimension.dimension, string->str, 8);
token->dimension.dimension = dimension;
break;
default:
g_assert_not_reached ();
@@ -633,7 +630,7 @@ gtk_css_tokenizer_parse_error (GError **error,
va_end (args);
}
static inline gboolean
static gboolean
is_newline (char c)
{
return c == '\n'
@@ -641,7 +638,7 @@ is_newline (char c)
|| c == '\f';
}
static inline gboolean
static gboolean
is_whitespace (char c)
{
return is_newline (c)
@@ -649,13 +646,13 @@ is_whitespace (char c)
|| c == ' ';
}
static inline gboolean
static gboolean
is_multibyte (char c)
{
return c & 0x80;
}
static inline gboolean
static gboolean
is_name_start (char c)
{
return is_multibyte (c)
@@ -663,7 +660,7 @@ is_name_start (char c)
|| c == '_';
}
static inline gboolean
static gboolean
is_name (char c)
{
return is_name_start (c)
@@ -671,7 +668,7 @@ is_name (char c)
|| c == '-';
}
static inline gboolean
static gboolean
is_non_printable (char c)
{
return (c >= 0 && c <= 0x08)
@@ -681,7 +678,7 @@ is_non_printable (char c)
|| c == 0x7F;
}
static inline gboolean
static gboolean
is_valid_escape (const char *data,
const char *end)
{
@@ -706,7 +703,7 @@ gtk_css_tokenizer_remaining (GtkCssTokenizer *tokenizer)
return tokenizer->end - tokenizer->data;
}
static inline gboolean
static gboolean
gtk_css_tokenizer_has_valid_escape (GtkCssTokenizer *tokenizer)
{
return is_valid_escape (tokenizer->data, tokenizer->end);
@@ -878,7 +875,7 @@ gtk_css_tokenizer_read_escape (GtkCssTokenizer *tokenizer)
return value;
}
static void
static char *
gtk_css_tokenizer_read_name (GtkCssTokenizer *tokenizer)
{
g_string_set_size (tokenizer->name_buffer, 0);
@@ -914,6 +911,8 @@ gtk_css_tokenizer_read_name (GtkCssTokenizer *tokenizer)
}
}
while (tokenizer->data != tokenizer->end);
return g_strndup (tokenizer->name_buffer->str, tokenizer->name_buffer->len);
}
static void
@@ -1006,8 +1005,7 @@ gtk_css_tokenizer_read_url (GtkCssTokenizer *tokenizer,
}
}
gtk_css_token_init_string (token, GTK_CSS_TOKEN_URL, url);
g_string_free (url, TRUE);
gtk_css_token_init_string (token, GTK_CSS_TOKEN_URL, g_string_free (url, FALSE));
return TRUE;
}
@@ -1017,12 +1015,12 @@ gtk_css_tokenizer_read_ident_like (GtkCssTokenizer *tokenizer,
GtkCssToken *token,
GError **error)
{
gtk_css_tokenizer_read_name (tokenizer);
char *name = gtk_css_tokenizer_read_name (tokenizer);
if (*tokenizer->data == '(')
{
gtk_css_tokenizer_consume_ascii (tokenizer);
if (g_ascii_strcasecmp (tokenizer->name_buffer->str, "url") == 0)
if (g_ascii_strcasecmp (name, "url") == 0)
{
const char *data = tokenizer->data;
@@ -1030,15 +1028,18 @@ gtk_css_tokenizer_read_ident_like (GtkCssTokenizer *tokenizer,
data++;
if (*data != '"' && *data != '\'')
return gtk_css_tokenizer_read_url (tokenizer, token, error);
{
g_free (name);
return gtk_css_tokenizer_read_url (tokenizer, token, error);
}
}
gtk_css_token_init_string (token, GTK_CSS_TOKEN_FUNCTION, tokenizer->name_buffer);
gtk_css_token_init_string (token, GTK_CSS_TOKEN_FUNCTION, name);
return TRUE;
}
else
{
gtk_css_token_init_string (token, GTK_CSS_TOKEN_IDENT, tokenizer->name_buffer);
gtk_css_token_init_string (token, GTK_CSS_TOKEN_IDENT, name);
return TRUE;
}
}
@@ -1128,8 +1129,7 @@ gtk_css_tokenizer_read_numeric (GtkCssTokenizer *tokenizer,
else
type = has_sign ? GTK_CSS_TOKEN_SIGNED_DIMENSION : GTK_CSS_TOKEN_SIGNLESS_DIMENSION;
gtk_css_tokenizer_read_name (tokenizer);
gtk_css_token_init_dimension (token, type, value, tokenizer->name_buffer);
gtk_css_token_init_dimension (token, type, value, gtk_css_tokenizer_read_name (tokenizer));
}
else if (gtk_css_tokenizer_remaining (tokenizer) > 0 && *tokenizer->data == '%')
{
@@ -1145,7 +1145,7 @@ gtk_css_tokenizer_read_numeric (GtkCssTokenizer *tokenizer,
else
type = has_sign ? GTK_CSS_TOKEN_SIGNED_NUMBER : GTK_CSS_TOKEN_SIGNLESS_NUMBER;
gtk_css_token_init_number (token, type, value);
gtk_css_token_init_number (token, type,value);
}
}
@@ -1196,8 +1196,7 @@ gtk_css_tokenizer_read_string (GtkCssTokenizer *tokenizer,
GtkCssToken *token,
GError **error)
{
g_string_set_size (tokenizer->name_buffer, 0);
GString *string = g_string_new (NULL);
char end = *tokenizer->data;
gtk_css_tokenizer_consume_ascii (tokenizer);
@@ -1223,22 +1222,23 @@ gtk_css_tokenizer_read_string (GtkCssTokenizer *tokenizer,
}
else
{
g_string_append_unichar (tokenizer->name_buffer, gtk_css_tokenizer_read_escape (tokenizer));
g_string_append_unichar (string, gtk_css_tokenizer_read_escape (tokenizer));
}
}
else if (is_newline (*tokenizer->data))
{
g_string_free (string, TRUE);
gtk_css_token_init (token, GTK_CSS_TOKEN_BAD_STRING);
gtk_css_tokenizer_parse_error (error, "Newlines inside strings must be escaped");
return FALSE;
}
else
{
gtk_css_tokenizer_consume_char (tokenizer, tokenizer->name_buffer);
gtk_css_tokenizer_consume_char (tokenizer, string);
}
}
gtk_css_token_init_string (token, GTK_CSS_TOKEN_STRING, tokenizer->name_buffer);
gtk_css_token_init_string (token, GTK_CSS_TOKEN_STRING, g_string_free (string, FALSE));
return TRUE;
}
@@ -1322,8 +1322,9 @@ gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
else
type = GTK_CSS_TOKEN_HASH_UNRESTRICTED;
gtk_css_tokenizer_read_name (tokenizer);
gtk_css_token_init_string (token, type, tokenizer->name_buffer);
gtk_css_token_init_string (token,
type,
gtk_css_tokenizer_read_name (tokenizer));
}
else
{
@@ -1403,8 +1404,9 @@ gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
gtk_css_tokenizer_consume_ascii (tokenizer);
if (gtk_css_tokenizer_has_identifier (tokenizer))
{
gtk_css_tokenizer_read_name (tokenizer);
gtk_css_token_init_string (token, GTK_CSS_TOKEN_AT_KEYWORD, tokenizer->name_buffer);
gtk_css_token_init_string (token,
GTK_CSS_TOKEN_AT_KEYWORD,
gtk_css_tokenizer_read_name (tokenizer));
}
else
{
+2 -15
View File
@@ -81,11 +81,7 @@ typedef struct _GtkCssDimensionToken GtkCssDimensionToken;
struct _GtkCssStringToken {
GtkCssTokenType type;
int len;
union {
char buf[16];
char *string;
} u;
char *string;
};
struct _GtkCssDelimToken {
@@ -101,7 +97,7 @@ struct _GtkCssNumberToken {
struct _GtkCssDimensionToken {
GtkCssTokenType type;
double value;
char dimension[8];
char *dimension;
};
union _GtkCssToken {
@@ -112,15 +108,6 @@ union _GtkCssToken {
GtkCssDimensionToken dimension;
};
static inline const char *
gtk_css_token_get_string (const GtkCssToken *token)
{
if (token->string.len < 16)
return token->string.u.buf;
else
return token->string.u.string;
}
void gtk_css_token_clear (GtkCssToken *token);
gboolean gtk_css_token_is_finite (const GtkCssToken *token) G_GNUC_PURE;
+1
View File
@@ -1,4 +1,5 @@
gtk_css_public_sources = files([
'gtkcsslocation.c',
'gtkcsserror.c',
'gtkcsssection.c',
])
+2 -2
View File
@@ -59,8 +59,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* ## GtkComboBoxText as GtkBuildable
*
* The `GtkComboBoxText` implementation of the `GtkBuildable` interface supports
* adding items directly using the `<items>` element and specifying `<item>`
* elements for each item. Each `<item>` element can specify the id
* adding items directly using the <items> element and specifying <item>
* elements for each item. Each <item> element can specify the id
* corresponding to the appended text and also supports the regular
* translation attributes translatable, context and comments.
*
-32
View File
@@ -169,8 +169,6 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* # Accessibility
*
* `GtkDialog` uses the %GTK_ACCESSIBLE_ROLE_DIALOG role.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
typedef struct _ResponseData ResponseData;
@@ -513,8 +511,6 @@ gtk_dialog_class_init (GtkDialogClass *class)
* delete event, and when [method@Gtk.Dialog.response] is called.
* On a delete event, the response ID is %GTK_RESPONSE_DELETE_EVENT.
* Otherwise, it depends on which action widget was clicked.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
dialog_signals[RESPONSE] =
g_signal_new (I_("response"),
@@ -534,8 +530,6 @@ gtk_dialog_class_init (GtkDialogClass *class)
* This is a [keybinding signal](class.SignalAction.html).
*
* The default binding for this signal is the Escape key.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
dialog_signals[CLOSE] =
g_signal_new (I_("close"),
@@ -567,8 +561,6 @@ gtk_dialog_class_init (GtkDialogClass *class)
* g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
* dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
* ```
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
g_object_class_install_property (gobject_class,
PROP_USE_HEADER_BAR,
@@ -698,8 +690,6 @@ gtk_dialog_close (GtkDialog *dialog)
* as described above.
*
* Returns: the new dialog as a `GtkWidget`
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
GtkWidget*
gtk_dialog_new (void)
@@ -776,8 +766,6 @@ gtk_dialog_new_empty (const char *title,
* ```
*
* Returns: a new `GtkDialog`
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
GtkWidget*
gtk_dialog_new_with_buttons (const char *title,
@@ -869,8 +857,6 @@ get_response_data (GtkDialog *dialog,
*
* If you want to add a non-activatable widget, simply pack it into
* the @action_area field of the `GtkDialog` struct.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
void
gtk_dialog_add_action_widget (GtkDialog *dialog,
@@ -912,8 +898,6 @@ gtk_dialog_add_action_widget (GtkDialog *dialog,
* The button widget is returned, but usually you dont need it.
*
* Returns: (transfer none): the `GtkButton` widget that was added
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
GtkWidget*
gtk_dialog_add_button (GtkDialog *dialog,
@@ -972,8 +956,6 @@ gtk_dialog_add_buttons_valist (GtkDialog *dialog,
* repeatedly. The variable argument list should be %NULL-terminated
* as with [ctor@Gtk.Dialog.new_with_buttons]. Each button must have both
* text and response ID.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
void
gtk_dialog_add_buttons (GtkDialog *dialog,
@@ -1001,8 +983,6 @@ gtk_dialog_add_buttons (GtkDialog *dialog,
*
* Calls `gtk_widget_set_sensitive (widget, @setting)`
* for each widget in the dialogs action area with the given @response_id.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
void
gtk_dialog_set_response_sensitive (GtkDialog *dialog,
@@ -1029,8 +1009,6 @@ gtk_dialog_set_response_sensitive (GtkDialog *dialog,
* Sets the default widget for the dialog based on the response ID.
*
* Pressing Enter normally activates the default widget.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
void
gtk_dialog_set_default_response (GtkDialog *dialog,
@@ -1059,8 +1037,6 @@ gtk_dialog_set_default_response (GtkDialog *dialog,
* Emits the ::response signal with the given response ID.
*
* Used to indicate that the user has responded to the dialog in some way.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
void
gtk_dialog_response (GtkDialog *dialog,
@@ -1084,8 +1060,6 @@ gtk_dialog_response (GtkDialog *dialog,
*
* Returns: (nullable) (transfer none): the @widget button that uses the given
* @response_id
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
GtkWidget*
gtk_dialog_get_widget_for_response (GtkDialog *dialog,
@@ -1115,8 +1089,6 @@ gtk_dialog_get_widget_for_response (GtkDialog *dialog,
*
* Returns: the response id of @widget, or %GTK_RESPONSE_NONE
* if @widget doesnt have a response id set.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
int
gtk_dialog_get_response_for_widget (GtkDialog *dialog,
@@ -1426,8 +1398,6 @@ gtk_dialog_get_action_area (GtkDialog *dialog)
* [property@Gtk.Dialog:use-header-bar] property is %TRUE.
*
* Returns: (type Gtk.HeaderBar) (transfer none): the header bar
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
GtkWidget *
gtk_dialog_get_header_bar (GtkDialog *dialog)
@@ -1446,8 +1416,6 @@ gtk_dialog_get_header_bar (GtkDialog *dialog)
* Returns the content area of @dialog.
*
* Returns: (type Gtk.Box) (transfer none): the content area `GtkBox`.
*
* Deprecated: 4.10: Use [class@Gtk.Window] instead
*/
GtkWidget *
gtk_dialog_get_content_area (GtkDialog *dialog)
+3 -6
View File
@@ -99,8 +99,7 @@ window_handle_exported (GtkWindow *window,
* This is the recommended call to be used as it passes information
* necessary for sandbox helpers to parent their dialogs properly.
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
* [method@Gtk.UriLauncher.launch] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] instead
*/
void
gtk_show_uri_full (GtkWindow *parent,
@@ -148,8 +147,7 @@ gtk_show_uri_full (GtkWindow *parent,
* Returns: %TRUE if the URI was shown successfully.
* Otherwise, %FALSE is returned and @error is set
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] or
* [method@Gtk.UriLauncher.launch_finish] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch_finish] instead
*/
gboolean
gtk_show_uri_full_finish (GtkWindow *parent,
@@ -193,8 +191,7 @@ show_uri_done (GObject *object,
* This function launches the default application for showing
* a given uri, or shows an error dialog if that fails.
*
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] or
* [method@Gtk.UriLauncher.launch] instead
* Deprecated: 4.10: Use [method@Gtk.FileLauncher.launch] instead
*/
void
gtk_show_uri (GtkWindow *parent,
+2 -2
View File
@@ -47,8 +47,8 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
* ## GtkTreeStore as GtkBuildable
*
* The GtkTreeStore implementation of the `GtkBuildable` interface allows
* to specify the model columns with a `<columns>` element that may contain
* multiple `<column>` elements, each specifying one model column. The type
* to specify the model columns with a <columns> element that may contain
* multiple <column> elements, each specifying one model column. The type
* attribute specifies the data type for the column.
*
* An example of a UI Definition fragment for a tree store:
+8 -10
View File
@@ -587,12 +587,10 @@ gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
if (gdk_texture_can_load (bytes))
{
/* We know these formats can't be scaled */
texture = gdk_texture_new_from_bytes (bytes, NULL);
if (texture == NULL)
return NULL;
/* We know these formats can't be scaled */
paintable = GDK_PAINTABLE (texture);
}
else
{
@@ -612,15 +610,15 @@ gdk_paintable_new_from_bytes_scaled (GBytes *bytes,
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
g_object_unref (loader);
if (loader_data.scale_factor != 1)
paintable = gtk_scaler_new (GDK_PAINTABLE (texture), loader_data.scale_factor);
else
paintable = g_object_ref (GDK_PAINTABLE (texture));
g_object_unref (texture);
}
if (loader_data.scale_factor != 1)
paintable = gtk_scaler_new (GDK_PAINTABLE (texture), loader_data.scale_factor);
else
paintable = g_object_ref ((GdkPaintable *)texture);
g_object_unref (texture);
return paintable;
}
-4
View File
@@ -70,10 +70,6 @@ for f in get_files('ui', '.ui'):
xml += '\n'
xml += '''
<file compressed="true">icons/hicolor.index.theme</file>
'''
for s in ['16x16', '32x32', '64x64', 'scalable']:
for c in ['actions', 'categories', 'emblems', 'emotes', 'devices', 'mimetypes', 'places', 'status']:
icons_dir = 'icons/{0}/{1}'.format(s,c)
+16 -84
View File
@@ -103,7 +103,6 @@ enum {
typedef struct {
GtkWindow *parent;
GFile *file;
char *uri;
gboolean open_folder;
GDBusConnection *connection;
GCancellable *cancellable;
@@ -126,7 +125,6 @@ open_uri_data_free (OpenUriData *data)
gtk_window_unexport_handle (data->parent);
g_clear_object (&data->parent);
g_clear_object (&data->file);
g_free (data->uri);
g_clear_object (&data->cancellable);
g_clear_object (&data->task);
g_free (data->handle);
@@ -153,7 +151,7 @@ response_received (GDBusConnection *connection,
g_task_return_boolean (task, TRUE);
break;
case XDG_DESKTOP_PORTAL_CANCELLED:
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_DISMISSED, "The portal dialog was dismissed by the user");
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "The portal dialog was closed");
break;
case XDG_DESKTOP_PORTAL_FAILED:
default:
@@ -254,19 +252,19 @@ canceled (GCancellable *cancellable,
send_close (data);
g_task_return_new_error (task,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED,
"The OpenURI portal call was cancelled by the application");
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_ABORTED,
"The OpenURI portal call was cancelled programmatically");
g_object_unref (task);
}
static void
open_uri (OpenUriData *data,
open_uri (GFile *file,
gboolean open_folder,
const char *parent_window,
const char *activation_token,
GAsyncReadyCallback callback)
GAsyncReadyCallback callback,
gpointer user_data)
{
GFile *file = data->file;
gboolean open_folder = data->open_folder;
OpenUriData *data = user_data;
GTask *task;
GVariant *opts = NULL;
int i;
@@ -278,9 +276,9 @@ open_uri (OpenUriData *data,
connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (openuri));
data->connection = g_object_ref (connection);
task = g_task_new (NULL, NULL, callback, data);
task = g_task_new (NULL, NULL, callback, user_data);
g_task_set_check_cancellable (task, FALSE);
g_task_set_task_data (task, data, NULL);
g_task_set_task_data (task, user_data, NULL);
if (data->cancellable)
data->cancel_handler = g_signal_connect (data->cancellable, "cancelled", G_CALLBACK (canceled), task);
@@ -308,12 +306,9 @@ open_uri (OpenUriData *data,
g_variant_builder_add (&opt_builder, "{sv}", "handle_token", g_variant_new_string (token));
g_free (token);
if (activation_token)
g_variant_builder_add (&opt_builder, "{sv}", "activation_token", g_variant_new_string (activation_token));
opts = g_variant_builder_end (&opt_builder);
if (file && g_file_is_native (file))
if (g_file_is_native (file))
{
const char *path = NULL;
GUnixFDList *fd_list = NULL;
@@ -367,15 +362,12 @@ open_uri (OpenUriData *data,
}
else
{
char *uri = NULL;
if (file)
uri = g_file_get_uri (file);
char *uri = g_file_get_uri (file);
data->call = OPEN_URI;
gxdp_open_uri_call_open_uri (openuri,
parent_window ? parent_window : "",
uri ? uri : data->uri,
uri,
opts,
NULL,
open_call_done,
@@ -398,8 +390,8 @@ open_uri_done (GObject *source,
{
g_error_free (error);
g_task_return_new_error (data->task,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED,
"The operation was cancelled by the application");
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_ABORTED,
"The operation was aborted programmatically");
}
else
g_task_return_error (data->task, error);
@@ -416,28 +408,8 @@ window_handle_exported (GtkWindow *window,
gpointer user_data)
{
OpenUriData *data = user_data;
GdkDisplay *display;
GAppLaunchContext *context;
char *activation_token = NULL;
if (window)
display = gtk_widget_get_display (GTK_WIDGET (window));
else
display = gdk_display_get_default ();
/* FIXME
* Call the vfunc directly since g_app_launch_context_get_startup_notify_id
* has NULL checks.
*
* We should have a more direct way to do this.
*/
context = G_APP_LAUNCH_CONTEXT (gdk_display_get_app_launch_context (display));
activation_token = G_APP_LAUNCH_CONTEXT_GET_CLASS (context)->get_startup_notify_id (context, NULL, NULL);
g_object_unref (context);
open_uri (data, handle, activation_token, open_uri_done);
g_free (activation_token);
open_uri (data->file, data->open_folder, handle, open_uri_done, data);
}
void
@@ -475,45 +447,5 @@ gboolean
g_openuri_portal_open_finish (GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == g_openuri_portal_open_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
void
g_openuri_portal_open_uri_async (const char *uri,
GtkWindow *parent,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
OpenUriData *data;
if (!init_openuri_portal ())
{
g_task_report_new_error (NULL, callback, user_data, NULL,
GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED,
"The OpenURI portal is not available");
return;
}
data = g_new0 (OpenUriData, 1);
data->parent = parent ? g_object_ref (parent) : NULL;
data->uri = g_strdup (uri);
data->cancellable = cancellable ? g_object_ref (cancellable) : NULL;
data->task = g_task_new (parent, cancellable, callback, user_data);
g_task_set_check_cancellable (data->task, FALSE);
g_task_set_source_tag (data->task, g_openuri_portal_open_uri_async);
if (!parent || !gtk_window_export_handle (parent, window_handle_exported, data))
window_handle_exported (parent, NULL, data);
}
gboolean
g_openuri_portal_open_uri_finish (GAsyncResult *result,
GError **error)
{
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == g_openuri_portal_open_uri_async, FALSE);
return g_task_propagate_boolean (G_TASK (result), error);
}
-9
View File
@@ -38,15 +38,6 @@ void g_openuri_portal_open_async (GFile *file,
gboolean g_openuri_portal_open_finish (GAsyncResult *result,
GError **error);
void g_openuri_portal_open_uri_async (const char *uri,
GtkWindow *window,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean g_openuri_portal_open_uri_finish (GAsyncResult *result,
GError **error);
G_END_DECLS
#endif
-1
View File
@@ -286,7 +286,6 @@
#include <gtk/deprecated/gtktreeviewcolumn.h>
#include <gtk/gtktypebuiltins.h>
#include <gtk/gtktypes.h>
#include <gtk/gtkurilauncher.h>
#include <gtk/gtkversion.h>
#include <gtk/gtkvideo.h>
#include <gtk/gtkviewport.h>
+7 -4
View File
@@ -44,13 +44,13 @@
#include "gtkorientable.h"
#include "gtkscrolledwindow.h"
#include "gtktextview.h"
#include "gtkfilelauncher.h"
#include "gtkmain.h"
#include "gtktogglebutton.h"
#include "gtktypebuiltins.h"
#include "gtkstack.h"
#include "gtkstackswitcher.h"
#include "gtksettings.h"
#include "gtkurilauncher.h"
#include "gtkheaderbar.h"
#include "gtkprivate.h"
#include <glib/gi18n-lib.h>
@@ -932,13 +932,16 @@ static gboolean
gtk_about_dialog_activate_link (GtkAboutDialog *about,
const char *uri)
{
GtkUriLauncher *launcher;
GtkFileLauncher *launcher;
GFile *file;
launcher = gtk_uri_launcher_new (uri);
file = g_file_new_for_uri (uri);
launcher = gtk_file_launcher_new (file);
gtk_uri_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
gtk_file_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
g_object_unref (launcher);
g_object_unref (file);
return TRUE;
}
+9 -9
View File
@@ -139,7 +139,7 @@ gtk_accessible_update_state (GtkAccessible *self,
GtkAccessibleState first_state,
...)
{
int state;
GtkAccessibleState state;
GtkATContext *context;
va_list args;
@@ -157,7 +157,7 @@ gtk_accessible_update_state (GtkAccessible *self,
{
GError *error = NULL;
GtkAccessibleValue *value =
gtk_accessible_value_collect_for_state ((GtkAccessibleState) state, &error, &args);
gtk_accessible_value_collect_for_state (state, &error, &args);
if (error != NULL)
{
@@ -168,7 +168,7 @@ gtk_accessible_update_state (GtkAccessible *self,
goto out;
}
gtk_at_context_set_accessible_state (context, (GtkAccessibleState) state, value);
gtk_at_context_set_accessible_state (context, state, value);
if (value != NULL)
gtk_accessible_value_unref (value);
@@ -286,7 +286,7 @@ gtk_accessible_update_property (GtkAccessible *self,
GtkAccessibleProperty first_property,
...)
{
int property;
GtkAccessibleProperty property;
GtkATContext *context;
va_list args;
@@ -304,7 +304,7 @@ gtk_accessible_update_property (GtkAccessible *self,
{
GError *error = NULL;
GtkAccessibleValue *value =
gtk_accessible_value_collect_for_property ((GtkAccessibleProperty) property, &error, &args);
gtk_accessible_value_collect_for_property (property, &error, &args);
if (error != NULL)
{
@@ -315,7 +315,7 @@ gtk_accessible_update_property (GtkAccessible *self,
goto out;
}
gtk_at_context_set_accessible_property (context, (GtkAccessibleProperty) property, value);
gtk_at_context_set_accessible_property (context, property, value);
if (value != NULL)
gtk_accessible_value_unref (value);
@@ -433,7 +433,7 @@ gtk_accessible_update_relation (GtkAccessible *self,
GtkAccessibleRelation first_relation,
...)
{
int relation;
GtkAccessibleRelation relation;
GtkATContext *context;
va_list args;
@@ -451,7 +451,7 @@ gtk_accessible_update_relation (GtkAccessible *self,
{
GError *error = NULL;
GtkAccessibleValue *value =
gtk_accessible_value_collect_for_relation ((GtkAccessibleRelation) relation, &error, &args);
gtk_accessible_value_collect_for_relation (relation, &error, &args);
if (error != NULL)
{
@@ -462,7 +462,7 @@ gtk_accessible_update_relation (GtkAccessible *self,
goto out;
}
gtk_at_context_set_accessible_relation (context, (GtkAccessibleRelation) relation, value);
gtk_at_context_set_accessible_relation (context, relation, value);
if (value != NULL)
gtk_accessible_value_unref (value);
+8 -20
View File
@@ -22,7 +22,6 @@
#include "gtkalertdialog.h"
#include "gtkbutton.h"
#include "gtkdialogerror.h"
#include "deprecated/gtkmessagedialog.h"
#include <glib/gi18n-lib.h>
@@ -607,11 +606,7 @@ response_cb (GTask *task,
if (cancellable)
g_signal_handlers_disconnect_by_func (cancellable, cancelled_cb, task);
if (response == GTK_RESPONSE_CLOSE)
{
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "Cancelled by application");
}
else if (response >= 0)
if (response >= 0)
{
g_task_return_int (task, response);
}
@@ -619,10 +614,7 @@ response_cb (GTask *task,
{
GtkAlertDialog *self = GTK_ALERT_DIALOG (g_task_get_source_object (task));
if (self->cancel_return >= 0)
g_task_return_int (task, self->cancel_return);
else
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_DISMISSED, "Dismissed by user");
g_task_return_int (task, self->cancel_return);
}
g_object_unref (task);
@@ -727,7 +719,6 @@ gtk_alert_dialog_choose (GtkAlertDialog *self,
* gtk_alert_dialog_choose_finish:
* @self: a `GtkAlertDialog`
* @result: a `GAsyncResult`
* @error: return location for a [enum@Gtk.DialogError] error
*
* Finishes the [method@Gtk.AlertDialog.choose] call
* and returns the index of the button that was clicked.
@@ -740,14 +731,13 @@ gtk_alert_dialog_choose (GtkAlertDialog *self,
*/
int
gtk_alert_dialog_choose_finish (GtkAlertDialog *self,
GAsyncResult *result,
GError **error)
GAsyncResult *result)
{
g_return_val_if_fail (GTK_IS_ALERT_DIALOG (self), -1);
g_return_val_if_fail (g_task_is_valid (result, self), -1);
g_return_val_if_fail (g_task_get_source_tag (G_TASK (result)) == gtk_alert_dialog_choose, -1);
return (int) g_task_propagate_int (G_TASK (result), error);
return (int) g_task_propagate_int (G_TASK (result), NULL);
}
/**
@@ -755,13 +745,11 @@ gtk_alert_dialog_choose_finish (GtkAlertDialog *self,
* @self: a `GtkAlertDialog`
* @parent: (nullable): the parent `GtkWindow`
*
* Show the alert to the user.
* This function shows the alert to the user.
*
* This function is a simple version of [method@Gtk.AlertDialog.choose]
* intended for dialogs with a single button.
* If you want to cancel the dialog or if the alert has more than one button,
* you should use that function instead and provide it with a #GCancellable or
* callback respectively.
* If the alert has more than one button, you should use
* [method@Gtk.AlertDialog.choose] instead and provide
* a callback that can react to the button that was clicked.
*
* Since: 4.10
*/
+1 -2
View File
@@ -87,8 +87,7 @@ void gtk_alert_dialog_choose (GtkAlertDialog *self,
GDK_AVAILABLE_IN_4_10
int gtk_alert_dialog_choose_finish (GtkAlertDialog *self,
GAsyncResult *result,
GError **error);
GAsyncResult *result);
GDK_AVAILABLE_IN_4_10
void gtk_alert_dialog_show (GtkAlertDialog *self,
-1
View File
@@ -27,7 +27,6 @@
#include <gdk/wayland/gdkwayland.h>
#include <gdk/wayland/gdkdisplay-wayland.h>
#include <gdk/wayland/gdksurface-wayland.h>
#include <gdk/wayland/gdktoplevel-wayland-private.h>
#include <gdk/wayland/idle-inhibit-unstable-v1-client-protocol.h>
typedef struct
+11
View File
@@ -342,6 +342,17 @@ static void
gtk_application_after_emit (GApplication *application,
GVariant *platform_data)
{
const char *startup_notification_id = NULL;
g_variant_lookup (platform_data, "desktop-startup-id", "&s", &startup_notification_id);
if (startup_notification_id)
{
GdkDisplay *display;
display = gdk_display_get_default ();
if (display)
gdk_display_notify_startup_complete (display, startup_notification_id);
}
}
static void
+1 -1
View File
@@ -454,7 +454,7 @@ gtk_aspect_frame_get_ratio (GtkAspectFrame *self)
* gtk_aspect_frame_set_obey_child: (attributes org.gtk.Method.set_propery=obey-child)
* @self: a `GtkAspectFrame`
* @obey_child: If %TRUE, @ratio is ignored, and the aspect
* ratio is taken from the requisition of the child.
* ratio is taken from the requistion of the child.
*
* Sets whether the aspect ratio of the child's size
* request should override the set aspect ratio of
+32
View File
@@ -902,6 +902,31 @@ gtk_at_context_get_accessible_relation (GtkATContext *self,
return gtk_accessible_attribute_set_get_value (self->relations, relation);
}
static gboolean
is_structural_role (GtkAccessibleRole role)
{
/* Keep the switch small while avoiding the compiler warning for
* unhandled enumeration values
*/
switch ((int) role)
{
case GTK_ACCESSIBLE_ROLE_FORM:
case GTK_ACCESSIBLE_ROLE_GROUP:
case GTK_ACCESSIBLE_ROLE_GENERIC:
case GTK_ACCESSIBLE_ROLE_LANDMARK:
case GTK_ACCESSIBLE_ROLE_LIST_ITEM:
case GTK_ACCESSIBLE_ROLE_REGION:
case GTK_ACCESSIBLE_ROLE_SEARCH:
case GTK_ACCESSIBLE_ROLE_SEPARATOR:
return TRUE;
default:
break;
}
return FALSE;
}
/* See the WAI-ARIA § 4.3, "Accessible Name and Description Computation" */
static void
gtk_at_context_get_name_accumulate (GtkATContext *self,
@@ -973,6 +998,13 @@ gtk_at_context_get_name_accumulate (GtkATContext *self,
return;
}
/* This fallback is in place only for unlabelled elements */
if (names->len != 0)
return;
/* Ignore structural elements, namely: generic containers */
if (self->accessible != NULL && !is_structural_role (role))
g_ptr_array_add (names, (char *)G_OBJECT_TYPE_NAME (self->accessible));
}
static void
+2 -2
View File
@@ -80,7 +80,7 @@ gtk_buildable_set_buildable_id (GtkBuildable *buildable,
* Gets the ID of the @buildable object.
*
* `GtkBuilder` sets the name based on the ID attribute
* of the `<object>` tag used to construct the @buildable.
* of the <object> tag used to construct the @buildable.
*
* Returns: (nullable): the ID of the buildable object
**/
@@ -193,7 +193,7 @@ gtk_buildable_construct_child (GtkBuildable *buildable,
* @data: (out): return location for user data that will be passed in
* to parser functions
*
* This is called for each unknown element under `<child>`.
* This is called for each unknown element under <child>.
*
* Returns: %TRUE if an object has a custom implementation, %FALSE
* if it doesn't.
+3 -3
View File
@@ -109,14 +109,14 @@ struct _GtkBuildableParser
* interface is created.
* @construct_child: Constructs a child of a buildable that has been
* specified as constructor in the UI definition. This can be used to
* reference a widget created in a `<ui>` tag which is outside
* reference a widget created in a <ui> tag which is outside
* of the normal GtkBuilder UI definition hierarchy. A reference to the
* constructed object is returned and becomes owned by the caller.
* @custom_tag_start: Implement this if the buildable needs to parse
* content below `<child>`. To handle an element, the implementation
* content below <child>. To handle an element, the implementation
* must fill in the @parser and @user_data and return %TRUE.
* `GtkWidget` implements this to parse accessible attributes specified
* in `<accessibility>` elements.
* in <accessibility> elements.
* Note that @user_data must be freed in @custom_tag_end or @custom_finished.
* @custom_tag_end: Called for the end tag of each custom element that is
* handled by the buildable (see @custom_tag_start).
+2 -2
View File
@@ -192,9 +192,9 @@
*
* Beyond this general structure, several object classes define their
* own XML DTD fragments for filling in the ANY placeholders in the DTD
* above. Note that a custom element in a `<child>` element gets parsed by
* above. Note that a custom element in a <child> element gets parsed by
* the custom tag handler of the parent object, while a custom element in
* an `<object>` element gets parsed by the custom tag handler of the object.
* an <object> element gets parsed by the custom tag handler of the object.
*
* These XML fragments are explained in the documentation of the
* respective objects.
+1 -1
View File
@@ -57,7 +57,7 @@ typedef enum { /*< prefix=GTK_BUILDER_CLOSURE >*/
* correct function name for registering the type and then use dlsym() to load it.
* The default implementation just tries g_type_from_name() and otherwise fails.
* @get_type_from_function: Try to lookup a `GType` via the given function name, specified
* explicitly in a GtkBuilder file, like via the "type-func" attribute in the `<object>` tag.
* explicitly in a GtkBuilder file, like via the "type-func" attribute in the "<object>" tag.
* This function is very rarely used.
* The C implementation will use dlsym() and call the resulting function as a `GTypeFunc`.
* The default implementation will fail and just return %G_TYPE_INVALID.
+2 -34
View File
@@ -1438,8 +1438,7 @@ gtk_calendar_select_day (GtkCalendar *calendar,
else
gtk_widget_remove_css_class (label, "other-month");
if (calendar->marked_date[day-1] &&
calendar->day_month[y][x] == MONTH_CURRENT)
if (calendar->marked_date[day-1])
gtk_widget_set_state_flags (label, GTK_STATE_FLAG_CHECKED, FALSE);
else
gtk_widget_unset_state_flags (label, GTK_STATE_FLAG_CHECKED);
@@ -1525,14 +1524,6 @@ gtk_calendar_clear_marks (GtkCalendar *calendar)
g_return_if_fail (GTK_IS_CALENDAR (calendar));
for (int y = 0; y < 6; y ++)
for (int x = 0; x < 7; x ++)
{
GtkWidget *label = calendar->day_number_labels[y][x];
gtk_widget_unset_state_flags (label, GTK_STATE_FLAG_CHECKED);
}
for (day = 0; day < 31; day++)
{
calendar->marked_date[day] = FALSE;
@@ -1542,33 +1533,12 @@ gtk_calendar_clear_marks (GtkCalendar *calendar)
calendar_queue_refresh (calendar);
}
static void
update_mark_state (GtkCalendar *calendar,
guint day,
gboolean mark)
{
for (int y = 0; y < 6; y ++)
for (int x = 0; x < 7; x ++)
{
GtkWidget *label = calendar->day_number_labels[y][x];
if (day != calendar->day[y][x])
continue;
if (mark && calendar->marked_date[day-1] &&
calendar->day_month[y][x] == MONTH_CURRENT)
gtk_widget_set_state_flags (label, GTK_STATE_FLAG_CHECKED, FALSE);
else
gtk_widget_unset_state_flags (label, GTK_STATE_FLAG_CHECKED);
}
}
/**
* gtk_calendar_mark_day:
* @calendar: a `GtkCalendar`
* @day: the day number to mark between 1 and 31.
*
* Places a visual marker on a particular day of the current month.
* Places a visual marker on a particular day.
*/
void
gtk_calendar_mark_day (GtkCalendar *calendar,
@@ -1580,7 +1550,6 @@ gtk_calendar_mark_day (GtkCalendar *calendar,
{
calendar->marked_date[day - 1] = TRUE;
calendar->num_marked_dates++;
update_mark_state (calendar, day, TRUE);
calendar_invalidate_day_num (calendar, day);
}
}
@@ -1623,7 +1592,6 @@ gtk_calendar_unmark_day (GtkCalendar *calendar,
{
calendar->marked_date[day - 1] = FALSE;
calendar->num_marked_dates--;
update_mark_state (calendar, day, FALSE);
calendar_invalidate_day_num (calendar, day);
}
}
+1 -1
View File
@@ -37,7 +37,7 @@
*
* The `GtkCenterBox` implementation of the `GtkBuildable` interface
* supports placing children in the 3 positions by specifying start, center
* or end as the type attribute of a `<child>` element.
* or end as the type attribute of a <child> element.
*
* # CSS nodes
*
+2 -2
View File
@@ -387,10 +387,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_task_return_pointer (task, gdk_rgba_copy (&color), (GDestroyNotify) gdk_rgba_free);
}
else if (response == GTK_RESPONSE_CLOSE)
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "Cancelled by application");
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_ABORTED, "Aborted by application");
else if (response == GTK_RESPONSE_CANCEL ||
response == GTK_RESPONSE_DELETE_EVENT)
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_DISMISSED, "Dismissed by user");
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_CANCELLED, "Cancelled by user");
else
g_task_return_new_error (task, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_FAILED, "Unknown failure (%d)", response);
+4 -5
View File
@@ -65,11 +65,10 @@ gtk_column_list_item_factory_setup (GtkListItemFactory *factory,
{
GtkColumnViewColumn *column = g_list_model_get_item (columns, i);
if (gtk_column_view_column_get_visible (column))
gtk_column_list_item_factory_add_column (self,
widget,
column,
FALSE);
gtk_column_list_item_factory_add_column (self,
widget,
column,
FALSE);
g_object_unref (column);
}
+7 -3
View File
@@ -579,8 +579,7 @@ gtk_column_view_column_remove_header (GtkColumnViewColumn *self)
static void
gtk_column_view_column_ensure_cells (GtkColumnViewColumn *self)
{
if (self->view && gtk_widget_get_root (GTK_WIDGET (self->view)) &&
gtk_column_view_column_get_visible (self))
if (self->view && gtk_widget_get_root (GTK_WIDGET (self->view)))
gtk_column_view_column_create_cells (self);
else
gtk_column_view_column_remove_cells (self);
@@ -805,6 +804,8 @@ void
gtk_column_view_column_set_visible (GtkColumnViewColumn *self,
gboolean visible)
{
GtkColumnViewCell *cell;
g_return_if_fail (GTK_IS_COLUMN_VIEW_COLUMN (self));
if (self->visible == visible)
@@ -818,7 +819,10 @@ gtk_column_view_column_set_visible (GtkColumnViewColumn *self,
if (self->header)
gtk_widget_set_visible (GTK_WIDGET (self->header), visible);
gtk_column_view_column_ensure_cells (self);
for (cell = self->first_cell; cell; cell = gtk_column_view_cell_get_next (cell))
{
gtk_widget_set_visible (GTK_WIDGET (cell), visible);
}
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_VISIBLE]);
}
+2
View File
@@ -1325,7 +1325,9 @@ gtk_compose_table_check (const GtkComposeTable *table,
if (n_compose == 1)
return TRUE;
seq = NULL;
match = FALSE;
value = 0;
for (i = n_compose - 1; i < table->max_seq_len; i++)
{
+1 -4
View File
@@ -937,12 +937,9 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base_style), NULL);
if (timestamp == 0)
if (timestamp == 0 || timestamp == source->current_time)
return g_object_ref (source->style);
if (timestamp == source->current_time)
return g_object_ref (GTK_CSS_STYLE (source));
gtk_internal_return_val_if_fail (timestamp > source->current_time, NULL);
animations = NULL;
+1 -1
View File
@@ -722,7 +722,7 @@ _gtk_css_color_value_parse (GtkCssParser *parser)
{
const GtkCssToken *token = gtk_css_parser_get_token (parser);
value = _gtk_css_color_value_new_name (gtk_css_token_get_string (token));
value = _gtk_css_color_value_new_name (token->string.string);
gtk_css_parser_consume_token (parser);
return value;
+10 -10
View File
@@ -947,7 +947,7 @@ gtk_css_selector_parse_selector_class (GtkCssParser *parser,
selector = gtk_css_selector_new (negate ? &GTK_CSS_SELECTOR_NOT_CLASS
: &GTK_CSS_SELECTOR_CLASS,
selector);
selector->style_class.style_class = g_quark_from_string (gtk_css_token_get_string (token));
selector->style_class.style_class = g_quark_from_string (token->string.string);
gtk_css_parser_consume_token (parser);
return selector;
}
@@ -1060,7 +1060,7 @@ parse_n_plus_b (GtkCssParser *parser,
return parse_plus_b (parser, TRUE, b);
}
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) &&
string_has_number (gtk_css_token_get_string (token), "n-", b))
string_has_number (token->string.string, "n-", b))
{
*a = before;
*b = -*b;
@@ -1156,7 +1156,7 @@ parse_a_n_plus_b (GtkCssParser *parser,
}
else if (!seen_sign &&
gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) &&
string_has_number (gtk_css_token_get_string (token), "-n-", b))
string_has_number (token->string.string, "-n-", b))
{
*a = -1;
*b = -*b;
@@ -1169,7 +1169,7 @@ parse_a_n_plus_b (GtkCssParser *parser,
return parse_n_plus_b (parser, seen_sign ? seen_sign : 1, a, b);
}
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) &&
string_has_number (gtk_css_token_get_string (token), "n-", b))
string_has_number (token->string.string, "n-", b))
{
*a = seen_sign ? seen_sign : 1;
*b = -*b;
@@ -1177,7 +1177,7 @@ parse_a_n_plus_b (GtkCssParser *parser,
return TRUE;
}
else if (!seen_sign && gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT) &&
string_has_number (gtk_css_token_get_string (token), "-n-", b))
string_has_number (token->string.string, "-n-", b))
{
*a = -1;
*b = -*b;
@@ -1288,7 +1288,7 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
for (i = 0; i < G_N_ELEMENTS (pseudo_classes); i++)
{
if (g_ascii_strcasecmp (pseudo_classes[i].name, gtk_css_token_get_string (token)) == 0)
if (g_ascii_strcasecmp (pseudo_classes[i].name, token->string.string) == 0)
{
if (pseudo_classes[i].state_flag)
{
@@ -1380,13 +1380,13 @@ gtk_css_selector_parse_selector_pseudo_class (GtkCssParser *parser,
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
{
selector = gtk_css_selector_new (&GTK_CSS_SELECTOR_NOT_NAME, selector);
selector->name.name = g_quark_from_string (gtk_css_token_get_string (token));
selector->name.name = g_quark_from_string (token->string.string);
gtk_css_parser_consume_token (parser);
}
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_HASH_ID))
{
selector = gtk_css_selector_new (&GTK_CSS_SELECTOR_NOT_ID, selector);
selector->id.name = g_quark_from_string (gtk_css_token_get_string (token));
selector->id.name = g_quark_from_string (token->string.string);
gtk_css_parser_consume_token (parser);
}
else if (gtk_css_token_is_delim (token, '.'))
@@ -1499,13 +1499,13 @@ gtk_css_selector_parse_simple_selector (GtkCssParser *parser,
else if (!parsed_something && gtk_css_token_is (token, GTK_CSS_TOKEN_IDENT))
{
selector = gtk_css_selector_new (&GTK_CSS_SELECTOR_NAME, selector);
selector->name.name = g_quark_from_string (gtk_css_token_get_string (token));
selector->name.name = g_quark_from_string (token->string.string);
gtk_css_parser_consume_token (parser);
}
else if (gtk_css_token_is (token, GTK_CSS_TOKEN_HASH_ID))
{
selector = gtk_css_selector_new (&GTK_CSS_SELECTOR_ID, selector);
selector->id.name = g_quark_from_string (gtk_css_token_get_string (token));
selector->id.name = g_quark_from_string (token->string.string);
gtk_css_parser_consume_token (parser);
}
else if (gtk_css_token_is_delim (token, '.'))
+6 -6
View File
@@ -39,10 +39,10 @@ G_BEGIN_DECLS
* GtkDialogError:
* @GTK_DIALOG_ERROR_FAILED: Generic error condition for when
* an operation fails and no more specific code is applicable
* @GTK_DIALOG_ERROR_CANCELLED: The async function call was cancelled
* via its `GCancellable`
* @GTK_DIALOG_ERROR_DISMISSED: The operation was cancelled
* by the user (via a Cancel or Close button)
* @GTK_DIALOG_ERROR_ABORTED: The async function call was aborted
* programmatically (via its `GCancellable`)
* @GTK_DIALOG_ERROR_CANCELLED: The async operation was cancelled
* by the user (via a Close button)
*
* Error codes in the `GTK_DIALOG_ERROR` domain that can be returned
* by async dialog functions.
@@ -52,8 +52,8 @@ G_BEGIN_DECLS
typedef enum
{
GTK_DIALOG_ERROR_FAILED,
GTK_DIALOG_ERROR_CANCELLED,
GTK_DIALOG_ERROR_DISMISSED
GTK_DIALOG_ERROR_ABORTED,
GTK_DIALOG_ERROR_CANCELLED
} GtkDialogError;
GDK_AVAILABLE_IN_4_10
+3 -6
View File
@@ -544,7 +544,6 @@ static void
gtk_directory_list_start_loading (GtkDirectoryList *self)
{
gboolean was_loading;
char *glib_apis_suck;
was_loading = gtk_directory_list_stop_loading (self);
gtk_directory_list_clear_items (self);
@@ -556,16 +555,14 @@ gtk_directory_list_start_loading (GtkDirectoryList *self)
return;
}
glib_apis_suck = g_strconcat ("standard::name,", self->attributes, NULL);
self->cancellable = g_cancellable_new ();
g_file_enumerate_children_async (self->file,
glib_apis_suck,
self->attributes,
G_FILE_QUERY_INFO_NONE,
self->io_priority,
self->cancellable,
gtk_directory_list_got_enumerator_cb,
self);
g_free (glib_apis_suck);
if (!was_loading)
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LOADING]);
@@ -864,8 +861,8 @@ gtk_directory_list_get_file (GtkDirectoryList *self)
*
* Sets the @attributes to be enumerated and starts the enumeration.
*
* If @attributes is %NULL, the list of file infos will still be created, it will just
* not contain any extra attributes.
* If @attributes is %NULL, no attributes will be queried, but a list
* of `GFileInfo`s will still be created.
*/
void
gtk_directory_list_set_attributes (GtkDirectoryList *self,

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