Compare commits
1 Commits
vulkan-lea
...
procedures
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b4d4b17ed |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,2 @@
|
||||
/subprojects/*/
|
||||
.flatpak-builder/
|
||||
.vscode/
|
||||
subprojects/*.wrap
|
||||
|
||||
@@ -22,7 +22,7 @@ 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 -Dpcre2:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
|
||||
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"
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
@@ -62,16 +62,18 @@ style-check-diff:
|
||||
.build-fedora-default:
|
||||
image: $FEDORA_IMAGE
|
||||
artifacts:
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs/testlog-x11.junit.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs/testlog-wayland.junit.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs/testlog-wayland_gl.junit.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs/testlog-broadway.junit.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gl.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report*.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.png"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
|
||||
@@ -216,7 +218,7 @@ macos:
|
||||
when: never
|
||||
- if: $RUNNER == "macosintel"
|
||||
variables:
|
||||
SDKROOT: /opt/sdks/MacOSX10.15.6.sdk
|
||||
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
|
||||
NINJA_PKG: $CI_API_V4_URL/projects/30745/packages/generic/ninja_macos/v1.11.1.1+9/ninja-1.11.1.1-cp38-cp38-macosx_11_0_x86_64.whl
|
||||
when: manual
|
||||
allow_failure: true
|
||||
@@ -240,7 +242,6 @@ macos:
|
||||
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
|
||||
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
|
||||
before_script:
|
||||
- ls /opt/sdks/
|
||||
- .gitlab-ci/show-info-macos.sh
|
||||
- python3 -m venv .venv
|
||||
# Building the introspection feature requires pkg-config and bison.
|
||||
@@ -264,7 +265,7 @@ macos:
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
vs2019-x64:
|
||||
vs2017-x64:
|
||||
# TODO: Uncomment this when ready to merge.
|
||||
# rules:
|
||||
# - if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||
@@ -273,7 +274,7 @@ vs2019-x64:
|
||||
- win32-ps
|
||||
needs: []
|
||||
script:
|
||||
- .gitlab-ci/test-msvc.bat ${COMMON_MESON_FLAGS}
|
||||
- .gitlab-ci/test-msvc.bat
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
@@ -326,6 +327,20 @@ flatpak:widget-factory:aarch64:
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
|
||||
flatpak:icon-browser:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak:icon-browser:aarch64:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
tags:
|
||||
- flatpak-aarch64
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
|
||||
flatpak:node-editor:
|
||||
extends: '.flatpak-defaults'
|
||||
needs: []
|
||||
@@ -359,6 +374,14 @@ nightly factory aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:widget-factory:aarch64']
|
||||
|
||||
nightly icon-browser:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:icon-browser']
|
||||
|
||||
nightly icon-browser aarch64:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:icon-browser:aarch64']
|
||||
|
||||
nightly node-editor:
|
||||
extends: '.publish_nightly'
|
||||
needs: ['flatpak:node-editor']
|
||||
|
||||
0
.gitlab-ci/.lock
Normal file
0
.gitlab-ci/.lock
Normal file
@@ -11,9 +11,7 @@ multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
|
||||
n_processes=${MESON_TEST_MAX_PROCESSES:-1}
|
||||
|
||||
# Ignore memory leaks lower in dependencies
|
||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1:symbolize=1
|
||||
export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
|
||||
|
||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
|
||||
|
||||
case "${setup}" in
|
||||
x11*)
|
||||
@@ -95,6 +93,13 @@ esac
|
||||
|
||||
cd ${builddir}
|
||||
|
||||
$srcdir/.gitlab-ci/meson-junit-report.py \
|
||||
--project-name=gtk \
|
||||
--backend="${setup}" \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--output="report-${setup}.xml" \
|
||||
"meson-logs/testlog-${setup}.json"
|
||||
|
||||
$srcdir/.gitlab-ci/meson-html-report.py \
|
||||
--project-name=gtk \
|
||||
--backend="${setup}" \
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
@echo on
|
||||
:: vcvarsall.bat sets various env vars like PATH, INCLUDE, LIB, LIBPATH for the
|
||||
:: specified build architecture
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
@echo on
|
||||
|
||||
pip3 install --upgrade --user meson~=1.2 || goto :error
|
||||
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled %~1 _build || goto :error
|
||||
:: FIXME: make warnings fatal
|
||||
pip3 install --upgrade --user meson~=0.64 || goto :error
|
||||
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled _build || goto :error
|
||||
ninja -C _build || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
113
NEWS
113
NEWS
@@ -1,117 +1,6 @@
|
||||
Overview of Changes in 4.17.1, xx-xx-xxxx
|
||||
Overview of Changes in 4.17.0, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
Overview of Changes in 4.17.0, 06-11-2024
|
||||
=========================================
|
||||
|
||||
* GtkScrolledWindow
|
||||
- Fix criticals in size allocation code
|
||||
|
||||
* GtkFileChooser
|
||||
- Fix a crash in the portal code
|
||||
|
||||
* GtkFontChoser
|
||||
- Make the dialog more shrinkable
|
||||
|
||||
* GtkPicture
|
||||
- Avoid unnecessary resizes
|
||||
|
||||
* GtkVideo
|
||||
- Make dmabufs work without GL
|
||||
|
||||
* GtkListBox:
|
||||
- Add a tab-behavior property to influence keynav
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Fix problems with insertion and selection
|
||||
|
||||
* GtkStringList:
|
||||
- Add gtk_string_list_find
|
||||
|
||||
* GtkApplication:
|
||||
- Respect GDK_DEBUG=no-portals
|
||||
- Set default window icon from app ID
|
||||
|
||||
* GtkTextView:
|
||||
- Vertical and horizontal positioning of the textview is now quantized
|
||||
to the nearest device pixel. This should improve the perceived smoothness
|
||||
of scrolling with fractional scaling and font hinting.
|
||||
- Incorrect re-use of cached styling was fixed
|
||||
- Fix some missing CSS invalidation
|
||||
- Handle charsets in clipboard datatypes
|
||||
|
||||
* Printing:
|
||||
- Avoid warnings for avahi errors
|
||||
- Fix a segfault in the print dialog setup code
|
||||
|
||||
* Accessibility:
|
||||
- Always realize non-widget accessibles, to help webkit
|
||||
- Fix list view selection implementation
|
||||
- Handle NULL values in more places
|
||||
|
||||
* Gstreamer:
|
||||
- Make dmabufs works without GL
|
||||
|
||||
* Gdk:
|
||||
- Add OKLAB and OKLCH color states
|
||||
- GL: Drop support for GLES 2 and GL < 3.3
|
||||
- GL: Use the ngl dmabuf downloader instead of the GL downloader
|
||||
- Vulkan: Drop the GDK_VULKAN_DEVICE env var. Use MESA_VK_DEVICE_SELECT instead
|
||||
- Vulkan: Use the swapchain maintenance extension to release swap images
|
||||
- Forbid opening displays before gtk_init()
|
||||
|
||||
* Gsk:
|
||||
- Many improvements to the dmabuf downloaders
|
||||
- ngl: Avoid glBufferSubData for globals, speeding up llvmpipe
|
||||
- Renderer selection will no longer consider the GL renderer
|
||||
- Allow Vulkan software rendering as fallback
|
||||
- Support gradient interpolation in different color states
|
||||
|
||||
* Wayland:
|
||||
- Improve settings portal handling
|
||||
- Improve fallback for cursor themes
|
||||
- Make cursor theme changes apply immediately
|
||||
- Use a viewporter for cursor image scaling
|
||||
- Improve cursor size handling
|
||||
- Use the system bell protocol if available
|
||||
- Fix possible deadlock with high-priority sources triggering roundtrips
|
||||
|
||||
* Windows:
|
||||
- Improve the backend code
|
||||
- Fix some problems with WGL on NVidia
|
||||
- Many testsuite fixes for Windows compatibility
|
||||
- Make all pixbuf loaders builtin in the gdk-pixbuf subproject
|
||||
- Add GDK_DISABLE=aerosnap to disable aerosnap
|
||||
- Improve clipboard handling
|
||||
- Fix behavior or gdk_display_open() on Windows
|
||||
- Numerous papercut fixes
|
||||
- Require Windows 10
|
||||
|
||||
* Macos:
|
||||
- Fix crashes when dragging libadwaita TabView tabs
|
||||
- Require macOS 10.15
|
||||
|
||||
* Tools and demos
|
||||
- gtk4-demo: Make demos standalone
|
||||
- gtk4-demo: Drop GL shader demos
|
||||
- gtk4-demo: Improve scrolling benchmarks
|
||||
- gtk4-builder-tool: Improve separator handling
|
||||
- gtk4-image-tool: Better color state support
|
||||
|
||||
* Build:
|
||||
- Don't set GSK_RENDERER in our flatpaks
|
||||
- Require meson 1.2
|
||||
|
||||
* Translation updates
|
||||
Belarusian
|
||||
Brazilian Portuguese
|
||||
British English
|
||||
Galician
|
||||
Lithuanian
|
||||
Romanian
|
||||
Slovenian
|
||||
Swedish
|
||||
|
||||
|
||||
Overview of Changes in 4.16.2, 09-25-2024
|
||||
=========================================
|
||||
|
||||
@@ -196,5 +196,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"GSK_RENDERER" : "opengl"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
"build-options" : {
|
||||
"env" : {
|
||||
"DBUS_SESSION_BUS_ADDRESS" : "''",
|
||||
"GSK_RENDERER" : "opengl",
|
||||
"G_ENABLE_DEBUG" : "true"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,8 +579,6 @@ released_cb (GtkGesture *gesture,
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
child = gtk_widget_pick (widget, x, y, 0);
|
||||
if (!child)
|
||||
return;
|
||||
item = (CanvasItem *)gtk_widget_get_ancestor (child, canvas_item_get_type ());
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
@@ -12,13 +12,11 @@
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
static gboolean
|
||||
close_request_cb (GtkWidget *win, gpointer user_data)
|
||||
static void
|
||||
response_cb (GtkDialog *dialog, int response_id)
|
||||
{
|
||||
g_assert (window == win);
|
||||
gtk_window_destroy ((GtkWindow *)window);
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
window = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -119,7 +117,7 @@ do_expander (GtkWidget *do_widget)
|
||||
g_signal_connect (expander, "notify::expanded",
|
||||
G_CALLBACK (expander_cb), window);
|
||||
|
||||
g_signal_connect (window, "close-request", G_CALLBACK (close_request_cb), NULL);
|
||||
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -811,7 +811,7 @@ tag_pair_equal (gconstpointer a, gconstpointer b)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
static GtkOrdering
|
||||
script_sort (const void *item1,
|
||||
const void *item2,
|
||||
void *data)
|
||||
@@ -1869,4 +1869,4 @@ do_font_features (GtkWidget *do_widget)
|
||||
return window;
|
||||
}
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -101,7 +101,7 @@ setup_centered_label (GtkSignalListItemFactory *factory,
|
||||
GObject *listitem)
|
||||
{
|
||||
GtkWidget *label;
|
||||
label = gtk_inscription_new ("");
|
||||
label = gtk_label_new ("");
|
||||
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ setup_label (GtkSignalListItemFactory *factory,
|
||||
GObject *listitem)
|
||||
{
|
||||
GtkWidget *label;
|
||||
label = gtk_inscription_new ("");
|
||||
gtk_inscription_set_xalign (GTK_INSCRIPTION (label), 0);
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
|
||||
}
|
||||
|
||||
@@ -120,10 +120,10 @@ setup_ellipsizing_label (GtkSignalListItemFactory *factory,
|
||||
GObject *listitem)
|
||||
{
|
||||
GtkWidget *label;
|
||||
label = gtk_inscription_new ("");
|
||||
gtk_inscription_set_xalign (GTK_INSCRIPTION (label), 0);
|
||||
gtk_inscription_set_text_overflow (GTK_INSCRIPTION (label), GTK_INSCRIPTION_OVERFLOW_ELLIPSIZE_END);
|
||||
gtk_inscription_set_nat_chars (GTK_INSCRIPTION (label), 20);
|
||||
label = gtk_label_new ("");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
|
||||
gtk_label_set_width_chars (GTK_LABEL (label), 20);
|
||||
gtk_list_item_set_child (GTK_LIST_ITEM (listitem), label);
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ bind_codepoint (GtkSignalListItemFactory *factory,
|
||||
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
|
||||
|
||||
g_snprintf (buffer, 10, "%#06x", codepoint);
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), buffer);
|
||||
gtk_label_set_label (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -160,7 +160,7 @@ bind_char (GtkSignalListItemFactory *factory,
|
||||
if (g_unichar_isprint (codepoint))
|
||||
g_unichar_to_utf8 (codepoint, buffer);
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), buffer);
|
||||
gtk_label_set_label (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -175,7 +175,7 @@ bind_name (GtkSignalListItemFactory *factory,
|
||||
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
|
||||
name = ucd_item_get_name (UCD_ITEM (item));
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), name);
|
||||
gtk_label_set_label (GTK_LABEL (label), name);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -190,7 +190,7 @@ bind_type (GtkSignalListItemFactory *factory,
|
||||
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
|
||||
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_unicode_type_name (g_unichar_type (codepoint)));
|
||||
gtk_label_set_label (GTK_LABEL (label), get_unicode_type_name (g_unichar_type (codepoint)));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -205,7 +205,7 @@ bind_break_type (GtkSignalListItemFactory *factory,
|
||||
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
|
||||
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_break_type_name (g_unichar_break_type (codepoint)));
|
||||
gtk_label_set_label (GTK_LABEL (label), get_break_type_name (g_unichar_break_type (codepoint)));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -220,7 +220,7 @@ bind_combining_class (GtkSignalListItemFactory *factory,
|
||||
item = gtk_list_item_get_item (GTK_LIST_ITEM (listitem));
|
||||
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
|
||||
gtk_label_set_label (GTK_LABEL (label), get_combining_class_name (g_unichar_combining_class (codepoint)));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -237,7 +237,7 @@ bind_script (GtkSignalListItemFactory *factory,
|
||||
codepoint = ucd_item_get_codepoint (UCD_ITEM (item));
|
||||
script = g_unichar_get_script (codepoint);
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), get_script_name (script));
|
||||
gtk_label_set_label (GTK_LABEL (label), get_script_name (script));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -255,7 +255,7 @@ selection_changed (GObject *object,
|
||||
if (g_unichar_isprint (codepoint))
|
||||
g_unichar_to_utf8 (codepoint, buffer);
|
||||
|
||||
gtk_inscription_set_text (GTK_INSCRIPTION (label), buffer);
|
||||
gtk_label_set_label (GTK_LABEL (label), buffer);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
||||
@@ -165,6 +165,10 @@ activate_about (GSimpleAction *action,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
const char *authors[] = {
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
char *version;
|
||||
char *os_name;
|
||||
char *os_version;
|
||||
@@ -202,11 +206,11 @@ activate_about (GSimpleAction *action,
|
||||
? "GTK Demo (Development)"
|
||||
: "GTK Demo",
|
||||
"version", version,
|
||||
"copyright", "© 1997—2024 The GTK Team",
|
||||
"copyright", "© 1997—2021 The GTK Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK widgets",
|
||||
"authors", (const char *[]) { "The GTK Team", NULL },
|
||||
"authors", authors,
|
||||
"logo-icon-name", "org.gtk.Demo4",
|
||||
"title", "About GTK Demo",
|
||||
"system-information", s->str,
|
||||
@@ -1056,6 +1060,8 @@ command_line (GApplication *app,
|
||||
|
||||
window = gtk_application_get_windows (GTK_APPLICATION (app))->data;
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "org.gtk.Demo4");
|
||||
|
||||
if (name == NULL)
|
||||
goto out;
|
||||
|
||||
@@ -1144,8 +1150,6 @@ main (int argc, char **argv)
|
||||
};
|
||||
int i;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
app = gtk_application_new ("org.gtk.Demo4", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<component type="desktop">
|
||||
<id>org.gtk.Demo4</id>
|
||||
<launchable type="desktop-id">org.gtk.Demo4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
517
demos/icon-browser/icon.list
Normal file
517
demos/icon-browser/icon.list
Normal file
@@ -0,0 +1,517 @@
|
||||
[volume]
|
||||
Name=Volume
|
||||
Description=Icons related to audio input and output volume
|
||||
|
||||
audio-volume-high=The icon used to indicate high audio volume
|
||||
audio-volume-low=The icon used to indicate low audio volume
|
||||
audio-volume-medium=The icon used to indicate medium audio volume
|
||||
audio-volume-muted=The icon used to indicate the muted state for audio playback
|
||||
microphone-sensitivity-high=The icon used to indicate high microphone sensitivity
|
||||
microphone-sensitivity-low=The icon used to indicate low microphone sensitivity
|
||||
microphone-sensitivity-medium=The icon used to indicate medium microphone sensitivity
|
||||
microphone-sensitivity-muted=The icon used to indicate that a microphone is muted
|
||||
|
||||
[multimedia]
|
||||
Name=Multimedia
|
||||
Description=Icons related to playback of media
|
||||
|
||||
media-playlist-repeat=The icon for the repeat mode of a media player
|
||||
media-playlist-repeat-song=The icon for repeating a song in a media player
|
||||
media-playlist-shuffle=The icon for the shuffle mode of a media player
|
||||
media-playlist-consecutive=The icon for consecutive mode of a media player
|
||||
media-skip-backward=The icon for the skip backward action of a media player
|
||||
media-seek-backward=The icon for the seek backward action of a media player
|
||||
media-playback-start=The icon for the start playback action of a media player
|
||||
media-seek-forward=The icon for the seek forward action of a media player
|
||||
media-skip-forward=The icon for the skip forward action of a media player
|
||||
media-playback-stop=The icon for the stop action of a media player
|
||||
media-playback-pause=The icon for the pause action of a media player
|
||||
media-eject=The icon for the eject action of a media player or file manager
|
||||
media-record=The icon for the record action of a media application
|
||||
media-view-subtitles=The icon used to show subtitles in a media player
|
||||
|
||||
[network]
|
||||
Name=Network
|
||||
Description=Icons related to network status
|
||||
|
||||
network-transmit-receive=The icon used data is being both transmitted and received simultaneously, while the computing device is connected to a network
|
||||
network-transmit=The icon used when data is being transmitted, while the computing device is connected to a network
|
||||
network-receive=The icon used when data is being received, while the computing device is connected to a network
|
||||
network-idle=The icon used when no data is being transmitted or received, while the computing device is connected to a network
|
||||
network-error=The icon used when an error occurs trying to initialize the network connection of the computing device
|
||||
network-offline=The icon used when the computing device is disconnected from the network
|
||||
|
||||
[weather]
|
||||
Name=Weather
|
||||
Description=Icons about weather conditions
|
||||
|
||||
weather-clear=The icon used while the weather for a region is “clear skies”
|
||||
weather-clear-night=The icon used while the weather for a region is “clear skies” during the night
|
||||
weather-few-clouds=The icon used while the weather for a region is “partly cloudy”
|
||||
weather-few-clouds-night=The icon used while the weather for a region is “partly cloudy” during the night
|
||||
weather-fog=The icon used while the weather for a region is “foggy”
|
||||
weather-overcast=The icon used while the weather for a region is “overcast”
|
||||
weather-severe-alert=The icon used while a sever weather alert is in effect for a region
|
||||
weather-showers=The icon used while rain showers are occurring in a region
|
||||
weather-showers-scattered=The icon used while scattered rain showers are occurring in a region
|
||||
weather-snow=The icon used while snow showers are occurring in a region
|
||||
weather-storm=The icon used while storms are occurring in a region
|
||||
weather-windy=The icon used while the weather is windy
|
||||
|
||||
[navigation]
|
||||
Name=Navigation
|
||||
Description=Icons for navigation in the user interface of a program
|
||||
|
||||
go-first=The icon for the go to the first item in a list
|
||||
go-previous=The icon for the go to the previous item in a list
|
||||
go-next=The icon for the go to the next item in a list
|
||||
go-last=The icon for the go to the last item in a list
|
||||
go-bottom=The icon for the go to bottom of a list
|
||||
go-down=The icon for the go down in a list
|
||||
go-up=The icon for the go up in a list
|
||||
go-top=The icon for the go to the top of a list
|
||||
go-home=The icon for the go to home location
|
||||
go-jump=The icon for the jump to action
|
||||
|
||||
[editing]
|
||||
Name=Editing
|
||||
Description=Icons related to editing a document
|
||||
format-indent-less=The icon for the decrease indent formatting action
|
||||
format-indent-more=The icon for the increase indent formatting action
|
||||
format-justify-center=The icon for the center justification formatting action
|
||||
format-justify-fill=The icon for the fill justification formatting action
|
||||
format-justify-left=The icon for the left justification formatting action
|
||||
format-justify-right=The icon for the right justification action
|
||||
format-text-direction-ltr=The icon for the left-to-right text formatting action
|
||||
format-text-direction-rtl=The icon for the right-to-left formatting action
|
||||
format-text-bold=The icon for the bold text formatting action
|
||||
format-text-italic=The icon for the italic text formatting action
|
||||
format-text-underline=The icon for the underlined text formatting action
|
||||
format-text-strikethrough=The icon for the strikethrough text formatting action
|
||||
edit-clear=The icon for the clear action
|
||||
edit-clear-all=
|
||||
edit-copy=The icon for the copy action
|
||||
edit-cut=The icon for the cut action
|
||||
edit-delete=The icon for the delete action
|
||||
edit-find-replace=The icon for the find and replace action
|
||||
edit-paste=The icon for the paste action
|
||||
edit-redo=The icon for the redo action
|
||||
edit-select-all=The icon for the select all action
|
||||
edit-select=
|
||||
edit-undo=The icon for the undo action
|
||||
error-correct=
|
||||
document-properties=The icon for the action to view the properties of a document in an application
|
||||
document-new=The icon used for the action to create a new document
|
||||
document-open=The icon used for the action to open a document
|
||||
document-open-recent=The icon used for the action to open a document that was recently opened
|
||||
document-save=The icon for the save action. Should be an arrow pointing down and toward a hard disk
|
||||
document-save-as=The icon for the save as action
|
||||
document-send=The icon for the send action. Should be an arrow pointing up and away from a hard disk
|
||||
document-page-setup=The icon for the page setup action of a document editor
|
||||
document-edit=The icon for the action to edit a document
|
||||
object-flip-horizontal=The icon for the action to flip an object horizontally
|
||||
object-flip-vertical=The icon for the action to flip an object vertically
|
||||
object-rotate-left=The icon for the rotate left action performed on an object
|
||||
object-rotate-right=The icon for the rotate right action performed on an object
|
||||
insert-image=The icon for the insert image action of an application
|
||||
insert-link=The icon for the insert link action of an application
|
||||
insert-object=The icon for the insert object action of an application
|
||||
insert-text=The icon for the insert text action of an application
|
||||
accessories-text-editor=The icon used for the desktop's text editing accessory program
|
||||
|
||||
[view]
|
||||
Name=View Controls
|
||||
Description=Icons for view controls in a user interface
|
||||
|
||||
view-list=The icon used for “List“ view mode
|
||||
view-grid=The icon used for “Grid“ view mode (as opposed to “List“)
|
||||
view-fullscreen=The icon used for the “Fullscreen” item in the application's “View” menu
|
||||
view-restore=The icon used by an application for leaving the fullscreen view, and returning to a normal windowed view
|
||||
zoom-fit-best=The icon used for the “Best Fit” item in the application's “View” menu
|
||||
zoom-in=The icon used for the “Zoom in” item in the application's “View” menu
|
||||
zoom-out=The icon used for the “Zoom Out” item in the application's “View” menu
|
||||
zoom-original=The icon used for the “Original Size” item in the application's “View” menu
|
||||
view-continuous=The icon used for a continuous view mode
|
||||
view-paged=The icon used for a paged view mode (as opposed to continuous)
|
||||
view-dual=The icon used for a side-by-side view of paginated content
|
||||
view-wrapped=The icon used to indicate a wrap-around to the beginning
|
||||
view-pin=The icon used for 'pin a view'
|
||||
|
||||
[calendar]
|
||||
Name=Calendar, Tasks and Alarms
|
||||
Description=Icons related to calendars, tasks and alarms
|
||||
|
||||
task-due=The icon used when a task is due soon
|
||||
task-past-due=The icon used when a task that was due, has been left incomplete
|
||||
appointment-soon=The icon used when an appointment will occur soon
|
||||
appointment-missed=The icon used when an appointment was missed
|
||||
alarm=The icon used for alarms when a task or appointment is due
|
||||
|
||||
[communication]
|
||||
Name=Communication
|
||||
Description=Icons related email, phone calls, IM and other forms of communication
|
||||
|
||||
mail-unread=The icon used for an electronic mail that is unread
|
||||
mail-read=The icon used for an electronic mail that is read
|
||||
mail-replied=The icon used for an electronic mail that has been replied to
|
||||
mail-attachment=The icon used for an electronic mail that contains attachments
|
||||
mail-mark-important=The icon for the mark as important action of an electronic mail application
|
||||
mail-send=The icon for the send action of an electronic mail application
|
||||
mail-send-receive=The icon for the send and receive action of an electronic mail application
|
||||
call-start=The icon used for initiating or accepting a call
|
||||
call-stop=The icon used for stopping a current call
|
||||
call-missed=The icon used to show a missed call
|
||||
user-available=The icon used when a user on a chat network is available to initiate a conversation with
|
||||
user-offline=The icon used when a user on a chat network is not available
|
||||
user-idle=The icon used when a user on a chat network has not been an active participant in any chats on the network, for an extended period of time
|
||||
user-invisible=The icon used when a user is on a chat network, but is invisible to others
|
||||
user-busy=The icon used when a user is on a chat network, and has marked himself as busy
|
||||
user-away=The icon used when a user on a chat network is away from their keyboard and the chat program
|
||||
user-status-pending=The icon used when the current user status on a chat network is not known
|
||||
|
||||
[devices]
|
||||
Name=Devices and Media
|
||||
Description=Icons for devices and media
|
||||
|
||||
audio-input-microphone=The icon used for the microphone audio input device
|
||||
camera-web=The fallback icon for web cameras
|
||||
camera-photo=The icon used for a digital still camera devices
|
||||
input-keyboard=The icon used for the keyboard input device
|
||||
printer=The icon used for a printer device
|
||||
video-display=The icon used for the monitor that video gets displayed to
|
||||
computer=The icon used for the computing device as a whole
|
||||
media-optical=The icon used for physical optical media such as CD and DVD
|
||||
phone=The icon used for phone devices which support connectivity to the PC, such as VoIP, cellular, or possibly landline phones
|
||||
input-dialpad=The icon used for dialpad input devices
|
||||
input-touchpad=The icon used for touchpad input devices
|
||||
scanner=The icon used for a scanner device
|
||||
audio-card=The icon used for the audio rendering device
|
||||
input-gaming=The icon used for the gaming input device
|
||||
input-mouse=The icon used for the mousing input device
|
||||
multimedia-player=The icon used for generic multimedia playing devices
|
||||
audio-headphones=The icon used for headphones
|
||||
audio-headset=The icon used for headsets
|
||||
display-projector=The icon used for projectors
|
||||
media-removable=The icon used for generic removable media
|
||||
printer-network=The icon used for printers which are connected via the network
|
||||
audio-speakers=The icon used for speakers
|
||||
camera-video=The fallback icon for video cameras
|
||||
drive-optical=The icon used for optical media drives such as CD and DVD
|
||||
drive-removable-media=The icon used for removable media drives
|
||||
input-tablet=The icon used for graphics tablet input devices
|
||||
network-wireless=The icon used for wireless network connections
|
||||
network-wired=The icon used for wired network connections
|
||||
media-floppy=The icon used for physical floppy disk media
|
||||
media-flash=The fallback icon used for flash media, such as memory stick and SD
|
||||
|
||||
[contenttypes]
|
||||
Name=Content Types
|
||||
Description=Icons for different types of data, such as audio or image files
|
||||
|
||||
application-certificate=
|
||||
application-rss+xml=
|
||||
application-x-appliance=
|
||||
audio-x-generic=The icon used for generic audio file types
|
||||
folder=The standard folder icon used to represent directories on local filesystems, mail folders, and other hierarchical groups
|
||||
text-x-generic=The icon used for generic text file types
|
||||
video-x-generic=The icon used for generic video file types
|
||||
x-office-calendar=The icon used for generic calendar file types
|
||||
|
||||
[emotes]
|
||||
Name=Emotes
|
||||
Description=Icons for emotions that are expressed through text chat applications such as :-) or :-P in IRC or instant messengers
|
||||
|
||||
face-angel=The icon used for the 0:-) emote
|
||||
face-angry=The icon used for the X-( emote
|
||||
face-cool=The icon used for the B-) emote
|
||||
face-crying=The icon used for the :'( emote
|
||||
face-devilish=The icon used for the >:-) emote
|
||||
face-embarrassed=The icon used for the :-[ emote
|
||||
face-kiss=The icon used for the :-* emote
|
||||
face-laugh=The icon used for the :-)) emote
|
||||
face-monkey=The icon used for the :-(|) emote
|
||||
face-plain=The icon used for the :-| emote
|
||||
face-raspberry=The icon used for the :-P emote
|
||||
face-sad=The icon used for the :-( emote
|
||||
face-shutmouth=The 'shut mouth' emote
|
||||
face-sick=The icon used for the :-& emote
|
||||
face-smile=The icon used for the :-) emote
|
||||
face-smile-big=The icon used for the :-D emote
|
||||
face-smirk=The icon used for the :-! emote
|
||||
face-surprise=The icon used for the :-0 emote
|
||||
face-tired=The icon used for the |-) emote
|
||||
face-uncertain=The icon used for the :-/ emote
|
||||
face-wink=The icon used for the ;-) emote
|
||||
face-worried=The icon used for the :-S emote
|
||||
face-yawn=
|
||||
|
||||
[general]
|
||||
Name=General
|
||||
Description=Generally useful icons that don't fit in a particular category
|
||||
|
||||
edit-find=The icon for generic search actions
|
||||
content-loading=The icon used to indicate that content is loading
|
||||
open-menu=The icon used for a menu button in the header bar
|
||||
view-more=The icon used for a “View More“ action
|
||||
tab-new=The icon used for a “New Tab“ action
|
||||
bookmark-new=The icon used for creating a new bookmark
|
||||
mark-location=The icon used to mark a location on a map
|
||||
find-location=The icon used for a “Search location“ action
|
||||
send-to=The icon used for a “Send to“ action
|
||||
object-select=The icon used for generic selection actions
|
||||
window-close=The icon used for actions that close a view, such as window or tab close button
|
||||
view-refresh=The icon used for the “Refresh” item in the application's “View” menu
|
||||
process-stop=The icon used for the “Stop” action in applications with actions that may take a while to process, such as web page loading in a browser
|
||||
action-unavailable=The icon used to indicate that an action is currently unavailable, such as “Pause“ when no media is playing
|
||||
document-print=The icon for the print action of an application
|
||||
printer-printing=The icon used while a print job is successfully being spooled to a printing device
|
||||
printer-warning=The icon used when a recoverable problem occurs while attempting to printing
|
||||
printer-error=The icon used when an error occurs while attempting to print
|
||||
dialog-information=The icon used when a dialog is opened to give information to the user that may be pertinent to the requested action
|
||||
dialog-question=The icon used when a dialog is opened to ask a simple question of the user
|
||||
dialog-warning=The icon used when a dialog is opened to warn the user of impending issues with the requested action
|
||||
dialog-password=The icon used when a dialog requesting the authentication credentials for a user is opened
|
||||
dialog-error=The icon used when a dialog is opened to explain an error condition to the user
|
||||
list-add=The icon for the add to list action
|
||||
list-remove=The icon for the remove from list action
|
||||
non-starred=The icon used to indicate that an object is not 'starred'
|
||||
semi-starred=The icon used to indicate that an object has is 'half-starred'
|
||||
starred=The icon used to indicate that an object is 'starred'
|
||||
star-new=The used for the “New Star“ action
|
||||
security-low=The icon used to indicate that the security level of a connection is presumed to be insecure, either by using weak encryption, or by using a certificate that the could not be automatically verified, and which the user has not chosent to trust
|
||||
security-medium=The icon used to indicate that the security level of a connection is presumed to be secure, using strong encryption, and a certificate that could not be automatically verified, but which the user has chosen to trust
|
||||
security-high=The icon used to indicate that the security level of a connection is known to be secure, using strong encryption and a valid certificate
|
||||
user-trash=The icon for the user's “Trash” place in the file system
|
||||
user-trash-full=The icon for the user's “Trash” in the file system, when there are items in the “Trash” waiting for disposal or recovery
|
||||
emblem-system=The icon used as an emblem for directories that contain system libraries, settings, and data
|
||||
avatar-default=The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar
|
||||
emblem-synchronizing=The icon used as an emblem to indicate that a synchronizing operation is in process
|
||||
emblem-shared=The icon used as an emblem for files and directories that are shared to other users
|
||||
help-browser=The icon used for the desktop's help browsing application
|
||||
|
||||
[other]
|
||||
Name=Other
|
||||
Description=Icons which have may be too specialized and not of general interest
|
||||
|
||||
changes-allow=
|
||||
changes-prevent=
|
||||
view-sort-ascending=The icon used for the “Sort Ascending” item in the application's “View” menu, or in a button for changing the sort method for a list
|
||||
view-sort-descending=The icon used for the “Sort Descending” item in the application's “View” menu, or in a button for changing the sort method for a list
|
||||
document-revert=The icon for the action of reverting to a previous version of a document
|
||||
address-book-new=The icon used for the action to create a new address book
|
||||
application-exit=The icon used for exiting an application. Typically this is seen in the application's menus as File->Quit
|
||||
appointment-new=The icon used for the action to create a new appointment in a calendaring application
|
||||
contact-new=The icon used for the action to create a new contact in an address book application
|
||||
document-print-preview=The icon for the print preview action of an application
|
||||
folder-new=The icon for creating a new folder
|
||||
help-about=The icon for the About item in the Help menu
|
||||
help-contents=The icon for Contents item in the Help menu
|
||||
help-faq=The icon for the FAQ item in the Help menu
|
||||
list-remove-all=
|
||||
mail-forward=The icon for the forward action of an electronic mail application
|
||||
mail-mark-junk=The icon for the mark as junk action of an electronic mail application
|
||||
mail-mark-notjunk=The icon for the mark as not junk action of an electronic mail application
|
||||
mail-mark-read=The icon for the mark as read action of an electronic mail application
|
||||
mail-mark-unread=The icon for the mark as unread action of an electronic mail application
|
||||
mail-message-new=The icon for the compose new mail action of an electronic mail application
|
||||
mail-reply-all=The icon for the reply to all action of an electronic mail application
|
||||
mail-reply-sender=The icon for the reply to sender action of an electronic mail application
|
||||
pan-down=
|
||||
pan-end=
|
||||
pan-start=
|
||||
pan-up=
|
||||
system-lock-screen=The icon used for the “Lock Screen” item in the desktop's panel application
|
||||
system-log-out=The icon used for the “Log Out” item in the desktop's panel application
|
||||
system-run=The icon used for the “Run Application...” item in the desktop's panel application
|
||||
system-search=The icon used for the “Search” item in the desktop's panel application
|
||||
system-reboot=The icon used for the “Reboot” item in the desktop's panel application
|
||||
system-shutdown=The icon used for the “Shutdown” item in the desktop's panel application
|
||||
tools-check-spelling=The icon used for the “Check Spelling” item in the application's “Tools” menu
|
||||
window-maximize=
|
||||
window-minimize=
|
||||
window-restore=
|
||||
window-new=The icon used for the “New Window” item in the application's “Windows” menu
|
||||
accessories-calculator=The icon used for the desktop's calculator accessory program
|
||||
accessories-character-map=The icon used for the desktop's international and extended text character accessory program
|
||||
accessories-dictionary=The icon used for the desktop's dictionary accessory program
|
||||
multimedia-volume-control=The icon used for the desktop's hardware volume control application
|
||||
preferences-desktop-accessibility=The icon used for the desktop's accessibility preferences
|
||||
preferences-desktop-display=
|
||||
preferences-desktop-font=The icon used for the desktop's font preferences
|
||||
preferences-desktop-keyboard=The icon used for the desktop's keyboard preferences
|
||||
preferences-desktop-keyboard-shortcuts=
|
||||
preferences-desktop-locale=The icon used for the desktop's locale preferences
|
||||
preferences-desktop-remote-desktop=
|
||||
preferences-desktop-multimedia=The icon used for the desktop's multimedia preferences
|
||||
preferences-desktop-screensaver=The icon used for the desktop's screen saving preferences
|
||||
preferences-desktop-theme=The icon used for the desktop's theme preferences
|
||||
preferences-desktop-wallpaper=The icon used for the desktop's wallpaper preferences
|
||||
preferences-system-privacy=
|
||||
preferences-system-windows=
|
||||
system-file-manager=The icon used for the desktop's file management application
|
||||
system-software-install=The icon used for the desktop's software installer application
|
||||
system-software-update=The icon used for the desktop's software updating application
|
||||
system-users=
|
||||
user-info=
|
||||
utilities-system-monitor=The icon used for the desktop's system resource monitor application
|
||||
utilities-terminal=The icon used for the desktop's terminal emulation application.
|
||||
application-x-addon=
|
||||
application-x-executable=The icon used for executable file types
|
||||
font-x-generic=The icon used for generic font file types
|
||||
image-x-generic=The icon used for generic image file types
|
||||
package-x-generic=The icon used for generic package file types
|
||||
text-html=The icon used for HTML text file types
|
||||
text-x-generic-template=The icon used for generic text templates
|
||||
text-x-preview=
|
||||
text-x-script=The icon used for script file types, such as shell scripts
|
||||
x-office-address-book=The icon used for generic address book file types
|
||||
x-office-document=The icon used for generic document and letter file types
|
||||
x-office-document-template=
|
||||
x-office-presentation=The icon used for generic presentation file types
|
||||
x-office-presentation-template=
|
||||
x-office-spreadsheet=The icon used for generic spreadsheet file types
|
||||
x-office-spreadsheet-template=
|
||||
x-package-repository=
|
||||
applications-accessories=The icon for the “Accessories” sub-menu of the Programs menu
|
||||
applications-development=The icon for the “Programming” sub-menu of the Programs menu
|
||||
applications-engineering=The icon for the “Engineering” sub-menu of the Programs menu
|
||||
applications-games=The icon for the “Games” sub-menu of the Programs menu
|
||||
applications-graphics=The icon for the “Graphics” sub-menu of the Programs menu
|
||||
applications-internet=The icon for the “Internet” sub-menu of the Programs menu
|
||||
applications-multimedia=The icon for the “Multimedia” sub-menu of the Programs menu
|
||||
applications-office=The icon for the “Office” sub-menu of the Programs menu
|
||||
applications-other=The icon for the “Other” sub-menu of the Programs menu
|
||||
applications-science=The icon for the “Science” sub-menu of the Programs menu
|
||||
applications-system=The icon for the “System Tools” sub-menu of the Programs menu
|
||||
applications-utilities=The icon for the “Utilities” sub-menu of the Programs menu
|
||||
preferences-desktop=The icon for the “Desktop Preferences” category
|
||||
preferences-desktop-peripherals=The icon for the “Peripherals” sub-category of the “Desktop Preferences” category
|
||||
preferences-desktop-personal=The icon for the “Personal” sub-category of the “Desktop Preferences” category
|
||||
preferences-other=The icon for the “Other” preferences category
|
||||
preferences-system=The icon for the “System Preferences” category
|
||||
preferences-system-network=The icon for the “Network” sub-category of the “System Preferences” category
|
||||
system-help=The icon for the “Help” system category
|
||||
battery=The icon used for the system battery device
|
||||
computer-apple-ipad=
|
||||
colorimeter-colorhug=
|
||||
drive-harddisk=The icon used for hard disk drives
|
||||
drive-harddisk-ieee1394=
|
||||
drive-harddisk-system=
|
||||
drive-multidisk=
|
||||
media-optical-bd=
|
||||
media-optical-cd-audio=
|
||||
media-optical-dvd=
|
||||
media-tape=The icon used for generic physical tape media
|
||||
media-zip=
|
||||
modem=The icon used for modem devices
|
||||
multimedia-player-apple-ipod-touch=
|
||||
network-vpn=
|
||||
pda=This is the fallback icon for Personal Digital Assistant devices. Primary use of this icon is for PDA devices connected to the PC. Connection medium is not an important aspect of the icon. The metaphor for this fallback icon should be a generic PDA device icon
|
||||
phone-apple-iphone=
|
||||
uninterruptible-power-supply=
|
||||
emblem-default=The icon used as an emblem to specify the default selection of a printer for example
|
||||
emblem-documents=The icon used as an emblem for the directory where a user's documents are stored
|
||||
emblem-downloads=The icon used as an emblem for the directory where a user's downloads from the internet are stored
|
||||
emblem-favorite=The icon used as an emblem for files and directories that the user marks as favorites
|
||||
emblem-generic=
|
||||
emblem-important=The icon used as an emblem for files and directories that are marked as important by the user
|
||||
emblem-mail=The icon used as an emblem to specify the directory where the user's electronic mail is stored
|
||||
emblem-new=
|
||||
emblem-ok=
|
||||
emblem-package=
|
||||
emblem-photos=The icon used as an emblem to specify the directory where the user stores photographs
|
||||
emblem-readonly=The icon used as an emblem for files and directories which can not be written to by the user
|
||||
emblem-symbolic-link=The icon used as an emblem for files and direcotires that are links to other files or directories on the filesystem
|
||||
emblem-synchronized=The icon used as an emblem for files or directories that are configured to be synchronized to another device
|
||||
emblem-unreadable=The icon used as an emblem for files and directories that are inaccessible.
|
||||
emblem-urgent=
|
||||
emblem-videos=
|
||||
emblem-web=
|
||||
folder-documents=
|
||||
folder-download=The icon representing the location in the file system where downloaded files are stored
|
||||
folder-music=
|
||||
folder-pictures=
|
||||
folder-publicshare=
|
||||
folder-remote=The icon used for normal directories on a remote filesystem
|
||||
folder-saved-search=
|
||||
folder-templates=
|
||||
folder-videos=
|
||||
network-server=The icon used for individual host machines under the “Network Servers” place in the file manager
|
||||
network-workgroup=The icon for the “Network Servers” place in the desktop's file manager, and workgroups within the network
|
||||
start-here=The icon used by the desktop's main menu for accessing places, applications, and other features
|
||||
user-bookmarks=The icon for the user's special “Bookmarks” place
|
||||
user-desktop=The icon for the special “Desktop” directory of the user
|
||||
user-home=The icon for the special “Home” directory of the user
|
||||
airplane-mode=
|
||||
battery-caution-charging=
|
||||
battery-caution=The icon used when the battery is below 40%
|
||||
battery-empty-charging=
|
||||
battery-empty=
|
||||
battery-full-charged=
|
||||
battery-full-charging=
|
||||
battery-full=
|
||||
battery-good-charging=
|
||||
battery-good=
|
||||
battery-low-charging=
|
||||
battery-low=The icon used when the battery is below 20%
|
||||
battery-missing=
|
||||
bluetooth-active=
|
||||
bluetooth-disabled=
|
||||
channel-insecure=
|
||||
channel-secure=
|
||||
computer-fail=
|
||||
display-brightness=
|
||||
keyboard-brightness=
|
||||
folder-drag-accept=The icon used for a folder while an object is being dragged onto it, that is of a type that the directory can contain
|
||||
folder-open=The icon used for folders, while their contents are being displayed within the same window. This icon would normally be shown in a tree or list view, next to the main view of a folder's contents
|
||||
folder-visiting=The icon used for folders, while their contents are being displayed in another window. This icon would typically be used when using multiple windows to navigate the hierarchy, such as in Nautilus's spatial mode
|
||||
image-loading=The icon used when another image is being loaded, such as thumnails for larger images in the file manager
|
||||
image-missing=The icon used when another image could not be loaded
|
||||
mail-signed=The icon used for an electronic mail that contains a signature
|
||||
mail-signed-verified=The icon used for an electronic mail that contains a signature which has also been verified by the security system
|
||||
network-cellular-3g=
|
||||
network-cellular-4g=
|
||||
network-cellular-edge=
|
||||
network-cellular-gprs=
|
||||
network-cellular-umts=
|
||||
network-cellular-acquiring=
|
||||
network-cellular-connected=
|
||||
network-cellular-no-route=
|
||||
network-cellular-offline=
|
||||
network-cellular-signal-excellent=
|
||||
network-cellular-signal-good=
|
||||
network-cellular-signal-ok=
|
||||
network-cellular-signal-weak=
|
||||
network-cellular-signal-none=
|
||||
network-vpn-acquiring=
|
||||
network-vpn=
|
||||
network-wired-acquiring=
|
||||
network-wired-disconnected=
|
||||
network-wired-no-route=
|
||||
network-wired-offline=
|
||||
network-wireless-acquiring=
|
||||
network-wireless-connected=
|
||||
network-wireless-encrypted=
|
||||
network-wireless-hotspot=
|
||||
network-wireless-no-route=
|
||||
network-wireless-offline=
|
||||
network-wireless-signal-excellent=
|
||||
network-wireless-signal-good=
|
||||
network-wireless-signal-ok=
|
||||
network-wireless-signal-weak=
|
||||
network-wireless-signal-none=
|
||||
rotation-allowed=
|
||||
rotation-locked=
|
||||
software-update-available=The icon used when an update is available for software installed on the computing device, through the system software update program
|
||||
software-update-urgent=The icon used when an urgent update is available through the system software update program
|
||||
sync-error=The icon used when an error occurs while attempting to synchronize data from the computing device, to another device
|
||||
sync-synchronizing=The icon used while data is successfully synchronizing to another device
|
||||
touchpad-disabled=
|
||||
trophy-bronze=
|
||||
trophy-silver=
|
||||
trophy-gold=
|
||||
night-light=
|
||||
daytime-sunrise=
|
||||
daytime-sunset=
|
||||
on=
|
||||
off=
|
||||
7
demos/icon-browser/iconbrowser.gresource.xml
Normal file
7
demos/icon-browser/iconbrowser.gresource.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gtk/iconbrowser/gtk">
|
||||
<file preprocess="xml-stripblanks">window.ui</file>
|
||||
<file>icon.list</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
160
demos/icon-browser/iconbrowserapp.c
Normal file
160
demos/icon-browser/iconbrowserapp.c
Normal file
@@ -0,0 +1,160 @@
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "iconbrowserapp.h"
|
||||
#include "iconbrowserwin.h"
|
||||
|
||||
#include "profile_conf.h"
|
||||
|
||||
struct _IconBrowserApp
|
||||
{
|
||||
GtkApplication parent;
|
||||
};
|
||||
|
||||
struct _IconBrowserAppClass
|
||||
{
|
||||
GtkApplicationClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(IconBrowserApp, icon_browser_app, GTK_TYPE_APPLICATION);
|
||||
|
||||
static void
|
||||
icon_browser_app_init (IconBrowserApp *app)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
quit_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer app)
|
||||
{
|
||||
g_application_quit (G_APPLICATION (app));
|
||||
}
|
||||
|
||||
static void
|
||||
inspector_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer app)
|
||||
{
|
||||
gtk_window_set_interactive_debugging (TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
about_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkApplication *app = user_data;
|
||||
const char *authors[] = {
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
char *icon_theme;
|
||||
char *version;
|
||||
GString *s;
|
||||
char *os_name;
|
||||
char *os_version;
|
||||
|
||||
g_object_get (gtk_settings_get_default (),
|
||||
"gtk-icon-theme-name", &icon_theme,
|
||||
NULL);
|
||||
|
||||
s = g_string_new ("");
|
||||
|
||||
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
|
||||
os_version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
|
||||
if (os_name && os_version)
|
||||
g_string_append_printf (s, "OS\t%s %s\n\n", os_name, os_version);
|
||||
g_string_append (s, "System libraries\n");
|
||||
g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
|
||||
glib_major_version,
|
||||
glib_minor_version,
|
||||
glib_micro_version);
|
||||
g_string_append_printf (s, "\tPango\t%s\n",
|
||||
pango_version_string ());
|
||||
g_string_append_printf (s, "\tGTK \t%d.%d.%d\n",
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ());
|
||||
g_string_append_printf (s, "\nIcon theme\n\t%s", icon_theme);
|
||||
version = g_strdup_printf ("%s%s%s\nRunning against GTK %d.%d.%d",
|
||||
PACKAGE_VERSION,
|
||||
g_strcmp0 (PROFILE, "devel") == 0 ? "-" : "",
|
||||
g_strcmp0 (PROFILE, "devel") == 0 ? VCS_TAG : "",
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ());
|
||||
|
||||
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
|
||||
"program-name", g_strcmp0 (PROFILE, "devel") == 0
|
||||
? "GTK Icon Browser (Development)"
|
||||
: "GTK Icon Browser",
|
||||
"version", version,
|
||||
"copyright", "© 1997—2021 The GTK Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to browse themed icons",
|
||||
"authors", authors,
|
||||
"logo-icon-name", "org.gtk.IconBrowser4",
|
||||
"title", "About GTK Icon Browser",
|
||||
"system-information", s->str,
|
||||
NULL);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
g_free (version);
|
||||
g_free (icon_theme);
|
||||
g_free (os_name);
|
||||
g_free (os_version);
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] =
|
||||
{
|
||||
{ "quit", quit_activated, NULL, NULL, NULL },
|
||||
{ "inspector", inspector_activated, NULL, NULL, NULL },
|
||||
{ "about", about_activated, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
icon_browser_app_startup (GApplication *app)
|
||||
{
|
||||
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (icon_browser_app_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app),
|
||||
"app.quit",
|
||||
quit_accels);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_app_activate (GApplication *app)
|
||||
{
|
||||
IconBrowserWindow *win;
|
||||
|
||||
win = icon_browser_window_new (ICON_BROWSER_APP (app));
|
||||
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.IconBrowser4");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_app_class_init (IconBrowserAppClass *class)
|
||||
{
|
||||
G_APPLICATION_CLASS (class)->startup = icon_browser_app_startup;
|
||||
G_APPLICATION_CLASS (class)->activate = icon_browser_app_activate;
|
||||
}
|
||||
|
||||
IconBrowserApp *
|
||||
icon_browser_app_new (void)
|
||||
{
|
||||
return g_object_new (ICON_BROWSER_APP_TYPE,
|
||||
"application-id", "org.gtk.IconBrowser4",
|
||||
NULL);
|
||||
}
|
||||
15
demos/icon-browser/iconbrowserapp.h
Normal file
15
demos/icon-browser/iconbrowserapp.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
#define ICON_BROWSER_APP_TYPE (icon_browser_app_get_type ())
|
||||
#define ICON_BROWSER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_BROWSER_APP_TYPE, IconBrowserApp))
|
||||
|
||||
|
||||
typedef struct _IconBrowserApp IconBrowserApp;
|
||||
typedef struct _IconBrowserAppClass IconBrowserAppClass;
|
||||
|
||||
|
||||
GType icon_browser_app_get_type (void);
|
||||
IconBrowserApp *icon_browser_app_new (void);
|
||||
156
demos/icon-browser/iconbrowsercontext.c
Normal file
156
demos/icon-browser/iconbrowsercontext.c
Normal file
@@ -0,0 +1,156 @@
|
||||
#include "iconbrowsercontext.h"
|
||||
|
||||
struct _IbContext
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
char *id;
|
||||
char *name;
|
||||
char *description;
|
||||
};
|
||||
|
||||
struct _IbContextClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_ID = 1,
|
||||
PROP_NAME,
|
||||
PROP_DESCRIPTION,
|
||||
PROP_NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (IbContext, ib_context, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
ib_context_init (IbContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
ib_context_finalize (GObject *object)
|
||||
{
|
||||
IbContext *context = IB_CONTEXT (object);
|
||||
|
||||
g_free (context->id);
|
||||
g_free (context->name);
|
||||
g_free (context->description);
|
||||
|
||||
G_OBJECT_CLASS (ib_context_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
ib_context_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
IbContext *context = IB_CONTEXT (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_free (context->id);
|
||||
context->id = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_NAME:
|
||||
g_free (context->name);
|
||||
context->name = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
g_free (context->description);
|
||||
context->description = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ib_context_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
IbContext *context = IB_CONTEXT (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_ID:
|
||||
g_value_set_string (value, context->id);
|
||||
break;
|
||||
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, context->name);
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
g_value_set_string (value, context->description);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ib_context_class_init (IbContextClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GParamSpec *pspec;
|
||||
|
||||
object_class->finalize = ib_context_finalize;
|
||||
object_class->set_property = ib_context_set_property;
|
||||
object_class->get_property = ib_context_get_property;
|
||||
|
||||
pspec = g_param_spec_string ("id", "Id", "Id",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_ID, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("name", "Name", "Name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_NAME, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("description", "Description", "Description",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_DESCRIPTION, pspec);
|
||||
}
|
||||
|
||||
IbContext *
|
||||
ib_context_new (const char *id,
|
||||
const char *name,
|
||||
const char *description)
|
||||
{
|
||||
return g_object_new (IB_TYPE_CONTEXT,
|
||||
"id", id,
|
||||
"name", name,
|
||||
"description", description,
|
||||
NULL);
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_context_get_id (IbContext *context)
|
||||
{
|
||||
return context->id;
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_context_get_name (IbContext *context)
|
||||
{
|
||||
return context->name;
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_context_get_description (IbContext *context)
|
||||
{
|
||||
return context->description;
|
||||
}
|
||||
14
demos/icon-browser/iconbrowsercontext.h
Normal file
14
demos/icon-browser/iconbrowsercontext.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk.h>
|
||||
|
||||
#define IB_TYPE_CONTEXT (ib_context_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (IbContext, ib_context, IB, CONTEXT, GObject)
|
||||
|
||||
IbContext *ib_context_new (const char *id,
|
||||
const char *name,
|
||||
const char *description);
|
||||
|
||||
const char *ib_context_get_id (IbContext *context);
|
||||
const char *ib_context_get_name (IbContext *context);
|
||||
const char *ib_context_get_description (IbContext *context);
|
||||
228
demos/icon-browser/iconbrowsericon.c
Normal file
228
demos/icon-browser/iconbrowsericon.c
Normal file
@@ -0,0 +1,228 @@
|
||||
#include "iconbrowsericon.h"
|
||||
|
||||
struct _IbIcon
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
gboolean use_symbolic;
|
||||
|
||||
char *regular_name;
|
||||
char *symbolic_name;
|
||||
char *description;
|
||||
char *context;
|
||||
};
|
||||
|
||||
struct _IbIconClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_NAME = 1,
|
||||
PROP_REGULAR_NAME,
|
||||
PROP_SYMBOLIC_NAME,
|
||||
PROP_USE_SYMBOLIC,
|
||||
PROP_DESCRIPTION,
|
||||
PROP_CONTEXT,
|
||||
PROP_NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (IbIcon, ib_icon, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
ib_icon_init (IbIcon *icon)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
ib_icon_finalize (GObject *object)
|
||||
{
|
||||
IbIcon *icon = IB_ICON (object);
|
||||
|
||||
g_free (icon->regular_name);
|
||||
g_free (icon->symbolic_name);
|
||||
g_free (icon->description);
|
||||
g_free (icon->context);
|
||||
|
||||
G_OBJECT_CLASS (ib_icon_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
ib_icon_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
IbIcon *icon = IB_ICON (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_REGULAR_NAME:
|
||||
g_free (icon->regular_name);
|
||||
icon->regular_name = g_value_dup_string (value);
|
||||
if (!icon->use_symbolic)
|
||||
g_object_notify (object, "name");
|
||||
break;
|
||||
|
||||
case PROP_SYMBOLIC_NAME:
|
||||
g_free (icon->symbolic_name);
|
||||
icon->symbolic_name = g_value_dup_string (value);
|
||||
if (icon->use_symbolic)
|
||||
g_object_notify (object, "name");
|
||||
break;
|
||||
|
||||
case PROP_USE_SYMBOLIC:
|
||||
icon->use_symbolic = g_value_get_boolean (value);
|
||||
g_object_notify (object, "name");
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
g_free (icon->description);
|
||||
icon->description = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_CONTEXT:
|
||||
g_free (icon->context);
|
||||
icon->context = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ib_icon_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
IbIcon *icon = IB_ICON (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, ib_icon_get_name (icon));
|
||||
break;
|
||||
|
||||
case PROP_REGULAR_NAME:
|
||||
g_value_set_string (value, icon->regular_name);
|
||||
break;
|
||||
|
||||
case PROP_SYMBOLIC_NAME:
|
||||
g_value_set_string (value, icon->symbolic_name);
|
||||
break;
|
||||
|
||||
case PROP_USE_SYMBOLIC:
|
||||
g_value_set_boolean (value, icon->use_symbolic);
|
||||
break;
|
||||
|
||||
case PROP_DESCRIPTION:
|
||||
g_value_set_string (value, icon->description);
|
||||
break;
|
||||
|
||||
case PROP_CONTEXT:
|
||||
g_value_set_string (value, icon->context);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ib_icon_class_init (IbIconClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GParamSpec *pspec;
|
||||
|
||||
object_class->finalize = ib_icon_finalize;
|
||||
object_class->set_property = ib_icon_set_property;
|
||||
object_class->get_property = ib_icon_get_property;
|
||||
|
||||
pspec = g_param_spec_string ("name", "Name", "Name",
|
||||
NULL,
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_NAME, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("regular-name", "Regular Name", "Regular Name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_REGULAR_NAME, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("symbolic-name", "Symbolic Name", "Symbolic Name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_SYMBOLIC_NAME, pspec);
|
||||
|
||||
pspec = g_param_spec_boolean ("use-symbolic", "Use Symbolic", "Use Symbolic",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_USE_SYMBOLIC, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("description", "Description", "Description",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_DESCRIPTION, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("context", "Context", "Context",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_property (object_class, PROP_CONTEXT, pspec);
|
||||
}
|
||||
|
||||
IbIcon *
|
||||
ib_icon_new (const char *regular_name,
|
||||
const char *symbolic_name,
|
||||
const char *description,
|
||||
const char *context)
|
||||
{
|
||||
return g_object_new (IB_TYPE_ICON,
|
||||
"regular-name", regular_name,
|
||||
"symbolic-name", symbolic_name,
|
||||
"description", description,
|
||||
"context", context,
|
||||
NULL);
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_icon_get_name (IbIcon *icon)
|
||||
{
|
||||
if (icon->use_symbolic)
|
||||
return icon->symbolic_name;
|
||||
else
|
||||
return icon->regular_name;
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_icon_get_regular_name (IbIcon *icon)
|
||||
{
|
||||
return icon->regular_name;
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_icon_get_symbolic_name (IbIcon *icon)
|
||||
{
|
||||
return icon->symbolic_name;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ib_icon_get_use_symbolic (IbIcon *icon)
|
||||
{
|
||||
return icon->use_symbolic;
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_icon_get_description (IbIcon *icon)
|
||||
{
|
||||
return icon->description;
|
||||
}
|
||||
|
||||
const char *
|
||||
ib_icon_get_context (IbIcon *icon)
|
||||
{
|
||||
return icon->context;
|
||||
}
|
||||
|
||||
18
demos/icon-browser/iconbrowsericon.h
Normal file
18
demos/icon-browser/iconbrowsericon.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk.h>
|
||||
|
||||
#define IB_TYPE_ICON (ib_icon_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (IbIcon, ib_icon, IB, ICON, GObject)
|
||||
|
||||
IbIcon *ib_icon_new (const char *regular_name,
|
||||
const char *symbolic_name,
|
||||
const char *description,
|
||||
const char *context);
|
||||
|
||||
const char *ib_icon_get_name (IbIcon *icon);
|
||||
const char *ib_icon_get_regular_name (IbIcon *icon);
|
||||
const char *ib_icon_get_symbolic_name (IbIcon *icon);
|
||||
gboolean ib_icon_get_use_symbolic (IbIcon *icon);
|
||||
const char *ib_icon_get_description (IbIcon *icon);
|
||||
const char *ib_icon_get_context (IbIcon *icon);
|
||||
460
demos/icon-browser/iconbrowserwin.c
Normal file
460
demos/icon-browser/iconbrowserwin.c
Normal file
@@ -0,0 +1,460 @@
|
||||
#include <string.h>
|
||||
#include "iconbrowserapp.h"
|
||||
#include "iconbrowserwin.h"
|
||||
#include "iconbrowsericon.h"
|
||||
#include "iconbrowsercontext.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
struct _IconBrowserWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
|
||||
GtkWidget *symbolic_radio;
|
||||
GtkWidget *searchbar;
|
||||
GListModel *icon_filter_model;
|
||||
GListStore *icon_store;
|
||||
GListModel *context_model;
|
||||
GListStore *context_store;
|
||||
GtkFilter *name_filter;
|
||||
GtkFilter *search_mode_filter;
|
||||
GtkWidget *details;
|
||||
GtkWidget *image1;
|
||||
GtkWidget *image2;
|
||||
GtkWidget *image3;
|
||||
GtkWidget *image4;
|
||||
GtkWidget *image5;
|
||||
GtkWidget *image6;
|
||||
GtkWidget *image7;
|
||||
GtkWidget *image8;
|
||||
GtkWidget *label8;
|
||||
GtkWidget *description;
|
||||
};
|
||||
|
||||
struct _IconBrowserWindowClass
|
||||
{
|
||||
GtkApplicationWindowClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(IconBrowserWindow, icon_browser_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
||||
static GtkIconTheme *
|
||||
icon_browser_window_get_icon_theme (IconBrowserWindow *win)
|
||||
{
|
||||
return gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (win)));
|
||||
}
|
||||
|
||||
static void
|
||||
add_icon (IconBrowserWindow *win,
|
||||
const char *name,
|
||||
const char *description,
|
||||
const char *context)
|
||||
{
|
||||
GtkIconTheme *icon_theme = icon_browser_window_get_icon_theme (win);
|
||||
char *regular_name;
|
||||
char *symbolic_name;
|
||||
IbIcon *icon;
|
||||
|
||||
regular_name = g_strdup (name);
|
||||
if (!gtk_icon_theme_has_icon (icon_theme, regular_name))
|
||||
{
|
||||
g_free (regular_name);
|
||||
regular_name = NULL;
|
||||
}
|
||||
|
||||
symbolic_name = g_strconcat (name, "-symbolic", NULL);
|
||||
if (!gtk_icon_theme_has_icon (icon_theme, symbolic_name))
|
||||
{
|
||||
g_free (symbolic_name);
|
||||
symbolic_name = NULL;
|
||||
}
|
||||
|
||||
icon = ib_icon_new (regular_name, symbolic_name, description, context);
|
||||
g_object_bind_property (win->symbolic_radio, "active",
|
||||
icon, "use-symbolic",
|
||||
G_BINDING_DEFAULT);
|
||||
g_list_store_append (win->icon_store, icon);
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
static void
|
||||
add_context (IconBrowserWindow *win,
|
||||
const char *id,
|
||||
const char *name,
|
||||
const char *description)
|
||||
{
|
||||
IbContext *context;
|
||||
|
||||
context = ib_context_new (id, name, description);
|
||||
g_list_store_append (win->context_store, context);
|
||||
g_object_unref (context);
|
||||
}
|
||||
|
||||
static void
|
||||
populate (IconBrowserWindow *win)
|
||||
{
|
||||
GFile *file;
|
||||
GKeyFile *kf;
|
||||
char *data;
|
||||
gsize length;
|
||||
char **groups;
|
||||
int i;
|
||||
|
||||
file = g_file_new_for_uri ("resource:/org/gtk/iconbrowser/gtk/icon.list");
|
||||
g_file_load_contents (file, NULL, &data, &length, NULL, NULL);
|
||||
|
||||
kf = g_key_file_new ();
|
||||
g_key_file_load_from_data (kf, data, length, G_KEY_FILE_NONE, NULL);
|
||||
|
||||
groups = g_key_file_get_groups (kf, &length);
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
const char *context;
|
||||
const char *name;
|
||||
const char *description;
|
||||
char **keys;
|
||||
gsize len;
|
||||
int j;
|
||||
|
||||
context = groups[i];
|
||||
name = g_key_file_get_string (kf, context, "Name", NULL);
|
||||
description = g_key_file_get_string (kf, context, "Description", NULL);
|
||||
add_context (win, context, name, description);
|
||||
|
||||
keys = g_key_file_get_keys (kf, context, &len, NULL);
|
||||
for (j = 0; j < len; j++)
|
||||
{
|
||||
const char *key = keys[j];
|
||||
const char *value;
|
||||
|
||||
if (strcmp (key, "Name") == 0 || strcmp (key, "Description") == 0)
|
||||
continue;
|
||||
|
||||
value = g_key_file_get_string (kf, context, key, NULL);
|
||||
|
||||
add_icon (win, key, value, context);
|
||||
}
|
||||
g_strfreev (keys);
|
||||
}
|
||||
g_strfreev (groups);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
filter_by_icon_name (gpointer item,
|
||||
gpointer data)
|
||||
{
|
||||
return ib_icon_get_name (IB_ICON (item)) != NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
symbolic_toggled (IconBrowserWindow *win)
|
||||
{
|
||||
gtk_filter_changed (win->name_filter, GTK_FILTER_CHANGE_DIFFERENT);
|
||||
}
|
||||
|
||||
static void
|
||||
copy_to_clipboard (GtkButton *button,
|
||||
IconBrowserWindow *win)
|
||||
{
|
||||
GdkClipboard *clipboard;
|
||||
|
||||
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (win));
|
||||
gdk_clipboard_set_text (clipboard, gtk_window_get_title (GTK_WINDOW (win->details)));
|
||||
}
|
||||
|
||||
static void
|
||||
set_image (GtkWidget *image, const char *name, int size)
|
||||
{
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (image), name);
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
|
||||
}
|
||||
|
||||
static void
|
||||
item_activated (GtkGridView *view,
|
||||
guint position,
|
||||
IconBrowserWindow *win)
|
||||
{
|
||||
GListModel *model = G_LIST_MODEL (gtk_grid_view_get_model (view));
|
||||
IbIcon *icon = g_list_model_get_item (model, position);
|
||||
const char *name;
|
||||
const char *description;
|
||||
gboolean symbolic;
|
||||
|
||||
name = ib_icon_get_name (icon);
|
||||
description = ib_icon_get_description (icon);
|
||||
symbolic = ib_icon_get_use_symbolic (icon);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (win->details), name);
|
||||
set_image (win->image1, name, 8);
|
||||
set_image (win->image2, name, 16);
|
||||
set_image (win->image3, name, 18);
|
||||
set_image (win->image4, name, 24);
|
||||
set_image (win->image5, name, 32);
|
||||
set_image (win->image6, name, 48);
|
||||
set_image (win->image7, name, 64);
|
||||
gtk_widget_set_visible (win->image8, symbolic);
|
||||
gtk_widget_set_visible (win->label8, symbolic);
|
||||
if (symbolic)
|
||||
set_image (win->image8, name, 64);
|
||||
gtk_widget_set_visible (win->description, description && description[0]);
|
||||
if (description && description[0])
|
||||
gtk_label_set_text (GTK_LABEL (win->description), description);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win->details));
|
||||
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
static GdkPaintable *
|
||||
get_image_paintable (GtkImage *image)
|
||||
{
|
||||
const char *icon_name;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIconPaintable *icon;
|
||||
int size;
|
||||
|
||||
switch (gtk_image_get_storage_type (image))
|
||||
{
|
||||
case GTK_IMAGE_PAINTABLE:
|
||||
return g_object_ref (gtk_image_get_paintable (image));
|
||||
case GTK_IMAGE_ICON_NAME:
|
||||
icon_name = gtk_image_get_icon_name (image);
|
||||
size = gtk_image_get_pixel_size (image);
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme,
|
||||
icon_name,
|
||||
NULL,
|
||||
size, 1,
|
||||
gtk_widget_get_direction (GTK_WIDGET (image)),
|
||||
0);
|
||||
if (icon == NULL)
|
||||
{
|
||||
g_print ("no icon for %s\n", icon_name);
|
||||
return NULL;
|
||||
}
|
||||
return GDK_PAINTABLE (icon);
|
||||
case GTK_IMAGE_GICON:
|
||||
case GTK_IMAGE_EMPTY:
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drag_begin (GtkDragSource *source,
|
||||
GdkDrag *drag,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
w = gdk_paintable_get_intrinsic_width (paintable);
|
||||
h = gdk_paintable_get_intrinsic_height (paintable);
|
||||
gtk_drag_source_set_icon (source, paintable, w, h);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
drag_prepare_texture (GtkDragSource *source,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
GtkSnapshot *snapshot;
|
||||
double width, height;
|
||||
GskRenderNode *node;
|
||||
GskRenderer *renderer;
|
||||
GdkTexture *texture;
|
||||
GdkContentProvider *ret;
|
||||
|
||||
if (!GDK_IS_PAINTABLE (paintable))
|
||||
return NULL;
|
||||
|
||||
snapshot = gtk_snapshot_new ();
|
||||
width = gdk_paintable_get_intrinsic_width (paintable);
|
||||
height = gdk_paintable_get_intrinsic_height (paintable);
|
||||
gdk_paintable_snapshot (paintable, snapshot, width, height);
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
|
||||
renderer = gtk_native_get_renderer (gtk_widget_get_native (widget));
|
||||
texture = gsk_renderer_render_texture (renderer, node, &GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
ret = gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, texture);
|
||||
|
||||
g_object_unref (texture);
|
||||
gsk_render_node_unref (node);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GdkContentProvider *
|
||||
drag_prepare_file (GtkDragSource *source,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GdkContentProvider *content;
|
||||
GtkIconTheme *icon_theme;
|
||||
const char *name;
|
||||
GtkIconPaintable *info;
|
||||
|
||||
name = gtk_image_get_icon_name (GTK_IMAGE (widget));
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
|
||||
|
||||
info = gtk_icon_theme_lookup_icon (icon_theme,
|
||||
name,
|
||||
NULL,
|
||||
32, 1,
|
||||
gtk_widget_get_direction (widget),
|
||||
0);
|
||||
content = gdk_content_provider_new_typed (G_TYPE_FILE, gtk_icon_paintable_get_file (info));
|
||||
g_object_unref (info);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_image_dnd (GtkWidget *image)
|
||||
{
|
||||
GtkDragSource *source;
|
||||
|
||||
source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (drag_prepare_texture), image);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_scalable_image_dnd (GtkWidget *image)
|
||||
{
|
||||
GtkDragSource *source;
|
||||
|
||||
source = gtk_drag_source_new ();
|
||||
g_signal_connect (source, "prepare", G_CALLBACK (drag_prepare_file), image);
|
||||
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
|
||||
}
|
||||
|
||||
static void
|
||||
search_mode_toggled (GtkSearchBar *searchbar,
|
||||
GParamSpec *pspec,
|
||||
IconBrowserWindow *win)
|
||||
{
|
||||
if (gtk_search_bar_get_search_mode (searchbar))
|
||||
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (win->context_model), GTK_INVALID_LIST_POSITION);
|
||||
else if (gtk_single_selection_get_selected (GTK_SINGLE_SELECTION (win->context_model)) == GTK_INVALID_LIST_POSITION)
|
||||
gtk_single_selection_set_selected (GTK_SINGLE_SELECTION (win->context_model), 0);
|
||||
|
||||
gtk_filter_changed (win->search_mode_filter, GTK_FILTER_CHANGE_DIFFERENT);
|
||||
}
|
||||
|
||||
static void
|
||||
selected_name_changed (GtkSingleSelection *selection,
|
||||
GParamSpec *pspec,
|
||||
IconBrowserWindow *win)
|
||||
{
|
||||
if (gtk_single_selection_get_selected (selection) != GTK_INVALID_LIST_POSITION)
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_init (IconBrowserWindow *win)
|
||||
{
|
||||
GtkFilter *filter;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
setup_image_dnd (win->image1);
|
||||
setup_image_dnd (win->image2);
|
||||
setup_image_dnd (win->image3);
|
||||
setup_image_dnd (win->image4);
|
||||
setup_image_dnd (win->image5);
|
||||
setup_image_dnd (win->image6);
|
||||
setup_image_dnd (win->image7);
|
||||
setup_scalable_image_dnd (win->image8);
|
||||
|
||||
gtk_window_set_transient_for (GTK_WINDOW (win->details), GTK_WINDOW (win));
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (win->searchbar), GTK_WIDGET (win));
|
||||
|
||||
populate (win);
|
||||
|
||||
filter = gtk_filter_list_model_get_filter (GTK_FILTER_LIST_MODEL (win->icon_filter_model));
|
||||
|
||||
win->name_filter = GTK_FILTER (gtk_custom_filter_new (filter_by_icon_name, NULL, NULL));
|
||||
|
||||
gtk_multi_filter_append (GTK_MULTI_FILTER (filter), g_object_ref (win->name_filter));
|
||||
|
||||
g_signal_connect (win->searchbar, "notify::search-mode-enabled", G_CALLBACK (search_mode_toggled), win);
|
||||
g_signal_connect (win->context_model, "notify::selected", G_CALLBACK (selected_name_changed), win);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_dispose (GObject *object)
|
||||
{
|
||||
gtk_widget_dispose_template (GTK_WIDGET (object), ICON_BROWSER_WINDOW_TYPE);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_finalize (GObject *object)
|
||||
{
|
||||
IconBrowserWindow *win = ICON_BROWSER_WINDOW (object);
|
||||
|
||||
g_clear_object (&win->name_filter);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_class_init (IconBrowserWindowClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->dispose = icon_browser_window_dispose;
|
||||
object_class->finalize = icon_browser_window_finalize;
|
||||
|
||||
g_type_ensure (IB_TYPE_ICON);
|
||||
g_type_ensure (IB_TYPE_CONTEXT);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/iconbrowser/gtk/window.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, symbolic_radio);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, searchbar);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, icon_store);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, icon_filter_model);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, context_model);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, context_store);
|
||||
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, details);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image1);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image2);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image3);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image4);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image5);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image6);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image7);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image8);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, label8);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, description);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, search_mode_filter);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), item_activated);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), copy_to_clipboard);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
|
||||
}
|
||||
|
||||
IconBrowserWindow *
|
||||
icon_browser_window_new (IconBrowserApp *app)
|
||||
{
|
||||
return g_object_new (ICON_BROWSER_WINDOW_TYPE, "application", app, NULL);
|
||||
}
|
||||
16
demos/icon-browser/iconbrowserwin.h
Normal file
16
demos/icon-browser/iconbrowserwin.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "iconbrowserapp.h"
|
||||
|
||||
|
||||
#define ICON_BROWSER_WINDOW_TYPE (icon_browser_window_get_type ())
|
||||
#define ICON_BROWSER_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ICON_BROWSER_WINDOW_TYPE, IconBrowserWindow))
|
||||
|
||||
|
||||
typedef struct _IconBrowserWindow IconBrowserWindow;
|
||||
typedef struct _IconBrowserWindowClass IconBrowserWindowClass;
|
||||
|
||||
|
||||
GType icon_browser_window_get_type (void);
|
||||
IconBrowserWindow *icon_browser_window_new (IconBrowserApp *app);
|
||||
8
demos/icon-browser/main.c
Normal file
8
demos/icon-browser/main.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <iconbrowserapp.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
return g_application_run (G_APPLICATION (icon_browser_app_new ()), argc, argv);
|
||||
}
|
||||
41
demos/icon-browser/meson.build
Normal file
41
demos/icon-browser/meson.build
Normal file
@@ -0,0 +1,41 @@
|
||||
iconbrowser_sources = [
|
||||
'main.c',
|
||||
'iconbrowserapp.c',
|
||||
'iconbrowserwin.c',
|
||||
'iconbrowsericon.c',
|
||||
'iconbrowsercontext.c'
|
||||
]
|
||||
|
||||
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
|
||||
'iconbrowser.gresource.xml',
|
||||
source_dir: meson.current_source_dir(),
|
||||
)
|
||||
|
||||
executable('gtk4-icon-browser',
|
||||
sources: [iconbrowser_sources, iconbrowser_resources],
|
||||
c_args: common_cflags,
|
||||
dependencies: [ libgtk_dep, profile_conf_h ],
|
||||
include_directories: confinc,
|
||||
win_subsystem: 'windows',
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true,
|
||||
)
|
||||
|
||||
# icons
|
||||
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
|
||||
|
||||
foreach size: ['scalable', 'symbolic']
|
||||
install_subdir('data/' + size, install_dir: icontheme_dir)
|
||||
endforeach
|
||||
|
||||
# desktop file
|
||||
install_data('org.gtk.IconBrowser4.desktop', install_dir: gtk_applicationsdir)
|
||||
|
||||
# appdata
|
||||
configure_file(
|
||||
input: 'org.gtk.IconBrowser4.appdata.xml.in',
|
||||
output: 'org.gtk.IconBrowser4.appdata.xml',
|
||||
configuration: appdata_config,
|
||||
install_dir: gtk_appdatadir
|
||||
)
|
||||
|
||||
41
demos/icon-browser/org.gtk.IconBrowser4.appdata.xml.in
Normal file
41
demos/icon-browser/org.gtk.IconBrowser4.appdata.xml.in
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.gtk.IconBrowser4</id>
|
||||
<launchable type="desktop-id">org.gtk.IconBrowser4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>LGPL-2.1-or-later</project_license>
|
||||
<name>GTK Icon Browser</name>
|
||||
<summary>Program to browse themed icons</summary>
|
||||
<description>
|
||||
<p>
|
||||
GTK Icon Browser is a simple application to show themed icons that
|
||||
are available on the system.
|
||||
</p>
|
||||
</description>
|
||||
<screenshots>
|
||||
<screenshot>
|
||||
<image>https://static.gnome.org/appdata/gtk4-icon-browser/gtk-icon-browser1.png</image>
|
||||
<caption>Icon Browser</caption>
|
||||
</screenshot>
|
||||
<screenshot>
|
||||
<image>https://static.gnome.org/appdata/gtk4-icon-browser/gtk-icon-browser2.png</image>
|
||||
<caption>Search</caption>
|
||||
</screenshot>
|
||||
</screenshots>
|
||||
<kudos>
|
||||
<kudo>HiDpiIcon</kudo>
|
||||
<kudo>ModernToolkit</kudo>
|
||||
</kudos>
|
||||
<url type="homepage">https://www.gtk.org</url>
|
||||
<translation type="gettext">gtk-4.0</translation>
|
||||
<update_contact>matthias.clasen_at_gmail.com</update_contact>
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
</release>
|
||||
</releases>
|
||||
</component>
|
||||
9
demos/icon-browser/org.gtk.IconBrowser4.desktop
Normal file
9
demos/icon-browser/org.gtk.IconBrowser4.desktop
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Icon Browser
|
||||
Comment=An application that shows themed icons
|
||||
Exec=gtk4-icon-browser
|
||||
Icon=org.gtk.IconBrowser4
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
||||
Categories=Development;GTK;
|
||||
482
demos/icon-browser/window.ui
Normal file
482
demos/icon-browser/window.ui
Normal file
@@ -0,0 +1,482 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="gear_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Inspector</attribute>
|
||||
<attribute name="action">app.inspector</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About GTK Icon Browser</attribute>
|
||||
<attribute name="action">app.about</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<child type="title">
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="normal_radio">
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="label" translatable="yes">Normal</property>
|
||||
<property name="active">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="symbolic_radio">
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="label" translatable="yes">Symbolic</property>
|
||||
<property name="group">normal_radio</property>
|
||||
<signal name="notify::active" handler="symbolic_toggled" swapped="yes" after="yes"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gear_menu_button">
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="focus-on-click">0</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<style>
|
||||
<class name="sidebar"/>
|
||||
</style>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListView">
|
||||
<style>
|
||||
<class name="navigation-sidebar"/>
|
||||
</style>
|
||||
<property name="model">
|
||||
<object class="GtkSingleSelection" id="context_model">
|
||||
<property name="model">
|
||||
<object class="GListStore" id="context_store">
|
||||
<property name="item-type">IbContext</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes">
|
||||
<![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="GtkListItem">
|
||||
<property name="child">
|
||||
<object class="GtkLabel">
|
||||
<property name="xalign">0</property>
|
||||
<binding name="label">
|
||||
<lookup name="name" type="IbContext">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="search-mode-enabled" bind-source="search" bind-property="active" bind-flags="bidirectional"/>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sw">
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkGridView" id="list">
|
||||
<style>
|
||||
<class name="content-view"/>
|
||||
</style>
|
||||
<signal name="activate" handler="item_activated"/>
|
||||
<property name="single-click-activate">1</property>
|
||||
<property name="model">
|
||||
<object class="GtkNoSelection">
|
||||
<property name="model">
|
||||
<object class="GtkFilterListModel" id="icon_filter_model">
|
||||
<property name="filter">
|
||||
<object class="GtkEveryFilter">
|
||||
<child>
|
||||
<object class="GtkStringFilter">
|
||||
<property name="expression">
|
||||
<lookup name="name" type="IbIcon"/>
|
||||
</property>
|
||||
<binding name="search">
|
||||
<lookup name="text" type="GtkSearchEntry">
|
||||
searchentry
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAnyFilter">
|
||||
<child>
|
||||
<object class="GtkBoolFilter" id="search_mode_filter">
|
||||
<property name="expression">
|
||||
<lookup name="search-mode-enabled">
|
||||
searchbar
|
||||
</lookup>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStringFilter">
|
||||
<property name="ignore-case">0</property>
|
||||
<property name="match-mode">exact</property>
|
||||
<property name="expression">
|
||||
<lookup name="context" type="IbIcon"/>
|
||||
</property>
|
||||
<binding name="search">
|
||||
<lookup name="id" type="IbContext">
|
||||
<lookup name="selected-item" type="GtkSingleSelection">
|
||||
context_model
|
||||
</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
<property name="model">
|
||||
<object class="GListStore" id="icon_store">
|
||||
<property name="item-type">IbIcon</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="factory">
|
||||
<object class="GtkBuilderListItemFactory">
|
||||
<property name="bytes">
|
||||
<![CDATA[
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="GtkListItem">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="pixel-size">48</property>
|
||||
<binding name="icon-name">
|
||||
<lookup name="name" type="IbIcon">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<binding name="label">
|
||||
<lookup name="name" type="IbIcon">
|
||||
<lookup name="item">GtkListItem</lookup>
|
||||
</lookup>
|
||||
</binding>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</template>
|
||||
</interface>
|
||||
]]>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
|
||||
<object class="GtkDialog" id="details">
|
||||
<property name="modal">1</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="resizable">0</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="row-spacing">18</property>
|
||||
<property name="column-spacing">18</property>
|
||||
<property name="halign">center</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image4">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image7">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image8">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">end</property>
|
||||
<layout>
|
||||
<property name="column">7</property>
|
||||
<property name="row">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">8×8</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">16×16</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">1</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">18×18</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">2</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">24×24</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">3</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">32×32</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">4</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">48×48</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">5</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">64×64</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">6</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="label">scalable</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="column">7</property>
|
||||
<property name="row">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Copy to Clipboard</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-start">20</property>
|
||||
<property name="margin-end">20</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<signal name="clicked" handler="copy_to_clipboard"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">10</property>
|
||||
<property name="margin-bottom">10</property>
|
||||
<property name="wrap">1</property>
|
||||
<property name="max-width-chars">60</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@@ -112,7 +112,7 @@ activate_about (GSimpleAction *action,
|
||||
? "GTK Node Editor (Development)"
|
||||
: "GTK Node Editor",
|
||||
"version", version,
|
||||
"copyright", "© 2019—2024 The GTK Team",
|
||||
"copyright", "© 2019—2021 The GTK Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to test GTK rendering",
|
||||
@@ -121,12 +121,8 @@ activate_about (GSimpleAction *action,
|
||||
"title", "About GTK Node Editor",
|
||||
"system-information", s->str,
|
||||
NULL);
|
||||
|
||||
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
|
||||
"Artwork by", (const char *[]) { "Jakub Steiner", NULL });
|
||||
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
|
||||
"Maintained by", (const char *[]) { "The GTK Team", NULL });
|
||||
|
||||
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
|
||||
"Artwork by", (const char *[]) { "Jakub Steiner", NULL });
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
@@ -223,6 +219,8 @@ node_editor_application_activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.gtk4.NodeEditor");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<component type="desktop">
|
||||
<id>org.gtk.gtk4.NodeEditor</id>
|
||||
<launchable type="desktop-id">org.gtk.gtk4.NodeEditor.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<component type="desktop">
|
||||
<id>org.gtk.PrintEditor4</id>
|
||||
<launchable type="desktop-id">org.gtk.PrintEditor4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -576,6 +576,18 @@ activate_about (GSimpleAction *action,
|
||||
int i;
|
||||
char *os_name;
|
||||
char *os_version;
|
||||
const char *authors[] = {
|
||||
"Alexander Larsson",
|
||||
NULL
|
||||
};
|
||||
const char *artists[] = {
|
||||
"Jakub Steiner",
|
||||
NULL
|
||||
};
|
||||
const char *maintainers[] = {
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
GtkWidget *dialog;
|
||||
|
||||
os_name = g_get_os_info (G_OS_INFO_KEY_NAME);
|
||||
@@ -619,21 +631,19 @@ activate_about (GSimpleAction *action,
|
||||
? "GTK Print Editor (Development)"
|
||||
: "GTK Print Editor",
|
||||
"version", version,
|
||||
"copyright", "© 2006-2024 Red Hat, Inc",
|
||||
"copyright", "© 2006-2021 Red Hat, Inc",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK printing",
|
||||
"authors", (const char *[]) { "Alexander Larsson", NULL },
|
||||
"authors", authors,
|
||||
"logo-icon-name", "org.gtk.PrintEditor4",
|
||||
"title", "About GTK Print Editor",
|
||||
"system-information", sysinfo->str,
|
||||
NULL);
|
||||
|
||||
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
|
||||
_("Artwork by"), (const char *[]) { "Jakub Steiner", NULL });
|
||||
|
||||
_("Artwork by"), artists);
|
||||
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
|
||||
_("Maintained by"), (const char *[]) { "The GTK Team", NULL });
|
||||
_("Maintained by"), maintainers);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
@@ -788,6 +798,7 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (main_window), "org.gtk.PrintEditor4");
|
||||
gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
|
||||
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
|
||||
update_title (GTK_WINDOW (main_window));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component xmlns="https://specifications.freedesktop.org/metainfo/1.0" type="desktop">
|
||||
<component type="desktop">
|
||||
<id>org.gtk.WidgetFactory4</id>
|
||||
<launchable type="desktop-id">org.gtk.WidgetFactory4.desktop</launchable>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
|
||||
@@ -294,6 +294,15 @@ activate_about (GSimpleAction *action,
|
||||
GtkApplication *app = user_data;
|
||||
GtkWindow *window;
|
||||
GtkWidget *button;
|
||||
const char *authors[] = {
|
||||
"Andrea Cimitan",
|
||||
"Cosimo Cecchi",
|
||||
NULL
|
||||
};
|
||||
const char *maintainers[] = {
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
char *version;
|
||||
char *os_name;
|
||||
char *os_version;
|
||||
@@ -338,18 +347,18 @@ activate_about (GSimpleAction *action,
|
||||
? "GTK Widget Factory (Development)"
|
||||
: "GTK Widget Factory",
|
||||
"version", version,
|
||||
"copyright", "© 1997—2024 The GTK Team",
|
||||
"copyright", "© 1997—2021 The GTK Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK themes and widgets",
|
||||
"authors", (const char *[]) { "Andrea Cimitan", "Cosimo Cecchi", NULL },
|
||||
"authors", authors,
|
||||
"logo-icon-name", "org.gtk.WidgetFactory4",
|
||||
"title", "About GTK Widget Factory",
|
||||
"system-information", s->str,
|
||||
NULL);
|
||||
|
||||
gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG (dialog),
|
||||
_("Maintained by"), (const char *[]) { "The GTK Team", NULL });
|
||||
_("Maintained by"), maintainers);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
@@ -2232,6 +2241,7 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (window, "org.gtk.WidgetFactory4");
|
||||
gtk_application_add_window (GTK_APPLICATION (app), window);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
|
||||
@@ -38,7 +38,7 @@ if get_option('documentation')
|
||||
gdk_gir[0],
|
||||
],
|
||||
depends: gdk_gir[0],
|
||||
suite: ['docs'],
|
||||
suite: ['docs', 'failing'],
|
||||
)
|
||||
|
||||
if x11_enabled
|
||||
@@ -69,18 +69,6 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk-x11',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4x11_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_x11_gir[0],
|
||||
],
|
||||
depends: gdk_x11_gir[0],
|
||||
suite: ['docs', 'failing'],
|
||||
)
|
||||
endif
|
||||
|
||||
if wayland_enabled
|
||||
|
||||
@@ -205,8 +205,7 @@ Other libraries, such as libadwaita, may provide replacements as well.
|
||||
|
||||
## gtk_show_uri is being replaced
|
||||
|
||||
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]
|
||||
or [class@Gtk.FileLauncher].
|
||||
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]or [class@Gtk.FileLauncher].
|
||||
|
||||
## GtkStatusbar is going away
|
||||
|
||||
|
||||
@@ -181,21 +181,15 @@ matrix3d() production to specify all 16 values individually.
|
||||
|
||||
### conic-gradient
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ----------------- | --------------- | -------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25, 25 | always |
|
||||
| rotation | `<number>` | 0 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| interpolation | `<color-state>` | srgb | non-default |
|
||||
| hue-interpolation | `<hue-interp>` | shorter | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25, 25 | always |
|
||||
| rotation | `<number>` | 0 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
|
||||
Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
|
||||
|
||||
Possible values for the hue-interpolation property are:
|
||||
|
||||
hue-interpolation: shorter | longer | increasing | decreasing
|
||||
|
||||
### cross-fade
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -264,14 +258,12 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
|
||||
|
||||
### linear-gradient
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ----------------- | --------------- | -------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| start | `<point>` | 0 0 | always |
|
||||
| end | `<point>` | 0 50 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| interpolation | `<color-state>` | srgb | non-default |
|
||||
| hue-interpolation | `<hue-interp>` | shorter | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| start | `<point>` | 0 0 | always |
|
||||
| end | `<point>` | 0 50 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
|
||||
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
|
||||
|
||||
@@ -313,17 +305,15 @@ Creates a node like `gsk_outset_shadow_node_new()` with the given properties.
|
||||
|
||||
### radial-gradient
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ----------------- | --------------- | -------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25 25 | always |
|
||||
| hradius | `<number>` | 25 | always |
|
||||
| vradius | `<number>` | 25 | always |
|
||||
| start | `<number>` | 0 | always |
|
||||
| end | `<number>` | 1 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| interpolation | `<color-state>` | srgb | non-default |
|
||||
| hue-interpolation | `<hue-interp>` | shorter | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25 25 | always |
|
||||
| hradius | `<number>` | 25 | always |
|
||||
| vradius | `<number>` | 25 | always |
|
||||
| start | `<number>` | 0 | always |
|
||||
| end | `<number>` | 1 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
|
||||
Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
|
||||
|
||||
|
||||
@@ -358,9 +358,6 @@ disable certain features.
|
||||
`color-mgmt`
|
||||
: Disable color management
|
||||
|
||||
`aerosnap`
|
||||
: Disable Aerosnap support on Windows
|
||||
|
||||
### `GDK_GL_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
|
||||
@@ -717,8 +717,6 @@ main (int argc, char **argv)
|
||||
int status;
|
||||
const char *accels[] = { "F11", NULL };
|
||||
|
||||
gtk_init ();
|
||||
|
||||
bloat_pad = bloat_pad_new ();
|
||||
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (bloat_pad),
|
||||
|
||||
@@ -257,6 +257,12 @@ gdk_broadway_display_flush (GdkDisplay *display)
|
||||
_gdk_broadway_server_flush (broadway_display->server);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_display_dispose (GObject *object)
|
||||
{
|
||||
@@ -479,6 +485,7 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
display_class->beep = gdk_broadway_display_beep;
|
||||
display_class->sync = gdk_broadway_display_sync;
|
||||
display_class->flush = gdk_broadway_display_flush;
|
||||
display_class->has_pending = gdk_broadway_display_has_pending;
|
||||
display_class->queue_events = _gdk_broadway_display_queue_events;
|
||||
|
||||
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
|
||||
|
||||
14
gdk/gdk.c
14
gdk/gdk.c
@@ -113,12 +113,6 @@ static int gdk_initialized = 0; /* 1 if the library is initi
|
||||
* 0 otherwise.
|
||||
*/
|
||||
|
||||
gboolean
|
||||
gdk_is_initialized (void)
|
||||
{
|
||||
return gdk_initialized != 0;
|
||||
}
|
||||
|
||||
static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "misc", GDK_DEBUG_MISC, "Miscellaneous information" },
|
||||
{ "events", GDK_DEBUG_EVENTS, "Information about events" },
|
||||
@@ -158,7 +152,6 @@ static const GdkDebugKey gdk_feature_keys[] = {
|
||||
{ "dmabuf", GDK_FEATURE_DMABUF, "Disable dmabuf support" },
|
||||
{ "offload", GDK_FEATURE_OFFLOAD, "Disable graphics offload" },
|
||||
{ "color-mgmt", GDK_FEATURE_COLOR_MANAGEMENT, "Disable color management" },
|
||||
{ "aerosnap", GDK_FEATURE_AEROSNAP, "Disable Aerosnap support on Windows" },
|
||||
};
|
||||
|
||||
|
||||
@@ -367,12 +360,13 @@ gdk_display_open_default (void)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
|
||||
gdk_ensure_initialized ();
|
||||
g_return_val_if_fail (gdk_initialized, NULL);
|
||||
|
||||
display = gdk_display_get_default ();
|
||||
if (display)
|
||||
return display;
|
||||
|
||||
if (!display)
|
||||
display = gdk_display_open (NULL);
|
||||
display = gdk_display_open (NULL);
|
||||
|
||||
return display;
|
||||
}
|
||||
|
||||
@@ -122,18 +122,6 @@ gdk_cairo_pattern_add_color_stop_rgba_ccs (cairo_pattern_t *pattern,
|
||||
cairo_pattern_add_color_stop_rgba (pattern, offset, color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_pattern_add_color_stop_color (cairo_pattern_t *pattern,
|
||||
GdkColorState *ccs,
|
||||
double offset,
|
||||
const GdkColor *color)
|
||||
{
|
||||
float values[4];
|
||||
|
||||
gdk_color_to_float (color, ccs, values);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, offset, values[0], values[1], values[2], values[3]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_rect (cairo_t *cr,
|
||||
const graphene_rect_t *rect)
|
||||
|
||||
@@ -478,4 +478,4 @@ gdk_cicp_params_get_cicp (GdkCicpParams *self)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "gdkcicpparams.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GdkCicp GdkCicp;
|
||||
|
||||
struct _GdkCicp
|
||||
@@ -84,5 +82,3 @@ gdk_cicp_equivalent (const GdkCicp *p1,
|
||||
const GdkCicp * gdk_cicp_params_get_cicp (GdkCicpParams *self);
|
||||
|
||||
GdkCicpParams * gdk_cicp_params_new_for_cicp (const GdkCicp *cicp);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -233,53 +233,3 @@ static const float srgb_to_rec2020[9] = {
|
||||
0.069108, 0.919519, 0.011360,
|
||||
0.016394, 0.088011, 0.895380,
|
||||
};
|
||||
|
||||
/* oklab conversion */
|
||||
|
||||
static float
|
||||
from_oklab_nl (float v)
|
||||
{
|
||||
return v * v * v;
|
||||
}
|
||||
|
||||
static float
|
||||
to_oklab_nl (float v)
|
||||
{
|
||||
return cbrtf (v);
|
||||
}
|
||||
|
||||
static const float oklab_to_lms[9] = {
|
||||
1, 0.3963377774, 0.2158037573,
|
||||
1, -0.1055613458, -0.0638541728,
|
||||
1, -0.0894841775, -1.2914855480
|
||||
};
|
||||
|
||||
static const float lms_to_srgb[9] = {
|
||||
4.0767416621, -3.3077115913, 0.2309699292,
|
||||
-1.2684380046, 2.6097574011, -0.3413193965,
|
||||
-0.0041960863, -0.7034186147, 1.7076147010,
|
||||
};
|
||||
|
||||
static const float srgb_to_lms[9] = {
|
||||
0.4122214708, 0.5363325363, 0.0514459929,
|
||||
0.2119034982, 0.6806995451, 0.1073969566,
|
||||
0.0883024619, 0.2817188376, 0.6299787005,
|
||||
};
|
||||
|
||||
static const float lms_to_oklab[9] = {
|
||||
0.2104542553, 0.7936177850, -0.0040720468,
|
||||
1.9779984951, -2.4285922050, 0.4505937099,
|
||||
0.0259040371, 0.7827717662, -0.8086757660,
|
||||
};
|
||||
|
||||
static const float rec2020_to_lms[9] = {
|
||||
0.616645, 0.360250, 0.023064,
|
||||
0.265075, 0.635874, 0.099059,
|
||||
0.100076, 0.203907, 0.696161,
|
||||
};
|
||||
|
||||
static const float lms_to_rec2020[9] = {
|
||||
2.140325, -1.246734, 0.106491,
|
||||
-0.884665, 2.163141, -0.278489,
|
||||
-0.048559, -0.454366, 1.502711,
|
||||
};
|
||||
|
||||
@@ -172,41 +172,6 @@ gdk_color_state_get_rec2100_linear (void)
|
||||
return GDK_COLOR_STATE_REC2100_LINEAR;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_get_oklab:
|
||||
*
|
||||
* Returns the color state object representing the oklab color space.
|
||||
*
|
||||
* This is a perceptually uniform color state.
|
||||
*
|
||||
* Returns: the color state object for oklab
|
||||
*
|
||||
* Since: 4.18
|
||||
*/
|
||||
GdkColorState *
|
||||
gdk_color_state_get_oklab (void)
|
||||
{
|
||||
return GDK_COLOR_STATE_OKLAB;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_get_oklch:
|
||||
*
|
||||
* Returns the color state object representing the oklch color space.
|
||||
*
|
||||
* This is the polar variant of oklab, in which the hue is encoded as
|
||||
* a polar coordinate.
|
||||
*
|
||||
* Returns: the color state object for oklch
|
||||
*
|
||||
* Since: 4.18
|
||||
*/
|
||||
GdkColorState *
|
||||
gdk_color_state_get_oklch (void)
|
||||
{
|
||||
return GDK_COLOR_STATE_OKLCH;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_equal:
|
||||
* @self: a `GdkColorState`
|
||||
@@ -258,171 +223,56 @@ gdk_color_state_create_cicp_params (GdkColorState *self)
|
||||
/* {{{ Conversion functions */
|
||||
|
||||
typedef float (* GdkTransferFunc) (float v);
|
||||
typedef void (* GdkConvertFunc) (GdkColorState *self,
|
||||
float values[4]);
|
||||
typedef const float GdkColorMatrix[9];
|
||||
|
||||
#define IDENTITY ((float*)0)
|
||||
#define NONE ((GdkTransferFunc)0)
|
||||
|
||||
#define CONVERT_FUNC(name) \
|
||||
#define TRANSFORM(name, eotf, matrix, oetf) \
|
||||
static void \
|
||||
gdk_convert_ ## name (GdkColorState *self, \
|
||||
float (*values)[4], \
|
||||
gsize n_values) \
|
||||
name (GdkColorState *self, \
|
||||
float (*values)[4], \
|
||||
gsize n_values) \
|
||||
{ \
|
||||
for (gsize i = 0; i < n_values; i++) \
|
||||
{ \
|
||||
name (self, values[i]); \
|
||||
if (eotf != NONE) \
|
||||
{ \
|
||||
values[i][0] = eotf (values[i][0]); \
|
||||
values[i][1] = eotf (values[i][1]); \
|
||||
values[i][2] = eotf (values[i][2]); \
|
||||
} \
|
||||
if (matrix != IDENTITY) \
|
||||
{ \
|
||||
float res[3]; \
|
||||
res[0] = matrix[0] * values[i][0] + matrix[1] * values[i][1] + matrix[2] * values[i][2]; \
|
||||
res[1] = matrix[3] * values[i][0] + matrix[4] * values[i][1] + matrix[5] * values[i][2]; \
|
||||
res[2] = matrix[6] * values[i][0] + matrix[7] * values[i][1] + matrix[8] * values[i][2]; \
|
||||
values[i][0] = res[0]; \
|
||||
values[i][1] = res[1]; \
|
||||
values[i][2] = res[2]; \
|
||||
} \
|
||||
if (oetf != NONE) \
|
||||
{ \
|
||||
values[i][0] = oetf (values[i][0]); \
|
||||
values[i][1] = oetf (values[i][1]); \
|
||||
values[i][2] = oetf (values[i][2]); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define TRANSFORM(name, eotf, matrix, nonlinear, matrix2, oetf) \
|
||||
static inline void \
|
||||
name (GdkColorState *self, \
|
||||
float values[4]) \
|
||||
{ \
|
||||
if (eotf != NONE) \
|
||||
{ \
|
||||
values[0] = eotf (values[0]); \
|
||||
values[1] = eotf (values[1]); \
|
||||
values[2] = eotf (values[2]); \
|
||||
} \
|
||||
if (matrix != IDENTITY) \
|
||||
{ \
|
||||
float res[3]; \
|
||||
res[0] = matrix[0] * values[0] + matrix[1] * values[1] + matrix[2] * values[2]; \
|
||||
res[1] = matrix[3] * values[0] + matrix[4] * values[1] + matrix[5] * values[2]; \
|
||||
res[2] = matrix[6] * values[0] + matrix[7] * values[1] + matrix[8] * values[2]; \
|
||||
values[0] = res[0]; \
|
||||
values[1] = res[1]; \
|
||||
values[2] = res[2]; \
|
||||
} \
|
||||
if (nonlinear != NONE) \
|
||||
{ \
|
||||
values[0] = nonlinear (values[0]); \
|
||||
values[1] = nonlinear (values[1]); \
|
||||
values[2] = nonlinear (values[2]); \
|
||||
} \
|
||||
if (matrix2 != IDENTITY) \
|
||||
{ \
|
||||
float res[3]; \
|
||||
res[0] = matrix2[0] * values[0] + matrix2[1] * values[1] + matrix2[2] * values[2]; \
|
||||
res[1] = matrix2[3] * values[0] + matrix2[4] * values[1] + matrix2[5] * values[2]; \
|
||||
res[2] = matrix2[6] * values[0] + matrix2[7] * values[1] + matrix2[8] * values[2]; \
|
||||
values[0] = res[0]; \
|
||||
values[1] = res[1]; \
|
||||
values[2] = res[2]; \
|
||||
} \
|
||||
if (oetf != NONE) \
|
||||
{ \
|
||||
values[0] = oetf (values[0]); \
|
||||
values[1] = oetf (values[1]); \
|
||||
values[2] = oetf (values[2]); \
|
||||
} \
|
||||
} \
|
||||
CONVERT_FUNC (name)
|
||||
|
||||
#define TRANSFORM_PAIR(name, func1, func2) \
|
||||
static inline void \
|
||||
name (GdkColorState *self, \
|
||||
float values[4]) \
|
||||
{ \
|
||||
func1 (self, values); \
|
||||
func2 (self, values); \
|
||||
} \
|
||||
CONVERT_FUNC (name)
|
||||
|
||||
TRANSFORM(srgb_to_srgb_linear, srgb_eotf, IDENTITY, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(srgb_linear_to_srgb, NONE, IDENTITY, NONE, IDENTITY, srgb_oetf)
|
||||
TRANSFORM(rec2100_pq_to_rec2100_linear, pq_eotf, IDENTITY, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(rec2100_linear_to_rec2100_pq, NONE, IDENTITY, NONE, IDENTITY, pq_oetf)
|
||||
TRANSFORM(srgb_linear_to_rec2100_linear, NONE, srgb_to_rec2020, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(rec2100_linear_to_srgb_linear, NONE, rec2020_to_srgb, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(srgb_to_rec2100_linear, srgb_eotf, srgb_to_rec2020, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(rec2100_pq_to_srgb_linear, pq_eotf, rec2020_to_srgb, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(srgb_linear_to_rec2100_pq, NONE, srgb_to_rec2020, NONE, IDENTITY, pq_oetf)
|
||||
TRANSFORM(rec2100_linear_to_srgb, NONE, rec2020_to_srgb, NONE, IDENTITY, srgb_oetf)
|
||||
TRANSFORM(srgb_to_rec2100_pq, srgb_eotf, srgb_to_rec2020, NONE, IDENTITY, pq_oetf)
|
||||
TRANSFORM(rec2100_pq_to_srgb, pq_eotf, rec2020_to_srgb, NONE, IDENTITY, srgb_oetf)
|
||||
|
||||
TRANSFORM(oklab_to_srgb_linear, NONE, oklab_to_lms, from_oklab_nl, lms_to_srgb, NONE)
|
||||
TRANSFORM(oklab_to_srgb, NONE, oklab_to_lms, from_oklab_nl, lms_to_srgb, srgb_oetf)
|
||||
TRANSFORM(oklab_to_rec2100_linear, NONE, oklab_to_lms, from_oklab_nl, lms_to_rec2020, NONE)
|
||||
TRANSFORM(oklab_to_rec2100_pq, NONE, oklab_to_lms, from_oklab_nl, lms_to_rec2020, pq_oetf)
|
||||
TRANSFORM(srgb_linear_to_oklab, NONE, srgb_to_lms, to_oklab_nl, lms_to_oklab, NONE)
|
||||
TRANSFORM(srgb_to_oklab, srgb_eotf, srgb_to_lms, to_oklab_nl, lms_to_oklab, NONE)
|
||||
TRANSFORM(rec2100_linear_to_oklab, NONE, rec2020_to_lms, to_oklab_nl, lms_to_oklab, NONE)
|
||||
TRANSFORM(rec2100_pq_to_oklab, pq_eotf, rec2020_to_lms, to_oklab_nl, lms_to_oklab, NONE)
|
||||
|
||||
#define DEG_TO_RAD(x) ((x) * G_PI / 180)
|
||||
#define RAD_TO_DEG(x) ((x) * 180 / G_PI)
|
||||
|
||||
static inline void
|
||||
_sincosf (float angle,
|
||||
float *out_s,
|
||||
float *out_c)
|
||||
{
|
||||
#ifdef HAVE_SINCOSF
|
||||
sincosf (angle, out_s, out_c);
|
||||
#else
|
||||
*out_s = sinf (angle);
|
||||
*out_c = cosf (angle);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
oklch_to_oklab (GdkColorState *self,
|
||||
float values[4])
|
||||
{
|
||||
float L, C, H, a, b;
|
||||
|
||||
L = values[0];
|
||||
C = values[1];
|
||||
H = values[2];
|
||||
|
||||
_sincosf (DEG_TO_RAD (H), &b, &a);
|
||||
a *= C;
|
||||
b *= C;
|
||||
|
||||
values[0] = L;
|
||||
values[1] = a;
|
||||
values[2] = b;
|
||||
}
|
||||
|
||||
static void
|
||||
oklab_to_oklch (GdkColorState *self,
|
||||
float values[4])
|
||||
{
|
||||
float L, a, b, C, H;
|
||||
|
||||
L = values[0];
|
||||
a = values[1];
|
||||
b = values[2];
|
||||
|
||||
C = hypotf (a, b);
|
||||
H = RAD_TO_DEG (atan2 (b, a));
|
||||
|
||||
H = fmod (H, 360);
|
||||
if (H < 0)
|
||||
H += 360;
|
||||
|
||||
values[0] = L;
|
||||
values[1] = C;
|
||||
values[2] = H;
|
||||
}
|
||||
|
||||
CONVERT_FUNC (oklch_to_oklab)
|
||||
CONVERT_FUNC (oklab_to_oklch)
|
||||
|
||||
TRANSFORM_PAIR (srgb_to_oklch, srgb_to_oklab, oklab_to_oklch)
|
||||
TRANSFORM_PAIR (srgb_linear_to_oklch, srgb_linear_to_oklab, oklab_to_oklch)
|
||||
TRANSFORM_PAIR (rec2100_pq_to_oklch, rec2100_pq_to_oklab, oklab_to_oklch)
|
||||
TRANSFORM_PAIR (rec2100_linear_to_oklch, rec2100_linear_to_oklab, oklab_to_oklch)
|
||||
TRANSFORM_PAIR (oklch_to_srgb, oklch_to_oklab, oklab_to_srgb)
|
||||
TRANSFORM_PAIR (oklch_to_srgb_linear, oklch_to_oklab, oklab_to_srgb_linear)
|
||||
TRANSFORM_PAIR (oklch_to_rec2100_pq, oklch_to_oklab, oklab_to_rec2100_pq)
|
||||
TRANSFORM_PAIR (oklch_to_rec2100_linear, oklch_to_oklab, oklab_to_rec2100_pq)
|
||||
TRANSFORM(gdk_default_srgb_to_srgb_linear, srgb_eotf, IDENTITY, NONE);
|
||||
TRANSFORM(gdk_default_srgb_linear_to_srgb, NONE, IDENTITY, srgb_oetf)
|
||||
TRANSFORM(gdk_default_rec2100_pq_to_rec2100_linear, pq_eotf, IDENTITY, NONE)
|
||||
TRANSFORM(gdk_default_rec2100_linear_to_rec2100_pq, NONE, IDENTITY, pq_oetf)
|
||||
TRANSFORM(gdk_default_srgb_linear_to_rec2100_linear, NONE, srgb_to_rec2020, NONE)
|
||||
TRANSFORM(gdk_default_rec2100_linear_to_srgb_linear, NONE, rec2020_to_srgb, NONE)
|
||||
TRANSFORM(gdk_default_srgb_to_rec2100_linear, srgb_eotf, srgb_to_rec2020, NONE)
|
||||
TRANSFORM(gdk_default_rec2100_pq_to_srgb_linear, pq_eotf, rec2020_to_srgb, NONE)
|
||||
TRANSFORM(gdk_default_srgb_linear_to_rec2100_pq, NONE, srgb_to_rec2020, pq_oetf)
|
||||
TRANSFORM(gdk_default_rec2100_linear_to_srgb, NONE, rec2020_to_srgb, srgb_oetf)
|
||||
TRANSFORM(gdk_default_srgb_to_rec2100_pq, srgb_eotf, srgb_to_rec2020, pq_oetf)
|
||||
TRANSFORM(gdk_default_rec2100_pq_to_srgb, pq_eotf, rec2020_to_srgb, srgb_oetf)
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Default implementation */
|
||||
@@ -478,9 +328,6 @@ gdk_default_color_state_get_cicp (GdkColorState *color_state)
|
||||
{
|
||||
GdkDefaultColorState *self = (GdkDefaultColorState *) color_state;
|
||||
|
||||
if (self->cicp.color_primaries == 0)
|
||||
return NULL;
|
||||
|
||||
return &self->cicp;
|
||||
}
|
||||
|
||||
@@ -572,11 +419,9 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.name = "srgb",
|
||||
.no_srgb = GDK_COLOR_STATE_SRGB_LINEAR,
|
||||
.convert_to = {
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_srgb_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_srgb_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_srgb_to_rec2100_linear,
|
||||
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_srgb_to_oklab,
|
||||
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_srgb_to_oklch,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_srgb_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_to_rec2100_linear,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
.cicp = { 1, 13, 0, 1 },
|
||||
@@ -592,11 +437,9 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.name = "srgb-linear",
|
||||
.no_srgb = NULL,
|
||||
.convert_to = {
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_srgb_linear_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_srgb_linear_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_srgb_linear_to_rec2100_linear,
|
||||
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_srgb_linear_to_oklab,
|
||||
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_srgb_linear_to_oklch,
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_default_srgb_linear_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_srgb_linear_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_srgb_linear_to_rec2100_linear,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
.cicp = { 1, 8, 0, 1 },
|
||||
@@ -612,11 +455,9 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.name = "rec2100-pq",
|
||||
.no_srgb = NULL,
|
||||
.convert_to = {
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_rec2100_pq_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_rec2100_pq_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_rec2100_pq_to_rec2100_linear,
|
||||
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_rec2100_pq_to_oklab,
|
||||
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_rec2100_pq_to_oklch,
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_default_rec2100_pq_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_pq_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_default_rec2100_pq_to_rec2100_linear,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_0_1,
|
||||
.cicp = { 9, 16, 0, 1 },
|
||||
@@ -632,54 +473,16 @@ GdkDefaultColorState gdk_default_color_states[] = {
|
||||
.name = "rec2100-linear",
|
||||
.no_srgb = NULL,
|
||||
.convert_to = {
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_rec2100_linear_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_rec2100_linear_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_rec2100_linear_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_rec2100_linear_to_oklab,
|
||||
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_rec2100_linear_to_oklch,
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_default_rec2100_linear_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_default_rec2100_linear_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_default_rec2100_linear_to_rec2100_pq,
|
||||
},
|
||||
.clamp = gdk_color_state_clamp_unbounded,
|
||||
.cicp = { 9, 8, 0, 1 },
|
||||
},
|
||||
[GDK_COLOR_STATE_ID_OKLAB] = {
|
||||
.parent = {
|
||||
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_FLOAT16,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB,
|
||||
},
|
||||
.name = "oklab",
|
||||
.no_srgb = NULL,
|
||||
.convert_to = {
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_oklab_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_oklab_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_oklab_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_oklab_to_rec2100_linear,
|
||||
[GDK_COLOR_STATE_ID_OKLCH] = gdk_convert_oklab_to_oklch,
|
||||
},
|
||||
.cicp = { 0, 0, 0, 0 },
|
||||
},
|
||||
[GDK_COLOR_STATE_ID_OKLCH] = {
|
||||
.parent = {
|
||||
.klass = &GDK_DEFAULT_COLOR_STATE_CLASS,
|
||||
.ref_count = 0,
|
||||
.depth = GDK_MEMORY_FLOAT16,
|
||||
.rendering_color_state = GDK_COLOR_STATE_SRGB,
|
||||
},
|
||||
.name = "oklch",
|
||||
.no_srgb = NULL,
|
||||
.convert_to = {
|
||||
[GDK_COLOR_STATE_ID_SRGB] = gdk_convert_oklch_to_srgb,
|
||||
[GDK_COLOR_STATE_ID_SRGB_LINEAR] = gdk_convert_oklch_to_srgb_linear,
|
||||
[GDK_COLOR_STATE_ID_REC2100_PQ] = gdk_convert_oklch_to_rec2100_pq,
|
||||
[GDK_COLOR_STATE_ID_REC2100_LINEAR] = gdk_convert_oklch_to_rec2100_linear,
|
||||
[GDK_COLOR_STATE_ID_OKLAB] = gdk_convert_oklch_to_oklab,
|
||||
},
|
||||
.cicp = { 0, 0, 0, 0 },
|
||||
},
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
/* }}} */
|
||||
/* {{{ Cicp implementation */
|
||||
|
||||
typedef struct _GdkCicpColorState GdkCicpColorState;
|
||||
@@ -706,22 +509,17 @@ struct _GdkCicpColorState
|
||||
|
||||
#define cicp ((GdkCicpColorState *)self)
|
||||
|
||||
TRANSFORM(cicp_to_srgb, cicp->eotf, cicp->to_srgb, NONE, IDENTITY, srgb_oetf)
|
||||
TRANSFORM(cicp_to_srgb_linear, cicp->eotf, cicp->to_srgb, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(cicp_to_rec2100_pq, cicp->eotf, cicp->to_rec2020, NONE, IDENTITY, pq_oetf)
|
||||
TRANSFORM(cicp_to_rec2100_linear, cicp->eotf, cicp->to_rec2020, NONE, IDENTITY, NONE)
|
||||
TRANSFORM(cicp_from_srgb, srgb_eotf, cicp->from_srgb, NONE, IDENTITY, cicp->oetf)
|
||||
TRANSFORM(cicp_from_srgb_linear, NONE, cicp->from_srgb, NONE, IDENTITY, cicp->oetf)
|
||||
TRANSFORM(cicp_from_rec2100_pq, pq_eotf, cicp->from_rec2020, NONE, IDENTITY, cicp->oetf)
|
||||
TRANSFORM(cicp_from_rec2100_linear, NONE, cicp->from_rec2020, NONE, IDENTITY, cicp->oetf)
|
||||
TRANSFORM(gdk_cicp_to_srgb, cicp->eotf, cicp->to_srgb, srgb_oetf)
|
||||
TRANSFORM(gdk_cicp_to_srgb_linear, cicp->eotf, cicp->to_srgb, NONE)
|
||||
TRANSFORM(gdk_cicp_to_rec2100_pq, cicp->eotf, cicp->to_rec2020, pq_oetf)
|
||||
TRANSFORM(gdk_cicp_to_rec2100_linear, cicp->eotf, cicp->to_rec2020, NONE)
|
||||
TRANSFORM(gdk_cicp_from_srgb, srgb_eotf, cicp->from_srgb, cicp->oetf)
|
||||
TRANSFORM(gdk_cicp_from_srgb_linear, NONE, cicp->from_srgb, cicp->oetf)
|
||||
TRANSFORM(gdk_cicp_from_rec2100_pq, pq_eotf, cicp->from_rec2020, cicp->oetf)
|
||||
TRANSFORM(gdk_cicp_from_rec2100_linear, NONE, cicp->from_rec2020, cicp->oetf)
|
||||
|
||||
#undef cicp
|
||||
|
||||
TRANSFORM_PAIR (cicp_to_oklab, cicp_to_srgb_linear, srgb_linear_to_oklab)
|
||||
TRANSFORM_PAIR (cicp_from_oklab, oklab_to_srgb_linear, cicp_from_srgb_linear)
|
||||
TRANSFORM_PAIR (cicp_to_oklch, cicp_to_srgb_linear, srgb_linear_to_oklch)
|
||||
TRANSFORM_PAIR (cicp_from_oklch, oklch_to_srgb_linear, cicp_from_srgb_linear)
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Vfuncs */
|
||||
|
||||
@@ -774,17 +572,13 @@ gdk_cicp_color_state_get_convert_to (GdkColorState *self,
|
||||
switch (GDK_DEFAULT_COLOR_STATE_ID (target))
|
||||
{
|
||||
case GDK_COLOR_STATE_ID_SRGB:
|
||||
return gdk_convert_cicp_to_srgb;
|
||||
return gdk_cicp_to_srgb;
|
||||
case GDK_COLOR_STATE_ID_SRGB_LINEAR:
|
||||
return gdk_convert_cicp_to_srgb_linear;
|
||||
return gdk_cicp_to_srgb_linear;
|
||||
case GDK_COLOR_STATE_ID_REC2100_PQ:
|
||||
return gdk_convert_cicp_to_rec2100_pq;
|
||||
return gdk_cicp_to_rec2100_pq;
|
||||
case GDK_COLOR_STATE_ID_REC2100_LINEAR:
|
||||
return gdk_convert_cicp_to_rec2100_linear;
|
||||
case GDK_COLOR_STATE_ID_OKLAB:
|
||||
return gdk_convert_cicp_to_oklab;
|
||||
case GDK_COLOR_STATE_ID_OKLCH:
|
||||
return gdk_convert_cicp_to_oklch;
|
||||
return gdk_cicp_to_rec2100_linear;
|
||||
|
||||
case GDK_COLOR_STATE_N_IDS:
|
||||
default:
|
||||
@@ -804,17 +598,13 @@ gdk_cicp_color_state_get_convert_from (GdkColorState *self,
|
||||
switch (GDK_DEFAULT_COLOR_STATE_ID (source))
|
||||
{
|
||||
case GDK_COLOR_STATE_ID_SRGB:
|
||||
return gdk_convert_cicp_from_srgb;
|
||||
return gdk_cicp_from_srgb;
|
||||
case GDK_COLOR_STATE_ID_SRGB_LINEAR:
|
||||
return gdk_convert_cicp_from_srgb_linear;
|
||||
return gdk_cicp_from_srgb_linear;
|
||||
case GDK_COLOR_STATE_ID_REC2100_PQ:
|
||||
return gdk_convert_cicp_from_rec2100_pq;
|
||||
return gdk_cicp_from_rec2100_pq;
|
||||
case GDK_COLOR_STATE_ID_REC2100_LINEAR:
|
||||
return gdk_convert_cicp_from_rec2100_linear;
|
||||
case GDK_COLOR_STATE_ID_OKLAB:
|
||||
return gdk_convert_cicp_from_oklab;
|
||||
case GDK_COLOR_STATE_ID_OKLCH:
|
||||
return gdk_convert_cicp_from_oklch;
|
||||
return gdk_cicp_from_rec2100_linear;
|
||||
|
||||
case GDK_COLOR_STATE_N_IDS:
|
||||
default:
|
||||
@@ -1068,4 +858,4 @@ gdk_color_state_clamp (GdkColorState *self,
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -49,12 +49,6 @@ GdkColorState * gdk_color_state_get_rec2100_pq (void);
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_rec2100_linear (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_oklab (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_oklch (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
gboolean gdk_color_state_equal (GdkColorState *self,
|
||||
GdkColorState *other);
|
||||
@@ -63,6 +57,6 @@ GDK_AVAILABLE_IN_4_16
|
||||
GdkCicpParams *gdk_color_state_create_cicp_params (GdkColorState *self);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkColorState, gdk_color_state_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkColorState, gdk_color_state_unref);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -13,8 +13,6 @@ typedef enum
|
||||
GDK_COLOR_STATE_ID_SRGB_LINEAR,
|
||||
GDK_COLOR_STATE_ID_REC2100_PQ,
|
||||
GDK_COLOR_STATE_ID_REC2100_LINEAR,
|
||||
GDK_COLOR_STATE_ID_OKLAB,
|
||||
GDK_COLOR_STATE_ID_OKLCH,
|
||||
|
||||
GDK_COLOR_STATE_N_IDS
|
||||
} GdkColorStateId;
|
||||
@@ -75,8 +73,6 @@ extern GdkDefaultColorState gdk_default_color_states[GDK_COLOR_STATE_N_IDS];
|
||||
#define GDK_COLOR_STATE_SRGB_LINEAR ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_SRGB_LINEAR])
|
||||
#define GDK_COLOR_STATE_REC2100_PQ ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_REC2100_PQ])
|
||||
#define GDK_COLOR_STATE_REC2100_LINEAR ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_REC2100_LINEAR])
|
||||
#define GDK_COLOR_STATE_OKLAB ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_OKLAB])
|
||||
#define GDK_COLOR_STATE_OKLCH ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_OKLCH])
|
||||
|
||||
#define GDK_IS_DEFAULT_COLOR_STATE(c) ((GdkDefaultColorState *) (c) >= &gdk_default_color_states[0] && \
|
||||
(GdkDefaultColorState *) (c) < &gdk_default_color_states[GDK_COLOR_STATE_N_IDS])
|
||||
|
||||
22
gdk/gdkconfig.h.win32
Normal file
22
gdk/gdkconfig.h.win32
Normal file
@@ -0,0 +1,22 @@
|
||||
/* gdkconfig.h
|
||||
*
|
||||
* This is a generated file. Please modify `configure.ac'
|
||||
*/
|
||||
|
||||
#ifndef __GDKCONFIG_H__
|
||||
#define __GDKCONFIG_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_WINDOWING_WIN32
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDKCONFIG_H__ */
|
||||
23
gdk/gdkconfig.h.win32_vulkan
Normal file
23
gdk/gdkconfig.h.win32_vulkan
Normal file
@@ -0,0 +1,23 @@
|
||||
/* gdkconfig.h
|
||||
*
|
||||
* This is a generated file. Please modify `configure.ac'
|
||||
*/
|
||||
|
||||
#ifndef __GDKCONFIG_H__
|
||||
#define __GDKCONFIG_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_WINDOWING_WIN32
|
||||
#define GDK_RENDERING_VULKAN
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDKCONFIG_H__ */
|
||||
@@ -124,7 +124,7 @@ gdk_content_provider_new_for_value (const GValue *value)
|
||||
content = g_object_new (GDK_TYPE_CONTENT_PROVIDER_VALUE, NULL);
|
||||
g_value_init (&content->value, G_VALUE_TYPE (value));
|
||||
g_value_copy (value, &content->value);
|
||||
|
||||
|
||||
return GDK_CONTENT_PROVIDER (content);
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ gdk_content_provider_union_init (GdkContentProviderUnion *self)
|
||||
* ```c
|
||||
* gdk_content_provider_new_union ((GdkContentProvider *[2]) {
|
||||
* gdk_content_provider_new_typed (G_TYPE_FILE, file),
|
||||
* gdk_content_provider_new_typed (GDK_TYPE_TEXTURE, texture)
|
||||
* gdk_content_provider_new_typed (G_TYPE_TEXTURE, texture)
|
||||
* }, 2);
|
||||
* ```
|
||||
*
|
||||
@@ -594,7 +594,7 @@ gdk_content_provider_new_for_bytes (const char *mime_type,
|
||||
content = g_object_new (GDK_TYPE_CONTENT_PROVIDER_BYTES, NULL);
|
||||
content->mime_type = g_intern_string (mime_type);
|
||||
content->bytes = g_bytes_ref (bytes);
|
||||
|
||||
|
||||
return GDK_CONTENT_PROVIDER (content);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,6 @@ typedef enum {
|
||||
GDK_FEATURE_DMABUF = 1 << 7,
|
||||
GDK_FEATURE_OFFLOAD = 1 << 8,
|
||||
GDK_FEATURE_COLOR_MANAGEMENT = 1 << 9,
|
||||
GDK_FEATURE_AEROSNAP = 1 << 10,
|
||||
} GdkFeatures;
|
||||
|
||||
#define GDK_ALL_FEATURES ((1 << 10) - 1)
|
||||
@@ -120,4 +119,3 @@ guint gdk_parse_debug_var (const char *variable,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -1198,9 +1198,8 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
|
||||
GdkDisplay *
|
||||
gdk_display_open (const char *display_name)
|
||||
{
|
||||
gdk_ensure_initialized ();
|
||||
|
||||
return gdk_display_manager_open_display (gdk_display_manager_get (), display_name);
|
||||
return gdk_display_manager_open_display (gdk_display_manager_get (),
|
||||
display_name);
|
||||
}
|
||||
|
||||
gulong
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
@@ -295,8 +294,6 @@ gdk_display_manager_get (void)
|
||||
{
|
||||
static GdkDisplayManager *manager = NULL;
|
||||
|
||||
gdk_ensure_initialized ();
|
||||
|
||||
if (manager == NULL)
|
||||
manager = g_object_new (GDK_TYPE_DISPLAY_MANAGER, NULL);
|
||||
|
||||
@@ -332,9 +329,6 @@ gdk_display_manager_get_default_display (GdkDisplayManager *manager)
|
||||
GdkDisplay *
|
||||
gdk_display_get_default (void)
|
||||
{
|
||||
if (!gdk_is_initialized ())
|
||||
return NULL;
|
||||
|
||||
return gdk_display_manager_get_default_display (gdk_display_manager_get ());
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@ typedef enum {
|
||||
GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE = 1 << 5,
|
||||
} GdkVulkanFeatures;
|
||||
|
||||
#define GDK_VULKAN_N_FEATURES 6
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
extern const GdkDebugKey gdk_vulkan_feature_keys[];
|
||||
#endif
|
||||
|
||||
/* Tracks information about the device grab on this display */
|
||||
typedef struct
|
||||
{
|
||||
@@ -160,6 +154,7 @@ struct _GdkDisplayClass
|
||||
void (*beep) (GdkDisplay *display);
|
||||
void (*sync) (GdkDisplay *display);
|
||||
void (*flush) (GdkDisplay *display);
|
||||
gboolean (*has_pending) (GdkDisplay *display);
|
||||
void (*queue_events) (GdkDisplay *display);
|
||||
void (*make_default) (GdkDisplay *display);
|
||||
|
||||
|
||||
@@ -55,6 +55,6 @@ GDK_AVAILABLE_IN_4_14
|
||||
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
|
||||
const GdkDmabufFormats *formats2);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GdkDmabufFormats, gdk_dmabuf_formats_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GdkDmabufFormats, gdk_dmabuf_formats_unref);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -375,7 +375,7 @@ gdk_dmabuf_texture_builder_class_init (GdkDmabufTextureBuilderClass *klass)
|
||||
/**
|
||||
* GdkDmabufTextureBuilder:update-region:
|
||||
*
|
||||
* The update region for [property@Gdk.DmabufTextureBuilder:update-texture].
|
||||
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -496,7 +496,7 @@ gdk_dmabuf_texture_builder_get_width (GdkDmabufTextureBuilder *self)
|
||||
*
|
||||
* Sets the width of the texture.
|
||||
*
|
||||
* The width must be set before calling [method@Gdk.DmabufTextureBuilder.build].
|
||||
* The width must be set before calling [method@Gdk.GLTextureBuilder.build].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -540,7 +540,7 @@ gdk_dmabuf_texture_builder_get_height (GdkDmabufTextureBuilder *self)
|
||||
*
|
||||
* Sets the height of the texture.
|
||||
*
|
||||
* The height must be set before calling [method@Gdk.DmabufTextureBuilder.build].
|
||||
* The height must be set before calling [method@Gdk.GLTextureBuilder.build].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -588,7 +588,7 @@ gdk_dmabuf_texture_builder_get_fourcc (GdkDmabufTextureBuilder *self)
|
||||
*
|
||||
* The format is specified as a fourcc code.
|
||||
*
|
||||
* The format must be set before calling [method@Gdk.DmabufTextureBuilder.build].
|
||||
* The format must be set before calling [method@Gdk.GLTextureBuilder.build].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -807,7 +807,7 @@ gdk_dmabuf_texture_builder_get_stride (GdkDmabufTextureBuilder *self,
|
||||
*
|
||||
* Sets the stride for a plane.
|
||||
*
|
||||
* The stride must be set for all planes before calling [method@Gdk.DmabufTextureBuilder.build].
|
||||
* The stride must be set for all planes before calling [method@Gdk.GLTextureBuilder.build].
|
||||
*
|
||||
* Since: 4.14
|
||||
*/
|
||||
@@ -876,7 +876,7 @@ gdk_dmabuf_texture_builder_set_offset (GdkDmabufTextureBuilder *self,
|
||||
*
|
||||
* Gets the color state previously set via gdk_dmabuf_texture_builder_set_color_state().
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the color state
|
||||
* Returns: (nullable): the color state
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
|
||||
@@ -87,12 +87,12 @@ typedef enum
|
||||
/**
|
||||
* GdkModifierType:
|
||||
* @GDK_SHIFT_MASK: the Shift key.
|
||||
* @GDK_LOCK_MASK: a Lock key (depending on the Windowing System configuration,
|
||||
* this may either be <kbd>CapsLock</kbd> or <kbd>ShiftLock</kbd>).
|
||||
* @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
|
||||
* X server this may either be CapsLock or ShiftLock).
|
||||
* @GDK_CONTROL_MASK: the Control key.
|
||||
* @GDK_ALT_MASK: the fourth modifier key (it depends on the Windowing System
|
||||
* configuration which key is interpreted as this modifier, but normally it
|
||||
* is the <kbd>Alt</kbd> key).
|
||||
* @GDK_ALT_MASK: the fourth modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier, but
|
||||
* normally it is the Alt key).
|
||||
* @GDK_BUTTON1_MASK: the first mouse button.
|
||||
* @GDK_BUTTON2_MASK: the second mouse button.
|
||||
* @GDK_BUTTON3_MASK: the third mouse button.
|
||||
@@ -109,7 +109,7 @@ typedef enum
|
||||
* Apple, CapsLock or ShiftLock.
|
||||
*
|
||||
* Note that GDK may add internal values to events which include values outside
|
||||
* of this enumeration. Your code should preserve and ignore them. You can use
|
||||
* of this enumeration. Your code should preserve and ignore them. You can use
|
||||
* %GDK_MODIFIER_MASK to remove all private values.
|
||||
*/
|
||||
typedef enum
|
||||
|
||||
@@ -3444,4 +3444,4 @@ gdk_grab_broken_event_get_implicit (GdkEvent *event)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
|
||||
|
||||
const GdkDebugKey gdk_gl_feature_keys[] = {
|
||||
static const GdkDebugKey gdk_gl_feature_keys[] = {
|
||||
{ "debug", GDK_GL_FEATURE_DEBUG, "GL_KHR_debug" },
|
||||
{ "base-instance", GDK_GL_FEATURE_BASE_INSTANCE, "GL_ARB_base_instance" },
|
||||
{ "buffer-storage", GDK_GL_FEATURE_BUFFER_STORAGE, "GL_EXT_buffer_storage" },
|
||||
@@ -382,6 +382,8 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
|
||||
if (ctx == EGL_NO_CONTEXT)
|
||||
return 0;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, OPENGL, "Created EGL context[%p]", ctx);
|
||||
|
||||
priv->egl_context = ctx;
|
||||
gdk_gl_context_set_version (context, &supported_versions[j]);
|
||||
gdk_gl_context_set_is_legacy (context, legacy);
|
||||
@@ -1750,20 +1752,22 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
{
|
||||
int i, max_texture_size;
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
|
||||
gdk_debug_message ("%s version: %d.%d (%s)",
|
||||
gdk_debug_message ("%s version: %d.%d (%s)\n"
|
||||
"* GLSL version: %s\n"
|
||||
"* Max texture size: %d\n",
|
||||
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
|
||||
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
|
||||
priv->is_legacy ? "legacy" : "core");
|
||||
gdk_debug_message ("GLSL version: %s", glGetString (GL_SHADING_LANGUAGE_VERSION));
|
||||
gdk_debug_message ("Max texture size: %d", max_texture_size);
|
||||
priv->is_legacy ? "legacy" : "core",
|
||||
glGetString (GL_SHADING_LANGUAGE_VERSION),
|
||||
max_texture_size);
|
||||
gdk_debug_message ("Enabled features (use GDK_GL_DISABLE env var to disable):");
|
||||
for (i = 0; i < G_N_ELEMENTS (gdk_gl_feature_keys); i++)
|
||||
{
|
||||
gdk_debug_message (" %s: %s",
|
||||
gdk_gl_feature_keys[i].key,
|
||||
(priv->features & gdk_gl_feature_keys[i].value) ? "✓" :
|
||||
(priv->features & gdk_gl_feature_keys[i].value) ? "YES" :
|
||||
((disabled_features & gdk_gl_feature_keys[i].value) ? "disabled via env var" :
|
||||
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "✗" :
|
||||
(((supported_features & gdk_gl_feature_keys[i].value) == 0) ? "not supported" :
|
||||
"Hum, what? This should not happen.")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
#include "gdkglversionprivate.h"
|
||||
#include "gdkdmabufprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -34,10 +33,6 @@ typedef enum {
|
||||
GDK_GL_FEATURE_BUFFER_STORAGE = 1 << 2,
|
||||
} GdkGLFeatures;
|
||||
|
||||
#define GDK_GL_N_FEATURES 3
|
||||
|
||||
extern const GdkDebugKey gdk_gl_feature_keys[];
|
||||
|
||||
typedef enum {
|
||||
GDK_GL_NONE = 0,
|
||||
GDK_GL_EGL,
|
||||
|
||||
@@ -647,7 +647,7 @@ gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
|
||||
*
|
||||
* Gets the color state previously set via gdk_gl_texture_builder_set_color_state().
|
||||
*
|
||||
* Returns: (transfer none): the color state
|
||||
* Returns: the color state
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
|
||||
@@ -22,11 +22,6 @@
|
||||
#include "gdkenums.h"
|
||||
#include "gdktypes.h"
|
||||
|
||||
/* epoxy needs this, see https://github.com/anholt/libepoxy/issues/299 */
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
|
||||
@@ -5,13 +5,6 @@
|
||||
/* Private API for use in GTK+ */
|
||||
|
||||
void gdk_pre_parse (void);
|
||||
gboolean gdk_is_initialized (void);
|
||||
|
||||
#define gdk_ensure_initialized() \
|
||||
G_STMT_START { \
|
||||
if (!gdk_is_initialized ()) \
|
||||
g_error ("%s() was called before gtk_init()", G_STRFUNC); \
|
||||
} G_STMT_END
|
||||
|
||||
gboolean gdk_running_in_sandbox (void);
|
||||
gboolean gdk_should_use_portal (void);
|
||||
|
||||
@@ -2940,7 +2940,6 @@ check_autohide (GdkEvent *event)
|
||||
{
|
||||
event_surface = gdk_event_get_surface (event);
|
||||
if (event_surface->autohide &&
|
||||
evtype != GDK_TOUCH_BEGIN &&
|
||||
!event_surface->has_pointer)
|
||||
event_surface = NULL;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
const GdkDebugKey gdk_vulkan_feature_keys[] = {
|
||||
static const GdkDebugKey gsk_vulkan_feature_keys[] = {
|
||||
{ "dmabuf", GDK_VULKAN_FEATURE_DMABUF, "Never import Dmabufs" },
|
||||
{ "ycbcr", GDK_VULKAN_FEATURE_YCBCR, "Do not support Ycbcr textures (also disables dmabufs)" },
|
||||
{ "semaphore-export", GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT, "Disable sync of exported dmabufs" },
|
||||
@@ -419,10 +419,6 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
VkDevice device;
|
||||
guint i;
|
||||
|
||||
GDK_DEBUG (VULKAN, "(Re)creating the swapchain for surface of size %dx%d",
|
||||
gdk_surface_get_width (surface),
|
||||
gdk_surface_get_height (surface));
|
||||
|
||||
device = gdk_vulkan_context_get_device (context);
|
||||
|
||||
/*
|
||||
@@ -460,10 +456,6 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
|
||||
GDK_DEBUG (VULKAN, "Using surface present mode %s",
|
||||
surface_present_mode_to_string (present_mode));
|
||||
GDK_DEBUG (VULKAN, "Using extent %dx%d",
|
||||
capabilities.currentExtent.width,
|
||||
capabilities.currentExtent.height);
|
||||
|
||||
|
||||
/*
|
||||
* Per https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/xhtml/vkspec.html#VkSurfaceCapabilitiesKHR
|
||||
@@ -476,10 +468,6 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
|
||||
capabilities.currentExtent.width = MAX (1, (int) ceil (gdk_surface_get_width (surface) * scale));
|
||||
capabilities.currentExtent.height = MAX (1, (int) ceil (gdk_surface_get_height (surface) * scale));
|
||||
|
||||
GDK_DEBUG (VULKAN, "Effective extent %dx%d",
|
||||
capabilities.currentExtent.width,
|
||||
capabilities.currentExtent.height);
|
||||
}
|
||||
|
||||
res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
|
||||
@@ -566,20 +554,12 @@ physical_device_supports_extension (VkPhysicalDevice device,
|
||||
{
|
||||
VkExtensionProperties *extensions;
|
||||
uint32_t n_device_extensions;
|
||||
static gboolean first = TRUE;
|
||||
|
||||
GDK_VK_CHECK (vkEnumerateDeviceExtensionProperties, device, NULL, &n_device_extensions, NULL);
|
||||
|
||||
extensions = g_newa (VkExtensionProperties, n_device_extensions);
|
||||
GDK_VK_CHECK (vkEnumerateDeviceExtensionProperties, device, NULL, &n_device_extensions, extensions);
|
||||
|
||||
if (first)
|
||||
{
|
||||
first = FALSE;
|
||||
for (uint32_t i = 0; i < n_device_extensions; i++)
|
||||
GDK_DEBUG (VULKAN, "%s", extensions[i].extensionName);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < n_device_extensions; i++)
|
||||
{
|
||||
if (g_str_equal (extensions[i].extensionName, extension_name))
|
||||
@@ -706,37 +686,7 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (acquire_result == VK_SUBOPTIMAL_KHR)
|
||||
{
|
||||
const VkPipelineStageFlags mask = VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT;
|
||||
|
||||
vkQueueSubmit (gdk_vulkan_context_get_queue (context),
|
||||
1,
|
||||
&(VkSubmitInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||
.waitSemaphoreCount = 1,
|
||||
.pWaitSemaphores = &priv->draw_semaphore,
|
||||
.pWaitDstStageMask = &mask,
|
||||
},
|
||||
VK_NULL_HANDLE);
|
||||
vkQueueWaitIdle (gdk_vulkan_context_get_queue (context));
|
||||
|
||||
if (gdk_vulkan_context_has_feature (context, GDK_VULKAN_FEATURE_SWAPCHAIN_MAINTENANCE))
|
||||
{
|
||||
PFN_vkReleaseSwapchainImagesEXT vkReleaseSwapchainImagesEXT;
|
||||
|
||||
vkReleaseSwapchainImagesEXT = (PFN_vkReleaseSwapchainImagesEXT) vkGetDeviceProcAddr (gdk_vulkan_context_get_device (context), "vkReleaseSwapchainImagesEXT");
|
||||
|
||||
vkReleaseSwapchainImagesEXT (gdk_vulkan_context_get_device (context),
|
||||
&(VkReleaseSwapchainImagesInfoEXT) {
|
||||
.sType = VK_STRUCTURE_TYPE_RELEASE_SWAPCHAIN_IMAGES_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.swapchain = priv->swapchain,
|
||||
.imageIndexCount = 1,
|
||||
.pImageIndices = &priv->draw_index,
|
||||
});
|
||||
}
|
||||
}
|
||||
GDK_DEBUG (VULKAN, "Recreating the swapchain");
|
||||
|
||||
if (gdk_vulkan_context_check_swapchain (context, &error))
|
||||
continue;
|
||||
@@ -1474,8 +1424,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
|
||||
skip_features = gdk_parse_debug_var ("GDK_VULKAN_DISABLE",
|
||||
"GDK_VULKAN_DISABLE can be set to a list of Vulkan features to disable.\n",
|
||||
gdk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gdk_vulkan_feature_keys));
|
||||
gsk_vulkan_feature_keys,
|
||||
G_N_ELEMENTS (gsk_vulkan_feature_keys));
|
||||
if (skip_features & GDK_VULKAN_FEATURE_YCBCR)
|
||||
skip_features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
@@ -1622,13 +1572,13 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
display->vulkan_features = features;
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, "Enabled features (use GDK_VULKAN_DISABLE env var to disable):");
|
||||
for (i = 0; i < G_N_ELEMENTS (gdk_vulkan_feature_keys); i++)
|
||||
for (i = 0; i < G_N_ELEMENTS (gsk_vulkan_feature_keys); i++)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, VULKAN, " %s: %s",
|
||||
gdk_vulkan_feature_keys[i].key,
|
||||
(features & gdk_vulkan_feature_keys[i].value) ? "✓" :
|
||||
((skip_features & gdk_vulkan_feature_keys[i].value) ? "disabled via env var" :
|
||||
(((device_features & gdk_vulkan_feature_keys[i].value) == 0) ? "✗" :
|
||||
gsk_vulkan_feature_keys[i].key,
|
||||
(features & gsk_vulkan_feature_keys[i].value) ? "YES" :
|
||||
((skip_features & gsk_vulkan_feature_keys[i].value) ? "disabled via env var" :
|
||||
(((device_features & gsk_vulkan_feature_keys[i].value) == 0) ? "not supported" :
|
||||
"Hum, what? This should not happen.")));
|
||||
}
|
||||
|
||||
@@ -1940,15 +1890,10 @@ gdk_vulkan_init_dmabuf (GdkDisplay *display)
|
||||
if (display->vk_dmabuf_formats != NULL)
|
||||
return;
|
||||
|
||||
if (!gdk_has_feature (GDK_FEATURE_DMABUF))
|
||||
return;
|
||||
|
||||
if (!gdk_display_init_vulkan (display, NULL))
|
||||
return;
|
||||
|
||||
if ((display->vulkan_features & GDK_VULKAN_FEATURE_DMABUF) == 0)
|
||||
if (!gdk_has_feature (GDK_FEATURE_DMABUF) ||
|
||||
!gdk_display_init_vulkan (display, NULL) ||
|
||||
((display->vulkan_features & GDK_VULKAN_FEATURE_DMABUF) == 0))
|
||||
{
|
||||
gdk_display_unref_vulkan (display);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,3 +117,4 @@ gdk_display_ref_vulkan (GdkDisplay *display,
|
||||
#endif /* !GDK_RENDERING_VULKAN */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -42,12 +42,6 @@
|
||||
#define siglongjmp longjmp
|
||||
#endif
|
||||
|
||||
#define JPEG_MEM_DEST_USES_SIZE_T \
|
||||
(!(LIBJPEG_TURBO_VERSION_NUMBER) && \
|
||||
(((JPEG_LIB_VERSION) > 90) || \
|
||||
((JPEG_LIB_VERSION) == 90 && (JPEG_LIB_VERSION_MAJOR) > 9) || \
|
||||
((JPEG_LIB_VERSION) == 90 && (JPEG_LIB_VERSION_MAJOR) == 9 && (JPEG_LIB_VERSION_MINOR) > 3)))
|
||||
|
||||
struct error_handler_data {
|
||||
struct jpeg_error_mgr pub;
|
||||
sigjmp_buf setjmp_buffer;
|
||||
@@ -237,11 +231,7 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
struct error_handler_data jerr;
|
||||
struct jpeg_error_mgr err;
|
||||
guchar *data = NULL;
|
||||
#if JPEG_MEM_DEST_USES_SIZE_T
|
||||
gsize size = 0;
|
||||
#else
|
||||
gulong size = 0;
|
||||
#endif
|
||||
guchar *input = NULL;
|
||||
GdkTextureDownloader downloader;
|
||||
GBytes *texbytes = NULL;
|
||||
@@ -308,4 +298,4 @@ gdk_save_jpeg (GdkTexture *texture)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -653,4 +653,4 @@ gdk_save_png (GdkTexture *texture)
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -512,4 +512,4 @@ gdk_load_tiff (GBytes *input_bytes,
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
typedef NSString *CALayerContentsGravity;
|
||||
#endif
|
||||
|
||||
@implementation GdkMacosWindow
|
||||
|
||||
-(BOOL)windowShouldClose:(id)sender
|
||||
@@ -142,6 +146,14 @@
|
||||
inManualResize = NO;
|
||||
inMove = NO;
|
||||
|
||||
/* We need to deliver the event to the proper drag gestures or we
|
||||
* will leave the window in inconsistent state that requires clicking
|
||||
* in the window to cancel the gesture.
|
||||
*
|
||||
* TODO: Can we improve grab breaking to fix this?
|
||||
*/
|
||||
_gdk_macos_display_send_event ([self gdkDisplay], event);
|
||||
|
||||
_gdk_macos_display_break_all_grabs (GDK_MACOS_DISPLAY (display), time);
|
||||
|
||||
/* Reset gravity */
|
||||
|
||||
@@ -270,6 +270,13 @@ gdk_macos_display_get_next_serial (GdkDisplay *display)
|
||||
return ++serial;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_macos_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
return _gdk_event_queue_find_first (display) ||
|
||||
_gdk_macos_event_source_check_pending ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_display_notify_startup_complete (GdkDisplay *display,
|
||||
const char *startup_notification_id)
|
||||
@@ -604,6 +611,7 @@ gdk_macos_display_class_init (GdkMacosDisplayClass *klass)
|
||||
display_class->get_next_serial = gdk_macos_display_get_next_serial;
|
||||
display_class->get_name = gdk_macos_display_get_name;
|
||||
display_class->get_setting = gdk_macos_display_get_setting;
|
||||
display_class->has_pending = gdk_macos_display_has_pending;
|
||||
display_class->init_gl = gdk_macos_display_init_gl;
|
||||
display_class->notify_startup_complete = gdk_macos_display_notify_startup_complete;
|
||||
display_class->queue_events = gdk_macos_display_queue_events;
|
||||
|
||||
@@ -163,6 +163,7 @@ GetSubpixelLayout (CGDirectDisplayID screen_id)
|
||||
char *
|
||||
_gdk_macos_monitor_get_localized_name (NSScreen *screen)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
GDK_BEGIN_MACOS_ALLOC_POOL;
|
||||
|
||||
NSString *str;
|
||||
@@ -176,6 +177,9 @@ _gdk_macos_monitor_get_localized_name (NSScreen *screen)
|
||||
GDK_END_MACOS_ALLOC_POOL;
|
||||
|
||||
return g_steal_pointer (&name);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
|
||||
typedef NSString *NSPasteboardType;
|
||||
#endif
|
||||
|
||||
@interface GdkMacosPasteboardItemDataProvider : NSObject <NSPasteboardItemDataProvider>
|
||||
{
|
||||
GdkContentProvider *_contentProvider;
|
||||
|
||||
@@ -59,8 +59,13 @@ get_pasteboard_type (int type)
|
||||
pasteboard_types[TYPE_PBOARD] = NSStringPboardType;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
|
||||
pasteboard_types[TYPE_URL] = NSPasteboardTypeURL;
|
||||
pasteboard_types[TYPE_FILE_URL] = NSPasteboardTypeFileURL;
|
||||
#else
|
||||
pasteboard_types[TYPE_URL] = [[NSString alloc] initWithUTF8String:"public.url"];
|
||||
pasteboard_types[TYPE_FILE_URL] = [[NSString alloc] initWithUTF8String:"public.file-url"];
|
||||
#endif
|
||||
|
||||
g_once_init_leave (&initialized, TRUE);
|
||||
}
|
||||
@@ -386,7 +391,7 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window)
|
||||
/* Default to an url type (think gobject://internal)
|
||||
* to support internal, GType-based DnD.
|
||||
*/
|
||||
if ([ret count] == 0)
|
||||
if (n_mime_types == 0)
|
||||
{
|
||||
GdkContentFormats *formats;
|
||||
gsize n_gtypes;
|
||||
|
||||
@@ -43,13 +43,31 @@ static inline NSPoint
|
||||
convert_nspoint_from_screen (NSWindow *window,
|
||||
NSPoint point)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
return [window convertPointFromScreen:point];
|
||||
#else
|
||||
/* Apple documentation claims that convertPointFromScreen is available
|
||||
* on 10.12+. However, that doesn't seem to be the case when using it.
|
||||
* Instead, we'll just use it on modern 10.15 systems and fallback to
|
||||
* converting using rects on older systems.
|
||||
*/
|
||||
return [window convertRectFromScreen:NSMakeRect (point.x, point.y, 0, 0)].origin;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline NSPoint
|
||||
convert_nspoint_to_screen (NSWindow *window,
|
||||
NSPoint point)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
return [window convertPointToScreen:point];
|
||||
#else
|
||||
/* Apple documentation claims that convertPointToScreen is available
|
||||
* on 10.12+. However, that doesn't seem to be the case when using it.
|
||||
* Instead, we'll just use it on modern 10.15 systems and fallback to
|
||||
* converting using rects on older systems.
|
||||
*/
|
||||
return [window convertRectToScreen:NSMakeRect (point.x, point.y, 0, 0)].origin;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -548,12 +548,6 @@ gdk_registry_handle_global (void *data,
|
||||
&wp_single_pixel_buffer_manager_v1_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
else if (strcmp (interface, xdg_system_bell_v1_interface.name) == 0)
|
||||
{
|
||||
display_wayland->system_bell =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&xdg_system_bell_v1_interface, 1);
|
||||
}
|
||||
|
||||
g_hash_table_insert (display_wayland->known_globals,
|
||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||
@@ -630,7 +624,7 @@ _gdk_wayland_display_open (const char *display_name)
|
||||
display = g_object_new (GDK_TYPE_WAYLAND_DISPLAY, NULL);
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
display_wayland->wl_display = wl_display;
|
||||
gdk_wayland_display_install_gsources (display_wayland);
|
||||
display_wayland->event_source = _gdk_wayland_display_event_source_new (display);
|
||||
|
||||
init_settings (display);
|
||||
|
||||
@@ -731,7 +725,12 @@ gdk_wayland_display_dispose (GObject *object)
|
||||
|
||||
g_list_free_full (display_wayland->toplevels, destroy_toplevel);
|
||||
|
||||
gdk_wayland_display_uninstall_gsources (display_wayland);
|
||||
if (display_wayland->event_source)
|
||||
{
|
||||
g_source_destroy (display_wayland->event_source);
|
||||
g_source_unref (display_wayland->event_source);
|
||||
display_wayland->event_source = NULL;
|
||||
}
|
||||
|
||||
g_list_free_full (display_wayland->async_roundtrips, (GDestroyNotify) wl_callback_destroy);
|
||||
|
||||
@@ -769,7 +768,6 @@ gdk_wayland_display_dispose (GObject *object)
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->dmabuf_formats_info, dmabuf_formats_info_free);
|
||||
g_clear_pointer (&display_wayland->color, gdk_wayland_color_free);
|
||||
g_clear_pointer (&display_wayland->system_bell, xdg_system_bell_v1_destroy);
|
||||
|
||||
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
||||
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
||||
@@ -816,32 +814,23 @@ gdk_wayland_display_get_name (GdkDisplay *display)
|
||||
|
||||
void
|
||||
gdk_wayland_display_system_bell (GdkDisplay *display,
|
||||
GdkSurface *surface)
|
||||
GdkSurface *window)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
struct gtk_surface1 *gtk_surface = NULL;
|
||||
struct wl_surface *wl_surface = NULL;
|
||||
struct gtk_surface1 *gtk_surface;
|
||||
gint64 now_ms;
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
|
||||
if (!display_wayland->gtk_shell &&
|
||||
!display_wayland->system_bell)
|
||||
if (!display_wayland->gtk_shell)
|
||||
return;
|
||||
|
||||
if (surface)
|
||||
{
|
||||
if (GDK_IS_WAYLAND_TOPLEVEL (surface))
|
||||
{
|
||||
GdkWaylandToplevel *toplevel = GDK_WAYLAND_TOPLEVEL (surface);
|
||||
|
||||
gtk_surface = gdk_wayland_toplevel_get_gtk_surface (toplevel);
|
||||
}
|
||||
|
||||
wl_surface = gdk_wayland_surface_get_wl_surface (surface);
|
||||
}
|
||||
if (window && GDK_IS_WAYLAND_TOPLEVEL (window))
|
||||
gtk_surface = gdk_wayland_toplevel_get_gtk_surface (GDK_WAYLAND_TOPLEVEL (window));
|
||||
else
|
||||
gtk_surface = NULL;
|
||||
|
||||
now_ms = g_get_monotonic_time () / 1000;
|
||||
if (now_ms - display_wayland->last_bell_time_ms < MIN_SYSTEM_BELL_DELAY_MS)
|
||||
@@ -849,10 +838,7 @@ gdk_wayland_display_system_bell (GdkDisplay *display,
|
||||
|
||||
display_wayland->last_bell_time_ms = now_ms;
|
||||
|
||||
if (display_wayland->system_bell)
|
||||
xdg_system_bell_v1_ring (display_wayland->system_bell, wl_surface);
|
||||
else
|
||||
gtk_shell1_system_bell (display_wayland->gtk_shell, gtk_surface);
|
||||
gtk_shell1_system_bell (display_wayland->gtk_shell, gtk_surface);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -896,6 +882,12 @@ gdk_wayland_display_make_default (GdkDisplay *display)
|
||||
display_wayland->startup_notification_id = g_strdup (startup_id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_wayland_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@@ -1062,6 +1054,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
display_class->sync = gdk_wayland_display_sync;
|
||||
display_class->flush = gdk_wayland_display_flush;
|
||||
display_class->make_default = gdk_wayland_display_make_default;
|
||||
display_class->has_pending = gdk_wayland_display_has_pending;
|
||||
display_class->queue_events = _gdk_wayland_display_queue_events;
|
||||
display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context;
|
||||
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
|
||||
@@ -2032,7 +2025,7 @@ init_settings (GdkDisplay *display)
|
||||
if (entry)
|
||||
{
|
||||
char *a = g_variant_print (v, FALSE);
|
||||
g_debug ("Using portal setting for %s %s: %s", schema_str, key, a);
|
||||
g_debug ("Using portal setting for %s %s: %s\n", schema_str, key, a);
|
||||
g_free (a);
|
||||
entry->valid = TRUE;
|
||||
apply_portal_setting (entry, v, display);
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-system-bell-v1-client-protocol.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
@@ -107,7 +106,6 @@ struct _GdkWaylandDisplay
|
||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
|
||||
struct gtk_shell1 *gtk_shell;
|
||||
struct xdg_system_bell_v1 *system_bell;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
struct wl_subcompositor *subcompositor;
|
||||
struct zwp_pointer_gestures_v1 *pointer_gestures;
|
||||
@@ -148,7 +146,6 @@ struct _GdkWaylandDisplay
|
||||
GHashTable *cursor_surface_cache;
|
||||
|
||||
GSource *event_source;
|
||||
GSource *poll_source;
|
||||
|
||||
uint32_t server_decoration_mode;
|
||||
|
||||
|
||||
@@ -24,119 +24,44 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct _GdkWaylandEventSource GdkWaylandEventSource;
|
||||
typedef struct _GdkWaylandPollSource GdkWaylandPollSource;
|
||||
|
||||
struct _GdkWaylandEventSource
|
||||
{
|
||||
GSource source;
|
||||
GdkWaylandDisplay *display;
|
||||
};
|
||||
|
||||
struct _GdkWaylandPollSource
|
||||
{
|
||||
typedef struct _GdkWaylandEventSource {
|
||||
GSource source;
|
||||
GPollFD pfd;
|
||||
GdkWaylandDisplay *display;
|
||||
guint reading : 1;
|
||||
guint can_dispatch : 1;
|
||||
};
|
||||
|
||||
/* If we should try wl_display_dispatch_pending() before
|
||||
* polling the Wayland fd
|
||||
*/
|
||||
static gboolean
|
||||
gdk_wayland_display_can_dispatch (GdkWaylandDisplay *display_wayland)
|
||||
{
|
||||
GdkWaylandPollSource *poll_source = (GdkWaylandPollSource *) display_wayland->poll_source;
|
||||
|
||||
return poll_source->can_dispatch;
|
||||
}
|
||||
|
||||
/* If we still have events to process and don't need to poll */
|
||||
static gboolean
|
||||
gdk_wayland_display_has_events_pending (GdkWaylandDisplay *display_wayland)
|
||||
{
|
||||
return gdk_wayland_display_can_dispatch (display_wayland) ||
|
||||
_gdk_event_queue_find_first (GDK_DISPLAY (display_wayland)) != NULL;
|
||||
}
|
||||
uint32_t mask;
|
||||
GdkDisplay *display;
|
||||
gboolean reading;
|
||||
} GdkWaylandEventSource;
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_event_source_prepare (GSource *base,
|
||||
int *timeout)
|
||||
gdk_event_source_prepare (GSource *base,
|
||||
int *timeout)
|
||||
{
|
||||
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
|
||||
|
||||
*timeout = -1;
|
||||
|
||||
return gdk_wayland_display_has_events_pending (source->display);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_event_source_check (GSource *base)
|
||||
{
|
||||
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
|
||||
|
||||
return gdk_wayland_display_has_events_pending (source->display);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_event_source_dispatch (GSource *base,
|
||||
GSourceFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_display_get_event (GDK_DISPLAY (source->display));
|
||||
|
||||
if (event)
|
||||
{
|
||||
_gdk_event_emit (event);
|
||||
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_event_source_finalize (GSource *base)
|
||||
{
|
||||
}
|
||||
|
||||
static GSourceFuncs gdk_wayland_event_source_funcs = {
|
||||
gdk_wayland_event_source_prepare,
|
||||
gdk_wayland_event_source_check,
|
||||
gdk_wayland_event_source_dispatch,
|
||||
gdk_wayland_event_source_finalize
|
||||
};
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_poll_source_prepare (GSource *base,
|
||||
int *timeout)
|
||||
{
|
||||
GdkWaylandPollSource *source = (GdkWaylandPollSource *) base;
|
||||
GdkWaylandDisplay *display = (GdkWaylandDisplay *) source->display;
|
||||
GList *l;
|
||||
|
||||
*timeout = -1;
|
||||
|
||||
if (gdk_wayland_display_has_events_pending (source->display))
|
||||
return FALSE;
|
||||
if (source->display->event_pause_count > 0)
|
||||
return _gdk_event_queue_find_first (source->display) != NULL;
|
||||
|
||||
/* We have to add/remove the GPollFD if we want to update our
|
||||
* poll event mask dynamically. Instead, let's just flush all
|
||||
* write on idle instead, which is what this amounts to.
|
||||
*/
|
||||
|
||||
if (_gdk_event_queue_find_first (source->display) != NULL)
|
||||
return TRUE;
|
||||
|
||||
/* wl_display_prepare_read() needs to be balanced with either
|
||||
* wl_display_read_events() or wl_display_cancel_read()
|
||||
* (in gdk_wayland_event_source_check() */
|
||||
* (in gdk_event_source_check() */
|
||||
if (source->reading)
|
||||
return FALSE;
|
||||
|
||||
/* if prepare_read() returns non-zero, there are events to be dispatched */
|
||||
if (wl_display_prepare_read (display->wl_display) != 0)
|
||||
{
|
||||
source->can_dispatch = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
/* We need to check whether there are pending events on the surface queues as well,
|
||||
* but we also need to make sure to only have one active "read" in the end,
|
||||
@@ -149,8 +74,6 @@ gdk_wayland_poll_source_prepare (GSource *base,
|
||||
|
||||
if (wl_display_prepare_read_queue (display->wl_display, queue) != 0)
|
||||
{
|
||||
source->can_dispatch = TRUE;
|
||||
/* cancel the read from before the for loop */
|
||||
wl_display_cancel_read (display->wl_display);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -169,19 +92,23 @@ gdk_wayland_poll_source_prepare (GSource *base,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_poll_source_check (GSource *base)
|
||||
gdk_event_source_check (GSource *base)
|
||||
{
|
||||
GdkWaylandPollSource *source = (GdkWaylandPollSource *) base;
|
||||
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
|
||||
GdkWaylandDisplay *display_wayland = (GdkWaylandDisplay *) source->display;
|
||||
|
||||
if (source->display->event_pause_count > 0)
|
||||
{
|
||||
if (source->reading)
|
||||
wl_display_cancel_read (display_wayland->wl_display);
|
||||
source->reading = FALSE;
|
||||
|
||||
return _gdk_event_queue_find_first (source->display) != NULL;
|
||||
}
|
||||
|
||||
/* read the events from the wayland fd into their respective queues if we have data */
|
||||
if (source->reading)
|
||||
{
|
||||
if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
g_message ("Lost connection to Wayland compositor.");
|
||||
_exit (1);
|
||||
}
|
||||
if (source->pfd.revents & G_IO_IN)
|
||||
{
|
||||
if (wl_display_read_events (display_wayland->wl_display) < 0)
|
||||
@@ -189,40 +116,53 @@ gdk_wayland_poll_source_check (GSource *base)
|
||||
g_message ("Error reading events from display: %s", g_strerror (errno));
|
||||
_exit (1);
|
||||
}
|
||||
source->pfd.revents = 0;
|
||||
source->can_dispatch = TRUE;
|
||||
}
|
||||
else
|
||||
wl_display_cancel_read (display_wayland->wl_display);
|
||||
source->reading = FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return _gdk_event_queue_find_first (source->display) != NULL ||
|
||||
source->pfd.revents;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_poll_source_dispatch (GSource *base,
|
||||
GSourceFunc callback,
|
||||
gpointer data)
|
||||
gdk_event_source_dispatch (GSource *base,
|
||||
GSourceFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
return G_SOURCE_CONTINUE;
|
||||
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
|
||||
GdkDisplay *display = source->display;
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_display_get_event (display);
|
||||
|
||||
if (event)
|
||||
{
|
||||
_gdk_event_emit (event);
|
||||
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_poll_source_finalize (GSource *base)
|
||||
gdk_event_source_finalize (GSource *base)
|
||||
{
|
||||
GdkWaylandPollSource *source = (GdkWaylandPollSource *) base;
|
||||
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
|
||||
GdkWaylandDisplay *display = (GdkWaylandDisplay *) source->display;
|
||||
|
||||
if (source->reading)
|
||||
wl_display_cancel_read (source->display->wl_display);
|
||||
wl_display_cancel_read (display->wl_display);
|
||||
source->reading = FALSE;
|
||||
}
|
||||
|
||||
static GSourceFuncs gdk_wayland_poll_source_funcs = {
|
||||
gdk_wayland_poll_source_prepare,
|
||||
gdk_wayland_poll_source_check,
|
||||
gdk_wayland_poll_source_dispatch,
|
||||
gdk_wayland_poll_source_finalize
|
||||
static GSourceFuncs wl_glib_source_funcs = {
|
||||
gdk_event_source_prepare,
|
||||
gdk_event_source_check,
|
||||
gdk_event_source_dispatch,
|
||||
gdk_event_source_finalize
|
||||
};
|
||||
|
||||
void
|
||||
@@ -236,81 +176,45 @@ _gdk_wayland_display_deliver_event (GdkDisplay *display,
|
||||
_gdk_display_get_next_serial (display));
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_display_install_gsources (GdkWaylandDisplay *display_wayland)
|
||||
GSource *
|
||||
_gdk_wayland_display_event_source_new (GdkDisplay *display)
|
||||
{
|
||||
GdkDisplay *display = GDK_DISPLAY (display_wayland);
|
||||
GSource *source;
|
||||
GdkWaylandEventSource *event_source;
|
||||
GdkWaylandPollSource *poll_source;
|
||||
GdkWaylandEventSource *wl_source;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
char *name;
|
||||
|
||||
/* SOURCE 1 */
|
||||
source = g_source_new (&gdk_wayland_event_source_funcs,
|
||||
source = g_source_new (&wl_glib_source_funcs,
|
||||
sizeof (GdkWaylandEventSource));
|
||||
display_wayland->event_source = source;
|
||||
event_source = (GdkWaylandEventSource *) source;
|
||||
name = g_strdup_printf ("GDK Wayland Event source (%s)",
|
||||
gdk_display_get_name (display));
|
||||
g_source_set_name (source, name);
|
||||
g_free (name);
|
||||
wl_source = (GdkWaylandEventSource *) source;
|
||||
|
||||
event_source->display = display_wayland;
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
wl_source->display = display;
|
||||
wl_source->pfd.fd = wl_display_get_fd (display_wayland->wl_display);
|
||||
wl_source->pfd.events = G_IO_IN | G_IO_ERR | G_IO_HUP;
|
||||
g_source_add_poll (source, &wl_source->pfd);
|
||||
|
||||
g_source_set_priority (source, GDK_PRIORITY_EVENTS);
|
||||
g_source_set_can_recurse (source, TRUE);
|
||||
g_source_attach (source, NULL);
|
||||
|
||||
/* SOURCE 2 */
|
||||
source = g_source_new (&gdk_wayland_poll_source_funcs,
|
||||
sizeof (GdkWaylandPollSource));
|
||||
display_wayland->poll_source = source;
|
||||
poll_source = (GdkWaylandPollSource *) source;
|
||||
name = g_strdup_printf ("GDK Wayland Poll source (%s)",
|
||||
gdk_display_get_name (display));
|
||||
g_source_set_name (source, name);
|
||||
g_free (name);
|
||||
|
||||
poll_source->display = display_wayland;
|
||||
poll_source->pfd.fd = wl_display_get_fd (display_wayland->wl_display);
|
||||
poll_source->pfd.events = G_IO_IN | G_IO_ERR | G_IO_HUP;
|
||||
g_source_add_poll (source, &poll_source->pfd);
|
||||
|
||||
/* We must guarantee to ALWAYS be called and called FIRST after
|
||||
* every poll - or rather: after every prepare().
|
||||
* Any other source might call Wayland functions and in turn
|
||||
* block while waiting for us.
|
||||
* And GSource has no after_pool() vfunc, check() is not guaranteed
|
||||
* to be called.
|
||||
*/
|
||||
g_source_set_priority (source, G_MININT);
|
||||
g_source_attach (source, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_display_uninstall_gsources (GdkWaylandDisplay *display_wayland)
|
||||
{
|
||||
if (display_wayland->event_source)
|
||||
{
|
||||
g_source_destroy (display_wayland->event_source);
|
||||
g_source_unref (display_wayland->event_source);
|
||||
display_wayland->event_source = NULL;
|
||||
}
|
||||
if (display_wayland->poll_source)
|
||||
{
|
||||
g_source_destroy (display_wayland->poll_source);
|
||||
g_source_unref (display_wayland->poll_source);
|
||||
display_wayland->poll_source = NULL;
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_wayland_display_queue_events (GdkDisplay *display)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
GdkWaylandPollSource *poll_source;
|
||||
GdkWaylandDisplay *display_wayland;
|
||||
GdkWaylandEventSource *source;
|
||||
GList *l;
|
||||
|
||||
display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
source = (GdkWaylandEventSource *) display_wayland->event_source;
|
||||
|
||||
if (wl_display_dispatch_pending (display_wayland->wl_display) < 0)
|
||||
{
|
||||
g_message ("Error %d (%s) dispatching to Wayland display.",
|
||||
@@ -330,6 +234,10 @@ _gdk_wayland_display_queue_events (GdkDisplay *display)
|
||||
}
|
||||
}
|
||||
|
||||
poll_source = (GdkWaylandPollSource *) display_wayland->poll_source;
|
||||
poll_source->can_dispatch = FALSE;
|
||||
if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
|
||||
{
|
||||
g_message ("Lost connection to Wayland compositor.");
|
||||
_exit (1);
|
||||
}
|
||||
source->pfd.revents = 0;
|
||||
}
|
||||
|
||||
@@ -1485,4 +1485,4 @@ _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -183,8 +183,7 @@ void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
|
||||
GdkEventSequence *sequence);
|
||||
|
||||
void _gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event);
|
||||
void gdk_wayland_display_install_gsources (GdkWaylandDisplay *display_wayland);
|
||||
void gdk_wayland_display_uninstall_gsources (GdkWaylandDisplay *display_wayland);
|
||||
GSource *_gdk_wayland_display_event_source_new (GdkDisplay *display);
|
||||
void _gdk_wayland_display_queue_events (GdkDisplay *display);
|
||||
|
||||
GdkAppLaunchContext *_gdk_wayland_display_get_app_launch_context (GdkDisplay *display);
|
||||
|
||||
@@ -1482,4 +1482,4 @@ gdk_wayland_surface_get_wl_surface (GdkSurface *surface)
|
||||
}
|
||||
|
||||
/* }}}} */
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -2765,4 +2765,4 @@ gdk_wayland_toplevel_set_transient_for_exported (GdkToplevel *toplevel,
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* vim:set foldmethod=marker: */
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
|
||||
@@ -151,11 +151,6 @@ proto_sources = [
|
||||
'stability': 'private',
|
||||
'version': 4,
|
||||
},
|
||||
{
|
||||
'name': 'xdg-system-bell',
|
||||
'stability': 'private',
|
||||
'version': 1,
|
||||
},
|
||||
]
|
||||
|
||||
gdk_wayland_gen_headers = []
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="xdg_system_bell_v1">
|
||||
<copyright>
|
||||
Copyright © 2016, 2023 Red Hat
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="xdg_system_bell_v1" version="1">
|
||||
<description summary="system bell">
|
||||
This global interface enables clients to ring the system bell.
|
||||
|
||||
Warning! The protocol described in this file is currently in the testing
|
||||
phase. Backward compatible changes may be added together with the
|
||||
corresponding interface version bump. Backward incompatible changes can
|
||||
only be done by creating a new major version of the extension.
|
||||
</description>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the system bell object">
|
||||
Notify that the object will no longer be used.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="ring">
|
||||
<description summary="ring the system bell">
|
||||
This requests rings the system bell on behalf of a client. How ringing
|
||||
the bell is implemented is up to the compositor. It may be an audible
|
||||
sound, a visual feedback of some kind, or any other thing including
|
||||
nothing.
|
||||
|
||||
The passed surface should correspond to a toplevel like surface role,
|
||||
or be null, meaning the client doesn't have a particular toplevel it
|
||||
wants to associate the bell ringing with. See the xdg-shell protocol
|
||||
extension for a toplevel like surface role.
|
||||
</description>
|
||||
<arg name="surface" type="object" interface="wl_surface"
|
||||
allow-null="true" summary="associated surface"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
200
gdk/win32/apisets.c
Normal file
200
gdk/win32/apisets.c
Normal file
@@ -0,0 +1,200 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
*
|
||||
* Copyright (C) 2024 the GTK team
|
||||
*
|
||||
* 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 "apisets.h"
|
||||
#include "procedures.h"
|
||||
|
||||
#include "gdkprivate-win32.h"
|
||||
|
||||
static struct api_set
|
||||
api_sets[] = {
|
||||
# define API_SET(id, name, os_version) \
|
||||
{name, L"" name, NULL, FALSE, os_version},
|
||||
API_SETS
|
||||
# undef API_SET
|
||||
};
|
||||
|
||||
static struct module
|
||||
modules[] = {
|
||||
# define MODULE(id, name, folder, flags) \
|
||||
{L"" name, folder, flags, NULL, FALSE},
|
||||
MODULES
|
||||
# undef MODULE
|
||||
};
|
||||
|
||||
static void
|
||||
load_api_set_internal (struct api_set *api_set)
|
||||
{
|
||||
if (ptrIsApiSetImplemented)
|
||||
if (!ptrIsApiSetImplemented (api_set->name_narrow))
|
||||
return;
|
||||
|
||||
/* Use LOAD_LIBRARY_SEARCH_SYSTEM32 for security (if IsApiSetImplemented
|
||||
* is not present)
|
||||
*
|
||||
* If we can't use IsApiSetImplemented, we should try loading the api set
|
||||
* directly. However, if the OS is too old and the api set is unknown,
|
||||
* LoadLibrary will look for a corresponding DLL file in the search paths.
|
||||
* Here we use LOAD_LIBRARY_SEARCH_SYSTEM32 to restrict search to a safe
|
||||
* folder. */
|
||||
const DWORD flags = LOAD_LIBRARY_SEARCH_SYSTEM32;
|
||||
|
||||
api_set->module_handle = LoadLibraryEx (api_set->name_wide, NULL, flags);
|
||||
if (api_set->module_handle == NULL)
|
||||
{
|
||||
DWORD code = GetLastError ();
|
||||
if (code == ERROR_INVALID_PARAMETER)
|
||||
{
|
||||
/* LOAD_LIBRARY_SEARCH_SYSTEM32 is supported on Windows Vista/7
|
||||
* only with update KB2533623 installed. If we can't use that
|
||||
* flag, it's best to return early and rely on classic modules.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
else if (code == ERROR_MOD_NOT_FOUND)
|
||||
{
|
||||
if (strncmp (api_set->name_narrow, "api", strlen ("api")) == 0 &&
|
||||
api_set->os_version <= gdk_win32_get_os_version ())
|
||||
{
|
||||
g_message ("%s missing\n", api_set->name_narrow);
|
||||
}
|
||||
}
|
||||
else
|
||||
WIN32_API_FAILED ("LoadLibraryEx");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
load_api_set (struct api_set *api_set)
|
||||
{
|
||||
g_assert (api_set->module_handle == NULL);
|
||||
g_assert (api_set->checked == false);
|
||||
|
||||
load_api_set_internal (api_set);
|
||||
|
||||
api_set->checked = true;
|
||||
}
|
||||
|
||||
/** gdk_win32_get_api_set:
|
||||
*/
|
||||
struct api_set *
|
||||
gdk_win32_get_api_set (int api_set_id)
|
||||
{
|
||||
if (api_set_id >= 0 && api_set_id < API_SET_COUNT)
|
||||
{
|
||||
struct api_set *api_set = &api_sets[api_set_id];
|
||||
|
||||
if (!api_set->checked)
|
||||
load_api_set (api_set);
|
||||
|
||||
return api_set;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
load_module_internal (struct module *module)
|
||||
{
|
||||
if (module->flags & MODULE_FLAG_PACKAGED)
|
||||
{
|
||||
if (gdk_win32_check_app_packaged ())
|
||||
{
|
||||
g_assert (ptrLoadPackagedLibrary);
|
||||
|
||||
module->module_handle = ptrLoadPackagedLibrary (module->name, 0);
|
||||
if (module->module_handle == NULL)
|
||||
{
|
||||
if (GetLastError () != ERROR_MOD_NOT_FOUND)
|
||||
WIN32_API_FAILED ("LoadPackagedLibrary");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO
|
||||
*
|
||||
* https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/framework-packages/use-the-dynamic-dependency-api
|
||||
* https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/use-windows-app-sdk-run-time
|
||||
* https://github.com/microsoft/WindowsAppSDK/issues/89
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
switch (module->folder)
|
||||
{
|
||||
case FOLDER_APP:
|
||||
if (can_use_app_folder < 0)
|
||||
can_use_app_folder = check_can_use_app_folder ();
|
||||
|
||||
if (can_use_app_folder)
|
||||
{
|
||||
module->module_handle = gdk_win32_load_library_from_app_folder (module->name);
|
||||
break;
|
||||
}
|
||||
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case FOLDER_SYSTEM32:
|
||||
module->module_handle = gdk_win32_load_library_from_system32 (module->name, false, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
load_module (struct module *module)
|
||||
{
|
||||
g_assert (module->module_handle == NULL);
|
||||
g_assert (module->checked == false);
|
||||
|
||||
load_module_internal (module);
|
||||
|
||||
module->checked = true;
|
||||
}
|
||||
|
||||
/** gdk_win32_get_module:
|
||||
*/
|
||||
struct module *
|
||||
gdk_win32_get_module (int module_id)
|
||||
{
|
||||
if (module_id >= 0 && module_id < MODULE_COUNT)
|
||||
{
|
||||
struct module *module = &modules[module_id];
|
||||
|
||||
if (!module->checked)
|
||||
load_module (module);
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// Check Dynamic-link library redirection
|
||||
// Check .exe.manifest file alongside exe
|
||||
// PSP_USEFUSIONCONTEXT
|
||||
// Manifest and WinRT activatable classes?
|
||||
// Check if GetProcAddress works in app container (do we really need a delay-load table for it to work?)
|
||||
// (can it really access the calling module?)
|
||||
|
||||
// Is it possible to generate a synthetic delay-load import table?
|
||||
|
||||
|
||||
87
gdk/win32/apisets.h
Normal file
87
gdk/win32/apisets.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
*
|
||||
* Copyright (C) 2024 the GTK team
|
||||
*
|
||||
* 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
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkmain-win32.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#undef API_SET
|
||||
|
||||
/* Api sets whose name starts with 'api' can be removed from the table once
|
||||
* support for older OSes is dropped. On the countrary, api sets whose name
|
||||
* starts with 'ext' must remain in the table because they are not present
|
||||
* on all Windows editions (Core, Desktop, Hololens, etc.) */
|
||||
|
||||
#define API_SETS \
|
||||
API_SET (API_CORE_APIQUERY_2 , "api-ms-win-core-apiquery-l2-1-0.dll" , OSVersionWindows10) \
|
||||
API_SET (API_APPMODEL_RUNTIME_1 , "api-ms-win-appmodel-runtime-l1-1-0.dll" , OSVersionWindows8 ) \
|
||||
API_SET (API_CORE_LIBRARYLOADER_2 , "api-ms-win-core-libraryloader-l2-1-0.dll" , OSVersionWindows8 ) \
|
||||
|
||||
#define MODULES \
|
||||
MODULE (MODULE_KERNEL32 , "kernel32.dll" , FOLDER_SYSTEM32 , 0 ) \
|
||||
MODULE (MODULE_USER32 , "user32.dll" , FOLDER_SYSTEM32 , 0 ) \
|
||||
|
||||
#define API_SET(id, name, os_version) id,
|
||||
enum ApiSets {
|
||||
API_SETS
|
||||
|
||||
API_SET_COUNT
|
||||
};
|
||||
#undef API_SET
|
||||
|
||||
#define MODULE(id, name, folder, flags) id,
|
||||
enum Modules {
|
||||
MODULES
|
||||
|
||||
MODULE_COUNT
|
||||
};
|
||||
#undef MODULE
|
||||
|
||||
struct api_set {
|
||||
const char *name_narrow;
|
||||
const wchar_t *name_wide;
|
||||
HMODULE module_handle;
|
||||
bool checked;
|
||||
OSVersion os_version;
|
||||
};
|
||||
|
||||
struct api_set * gdk_win32_get_api_set (int api_set_id);
|
||||
|
||||
enum ModuleFolder {
|
||||
FOLDER_SYSTEM32,
|
||||
FOLDER_APP,
|
||||
};
|
||||
|
||||
#define MODULE_FLAG_PACKAGED (1U << 0)
|
||||
#define MODULE_FLAG_DIRECT (1U << 1)
|
||||
|
||||
struct module {
|
||||
const wchar_t *name;
|
||||
enum ModuleFolder folder;
|
||||
unsigned int flags;
|
||||
HMODULE module_handle;
|
||||
bool checked;
|
||||
};
|
||||
|
||||
struct module * gdk_win32_get_module (int module_id);
|
||||
|
||||
@@ -62,13 +62,12 @@ gdk_win32_clipboard_request_contentformats (GdkWin32Clipboard *cb)
|
||||
UINT w32_formats_len = 0;
|
||||
UINT w32_formats_allocated;
|
||||
gsize i;
|
||||
GdkContentFormatsBuilder *builder;
|
||||
GdkContentFormats *formats;
|
||||
GArray *formatpairs;
|
||||
GdkWin32Clipdrop *clipdrop = gdk_win32_clipboard_get_clipdrop (GDK_CLIPBOARD (cb));
|
||||
DWORD error_code;
|
||||
|
||||
SetLastError (0);
|
||||
success = GetUpdatedClipboardFormats (NULL, 0, &w32_formats_allocated);
|
||||
success = clipdrop->GetUpdatedClipboardFormats (NULL, 0, &w32_formats_allocated);
|
||||
error_code = GetLastError ();
|
||||
|
||||
if (!success && error_code != ERROR_INSUFFICIENT_BUFFER)
|
||||
@@ -80,7 +79,7 @@ gdk_win32_clipboard_request_contentformats (GdkWin32Clipboard *cb)
|
||||
w32_formats = g_new0 (UINT, w32_formats_allocated);
|
||||
|
||||
SetLastError (0);
|
||||
success = GetUpdatedClipboardFormats (w32_formats, w32_formats_allocated, &w32_formats_len);
|
||||
success = clipdrop->GetUpdatedClipboardFormats (w32_formats, w32_formats_allocated, &w32_formats_len);
|
||||
error_code = GetLastError ();
|
||||
|
||||
if (!success)
|
||||
@@ -90,21 +89,46 @@ gdk_win32_clipboard_request_contentformats (GdkWin32Clipboard *cb)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
formatpairs = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof (GdkWin32ContentFormatPair),
|
||||
MIN (w32_formats_len, w32_formats_allocated));
|
||||
|
||||
for (i = 0; i < MIN (w32_formats_len, w32_formats_allocated); i++)
|
||||
gdk_win32_clipdrop_add_win32_format_to_pairs (clipdrop, w32_formats[i], NULL, builder);
|
||||
gdk_win32_clipdrop_add_win32_format_to_pairs (clipdrop, w32_formats[i], formatpairs, NULL);
|
||||
|
||||
g_free (w32_formats);
|
||||
formats = gdk_content_formats_builder_free_to_formats (builder);
|
||||
|
||||
GDK_NOTE (DND, {
|
||||
char *s = gdk_content_formats_to_string (formats);
|
||||
g_print ("... %s\n", s);
|
||||
g_free (s);
|
||||
g_print ("... ");
|
||||
for (i = 0; i < formatpairs->len; i++)
|
||||
{
|
||||
const char *mime_type = (const char *) g_array_index (formatpairs, GdkWin32ContentFormatPair, i).contentformat;
|
||||
|
||||
g_print ("%s", mime_type);
|
||||
if (i < formatpairs->len - 1)
|
||||
g_print (", ");
|
||||
}
|
||||
g_print ("\n");
|
||||
});
|
||||
|
||||
return formats;
|
||||
if (formatpairs->len > 0)
|
||||
{
|
||||
GdkContentFormatsBuilder *builder = gdk_content_formats_builder_new ();
|
||||
|
||||
for (i = 0; i < formatpairs->len; i++)
|
||||
gdk_content_formats_builder_add_mime_type (builder, g_array_index (formatpairs, GdkWin32ContentFormatPair, i).contentformat);
|
||||
|
||||
g_array_free (formatpairs, TRUE);
|
||||
|
||||
return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_array_free (formatpairs, TRUE);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -267,6 +267,9 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* For C-style COM wrapper macros */
|
||||
#define COBJMACROS
|
||||
|
||||
/* for CIDA */
|
||||
#include <shlobj.h>
|
||||
|
||||
@@ -280,7 +283,6 @@ Otherwise it's similar to how the clipboard works. Only the DnD server
|
||||
#include "gdkhdataoutputstream-win32.h"
|
||||
#include "gdkwin32dnd.h"
|
||||
#include "gdkwin32dnd-private.h"
|
||||
#include "gdkwin32messagesourceprivate.h"
|
||||
#include "gdkwin32.h"
|
||||
|
||||
#include "gdk/gdkdebugprivate.h"
|
||||
@@ -406,6 +408,15 @@ struct _GdkWin32ClipboardThread
|
||||
*/
|
||||
HWND clipboard_opened_for;
|
||||
|
||||
/* We can't peek the queue or "unpop" queue items,
|
||||
* so the items that we can't act upon (yet) got
|
||||
* to be stored *somewhere*.
|
||||
*/
|
||||
GList *dequeued_items;
|
||||
|
||||
/* Wakeup timer id (1 if timer is set, 0 otherwise) */
|
||||
UINT wakeup_timer;
|
||||
|
||||
/* The formats that the main thread claims to provide */
|
||||
GArray *cached_advertisement; /* of GdkWin32ContentFormatPair */
|
||||
|
||||
@@ -413,6 +424,9 @@ struct _GdkWin32ClipboardThread
|
||||
* Contains GdkWin32ClipboardThreadRender structs.
|
||||
*/
|
||||
GAsyncQueue *render_queue;
|
||||
|
||||
/* Set to TRUE when we're calling EmptyClipboard () */
|
||||
gboolean ignore_destroy_clipboard;
|
||||
};
|
||||
|
||||
typedef struct _GdkWin32ClipboardThreadResponse GdkWin32ClipboardThreadResponse;
|
||||
@@ -453,6 +467,18 @@ _gdk_win32_format_uses_hdata (UINT w32format)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This function is called in the main thread */
|
||||
static gboolean
|
||||
clipboard_hwnd_created (gpointer user_data)
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop = gdk_win32_display_get_clipdrop (gdk_display_get_default ());
|
||||
|
||||
clipdrop->clipboard_hwnd = (HWND) user_data;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
/* This function is called in the main thread */
|
||||
static gboolean
|
||||
clipboard_owner_changed (gpointer user_data)
|
||||
@@ -709,8 +735,10 @@ process_advertise (GdkWin32Clipdrop *clipdrop,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, ignore_destroy_clipboard) = TRUE;
|
||||
if (!EmptyClipboard ())
|
||||
{
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, ignore_destroy_clipboard) = FALSE;
|
||||
error_code = GetLastError ();
|
||||
send_response (adv->parent.item_type,
|
||||
adv->parent.opaque_task,
|
||||
@@ -719,6 +747,8 @@ process_advertise (GdkWin32Clipdrop *clipdrop,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, ignore_destroy_clipboard) = FALSE;
|
||||
|
||||
if (adv->unset)
|
||||
return FALSE;
|
||||
|
||||
@@ -916,6 +946,8 @@ process_retrieve (GdkWin32Clipdrop *clipdrop,
|
||||
|
||||
if (CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_opened_for) == INVALID_HANDLE_VALUE)
|
||||
error_code = try_open_clipboard (clipdrop, CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd));
|
||||
else
|
||||
error_code = try_open_clipboard (clipdrop, CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_opened_for));
|
||||
|
||||
if (error_code == ERROR_ACCESS_DENIED)
|
||||
return TRUE;
|
||||
@@ -1001,14 +1033,38 @@ process_retrieve (GdkWin32Clipdrop *clipdrop,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
process_clipboard_queue (gpointer data)
|
||||
process_clipboard_queue (GdkWin32Clipdrop *clipdrop)
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop = data;
|
||||
GdkWin32ClipboardThreadQueueItem *placeholder;
|
||||
GList *p;
|
||||
gboolean try_again;
|
||||
GList *p_next;
|
||||
|
||||
for (p = CLIPDROP_CB_THREAD_MEMBER (clipdrop, dequeued_items), p_next = NULL; p; p = p_next)
|
||||
{
|
||||
placeholder = (GdkWin32ClipboardThreadQueueItem *) p->data;
|
||||
p_next = p->next;
|
||||
|
||||
switch (placeholder->item_type)
|
||||
{
|
||||
case GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_ADVERTISE:
|
||||
try_again = process_advertise (clipdrop, (GdkWin32ClipboardThreadAdvertise *) placeholder);
|
||||
break;
|
||||
case GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_RETRIEVE:
|
||||
try_again = process_retrieve (clipdrop, (GdkWin32ClipboardThreadRetrieve *) placeholder);
|
||||
break;
|
||||
case GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_STORE:
|
||||
try_again = process_store (clipdrop, (GdkWin32ClipboardThreadStore *) placeholder);
|
||||
break;
|
||||
}
|
||||
|
||||
if (try_again)
|
||||
return FALSE;
|
||||
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, dequeued_items) = g_list_delete_link (CLIPDROP_CB_THREAD_MEMBER (clipdrop, dequeued_items), p);
|
||||
free_queue_item (placeholder);
|
||||
}
|
||||
|
||||
while ((placeholder = g_async_queue_try_pop (CLIPDROP_CB_THREAD_MEMBER (clipdrop, input_queue))) != NULL)
|
||||
{
|
||||
switch (placeholder->item_type)
|
||||
@@ -1024,30 +1080,18 @@ process_clipboard_queue (gpointer data)
|
||||
break;
|
||||
}
|
||||
|
||||
if (try_again)
|
||||
if (!try_again)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
g_async_queue_push_front (CLIPDROP_CB_THREAD_MEMBER (clipdrop, input_queue), placeholder);
|
||||
|
||||
source = g_timeout_source_new (1000);
|
||||
g_source_set_priority (source, G_PRIORITY_DEFAULT);
|
||||
g_source_set_callback (source, process_clipboard_queue, clipdrop, NULL);
|
||||
g_source_attach (source, clipdrop->clipboard_main_context);
|
||||
g_source_unref (source);
|
||||
break;
|
||||
free_queue_item (placeholder);
|
||||
continue;
|
||||
}
|
||||
|
||||
free_queue_item (placeholder);
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, dequeued_items) = g_list_append (CLIPDROP_CB_THREAD_MEMBER (clipdrop, dequeued_items), placeholder);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_opened_for) != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
API_CALL (CloseClipboard, ());
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_opened_for) = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1069,9 +1113,9 @@ discard_render (GdkWin32ClipboardThreadRender *render,
|
||||
|
||||
static LRESULT
|
||||
inner_clipboard_hwnd_procedure (HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop = NULL;
|
||||
|
||||
@@ -1087,6 +1131,49 @@ inner_clipboard_hwnd_procedure (HWND hwnd,
|
||||
else
|
||||
clipdrop = (GdkWin32Clipdrop *) GetWindowLongPtr (hwnd, GWLP_USERDATA);
|
||||
|
||||
if (message == clipdrop->thread_wakeup_message ||
|
||||
message == WM_TIMER)
|
||||
{
|
||||
gboolean queue_is_empty = FALSE;
|
||||
|
||||
if (clipdrop->clipboard_thread_items == NULL)
|
||||
{
|
||||
g_warning ("Clipboard thread got an actionable message with no thread data");
|
||||
return DefWindowProcW (hwnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
queue_is_empty = process_clipboard_queue (clipdrop);
|
||||
|
||||
if (queue_is_empty && CLIPDROP_CB_THREAD_MEMBER (clipdrop, wakeup_timer))
|
||||
{
|
||||
API_CALL (KillTimer, (CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd), CLIPDROP_CB_THREAD_MEMBER (clipdrop, wakeup_timer)));
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, wakeup_timer) = 0;
|
||||
}
|
||||
|
||||
/* Close the clipboard after each queue run, if it's open.
|
||||
* It would be wrong to keep it open, even if we would
|
||||
* need it again a second later.
|
||||
* queue_is_empty == FALSE implies that the clipboard
|
||||
* is closed already, but it's better to be sure.
|
||||
*/
|
||||
if (CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_opened_for) != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
API_CALL (CloseClipboard, ());
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_opened_for) = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
if (queue_is_empty ||
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, wakeup_timer) != 0)
|
||||
return 0;
|
||||
|
||||
if (SetTimer (CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd), 1, 1000, NULL))
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, wakeup_timer) = 1;
|
||||
else
|
||||
g_critical ("Failed to set a timer for the clipboard HWND 0x%p: %lu",
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd),
|
||||
GetLastError ());
|
||||
}
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_DESTROY: /* unregister the clipboard listener */
|
||||
@@ -1163,7 +1250,7 @@ inner_clipboard_hwnd_procedure (HWND hwnd,
|
||||
CLIPDROP_CB_THREAD_MEMBER (clipdrop, cached_advertisement) = NULL;
|
||||
}
|
||||
|
||||
process_clipboard_queue (clipdrop);
|
||||
API_CALL (PostMessage, (CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd), clipdrop->thread_wakeup_message, 0, 0));
|
||||
|
||||
if (hwnd_owner != CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd))
|
||||
g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_owner_changed, NULL, NULL);
|
||||
@@ -1302,11 +1389,11 @@ inner_clipboard_hwnd_procedure (HWND hwnd,
|
||||
}
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK
|
||||
clipboard_hwnd_procedure (HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
LRESULT CALLBACK
|
||||
_clipboard_hwnd_procedure (HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wparam,
|
||||
LPARAM lparam)
|
||||
{
|
||||
LRESULT retval;
|
||||
|
||||
@@ -1329,7 +1416,7 @@ register_clipboard_notification (GdkWin32Clipdrop *clipdrop)
|
||||
ATOM klass;
|
||||
|
||||
wclass.lpszClassName = L"GdkClipboardNotification";
|
||||
wclass.lpfnWndProc = clipboard_hwnd_procedure;
|
||||
wclass.lpfnWndProc = _clipboard_hwnd_procedure;
|
||||
wclass.hInstance = this_module ();
|
||||
wclass.cbWndExtra = sizeof (GdkWin32ClipboardThread *);
|
||||
|
||||
@@ -1354,6 +1441,8 @@ register_clipboard_notification (GdkWin32Clipdrop *clipdrop)
|
||||
goto failed;
|
||||
}
|
||||
|
||||
g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_hwnd_created, (gpointer) CLIPDROP_CB_THREAD_MEMBER (clipdrop, clipboard_hwnd), NULL);
|
||||
|
||||
return TRUE;
|
||||
|
||||
failed:
|
||||
@@ -1365,43 +1454,37 @@ failed:
|
||||
static gpointer
|
||||
_gdk_win32_clipboard_thread_main (gpointer data)
|
||||
{
|
||||
GdkWin32Clipdrop *self = data;
|
||||
MSG msg;
|
||||
GAsyncQueue *queue = self->clipboard_open_thread_queue;
|
||||
GAsyncQueue *render_queue = self->clipboard_render_queue;
|
||||
guint message_source_id;
|
||||
GMainLoop *loop;
|
||||
|
||||
g_assert (self->clipboard_thread_items == NULL);
|
||||
g_assert (self->clipboard_main_context != NULL);
|
||||
clipdrop_thread_items *items = (clipdrop_thread_items*) data;
|
||||
GAsyncQueue *queue = items->queue;
|
||||
GAsyncQueue *render_queue = (GAsyncQueue *) g_async_queue_pop (queue);
|
||||
|
||||
g_main_context_push_thread_default (self->clipboard_main_context);
|
||||
message_source_id = gdk_win32_message_source_add (self->clipboard_main_context);
|
||||
g_assert (items->clipdrop->clipboard_thread_items == NULL);
|
||||
|
||||
self->clipboard_thread_items = g_new0 (GdkWin32ClipboardThread, 1);
|
||||
CLIPDROP_CB_THREAD_MEMBER (self, input_queue) = queue;
|
||||
CLIPDROP_CB_THREAD_MEMBER (self, render_queue) = render_queue;
|
||||
CLIPDROP_CB_THREAD_MEMBER (self, clipboard_opened_for) = INVALID_HANDLE_VALUE;
|
||||
items->clipdrop->clipboard_thread_items = g_new0 (GdkWin32ClipboardThread, 1);
|
||||
CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, input_queue) = queue;
|
||||
CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, render_queue) = render_queue;
|
||||
CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, clipboard_opened_for) = INVALID_HANDLE_VALUE;
|
||||
|
||||
if (!register_clipboard_notification (self))
|
||||
if (!register_clipboard_notification (items->clipdrop))
|
||||
{
|
||||
g_async_queue_unref (queue);
|
||||
g_clear_pointer (&self->clipboard_thread_items, g_free);
|
||||
g_clear_pointer (&items->clipdrop->clipboard_thread_items, g_free);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
loop = g_main_loop_new (self->clipboard_main_context, TRUE);
|
||||
g_main_loop_run (loop);
|
||||
g_main_loop_unref (loop);
|
||||
while (GetMessage (&msg, NULL, 0, 0))
|
||||
{
|
||||
TranslateMessage (&msg);
|
||||
DispatchMessage (&msg);
|
||||
}
|
||||
|
||||
/* Just in case, as this should only happen when we shut down */
|
||||
DestroyWindow (CLIPDROP_CB_THREAD_MEMBER (self, clipboard_hwnd));
|
||||
CloseHandle (CLIPDROP_CB_THREAD_MEMBER (self, clipboard_hwnd));
|
||||
g_clear_pointer (&self->clipboard_thread_items, g_free);
|
||||
|
||||
g_source_remove (message_source_id);
|
||||
g_main_context_pop_thread_default (self->clipboard_main_context);
|
||||
DestroyWindow (CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, clipboard_hwnd));
|
||||
CloseHandle (CLIPDROP_CB_THREAD_MEMBER (items->clipdrop, clipboard_hwnd));
|
||||
g_async_queue_unref (queue);
|
||||
g_clear_pointer (&items->clipdrop->clipboard_thread_items, g_free);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1437,9 +1520,15 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
||||
int i;
|
||||
GArray *comp;
|
||||
GdkWin32ContentFormatPair fmt;
|
||||
|
||||
HMODULE user32;
|
||||
clipdrop_thread_items cb_items, dnd_items;
|
||||
|
||||
win32_clipdrop->thread_wakeup_message = RegisterWindowMessage (L"GDK_WORKER_THREAD_WEAKEUP");
|
||||
|
||||
user32 = LoadLibrary (L"user32.dll");
|
||||
win32_clipdrop->GetUpdatedClipboardFormats = (GetUpdatedClipboardFormatsFunc) GetProcAddress (user32, "GetUpdatedClipboardFormats");
|
||||
FreeLibrary (user32);
|
||||
|
||||
atoms = g_array_sized_new (FALSE, TRUE, sizeof (const char *), GDK_WIN32_ATOM_INDEX_LAST);
|
||||
g_array_set_size (atoms, GDK_WIN32_ATOM_INDEX_LAST);
|
||||
cfs = g_array_sized_new (FALSE, TRUE, sizeof (UINT), GDK_WIN32_CF_INDEX_LAST);
|
||||
@@ -1721,15 +1810,22 @@ gdk_win32_clipdrop_init (GdkWin32Clipdrop *win32_clipdrop)
|
||||
|
||||
win32_clipdrop->clipboard_open_thread_queue = g_async_queue_new ();
|
||||
win32_clipdrop->clipboard_render_queue = g_async_queue_new ();
|
||||
win32_clipdrop->clipboard_main_context = g_main_context_new ();
|
||||
/* Out of sheer laziness, we just push the extra queue through the
|
||||
* main queue, instead of allocating a struct with two queue
|
||||
* pointers and then passing *that* to the thread.
|
||||
*/
|
||||
g_async_queue_push (win32_clipdrop->clipboard_open_thread_queue, g_async_queue_ref (win32_clipdrop->clipboard_render_queue));
|
||||
cb_items.clipdrop = dnd_items.clipdrop = win32_clipdrop;
|
||||
cb_items.queue = g_async_queue_ref (win32_clipdrop->clipboard_open_thread_queue);
|
||||
win32_clipdrop->clipboard_open_thread = g_thread_new ("GDK Win32 Clipboard Thread",
|
||||
_gdk_win32_clipboard_thread_main,
|
||||
win32_clipdrop);
|
||||
&cb_items);
|
||||
|
||||
win32_clipdrop->dnd_queue = g_async_queue_new ();
|
||||
dnd_items.queue = g_async_queue_ref (win32_clipdrop->dnd_queue);
|
||||
win32_clipdrop->dnd_thread = g_thread_new ("GDK Win32 DnD Thread",
|
||||
_gdk_win32_dnd_thread_main,
|
||||
win32_clipdrop);
|
||||
&dnd_items);
|
||||
win32_clipdrop->dnd_thread_id = GPOINTER_TO_UINT (g_async_queue_pop (win32_clipdrop->dnd_queue));
|
||||
}
|
||||
|
||||
@@ -2674,29 +2770,6 @@ _gdk_win32_add_contentformat_to_pairs (GdkWin32Clipdrop *clip_drop,
|
||||
return added_count;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_clipdrop_run_in_clipboard_thread (GdkWin32Clipdrop *self,
|
||||
GdkWin32ClipboardThreadQueueItem *item)
|
||||
{
|
||||
gboolean was_empty;
|
||||
|
||||
g_async_queue_lock (self->clipboard_open_thread_queue);
|
||||
was_empty = g_async_queue_length_unlocked (self->clipboard_open_thread_queue) == 0;
|
||||
g_async_queue_push_unlocked (self->clipboard_open_thread_queue, item);
|
||||
g_async_queue_unlock (self->clipboard_open_thread_queue);
|
||||
|
||||
if (was_empty)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
source = g_idle_source_new ();
|
||||
g_source_set_priority (source, G_PRIORITY_DEFAULT);
|
||||
g_source_set_callback (source, process_clipboard_queue, self, NULL);
|
||||
g_source_attach (source, self->clipboard_main_context);
|
||||
g_source_unref (source);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_win32_advertise_clipboard_contentformats (GdkClipboard *cb,
|
||||
GTask *task,
|
||||
@@ -2708,6 +2781,8 @@ _gdk_win32_advertise_clipboard_contentformats (GdkClipboard *cb,
|
||||
gsize mime_types_len;
|
||||
gsize i;
|
||||
|
||||
g_assert (clipdrop->clipboard_hwnd != NULL);
|
||||
|
||||
adv->parent.item_type = GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_ADVERTISE;
|
||||
adv->parent.start_time = g_get_monotonic_time ();
|
||||
adv->parent.end_time = adv->parent.start_time + CLIPBOARD_OPERATION_TIMEOUT;
|
||||
@@ -2728,7 +2803,10 @@ _gdk_win32_advertise_clipboard_contentformats (GdkClipboard *cb,
|
||||
_gdk_win32_add_contentformat_to_pairs (clipdrop, mime_types[i], adv->pairs);
|
||||
}
|
||||
|
||||
gdk_win32_clipdrop_run_in_clipboard_thread (clipdrop, &adv->parent);
|
||||
g_async_queue_push (clipdrop->clipboard_open_thread_queue, adv);
|
||||
API_CALL (PostMessage, (clipdrop->clipboard_hwnd, clipdrop->thread_wakeup_message, 0, 0));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2742,6 +2820,8 @@ _gdk_win32_retrieve_clipboard_contentformats (GdkClipboard *cb,
|
||||
gsize mime_types_len;
|
||||
gsize i;
|
||||
|
||||
g_assert (clipdrop->clipboard_hwnd != NULL);
|
||||
|
||||
retr->parent.item_type = GDK_WIN32_CLIPBOARD_THREAD_QUEUE_ITEM_RETRIEVE;
|
||||
retr->parent.start_time = g_get_monotonic_time ();
|
||||
retr->parent.end_time = retr->parent.start_time + CLIPBOARD_OPERATION_TIMEOUT;
|
||||
@@ -2754,7 +2834,10 @@ _gdk_win32_retrieve_clipboard_contentformats (GdkClipboard *cb,
|
||||
for (i = 0; i < mime_types_len; i++)
|
||||
_gdk_win32_add_contentformat_to_pairs (clipdrop, mime_types[i], retr->pairs);
|
||||
|
||||
gdk_win32_clipdrop_run_in_clipboard_thread (clipdrop, &retr->parent);
|
||||
g_async_queue_push (clipdrop->clipboard_open_thread_queue, retr);
|
||||
API_CALL (PostMessage, (clipdrop->clipboard_hwnd, clipdrop->thread_wakeup_message, 0, 0));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
typedef struct _GdkWin32ClipboardHDataPrepAndStream GdkWin32ClipboardHDataPrepAndStream;
|
||||
@@ -2832,7 +2915,8 @@ clipboard_store_hdata_ready (GObject *clipboard,
|
||||
store->parent.opaque_task = prep->store_task;
|
||||
store->elements = prep->elements;
|
||||
|
||||
gdk_win32_clipdrop_run_in_clipboard_thread (clipdrop, &store->parent);
|
||||
g_async_queue_push (clipdrop->clipboard_open_thread_queue, store);
|
||||
API_CALL (PostMessage, (clipdrop->clipboard_hwnd, clipdrop->thread_wakeup_message, 0, 0));
|
||||
|
||||
g_free (prep);
|
||||
}
|
||||
@@ -2849,6 +2933,8 @@ _gdk_win32_store_clipboard_contentformats (GdkClipboard *cb,
|
||||
GdkWin32Clipdrop *clipdrop = gdk_win32_display_get_clipdrop (gdk_clipboard_get_display (cb));
|
||||
GdkWin32ClipboardStorePrep *prep;
|
||||
|
||||
g_assert (clipdrop->clipboard_hwnd != NULL);
|
||||
|
||||
mime_types = gdk_content_formats_get_mime_types (contentformats, &n_mime_types);
|
||||
|
||||
pairs = g_array_sized_new (FALSE,
|
||||
|
||||
@@ -113,6 +113,21 @@ typedef enum _GdkWin32CFIndex GdkWin32CFIndex;
|
||||
typedef struct _GdkWin32Clipdrop GdkWin32Clipdrop;
|
||||
typedef struct _GdkWin32ClipdropClass GdkWin32ClipdropClass;
|
||||
|
||||
/* this is shared with gdkdrag-win32.c as well */
|
||||
struct _clipdrop_thread_items
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop;
|
||||
GAsyncQueue *queue;
|
||||
};
|
||||
|
||||
typedef struct _clipdrop_thread_items clipdrop_thread_items;
|
||||
|
||||
typedef BOOL (WINAPI * GetUpdatedClipboardFormatsFunc)(
|
||||
_Out_ PUINT lpuiFormats,
|
||||
_In_ UINT cFormats,
|
||||
_Out_ PUINT pcFormatsOut
|
||||
);
|
||||
|
||||
/* This object is just a sink to hold all the clipboard- and dnd-related data
|
||||
* that otherwise would be in global variables.
|
||||
*/
|
||||
@@ -141,6 +156,14 @@ struct _GdkWin32Clipdrop
|
||||
/* A format-keyed hash table of GArrays of GdkAtoms describing compatibility contentformats for a w32format */
|
||||
GHashTable *compatibility_contentformats;
|
||||
|
||||
/* By all rights we should be able to just use this function
|
||||
* normally, as our target platform is Vista-or-later.
|
||||
* This pointer is manually retrieved only to allow
|
||||
* GTK to be compiled with old MinGW versions, which
|
||||
* don't have GetUpdatedClipboardFormats in the import libs.
|
||||
*/
|
||||
GetUpdatedClipboardFormatsFunc GetUpdatedClipboardFormats;
|
||||
|
||||
/* The thread that tries to open the clipboard and then
|
||||
* do stuff with it. Since clipboard opening can
|
||||
* fail, we split the code into a thread, and let
|
||||
@@ -149,12 +172,6 @@ struct _GdkWin32Clipdrop
|
||||
*/
|
||||
GThread *clipboard_open_thread;
|
||||
|
||||
/* The main loop run in the clipboard thread.
|
||||
* When we want to communicate with the thread, we just add
|
||||
* tasks to it via this context.
|
||||
*/
|
||||
GMainContext *clipboard_main_context;
|
||||
|
||||
/* Our primary means of communicating with the thread.
|
||||
* The communication is one-way only - the thread replies
|
||||
* by just queueing functions to be called in the main
|
||||
@@ -169,6 +186,13 @@ struct _GdkWin32Clipdrop
|
||||
*/
|
||||
GAsyncQueue *clipboard_render_queue;
|
||||
|
||||
/* Window handle for the clipboard surface that we
|
||||
* receive from the clipboard thread. We use that
|
||||
* to wake up the clipboard surface main loop by
|
||||
* posting a message to it.
|
||||
*/
|
||||
HWND clipboard_hwnd;
|
||||
|
||||
/* The thread that calls DoDragDrop (), which would
|
||||
* normally block our main thread, as it runs its own
|
||||
* Windows message loop.
|
||||
|
||||
@@ -527,16 +527,18 @@ _gdk_win32_display_open (const char *display_name)
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_display_open: %s\n", (display_name ? display_name : "NULL")));
|
||||
|
||||
if (display != NULL)
|
||||
if (display_name == NULL || g_ascii_strcasecmp (display_name, gdk_display_get_name (display)) == 0)
|
||||
{
|
||||
GDK_NOTE (MISC, g_print ("... Display is already open\n"));
|
||||
return NULL;
|
||||
if (display != NULL)
|
||||
{
|
||||
GDK_NOTE (MISC, g_print ("... return existing gdkdisplay\n"));
|
||||
return display;
|
||||
}
|
||||
}
|
||||
|
||||
if (display_name != NULL)
|
||||
else
|
||||
{
|
||||
/* we don't really support multiple GdkDisplay's on Windows at this point */
|
||||
GDK_NOTE (MISC, g_print ("... win32 does not support named displays, but given name was \"%s\"\n", display_name));
|
||||
GDK_NOTE (MISC, g_print ("... return NULL\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -656,17 +658,25 @@ gdk_win32_display_get_name (GdkDisplay *display)
|
||||
static void
|
||||
gdk_win32_display_beep (GdkDisplay *display)
|
||||
{
|
||||
MessageBeep ((UINT)-1);
|
||||
g_return_if_fail (display == gdk_display_get_default());
|
||||
if (!MessageBeep (-1))
|
||||
Beep(1000, 50);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_flush (GdkDisplay * display)
|
||||
{
|
||||
g_return_if_fail (display == gdk_display_get_default());
|
||||
|
||||
GdiFlush ();
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_sync (GdkDisplay * display)
|
||||
{
|
||||
g_return_if_fail (display == gdk_display_get_default());
|
||||
|
||||
GdiFlush ();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1355,6 +1365,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->beep = gdk_win32_display_beep;
|
||||
display_class->sync = gdk_win32_display_sync;
|
||||
display_class->flush = gdk_win32_display_flush;
|
||||
display_class->has_pending = _gdk_win32_display_has_pending;
|
||||
display_class->queue_events = _gdk_win32_display_queue_events;
|
||||
|
||||
//? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "gdkglversionprivate.h"
|
||||
|
||||
/* Used for active language or text service change notifications */
|
||||
#define COBJMACROS
|
||||
#include <msctf.h>
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
@@ -212,9 +213,10 @@ struct _GdkWin32Display
|
||||
guint hasWglARBPixelFormat : 1;
|
||||
guint hasGlWINSwapHint : 1;
|
||||
|
||||
struct {
|
||||
struct wgl_quirks {
|
||||
guint force_gdi_compatibility : 1;
|
||||
guint disallow_swap_exchange : 1;
|
||||
} wgl_quirks;
|
||||
} *wgl_quirks;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
guint hasEglKHRCreateContext : 1;
|
||||
|
||||
@@ -192,6 +192,9 @@
|
||||
#define INITGUID
|
||||
#endif
|
||||
|
||||
/* For C-style COM wrapper macros */
|
||||
#define COBJMACROS
|
||||
|
||||
#include "gdkdrag.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkwin32.h"
|
||||
@@ -634,8 +637,10 @@ do_drag_drop (GdkWin32DnDThreadDoDragDrop *ddd)
|
||||
gpointer
|
||||
_gdk_win32_dnd_thread_main (gpointer data)
|
||||
{
|
||||
GdkWin32Clipdrop *clipdrop = data;
|
||||
GAsyncQueue *queue = clipdrop->dnd_queue;
|
||||
|
||||
clipdrop_thread_items *clipdrop_items = (clipdrop_thread_items *) data;
|
||||
GAsyncQueue *queue = clipdrop_items->queue;
|
||||
GdkWin32Clipdrop *clipdrop = clipdrop_items->clipdrop;
|
||||
GdkWin32DnDThreadQueueItem *item;
|
||||
MSG msg;
|
||||
HRESULT hr;
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
#define INITGUID
|
||||
#endif
|
||||
|
||||
/* For C-style COM wrapper macros */
|
||||
#define COBJMACROS
|
||||
|
||||
#include "gdkdropprivate.h"
|
||||
|
||||
#include "gdkdrag.h"
|
||||
@@ -300,7 +303,8 @@ query_object_formats (GdkDisplay *display,
|
||||
hr = IEnumFORMATETC_Next (pfmt, 1, &fmt, NULL);
|
||||
}
|
||||
|
||||
gdk_win32_com_clear (&pfmt);
|
||||
if (pfmt)
|
||||
IEnumFORMATETC_Release (pfmt);
|
||||
|
||||
result_formats = gdk_content_formats_builder_free_to_formats (builder);
|
||||
|
||||
@@ -310,7 +314,8 @@ query_object_formats (GdkDisplay *display,
|
||||
static void
|
||||
set_data_object (LPDATAOBJECT *location, LPDATAOBJECT data_object)
|
||||
{
|
||||
gdk_win32_com_clear (location);
|
||||
if (*location != NULL)
|
||||
IDataObject_Release (*location);
|
||||
|
||||
*location = data_object;
|
||||
|
||||
|
||||
@@ -81,6 +81,23 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define GDK_MOD2_MASK (1 << 4)
|
||||
|
||||
#ifndef XBUTTON1
|
||||
#define XBUTTON1 1
|
||||
#define XBUTTON2 2
|
||||
#endif
|
||||
|
||||
#ifndef VK_XBUTTON1
|
||||
#define VK_XBUTTON1 5
|
||||
#define VK_XBUTTON2 6
|
||||
#endif
|
||||
|
||||
#ifndef MK_XBUTTON1
|
||||
#define MK_XBUTTON1 32
|
||||
#define MK_XBUTTON2 64
|
||||
#endif
|
||||
|
||||
/* Undefined flags: */
|
||||
#define SWP_NOCLIENTSIZE 0x0800
|
||||
#define SWP_NOCLIENTMOVE 0x1000
|
||||
@@ -391,9 +408,6 @@ set_up_low_level_keyboard_hook (GdkDisplay *display)
|
||||
{
|
||||
HHOOK hook_handle;
|
||||
|
||||
if (!gdk_has_feature (GDK_FEATURE_AEROSNAP))
|
||||
return;
|
||||
|
||||
if (GDK_WIN32_DISPLAY (display)->event_record->aerosnap_keyboard_hook != NULL)
|
||||
return;
|
||||
|
||||
@@ -522,6 +536,14 @@ _gdk_events_init (GdkDisplay *display)
|
||||
set_up_low_level_keyboard_hook (display);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_win32_display_has_pending (GdkDisplay *display)
|
||||
{
|
||||
return (_gdk_event_queue_find_first (display) ||
|
||||
(modal_win32_dialog == NULL &&
|
||||
GetQueueStatus (QS_ALLINPUT) != 0));
|
||||
}
|
||||
|
||||
#if 0 /* Unused, but might be useful to re-introduce in some debugging output? */
|
||||
|
||||
static char *
|
||||
@@ -702,6 +724,7 @@ print_event_state (guint state)
|
||||
CASE (LOCK);
|
||||
CASE (CONTROL);
|
||||
CASE (ALT);
|
||||
CASE (MOD2);
|
||||
CASE (BUTTON1);
|
||||
CASE (BUTTON2);
|
||||
CASE (BUTTON3);
|
||||
@@ -1775,19 +1798,19 @@ gdk_event_translate (MSG *msg,
|
||||
{
|
||||
/* XXX Handle WM_QUIT here ? */
|
||||
if (msg->message == WM_QUIT)
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print (" %d", (int) msg->wParam));
|
||||
exit (msg->wParam);
|
||||
}
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print (" %d", (int) msg->wParam));
|
||||
exit (msg->wParam);
|
||||
}
|
||||
else if (msg->message == WM_CREATE)
|
||||
{
|
||||
surface = (GdkSurface*) (((LPCREATESTRUCTW) msg->lParam)->lpCreateParams);
|
||||
GDK_SURFACE_HWND (surface) = msg->hwnd;
|
||||
}
|
||||
{
|
||||
surface = (UNALIGNED GdkSurface*) (((LPCREATESTRUCTW) msg->lParam)->lpCreateParams);
|
||||
GDK_SURFACE_HWND (surface) = msg->hwnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print (" (no GdkSurface)"));
|
||||
}
|
||||
{
|
||||
GDK_NOTE (EVENTS, g_print (" (no GdkSurface)"));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2297,8 +2320,8 @@ gdk_event_translate (MSG *msg,
|
||||
*
|
||||
*/
|
||||
if (win32_display->tablet_input_api == GDK_WIN32_TABLET_INPUT_API_WINPOINTER &&
|
||||
((msg->time - win32_display->device_manager->last_digitizer_time) < 200 ||
|
||||
(win32_display->device_manager->last_digitizer_time - msg->time) < 200 ))
|
||||
( (msg->time - win32_display->device_manager->last_digitizer_time) < 200 ||
|
||||
-(msg->time - win32_display->device_manager->last_digitizer_time) < 200 ))
|
||||
break;
|
||||
|
||||
win32_display->device_manager->pen_touch_input = FALSE;
|
||||
@@ -3078,12 +3101,7 @@ gdk_event_translate (MSG *msg,
|
||||
|
||||
/* Call modal timer immediate so that we repaint faster after a resize. */
|
||||
if (GDK_WIN32_DISPLAY (gdk_surface_get_display (surface))->display_surface_record->modal_operation_in_progress & GDK_WIN32_MODAL_OP_SIZEMOVE_MASK)
|
||||
{
|
||||
modal_timer_proc (msg->hwnd,
|
||||
msg->message,
|
||||
(UINT_PTR)surface,
|
||||
msg->time);
|
||||
}
|
||||
modal_timer_proc (0,0,0,0);
|
||||
|
||||
/* Claim as handled, so that WM_SIZE and WM_MOVE are avoided */
|
||||
return_val = TRUE;
|
||||
|
||||
@@ -367,9 +367,10 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
|
||||
attribs_add_static_array (&attribs, attribs_base);
|
||||
|
||||
attribs_commit (&attribs);
|
||||
if (display_win32->wgl_quirks->force_gdi_compatibility)
|
||||
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
|
||||
|
||||
attribs_add (&attribs, WGL_SUPPORT_GDI_ARB, GL_TRUE);
|
||||
attribs_commit (&attribs);
|
||||
|
||||
attribs_add_static_array (&attribs, attribs_ancillary_buffers);
|
||||
|
||||
@@ -394,7 +395,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
|
||||
if (find_pixel_format_with_defined_swap_method (hdc, formats, count, &index, &swap_method))
|
||||
{
|
||||
if (!display_win32->wgl_quirks.disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
if (!display_win32->wgl_quirks->disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
{
|
||||
format = formats[index];
|
||||
goto done;
|
||||
@@ -405,7 +406,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
|
||||
const int swap_methods[] =
|
||||
{
|
||||
(display_win32->wgl_quirks.disallow_swap_exchange) ? 0 : WGL_SWAP_EXCHANGE_ARB,
|
||||
(display_win32->wgl_quirks->disallow_swap_exchange) ? 0 : WGL_SWAP_EXCHANGE_ARB,
|
||||
WGL_SWAP_COPY_ARB,
|
||||
};
|
||||
for (size_t i = 0; i < G_N_ELEMENTS (swap_methods); i++)
|
||||
@@ -420,7 +421,7 @@ choose_pixel_format_arb_attribs (GdkWin32Display *display_win32,
|
||||
&count));
|
||||
if (find_pixel_format_with_defined_swap_method (hdc, formats, count, &index, &swap_method))
|
||||
{
|
||||
if (!display_win32->wgl_quirks.disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
if (!display_win32->wgl_quirks->disallow_swap_exchange || swap_method != WGL_SWAP_EXCHANGE_ARB)
|
||||
{
|
||||
format = formats[index];
|
||||
goto done;
|
||||
@@ -449,16 +450,13 @@ get_distance (PIXELFORMATDESCRIPTOR *pfd,
|
||||
int is_double_buffered = (pfd->dwFlags & PFD_DOUBLEBUFFER) != 0;
|
||||
int is_swap_defined = (pfd->dwFlags & swap_flags) != 0;
|
||||
int is_mono = (pfd->dwFlags & PFD_STEREO) == 0;
|
||||
int is_transparent = (pfd->dwFlags & PFD_SUPPORT_GDI) != 0;
|
||||
int ancillary_bits = pfd->cStencilBits + pfd->cDepthBits + pfd->cAccumBits;
|
||||
|
||||
int opacity_distance = !is_transparent * 5000;
|
||||
int quality_distance = !is_double_buffered * 1000;
|
||||
int performance_distance = !is_swap_defined * 200;
|
||||
int memory_distance = !is_mono + ancillary_bits;
|
||||
|
||||
return opacity_distance +
|
||||
quality_distance +
|
||||
return quality_distance +
|
||||
performance_distance +
|
||||
memory_distance;
|
||||
}
|
||||
@@ -479,9 +477,10 @@ choose_pixel_format_opengl32 (GdkWin32Display *display_win32,
|
||||
const DWORD skip_flags = PFD_GENERIC_FORMAT |
|
||||
PFD_GENERIC_ACCELERATED;
|
||||
const DWORD required_flags = PFD_DRAW_TO_WINDOW |
|
||||
PFD_SUPPORT_OPENGL;
|
||||
PFD_SUPPORT_OPENGL |
|
||||
(display_win32->wgl_quirks->force_gdi_compatibility ? PFD_SUPPORT_GDI : 0);
|
||||
const DWORD best_swap_flags = PFD_SWAP_COPY |
|
||||
(display_win32->wgl_quirks.disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
|
||||
(display_win32->wgl_quirks->disallow_swap_exchange ? 0 : PFD_SWAP_EXCHANGE);
|
||||
|
||||
struct {
|
||||
int index;
|
||||
@@ -620,6 +619,18 @@ create_dummy_gl_window (void)
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
static bool
|
||||
check_driver_is_d3d12 (void)
|
||||
{
|
||||
const char *vendor = (const char *) glGetString (GL_VENDOR);
|
||||
const char *renderer = (const char *) glGetString (GL_RENDERER);
|
||||
|
||||
return vendor != NULL &&
|
||||
g_ascii_strncasecmp (vendor, "MICROSOFT", strlen ("MICROSOFT")) == 0 &&
|
||||
renderer != NULL &&
|
||||
g_ascii_strncasecmp (renderer, "D3D12", strlen ("D3D12")) == 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
check_vendor_is_nvidia (void)
|
||||
{
|
||||
@@ -640,7 +651,9 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_WGL, error))
|
||||
return NULL;
|
||||
|
||||
|
||||
g_assert (display_win32->wgl_quirks == NULL);
|
||||
display_win32->wgl_quirks = g_new0 (struct wgl_quirks, 1);
|
||||
|
||||
/* acquire and cache dummy Window (HWND & HDC) and
|
||||
* dummy GL Context, it is used to query functions
|
||||
* and used for other stuff as well
|
||||
@@ -681,7 +694,8 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
display_win32->hasGlWINSwapHint =
|
||||
epoxy_has_gl_extension ("GL_WIN_swap_hint");
|
||||
|
||||
display_win32->wgl_quirks.disallow_swap_exchange = check_vendor_is_nvidia ();
|
||||
display_win32->wgl_quirks->force_gdi_compatibility = check_driver_is_d3d12 ();
|
||||
display_win32->wgl_quirks->disallow_swap_exchange = check_vendor_is_nvidia ();
|
||||
|
||||
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
|
||||
"display", display,
|
||||
@@ -700,6 +714,7 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
GDK_NOTE (OPENGL, g_print ("WGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Renderer: %s\n"
|
||||
" - Quirks / force GDI compatiblity: %s\n"
|
||||
" - Quirks / disallow swap exchange: %s\n"
|
||||
" - Checked extensions:\n"
|
||||
"\t* WGL_ARB_pixel_format: %s\n"
|
||||
@@ -710,7 +725,8 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
|
||||
major, minor,
|
||||
glGetString (GL_VENDOR),
|
||||
glGetString (GL_RENDERER),
|
||||
display_win32->wgl_quirks.disallow_swap_exchange ? "enabled" : "disabled",
|
||||
display_win32->wgl_quirks->force_gdi_compatibility ? "enabled" : "disabled",
|
||||
display_win32->wgl_quirks->disallow_swap_exchange ? "enabled" : "disabled",
|
||||
display_win32->hasWglARBPixelFormat ? "yes" : "no",
|
||||
display_win32->hasWglARBCreateContext ? "yes" : "no",
|
||||
display_win32->hasWglEXTSwapControl ? "yes" : "no",
|
||||
@@ -1125,7 +1141,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
context_wgl->swap_method = SWAP_METHOD_COPY;
|
||||
break;
|
||||
case WGL_SWAP_EXCHANGE_ARB:
|
||||
if (!display_win32->wgl_quirks.disallow_swap_exchange)
|
||||
if (!display_win32->wgl_quirks->disallow_swap_exchange)
|
||||
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
|
||||
break;
|
||||
}
|
||||
@@ -1141,7 +1157,7 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
|
||||
|
||||
if (pfd.dwFlags & PFD_SWAP_COPY)
|
||||
context_wgl->swap_method = SWAP_METHOD_COPY;
|
||||
else if ((pfd.dwFlags & PFD_SWAP_EXCHANGE) && !display_win32->wgl_quirks.disallow_swap_exchange)
|
||||
else if ((pfd.dwFlags & PFD_SWAP_EXCHANGE) && !display_win32->wgl_quirks->disallow_swap_exchange)
|
||||
context_wgl->swap_method = SWAP_METHOD_EXCHANGE;
|
||||
else
|
||||
context_wgl->swap_method = SWAP_METHOD_UNDEFINED;
|
||||
|
||||
@@ -21,10 +21,6 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef DONT_INCLUDE_LIBEPOXY
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
/* epoxy needs this, see https://github.com/anholt/libepoxy/issues/299 */
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include <epoxy/gl.h>
|
||||
#include <epoxy/wgl.h>
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#endif
|
||||
#define WINVER 0x0603
|
||||
#define _WIN32_WINNT 0x0603
|
||||
#define COBJMACROS
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
@@ -37,7 +38,6 @@
|
||||
#include "gdkdevice-virtual.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplay-win32.h"
|
||||
#include "gdkprivate-win32.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkseatdefaultprivate.h"
|
||||
#include "gdkinput-dmanipulation.h"
|
||||
@@ -360,7 +360,7 @@ reset_viewport (IDirectManipulationViewport *viewport)
|
||||
HR_CHECK_GOTO (hr, failed);
|
||||
|
||||
failed:
|
||||
gdk_win32_com_clear (&content);
|
||||
IUnknown_Release (content);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -392,7 +392,8 @@ gdk_win32_display_close_dmanip_manager (GdkDisplay *display)
|
||||
{
|
||||
IDirectManipulationManager *manager = GDK_DISPLAY_GET_DMANIP_MANAGER (display);
|
||||
|
||||
gdk_win32_com_clear (&manager);
|
||||
if (manager != NULL)
|
||||
IUnknown_Release (manager);
|
||||
|
||||
g_clear_pointer (&GDK_WIN32_DISPLAY (display)->dmanip_items, g_free);
|
||||
}
|
||||
@@ -451,7 +452,8 @@ create_viewport (GdkSurface *surface,
|
||||
return;
|
||||
|
||||
failed:
|
||||
gdk_win32_com_clear (&handler);
|
||||
if (handler)
|
||||
IUnknown_Release (handler);
|
||||
|
||||
close_viewport (pViewport);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user