Compare commits
4 Commits
devel-them
...
shader-cac
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8d497b83a | ||
|
|
37767e056f | ||
|
|
c7e1ab67c6 | ||
|
|
4a2e73a07c |
@@ -2,62 +2,42 @@ stages:
|
||||
- build
|
||||
- flatpak
|
||||
|
||||
.cache-paths: &cache-paths
|
||||
paths:
|
||||
- _ccache/
|
||||
- subprojects/gdk-pixbuf/
|
||||
- subprojects/glib/
|
||||
- subprojects/graphene/
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v1
|
||||
gtk:
|
||||
image: ebassi/gitlab-gtk:latest
|
||||
stage: build
|
||||
before_script:
|
||||
- export CCACHE_DISABLE=true_
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker.sh
|
||||
cache:
|
||||
paths:
|
||||
- subprojects/gdk-pixbuf/
|
||||
- subprojects/glib/
|
||||
- subprojects/graphene/
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
artifacts:
|
||||
when: on_failure
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
|
||||
.mingw-defaults: &mingw-defaults
|
||||
stage: build
|
||||
tags:
|
||||
- win32
|
||||
script:
|
||||
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
|
||||
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
|
||||
cache:
|
||||
key: "%CI_JOB_NAME%"
|
||||
<<: *cache-paths
|
||||
|
||||
msys2-mingw32:
|
||||
variables:
|
||||
MSYSTEM: "MINGW32"
|
||||
CHERE_INVOKING: "yes"
|
||||
<<: *mingw-defaults
|
||||
|
||||
.flatpak-defaults: &flatpak-defaults
|
||||
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
|
||||
stage: flatpak
|
||||
artifacts:
|
||||
paths:
|
||||
- "${APPID}-dev.flatpak"
|
||||
expire_in: 1 day
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
|
||||
flatpak:demo:
|
||||
variables:
|
||||
APPID: org.gtk.Demo
|
||||
<<: *flatpak-defaults
|
||||
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
|
||||
stage: flatpak
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh org.gtk.Demo
|
||||
artifacts:
|
||||
paths:
|
||||
- org.gtk.Demo-dev.flatpak
|
||||
expire_in: 1 day
|
||||
|
||||
flatpak:widget-factory:
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory
|
||||
<<: *flatpak-defaults
|
||||
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
|
||||
stage: flatpak
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh org.gtk.WidgetFactory
|
||||
artifacts:
|
||||
paths:
|
||||
- org.gtk.WidgetFactory-dev.flatpak
|
||||
expire_in: 1 day
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM fedora:28
|
||||
FROM fedora:27
|
||||
|
||||
RUN dnf -y install \
|
||||
adwaita-icon-theme \
|
||||
@@ -28,7 +28,6 @@ RUN dnf -y install \
|
||||
gstreamer1-plugins-good \
|
||||
gstreamer1-plugins-bad-free-devel \
|
||||
gstreamer1-plugins-base-devel \
|
||||
gtk-doc \
|
||||
iso-codes \
|
||||
itstool \
|
||||
json-glib-devel \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v1"
|
||||
TAG="ebassi/gitlab-gtk:latest"
|
||||
|
||||
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
||||
--file "Dockerfile" .
|
||||
|
||||
@@ -4,25 +4,16 @@ set -e
|
||||
|
||||
srcdir=$(pwd)
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
meson \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dbroadway-backend=true \
|
||||
-Dvulkan=yes \
|
||||
_build $srcdir
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
cd _build
|
||||
|
||||
ninja
|
||||
ccache --show-stats
|
||||
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test \
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$MSYSTEM" == "MINGW32" ]]; then
|
||||
export MSYS2_ARCH="i686"
|
||||
else
|
||||
export MSYS2_ARCH="x86_64"
|
||||
fi
|
||||
|
||||
# Update everything
|
||||
pacman --noconfirm -Suy
|
||||
|
||||
# Install the required packages
|
||||
pacman --noconfirm -S --needed \
|
||||
base-devel \
|
||||
git \
|
||||
mingw-w64-$MSYS2_ARCH-toolchain \
|
||||
mingw-w64-$MSYS2_ARCH-ccache \
|
||||
mingw-w64-$MSYS2_ARCH-pkg-config \
|
||||
mingw-w64-$MSYS2_ARCH-gobject-introspection \
|
||||
mingw-w64-$MSYS2_ARCH-meson \
|
||||
mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \
|
||||
mingw-w64-$MSYS2_ARCH-atk \
|
||||
mingw-w64-$MSYS2_ARCH-cairo \
|
||||
mingw-w64-$MSYS2_ARCH-gdk-pixbuf2 \
|
||||
mingw-w64-$MSYS2_ARCH-glib2 \
|
||||
mingw-w64-$MSYS2_ARCH-graphene \
|
||||
mingw-w64-$MSYS2_ARCH-json-glib \
|
||||
mingw-w64-$MSYS2_ARCH-libepoxy \
|
||||
mingw-w64-$MSYS2_ARCH-pango \
|
||||
mingw-w64-$MSYS2_ARCH-fribidi \
|
||||
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
# Build
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
meson \
|
||||
-Denable-x11-backend=false \
|
||||
-Denable-wayland-backend=false \
|
||||
-Denable-win32-backend=true \
|
||||
_build
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
ninja -C _build
|
||||
ccache --show-stats
|
||||
@@ -23,14 +23,17 @@
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- What operating system and version
|
||||
- For Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
- which version of GTK+ you are using
|
||||
- what operating system and version
|
||||
- for Linux, which distribution
|
||||
- if you built GTK+ yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
## Additional information
|
||||
<!--
|
||||
- Screenshots or screen recordings are useful for visual errors
|
||||
- Please report any warning or message printed on the terminal
|
||||
-->
|
||||
- If the bug was a crash, the exact text that was printed out
|
||||
when the crash occurred.
|
||||
- If the bug was a crash, attaching a stack trace obtained using
|
||||
GDB is appreciated; follow the instructions on the wiki:
|
||||
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces
|
||||
-->
|
||||
@@ -1,34 +0,0 @@
|
||||
## Steps to reproduce
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
<!--
|
||||
You should try and reproduce with the demos applications available
|
||||
under the `demos` directory, or the test programs in the `tests` directory.
|
||||
Alternatively, please attach a *small and self-contained* example that
|
||||
exhibits the issue.
|
||||
-->
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- What operating system and version
|
||||
- for Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
## Warnings
|
||||
<!--
|
||||
- If the application generates warning messages before crashing please
|
||||
report them here
|
||||
-->
|
||||
|
||||
## Backtrace
|
||||
<!--
|
||||
- Attaching a stack trace obtained using GDB is appreciated; follow the
|
||||
instructions on the wiki:
|
||||
|
||||
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces
|
||||
-->
|
||||
@@ -60,6 +60,4 @@ $ git checkout -b your-branch
|
||||
|
||||
Once you've finished working on the bug fix or feature, push the branch
|
||||
to the Git repository and open a new merge request, to let the GTK
|
||||
maintainers review your contribution. The [CODE-OWNERS](./docs-CODE-OWNERS)
|
||||
document contains the list of core contributors to GTK and the areas for
|
||||
which they are responsible.
|
||||
maintainers review your contribution.
|
||||
|
||||
84
NEWS
84
NEWS
@@ -1,87 +1,3 @@
|
||||
Overview of Changes in GTK+ 3.94.0
|
||||
==================================
|
||||
|
||||
* GdkPaintable is a new, powerful abstraction for drawable content.
|
||||
gtk4-demo has a new "Paint" demo to show some of its capabilities.
|
||||
|
||||
* There is support for displaying media, with
|
||||
GtkVideo
|
||||
GtkMediaFile
|
||||
GtkMediaStream
|
||||
GtkMediaControls
|
||||
|
||||
* GtkFontChooser now supports OpenType font variations and features.
|
||||
|
||||
* The Ctrl-Shift-E support in the simple IM context has been replaced
|
||||
by an optional completion popup for Emoji alpha codes. This can be
|
||||
enabled with the GtkEntry::enable-emoji-completion property.
|
||||
|
||||
* Wayland has an input method based on the text protocol now
|
||||
|
||||
* Input methods, print backends and media backends have been converted
|
||||
to GIOModules and extension points, and support for generic loadable
|
||||
modules has been dropped. Platform im modules are always included.
|
||||
|
||||
* GdkWindow has been renamed to GdkSurface.
|
||||
|
||||
* Applications can now create their own GtkSnapshot objects for
|
||||
intermediate rendering.
|
||||
|
||||
* Widget event signals have been replaced by event controller, and
|
||||
some new event controllers have been introduced for this:
|
||||
GtkEventControllerMotion
|
||||
GtkEventControllerKey
|
||||
GtkGestureStylus
|
||||
|
||||
* Event controllers can now be created in .ui files.
|
||||
|
||||
* Invalidation tracking has been changed, only gtk_widget_queue_draw is left.
|
||||
|
||||
* Observing widget contents and size is now done by using the
|
||||
GtkWidgetPaintable object instead of connecting to widget signals.
|
||||
|
||||
* The GtkWidget::draw signal has been removed, widgets need
|
||||
to implement GtkWidget::snapshot.
|
||||
|
||||
* GdkTexture now has GdkMemoryTexture and GdkGLTexture subclasses.
|
||||
|
||||
* The Vulkan support in GDK can now use a particular device that is
|
||||
specified by the GDK_VULKAN_DEVICE environment variable. use
|
||||
GDK_VULKAN_DEVICE=list to see them all.
|
||||
|
||||
* GTK+ Inspector
|
||||
- has logging support, and the logging settings have been cleaned up
|
||||
- has an fps overlay
|
||||
|
||||
* Removed APIs and features:
|
||||
Individual event signals such as ::proximity-in-event
|
||||
The ::draw signal
|
||||
threading support
|
||||
non-platform IM modules
|
||||
papi and test print backends
|
||||
GtkPlacesSidebar
|
||||
GtkRecentChooser
|
||||
GtkToolPalette
|
||||
GdkStatus
|
||||
gtk_true, gtk_false
|
||||
gtk_widget_show_now
|
||||
gtk_widget_draw
|
||||
gtk_render_icon_surface
|
||||
|
||||
* Translation updates:
|
||||
Croatian
|
||||
Esperanto
|
||||
Estonian
|
||||
French
|
||||
Friulian
|
||||
Icelandic
|
||||
Latvian
|
||||
Polish
|
||||
Russian
|
||||
Scottish Gaelic
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.93.0
|
||||
==================================
|
||||
|
||||
|
||||
@@ -27,20 +27,6 @@
|
||||
"/share/doc"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--disable-documentation"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/wayland-project/wayland.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
|
||||
@@ -27,20 +27,6 @@
|
||||
"/share/doc"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--disable-documentation"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/wayland-project/wayland.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
|
||||
@@ -286,10 +286,6 @@
|
||||
/* Define to 1 if linux/memfd.h exists */
|
||||
#mesondefine HAVE_LINUX_MEMFD_H
|
||||
|
||||
#mesondefine HAVE_LINUX_INPUT_H
|
||||
|
||||
#mesondefine HAVE_DEV_EVDEV_INPUT_H
|
||||
|
||||
#mesondefine GTK_SYSCONFDIR
|
||||
|
||||
#mesondefine GTK_LOCALEDIR
|
||||
|
||||
@@ -457,12 +457,13 @@ demo_application_window_constructed (GObject *object)
|
||||
static void
|
||||
demo_application_window_size_allocate (GtkWidget *widget,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline)
|
||||
int baseline,
|
||||
GtkAllocation *out_clip)
|
||||
{
|
||||
DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
|
||||
|
||||
GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
|
||||
baseline);
|
||||
baseline, out_clip);
|
||||
|
||||
if (!window->maximized && !window->fullscreen)
|
||||
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
|
||||
|
||||
@@ -321,10 +321,10 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gesture = gtk_gesture_multi_press_new (image);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Create the second image */
|
||||
image = gtk_image_new_from_icon_name ("process-stop");
|
||||
@@ -346,10 +346,10 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gesture = gtk_gesture_multi_press_new (image);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<gresource prefix="/ui">
|
||||
<file preprocess="xml-stripblanks">main.ui</file>
|
||||
<file preprocess="xml-stripblanks">appmenu.ui</file>
|
||||
<file>theme.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/application_demo">
|
||||
<file>application.c</file>
|
||||
@@ -161,6 +160,7 @@
|
||||
<file>expander.c</file>
|
||||
<file>filtermodel.c</file>
|
||||
<file>fishbowl.c</file>
|
||||
<file>widgetbowl.c</file>
|
||||
<file>flowbox.c</file>
|
||||
<file>foreigndrawing.c</file>
|
||||
<file>font_features.c</file>
|
||||
@@ -181,7 +181,6 @@
|
||||
<file>modelbutton.c</file>
|
||||
<file>overlay.c</file>
|
||||
<file>overlay2.c</file>
|
||||
<file>paint.c</file>
|
||||
<file>pagesetup.c</file>
|
||||
<file>paintable.c</file>
|
||||
<file>paintable_animated.c</file>
|
||||
|
||||
@@ -356,11 +356,10 @@ do_dnd (GtkWidget *do_widget)
|
||||
gtk_widget_set_hexpand (fixed, TRUE);
|
||||
gtk_widget_set_vexpand (fixed, TRUE);
|
||||
|
||||
multipress = gtk_gesture_multi_press_new ();
|
||||
multipress = gtk_gesture_multi_press_new (fixed);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (multipress), 0);
|
||||
g_signal_connect (multipress, "pressed", G_CALLBACK (pressed_cb), NULL);
|
||||
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);
|
||||
gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");
|
||||
|
||||
@@ -86,7 +86,7 @@ draw_brush (GtkWidget *widget,
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
gtk_widget_queue_draw_area (widget, update_rect.x, update_rect.y, update_rect.width, update_rect.height);
|
||||
}
|
||||
|
||||
static double start_x;
|
||||
@@ -244,14 +244,13 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
g_signal_connect (da, "size-allocate",
|
||||
G_CALLBACK (scribble_size_allocate), NULL);
|
||||
|
||||
drag = gtk_gesture_drag_new ();
|
||||
drag = gtk_gesture_drag_new (da);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
|
||||
gtk_widget_add_controller (da, GTK_EVENT_CONTROLLER (drag));
|
||||
g_object_set_data_full (G_OBJECT (da), "drag", drag, g_object_unref);
|
||||
|
||||
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), da);
|
||||
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), da);
|
||||
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), da);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -581,7 +581,8 @@ init_pad_controller (GtkWidget *window,
|
||||
gint i;
|
||||
|
||||
action_group = g_simple_action_group_new ();
|
||||
pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
|
||||
pad_controller = gtk_pad_controller_new (GTK_WINDOW (window),
|
||||
G_ACTION_GROUP (action_group),
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
|
||||
@@ -606,7 +607,8 @@ init_pad_controller (GtkWidget *window,
|
||||
|
||||
gtk_pad_controller_set_action_entries (pad_controller, pad_actions,
|
||||
G_N_ELEMENTS (pad_actions));
|
||||
gtk_widget_add_controller (window, GTK_EVENT_CONTROLLER (pad_controller));
|
||||
g_object_set_data_full (G_OBJECT (window), "pad-controller",
|
||||
pad_controller, g_object_unref);
|
||||
|
||||
g_object_unref (action_group);
|
||||
}
|
||||
|
||||
@@ -8,268 +8,165 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkfishbowl.h"
|
||||
#include "gtkgears.h"
|
||||
|
||||
const char *const css =
|
||||
".blurred-button {"
|
||||
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
|
||||
"}"
|
||||
"";
|
||||
GtkWidget *allow_changes;
|
||||
|
||||
char **icon_names = NULL;
|
||||
gsize n_icon_names = 0;
|
||||
#define N_STATS 5
|
||||
|
||||
static void
|
||||
init_icon_names (GtkIconTheme *theme)
|
||||
{
|
||||
GPtrArray *icons;
|
||||
GList *l, *icon_list;
|
||||
#define STATS_UPDATE_TIME G_USEC_PER_SEC
|
||||
|
||||
if (icon_names)
|
||||
return;
|
||||
typedef struct _Stats Stats;
|
||||
struct _Stats {
|
||||
gint64 last_stats;
|
||||
gint64 last_frame;
|
||||
gint last_suggestion;
|
||||
guint frame_counter_max;
|
||||
|
||||
icon_list = gtk_icon_theme_list_icons (theme, NULL);
|
||||
icons = g_ptr_array_new ();
|
||||
|
||||
for (l = icon_list; l; l = l->next)
|
||||
{
|
||||
if (g_str_has_suffix (l->data, "symbolic"))
|
||||
continue;
|
||||
|
||||
g_ptr_array_add (icons, g_strdup (l->data));
|
||||
}
|
||||
|
||||
n_icon_names = icons->len;
|
||||
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
|
||||
icon_names = (char **) g_ptr_array_free (icons, FALSE);
|
||||
|
||||
/* don't free strings, we assigned them to the array */
|
||||
g_list_free_full (icon_list, g_free);
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_random_icon_name (GtkIconTheme *theme)
|
||||
{
|
||||
init_icon_names (theme);
|
||||
|
||||
return icon_names[g_random_int_range(0, n_icon_names)];
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_icon (void)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_button (void)
|
||||
{
|
||||
return gtk_button_new_with_label ("Button");
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_blurred_button (void)
|
||||
{
|
||||
GtkWidget *w = gtk_button_new ();
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_font_button (void)
|
||||
{
|
||||
return gtk_font_button_new ();
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_level_bar (void)
|
||||
{
|
||||
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
|
||||
|
||||
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
|
||||
|
||||
/* Force them to be a bit larger */
|
||||
gtk_widget_set_size_request (w, 200, -1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinner (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spinner_new ();
|
||||
|
||||
gtk_spinner_start (GTK_SPINNER (w));
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinbutton (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_label (void)
|
||||
{
|
||||
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
|
||||
|
||||
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_video (void)
|
||||
{
|
||||
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
GtkWidget *w = gtk_image_new_from_paintable (GDK_PAINTABLE (stream));
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
gtk_media_stream_play (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gears (void)
|
||||
{
|
||||
GtkWidget *w = gtk_gears_new ();
|
||||
|
||||
gtk_widget_set_size_request (w, 100, 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_switch (void)
|
||||
{
|
||||
GtkWidget *w = gtk_switch_new ();
|
||||
|
||||
gtk_switch_set_state (GTK_SWITCH (w), TRUE);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
GtkWidget * (*create_func) (void);
|
||||
} widget_types[] = {
|
||||
{ "Icon", create_icon },
|
||||
{ "Button", create_button },
|
||||
{ "Blurbutton", create_blurred_button },
|
||||
{ "Fontbutton", create_font_button },
|
||||
{ "Levelbar", create_level_bar },
|
||||
{ "Label", create_label },
|
||||
{ "Spinner", create_spinner },
|
||||
{ "Spinbutton", create_spinbutton },
|
||||
{ "Video", create_video },
|
||||
{ "Gears", create_gears },
|
||||
{ "Switch", create_switch },
|
||||
guint stats_index;
|
||||
guint frame_counter[N_STATS];
|
||||
guint item_counter[N_STATS];
|
||||
};
|
||||
|
||||
static int selected_widget_type = -1;
|
||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||
static Stats *
|
||||
get_stats (GtkWidget *widget)
|
||||
{
|
||||
static GQuark stats_quark = 0;
|
||||
Stats *stats;
|
||||
|
||||
if (G_UNLIKELY (stats_quark == 0))
|
||||
stats_quark = g_quark_from_static_string ("stats");
|
||||
|
||||
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
|
||||
if (stats == NULL)
|
||||
{
|
||||
stats = g_new0 (Stats, 1);
|
||||
g_object_set_qdata_full (G_OBJECT (widget), stats_quark, stats, g_free);
|
||||
stats->last_frame = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
stats->last_stats = stats->last_frame;
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
static void
|
||||
set_widget_type (GtkFishbowl *fishbowl,
|
||||
int widget_type_index)
|
||||
do_stats (GtkWidget *widget,
|
||||
GtkWidget *info_label,
|
||||
gint *suggested_change)
|
||||
{
|
||||
GtkWidget *window, *headerbar;
|
||||
Stats *stats;
|
||||
gint64 frame_time;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return;
|
||||
stats = get_stats (widget);
|
||||
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
|
||||
selected_widget_type = widget_type_index;
|
||||
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
|
||||
{
|
||||
char *new_label;
|
||||
guint i, n_frames;
|
||||
|
||||
gtk_fishbowl_set_creation_func (fishbowl,
|
||||
widget_types[selected_widget_type].create_func);
|
||||
n_frames = 0;
|
||||
for (i = 0; i < N_STATS; i++)
|
||||
{
|
||||
n_frames += stats->frame_counter[i];
|
||||
}
|
||||
|
||||
new_label = g_strdup_printf ("icons - %.1f fps",
|
||||
(double) G_USEC_PER_SEC * n_frames
|
||||
/ (N_STATS * STATS_UPDATE_TIME));
|
||||
gtk_label_set_label (GTK_LABEL (info_label), new_label);
|
||||
g_free (new_label);
|
||||
|
||||
window = gtk_widget_get_toplevel (GTK_WIDGET (fishbowl));
|
||||
headerbar = gtk_window_get_titlebar (GTK_WINDOW (window));
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
if (stats->frame_counter[stats->stats_index] >= 19 * stats->frame_counter_max / 20)
|
||||
{
|
||||
if (stats->last_suggestion > 0)
|
||||
stats->last_suggestion *= 2;
|
||||
else
|
||||
stats->last_suggestion = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stats->last_suggestion < 0)
|
||||
stats->last_suggestion--;
|
||||
else
|
||||
stats->last_suggestion = -1;
|
||||
stats->last_suggestion = MAX (stats->last_suggestion, 1 - (int) stats->item_counter[stats->stats_index]);
|
||||
}
|
||||
|
||||
void
|
||||
next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index;
|
||||
|
||||
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
stats->stats_index = (stats->stats_index + 1) % N_STATS;
|
||||
stats->frame_counter[stats->stats_index] = 0;
|
||||
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
|
||||
stats->last_stats = frame_time;
|
||||
|
||||
if (suggested_change)
|
||||
*suggested_change = stats->last_suggestion;
|
||||
else
|
||||
stats->last_suggestion = 0;
|
||||
}
|
||||
else
|
||||
new_index = selected_widget_type + 1;
|
||||
{
|
||||
if (suggested_change)
|
||||
*suggested_change = 0;
|
||||
}
|
||||
|
||||
set_widget_type (fishbowl, new_index);
|
||||
stats->last_frame = frame_time;
|
||||
stats->frame_counter[stats->stats_index]++;
|
||||
stats->frame_counter_max = MAX (stats->frame_counter_max, stats->frame_counter[stats->stats_index]);
|
||||
}
|
||||
|
||||
void
|
||||
prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
static void
|
||||
stats_update (GtkWidget *widget)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index;
|
||||
Stats *stats;
|
||||
|
||||
if (selected_widget_type - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = selected_widget_type - 1;
|
||||
stats = get_stats (widget);
|
||||
|
||||
set_widget_type (fishbowl, new_index);
|
||||
stats->item_counter[stats->stats_index] = gtk_fishbowl_get_count (GTK_FISHBOWL (widget));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_fish (GtkWidget *bowl,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer info_label)
|
||||
{
|
||||
gint suggested_change = 0;
|
||||
|
||||
do_stats (bowl,
|
||||
info_label,
|
||||
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allow_changes)) ? &suggested_change : NULL);
|
||||
|
||||
gtk_fishbowl_set_count (GTK_FISHBOWL (bowl),
|
||||
gtk_fishbowl_get_count (GTK_FISHBOWL (bowl)) + suggested_change);
|
||||
stats_update (bowl);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_fishbowl (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkCssProvider *provider = NULL;
|
||||
|
||||
if (provider == NULL)
|
||||
{
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *bowl;
|
||||
GtkWidget *bowl, *info_label;
|
||||
|
||||
g_type_ensure (GTK_TYPE_FISHBOWL);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
|
||||
gtk_builder_add_callback_symbols (builder,
|
||||
"next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb),
|
||||
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
|
||||
NULL);
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
|
||||
set_widget_type (GTK_FISHBOWL (bowl), 0);
|
||||
gtk_fishbowl_set_use_icons (GTK_FISHBOWL (bowl), TRUE);
|
||||
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
|
||||
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
gtk_widget_add_tick_callback (bowl, move_fish, info_label, NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -7,43 +7,7 @@
|
||||
<object class="GtkHeaderBar" id="">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-start-symbolic</property>
|
||||
<signal name="clicked" handler="prev_button_clicked_cb" object="bowl" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
<signal name="clicked" handler="next_button_clicked_cb" object="bowl" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">fps</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" bind-source="bowl" bind-property="framerate"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Icons, </property>
|
||||
<object class="GtkLabel" id="info_label">
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
@@ -84,7 +48,6 @@
|
||||
<object class="GtkFishbowl" id="bowl">
|
||||
<property name="visible">True</property>
|
||||
<property name="animating">True</property>
|
||||
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="font">Sans 12</property>
|
||||
<property name="level">family|style|size|variations|features</property>
|
||||
<signal name="font-set" handler="font_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
@@ -133,6 +132,7 @@
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
|
||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||
<signal name="key-press-event" handler="entry_key_press"/>
|
||||
<signal name="activate" handler="stop_edit"/>
|
||||
<property name="valign">start</property>
|
||||
<property name="width-chars">50</property>
|
||||
|
||||
@@ -1669,12 +1669,12 @@ stop_edit (void)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entry_key_press (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
GtkEntry *entry)
|
||||
entry_key_press (GtkEntry *entry, GdkEventKey *event)
|
||||
{
|
||||
guint keyval;
|
||||
|
||||
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
|
||||
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
@@ -1694,7 +1694,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *feature_list;
|
||||
GtkEventController *controller;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
|
||||
|
||||
@@ -1704,6 +1703,7 @@ do_font_features (GtkWidget *do_widget)
|
||||
gtk_builder_add_callback_symbol (builder, "reset", reset_features);
|
||||
gtk_builder_add_callback_symbol (builder, "stop_edit", G_CALLBACK (stop_edit));
|
||||
gtk_builder_add_callback_symbol (builder, "toggle_edit", G_CALLBACK (toggle_edit));
|
||||
gtk_builder_add_callback_symbol (builder, "entry_key_press", G_CALLBACK (entry_key_press));
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
@@ -1718,11 +1718,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
||||
gtk_widget_add_controller (entry, controller);
|
||||
|
||||
add_check_group (feature_list, _("Kerning"), (const char *[]){ "kern", NULL });
|
||||
add_check_group (feature_list, _("Ligatures"), (const char *[]){ "liga",
|
||||
"dlig",
|
||||
|
||||
@@ -68,7 +68,8 @@ plane_snapshot (GtkWidget *widget,
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
"FontPlane");
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
@@ -207,27 +208,23 @@ plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
static void
|
||||
gtk_font_plane_init (GtkFontPlane *plane)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE);
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
|
||||
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (gesture, "drag-begin",
|
||||
plane->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->drag_gesture, "drag-begin",
|
||||
G_CALLBACK (plane_drag_gesture_begin), plane);
|
||||
g_signal_connect (gesture, "drag-update",
|
||||
g_signal_connect (plane->drag_gesture, "drag-update",
|
||||
G_CALLBACK (plane_drag_gesture_update), plane);
|
||||
g_signal_connect (gesture, "drag-end",
|
||||
g_signal_connect (plane->drag_gesture, "drag-end",
|
||||
G_CALLBACK (plane_drag_gesture_end), plane);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (plane->drag_gesture), 0);
|
||||
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
plane->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->long_press_gesture, "pressed",
|
||||
G_CALLBACK (hold_action), plane);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (plane->long_press_gesture),
|
||||
TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -238,6 +235,9 @@ plane_finalize (GObject *object)
|
||||
g_clear_object (&plane->weight_adj);
|
||||
g_clear_object (&plane->width_adj);
|
||||
|
||||
g_clear_object (&plane->drag_gesture);
|
||||
g_clear_object (&plane->long_press_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_font_plane_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ struct _GtkFontPlane
|
||||
GtkAdjustment *width_adj;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkGesture *long_press_gesture;
|
||||
};
|
||||
|
||||
struct _GtkFontPlaneClass
|
||||
|
||||
@@ -157,12 +157,12 @@ do_gestures (GtkWidget *do_widget)
|
||||
NULL, NULL);
|
||||
|
||||
/* Swipe */
|
||||
gesture = gtk_gesture_swipe_new ();
|
||||
gesture = gtk_gesture_swipe_new (drawing_area);
|
||||
g_signal_connect (gesture, "swipe",
|
||||
G_CALLBACK (swipe_gesture_swept), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
|
||||
/* 3fg swipe for touchpads */
|
||||
gesture = g_object_new (GTK_TYPE_GESTURE_SWIPE,
|
||||
@@ -178,30 +178,30 @@ do_gestures (GtkWidget *do_widget)
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
|
||||
/* Long press */
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
gesture = gtk_gesture_long_press_new (drawing_area);
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (long_press_gesture_pressed), drawing_area);
|
||||
g_signal_connect (gesture, "end",
|
||||
G_CALLBACK (long_press_gesture_end), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
|
||||
/* Rotate */
|
||||
rotate = gesture = gtk_gesture_rotate_new ();
|
||||
rotate = gesture = gtk_gesture_rotate_new (drawing_area);
|
||||
g_signal_connect (gesture, "angle-changed",
|
||||
G_CALLBACK (rotation_angle_changed), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
|
||||
/* Zoom */
|
||||
zoom = gesture = gtk_gesture_zoom_new ();
|
||||
zoom = gesture = gtk_gesture_zoom_new (drawing_area);
|
||||
g_signal_connect (gesture, "scale-changed",
|
||||
G_CALLBACK (zoom_scale_changed), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -24,18 +24,13 @@ typedef struct _GtkFishbowlChild GtkFishbowlChild;
|
||||
|
||||
struct _GtkFishbowlPrivate
|
||||
{
|
||||
GtkFishCreationFunc creation_func;
|
||||
GList *children;
|
||||
guint count;
|
||||
|
||||
gint64 last_frame_time;
|
||||
gint64 update_delay;
|
||||
guint tick_id;
|
||||
|
||||
double framerate;
|
||||
int last_benchmark_change;
|
||||
|
||||
guint benchmark : 1;
|
||||
guint use_icons: 1;
|
||||
};
|
||||
|
||||
struct _GtkFishbowlChild
|
||||
@@ -50,25 +45,18 @@ struct _GtkFishbowlChild
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ANIMATING,
|
||||
PROP_BENCHMARK,
|
||||
PROP_COUNT,
|
||||
PROP_FRAMERATE,
|
||||
PROP_UPDATE_DELAY,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_WIDGET)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_CONTAINER)
|
||||
|
||||
static void
|
||||
gtk_fishbowl_init (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (fishbowl), FALSE);
|
||||
|
||||
priv->update_delay = G_USEC_PER_SEC;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,6 +72,15 @@ gtk_fishbowl_new (void)
|
||||
return g_object_new (GTK_TYPE_FISHBOWL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_use_icons (GtkFishbowl *fishbowl,
|
||||
gboolean use_icons)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
priv->use_icons = use_icons;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
@@ -130,7 +127,8 @@ gtk_fishbowl_measure (GtkWidget *widget,
|
||||
static void
|
||||
gtk_fishbowl_size_allocate (GtkWidget *widget,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline)
|
||||
int baseline,
|
||||
GtkAllocation *out_clip)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
@@ -141,6 +139,8 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
|
||||
|
||||
for (children = priv->children; children; children = children->next)
|
||||
{
|
||||
GtkAllocation child_clip;
|
||||
|
||||
child = children->data;
|
||||
|
||||
if (!gtk_widget_get_visible (child->widget))
|
||||
@@ -152,7 +152,7 @@ gtk_fishbowl_size_allocate (GtkWidget *widget,
|
||||
child_allocation.width = child_requisition.width;
|
||||
child_allocation.height = child_requisition.height;
|
||||
|
||||
gtk_widget_size_allocate (child->widget, &child_allocation, -1);
|
||||
gtk_widget_size_allocate (child->widget, &child_allocation, -1, &child_clip);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,9 +164,10 @@ new_speed (void)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_add (GtkFishbowl *fishbowl,
|
||||
GtkWidget *widget)
|
||||
gtk_fishbowl_add (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GtkFishbowlChild *child_info;
|
||||
|
||||
@@ -188,12 +189,13 @@ gtk_fishbowl_add (GtkFishbowl *fishbowl,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_remove (GtkFishbowl *fishbowl,
|
||||
GtkWidget *widget)
|
||||
gtk_fishbowl_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GtkFishbowlChild *child;
|
||||
GtkWidget *widget_bowl = GTK_WIDGET (fishbowl);
|
||||
GtkWidget *widget_container = GTK_WIDGET (container);
|
||||
GList *children;
|
||||
|
||||
for (children = priv->children; children; children = children->next)
|
||||
@@ -210,8 +212,8 @@ gtk_fishbowl_remove (GtkFishbowl *fishbowl,
|
||||
g_list_free (children);
|
||||
g_free (child);
|
||||
|
||||
if (was_visible && gtk_widget_get_visible (widget_bowl))
|
||||
gtk_widget_queue_resize (widget_bowl);
|
||||
if (was_visible && gtk_widget_get_visible (widget_container))
|
||||
gtk_widget_queue_resize (widget_container);
|
||||
|
||||
priv->count--;
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]);
|
||||
@@ -220,6 +222,26 @@ gtk_fishbowl_remove (GtkFishbowl *fishbowl,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_forall (GtkContainer *container,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GtkFishbowlChild *child;
|
||||
GList *children;
|
||||
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
|
||||
(* callback) (child->widget, callback_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_dispose (GObject *object)
|
||||
{
|
||||
@@ -245,18 +267,10 @@ gtk_fishbowl_set_property (GObject *object,
|
||||
gtk_fishbowl_set_animating (fishbowl, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_BENCHMARK:
|
||||
gtk_fishbowl_set_benchmark (fishbowl, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_COUNT:
|
||||
gtk_fishbowl_set_count (fishbowl, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_DELAY:
|
||||
gtk_fishbowl_set_update_delay (fishbowl, g_value_get_int64 (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -277,22 +291,10 @@ gtk_fishbowl_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_fishbowl_get_animating (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_BENCHMARK:
|
||||
g_value_set_boolean (value, gtk_fishbowl_get_benchmark (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_COUNT:
|
||||
g_value_set_uint (value, gtk_fishbowl_get_count (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_FRAMERATE:
|
||||
g_value_set_double (value, gtk_fishbowl_get_framerate (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_DELAY:
|
||||
g_value_set_int64 (value, gtk_fishbowl_get_update_delay (fishbowl));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -304,6 +306,7 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_fishbowl_dispose;
|
||||
object_class->set_property = gtk_fishbowl_set_property;
|
||||
@@ -312,6 +315,10 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
widget_class->measure = gtk_fishbowl_measure;
|
||||
widget_class->size_allocate = gtk_fishbowl_size_allocate;
|
||||
|
||||
container_class->add = gtk_fishbowl_add;
|
||||
container_class->remove = gtk_fishbowl_remove;
|
||||
container_class->forall = gtk_fishbowl_forall;
|
||||
|
||||
props[PROP_ANIMATING] =
|
||||
g_param_spec_boolean ("animating",
|
||||
"animating",
|
||||
@@ -319,36 +326,13 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
props[PROP_BENCHMARK] =
|
||||
g_param_spec_boolean ("benchmark",
|
||||
"Benchmark",
|
||||
"Adapt the count property to hit the maximum framerate",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
props[PROP_COUNT] =
|
||||
g_param_spec_uint ("count",
|
||||
"Count",
|
||||
"Number of widgets",
|
||||
0, G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
props[PROP_FRAMERATE] =
|
||||
g_param_spec_double ("framerate",
|
||||
"Framerate",
|
||||
"Framerate of this widget in frames per second",
|
||||
0, G_MAXDOUBLE,
|
||||
0,
|
||||
G_PARAM_READABLE);
|
||||
|
||||
props[PROP_UPDATE_DELAY] =
|
||||
g_param_spec_int64 ("update-delay",
|
||||
"Update delay",
|
||||
"Number of usecs between updates",
|
||||
0, G_MAXINT64,
|
||||
G_USEC_PER_SEC,
|
||||
G_PARAM_READWRITE);
|
||||
G_PARAM_READABLE);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
|
||||
}
|
||||
@@ -361,58 +345,96 @@ gtk_fishbowl_get_count (GtkFishbowl *fishbowl)
|
||||
return priv->count;
|
||||
}
|
||||
|
||||
char **icon_names = NULL;
|
||||
gsize n_icon_names = 0;
|
||||
|
||||
static void
|
||||
init_icon_names (GtkIconTheme *theme)
|
||||
{
|
||||
GPtrArray *icons;
|
||||
GList *l, *icon_list;
|
||||
|
||||
if (icon_names)
|
||||
return;
|
||||
|
||||
icon_list = gtk_icon_theme_list_icons (theme, NULL);
|
||||
icons = g_ptr_array_new ();
|
||||
|
||||
for (l = icon_list; l; l = l->next)
|
||||
{
|
||||
if (g_str_has_suffix (l->data, "symbolic"))
|
||||
continue;
|
||||
|
||||
g_ptr_array_add (icons, g_strdup (l->data));
|
||||
}
|
||||
|
||||
n_icon_names = icons->len;
|
||||
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
|
||||
icon_names = (char **) g_ptr_array_free (icons, FALSE);
|
||||
|
||||
/* don't free strings, we assigned them to the array */
|
||||
g_list_free_full (icon_list, g_free);
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_random_icon_name (GtkIconTheme *theme)
|
||||
{
|
||||
init_icon_names (theme);
|
||||
|
||||
return icon_names[g_random_int_range(0, n_icon_names)];
|
||||
}
|
||||
|
||||
static GType
|
||||
get_random_widget_type ()
|
||||
{
|
||||
GType types[] = {
|
||||
GTK_TYPE_SWITCH,
|
||||
GTK_TYPE_BUTTON,
|
||||
GTK_TYPE_ENTRY,
|
||||
GTK_TYPE_SPIN_BUTTON,
|
||||
GTK_TYPE_FONT_BUTTON,
|
||||
GTK_TYPE_SCROLLBAR,
|
||||
GTK_TYPE_SCALE,
|
||||
GTK_TYPE_LEVEL_BAR,
|
||||
GTK_TYPE_PROGRESS_BAR,
|
||||
GTK_TYPE_RADIO_BUTTON,
|
||||
GTK_TYPE_CHECK_BUTTON
|
||||
};
|
||||
return types[g_random_int_range (0, G_N_ELEMENTS (types))];
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
|
||||
guint count)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
if (priv->count == count)
|
||||
return;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (fishbowl));
|
||||
|
||||
while (priv->count > count)
|
||||
{
|
||||
gtk_fishbowl_remove (fishbowl, gtk_widget_get_first_child (GTK_WIDGET (fishbowl)));
|
||||
gtk_container_remove (GTK_CONTAINER (fishbowl),
|
||||
((GtkFishbowlChild *) priv->children->data)->widget);
|
||||
}
|
||||
|
||||
while (priv->count < count)
|
||||
{
|
||||
GtkWidget *new_widget;
|
||||
|
||||
new_widget = priv->creation_func ();
|
||||
if (priv->use_icons)
|
||||
{
|
||||
new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
|
||||
gtk_image_set_icon_size (GTK_IMAGE (new_widget), GTK_ICON_SIZE_LARGE);
|
||||
}
|
||||
else
|
||||
new_widget = g_object_new (get_random_widget_type (), NULL);
|
||||
|
||||
gtk_fishbowl_add (fishbowl, new_widget);
|
||||
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (fishbowl));
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
return priv->benchmark;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
|
||||
gboolean benchmark)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
if (priv->benchmark == benchmark)
|
||||
return;
|
||||
|
||||
priv->benchmark = benchmark;
|
||||
if (!benchmark)
|
||||
priv->last_benchmark_change = 0;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_BENCHMARK]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
|
||||
{
|
||||
@@ -421,111 +443,6 @@ gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
|
||||
return priv->tick_id != 0;
|
||||
}
|
||||
|
||||
static gint64
|
||||
guess_refresh_interval (GdkFrameClock *frame_clock)
|
||||
{
|
||||
gint64 interval;
|
||||
gint64 i;
|
||||
|
||||
interval = G_MAXINT64;
|
||||
|
||||
for (i = gdk_frame_clock_get_history_start (frame_clock);
|
||||
i < gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
i++)
|
||||
{
|
||||
GdkFrameTimings *t, *before;
|
||||
gint64 ts, before_ts;
|
||||
|
||||
t = gdk_frame_clock_get_timings (frame_clock, i);
|
||||
before = gdk_frame_clock_get_timings (frame_clock, i - 1);
|
||||
if (t == NULL || before == NULL)
|
||||
continue;
|
||||
|
||||
ts = gdk_frame_timings_get_frame_time (t);
|
||||
before_ts = gdk_frame_timings_get_frame_time (before);
|
||||
if (ts == 0 || before_ts == 0)
|
||||
continue;
|
||||
|
||||
interval = MIN (interval, ts - before_ts);
|
||||
}
|
||||
|
||||
if (interval == G_MAXINT64)
|
||||
return 0;
|
||||
|
||||
return interval;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GdkFrameClock *frame_clock;
|
||||
GdkFrameTimings *start, *end;
|
||||
gint64 start_counter, end_counter;
|
||||
gint64 n_frames, expected_frames;
|
||||
gint64 start_timestamp, end_timestamp;
|
||||
gint64 interval;
|
||||
|
||||
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
||||
if (frame_clock == NULL)
|
||||
return;
|
||||
|
||||
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end_counter - start_counter < 4)
|
||||
return;
|
||||
|
||||
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||
if (start_timestamp == 0 || end_timestamp == 0)
|
||||
{
|
||||
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||
}
|
||||
|
||||
n_frames = end_counter - start_counter;
|
||||
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||
|
||||
if (!priv->benchmark)
|
||||
return;
|
||||
|
||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||
if (interval == 0)
|
||||
{
|
||||
interval = guess_refresh_interval (frame_clock);
|
||||
if (interval == 0)
|
||||
return;
|
||||
}
|
||||
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||
|
||||
if (n_frames >= expected_frames)
|
||||
{
|
||||
if (priv->last_benchmark_change > 0)
|
||||
priv->last_benchmark_change *= 2;
|
||||
else
|
||||
priv->last_benchmark_change = 1;
|
||||
}
|
||||
else if (n_frames + 1 < expected_frames)
|
||||
{
|
||||
if (priv->last_benchmark_change < 0)
|
||||
priv->last_benchmark_change--;
|
||||
else
|
||||
priv->last_benchmark_change = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->last_benchmark_change = 0;
|
||||
}
|
||||
|
||||
gtk_fishbowl_set_count (fishbowl, MAX (1, (int) priv->count + priv->last_benchmark_change));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_fishbowl_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
@@ -536,11 +453,9 @@ gtk_fishbowl_tick (GtkWidget *widget,
|
||||
GtkFishbowlChild *child;
|
||||
GList *l;
|
||||
gint64 frame_time, elapsed;
|
||||
gboolean do_update;
|
||||
|
||||
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
elapsed = frame_time - priv->last_frame_time;
|
||||
do_update = frame_time / priv->update_delay != priv->last_frame_time / priv->update_delay;
|
||||
priv->last_frame_time = frame_time;
|
||||
|
||||
/* last frame was 0, so we're just starting to animate */
|
||||
@@ -579,9 +494,6 @@ gtk_fishbowl_tick (GtkWidget *widget,
|
||||
|
||||
gtk_widget_queue_allocate (widget);
|
||||
|
||||
if (do_update)
|
||||
gtk_fishbowl_do_update (fishbowl);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -606,57 +518,8 @@ gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
|
||||
priv->last_frame_time = 0;
|
||||
gtk_widget_remove_tick_callback (GTK_WIDGET (fishbowl), priv->tick_id);
|
||||
priv->tick_id = 0;
|
||||
priv->framerate = 0;
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_ANIMATING]);
|
||||
}
|
||||
|
||||
double
|
||||
gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
return priv->framerate;
|
||||
}
|
||||
|
||||
gint64
|
||||
gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
return priv->update_delay;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
|
||||
gint64 update_delay)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
if (priv->update_delay == update_delay)
|
||||
return;
|
||||
|
||||
priv->update_delay = update_delay;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_UPDATE_DELAY]);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
|
||||
GtkFishCreationFunc creation_func)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (fishbowl));
|
||||
|
||||
gtk_fishbowl_set_count (fishbowl, 0);
|
||||
priv->last_benchmark_change = 0;
|
||||
|
||||
priv->creation_func = creation_func;
|
||||
|
||||
gtk_fishbowl_set_count (fishbowl, 1);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (fishbowl));
|
||||
}
|
||||
|
||||
@@ -32,37 +32,29 @@ G_BEGIN_DECLS
|
||||
typedef struct _GtkFishbowl GtkFishbowl;
|
||||
typedef struct _GtkFishbowlClass GtkFishbowlClass;
|
||||
|
||||
typedef GtkWidget * (* GtkFishCreationFunc) (void);
|
||||
|
||||
struct _GtkFishbowl
|
||||
{
|
||||
GtkWidget parent;
|
||||
GtkContainer container;
|
||||
};
|
||||
|
||||
struct _GtkFishbowlClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
GtkContainerClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_fishbowl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget* gtk_fishbowl_new (void);
|
||||
|
||||
void gtk_fishbowl_set_use_icons (GtkFishbowl *fishbowl,
|
||||
gboolean use_icons);
|
||||
|
||||
guint gtk_fishbowl_get_count (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
|
||||
guint count);
|
||||
gboolean gtk_fishbowl_get_animating (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
gboolean gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
double gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl);
|
||||
gint64 gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
|
||||
gint64 update_delay);
|
||||
void gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
|
||||
GtkFishCreationFunc creation_func);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -105,14 +105,14 @@ follow_if_link (GtkWidget *text_view,
|
||||
/* Links can be activated by pressing Enter.
|
||||
*/
|
||||
static gboolean
|
||||
key_pressed (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
GtkWidget *text_view)
|
||||
key_press_event (GtkWidget *text_view,
|
||||
GdkEventKey *event)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextBuffer *buffer;
|
||||
guint keyval;
|
||||
|
||||
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
|
||||
|
||||
switch (keyval)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ key_pressed (GtkEventController *controller,
|
||||
break;
|
||||
}
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
@@ -241,7 +241,6 @@ do_hypertext (GtkWidget *do_widget)
|
||||
GtkWidget *view;
|
||||
GtkWidget *sw;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkEventController *controller;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
|
||||
@@ -256,9 +255,8 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
|
||||
gtk_widget_add_controller (view, controller);
|
||||
g_signal_connect (view, "key-press-event",
|
||||
G_CALLBACK (key_press_event), NULL);
|
||||
g_signal_connect (view, "event",
|
||||
G_CALLBACK (event_cb), NULL);
|
||||
|
||||
|
||||
@@ -325,7 +325,6 @@ do_images (GtkWidget *do_widget)
|
||||
GtkWidget *image;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GdkPaintable *paintable;
|
||||
GIcon *gicon;
|
||||
|
||||
if (!window)
|
||||
@@ -446,22 +445,6 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_media_stream_set_loop (gtk_video_get_media_stream (GTK_VIDEO (video)), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), video);
|
||||
|
||||
/* Widget paintables */
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), vbox);
|
||||
|
||||
label = gtk_label_new (NULL);
|
||||
gtk_label_set_markup (GTK_LABEL (label),
|
||||
"<u>GtkWidgetPaintable</u>");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label);
|
||||
|
||||
paintable = gtk_widget_paintable_new (do_widget);
|
||||
image = gtk_image_new_from_paintable (paintable);
|
||||
gtk_image_set_can_shrink (GTK_IMAGE (image), TRUE);
|
||||
gtk_widget_set_size_request (image, 100, 100);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), image);
|
||||
|
||||
/* Sensitivity control */
|
||||
button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
|
||||
gtk_box_pack_start (GTK_BOX (base_vbox), button);
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <dirent.h>
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <glib.h>
|
||||
@@ -174,9 +173,9 @@ languages_variant_init (const char *variant)
|
||||
{
|
||||
gboolean res;
|
||||
gsize buf_len;
|
||||
char *buf = NULL;
|
||||
char *filename = NULL;
|
||||
GError *error = NULL;
|
||||
g_autofree char *buf = NULL;
|
||||
g_autofree char *filename = NULL;
|
||||
g_autoptr (GError) error = NULL;
|
||||
|
||||
bindtextdomain (variant, ISO_CODES_LOCALESDIR);
|
||||
bind_textdomain_codeset (variant, "UTF-8");
|
||||
@@ -186,25 +185,19 @@ languages_variant_init (const char *variant)
|
||||
res = g_file_get_contents (filename, &buf, &buf_len, &error);
|
||||
if (res)
|
||||
{
|
||||
GMarkupParseContext *ctx = NULL;
|
||||
g_autoptr (GMarkupParseContext) ctx = NULL;
|
||||
GMarkupParser parser = { languages_parse_start_tag, NULL, NULL, NULL, NULL };
|
||||
|
||||
ctx = g_markup_parse_context_new (&parser, 0, NULL, NULL);
|
||||
|
||||
g_free (error);
|
||||
error = NULL;
|
||||
res = g_markup_parse_context_parse (ctx, buf, buf_len, &error);
|
||||
g_free (ctx);
|
||||
|
||||
if (!res)
|
||||
g_warning ("Failed to parse '%s': %s\n", filename, error->message);
|
||||
}
|
||||
else
|
||||
g_warning ("Failed to load '%s': %s\n", filename, error->message);
|
||||
|
||||
g_free (error);
|
||||
g_free (filename);
|
||||
g_free (buf);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -532,106 +532,7 @@ fontify (GtkTextBuffer *source_buffer)
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_image (const char *resource)
|
||||
{
|
||||
GtkWidget *sw, *image;
|
||||
|
||||
image = gtk_image_new_from_resource (resource);
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), image);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_text (const char *resource)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *textview, *sw;
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
g_assert (bytes);
|
||||
|
||||
g_assert (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL));
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
g_object_set (textview,
|
||||
"left-margin", 20,
|
||||
"right-margin", 20,
|
||||
"top-margin", 20,
|
||||
"bottom-margin", 20,
|
||||
NULL);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
|
||||
/* Make it a bit nicer for text. */
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (textview), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (textview), 2);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
if (g_str_has_suffix (resource, ".c"))
|
||||
fontify (buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (sw), textview);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_video (const char *resource)
|
||||
{
|
||||
GtkWidget *video;
|
||||
|
||||
video = gtk_video_new_for_resource (resource);
|
||||
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
|
||||
|
||||
return video;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_nothing (const char *resource)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
char *str;
|
||||
|
||||
str = g_strdup_printf ("The lazy GTK developers forgot to add a way to display the resource '%s'", resource);
|
||||
widget = gtk_label_new (str);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
|
||||
|
||||
g_free (str);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static struct {
|
||||
const char *extension;
|
||||
GtkWidget * (* display_func) (const char *resource);
|
||||
} display_funcs[] = {
|
||||
{ ".gif", display_image },
|
||||
{ ".jpg", display_image },
|
||||
{ ".png", display_image },
|
||||
{ ".c", display_text },
|
||||
{ ".css", display_text },
|
||||
{ ".glsl", display_text },
|
||||
{ ".h", display_text },
|
||||
{ ".txt", display_text },
|
||||
{ ".ui", display_text },
|
||||
{ ".webm", display_video }
|
||||
};
|
||||
static GtkWidget *create_text (GtkWidget **text_view, gboolean is_source);
|
||||
|
||||
static void
|
||||
add_data_tab (const gchar *demoname)
|
||||
@@ -639,7 +540,7 @@ add_data_tab (const gchar *demoname)
|
||||
gchar *resource_dir, *resource_name;
|
||||
gchar **resources;
|
||||
GtkWidget *widget, *label;
|
||||
guint i, j;
|
||||
guint i;
|
||||
|
||||
resource_dir = g_strconcat ("/", demoname, NULL);
|
||||
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
|
||||
@@ -653,22 +554,58 @@ add_data_tab (const gchar *demoname)
|
||||
{
|
||||
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
|
||||
|
||||
for (j = 0; j < G_N_ELEMENTS(display_funcs); j++)
|
||||
widget = gtk_image_new_from_resource (resource_name);
|
||||
if (gtk_image_get_paintable (GTK_IMAGE (widget)) == NULL)
|
||||
{
|
||||
if (g_str_has_suffix (resource_name, display_funcs[j].extension))
|
||||
break;
|
||||
GBytes *bytes;
|
||||
|
||||
/* So we've used the best API available to figure out it's
|
||||
* not an image. Let's try something else then.
|
||||
*/
|
||||
g_object_ref_sink (widget);
|
||||
g_object_unref (widget);
|
||||
|
||||
bytes = g_resources_lookup_data (resource_name, 0, NULL);
|
||||
g_assert (bytes);
|
||||
|
||||
if (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
|
||||
{
|
||||
/* Looks like it parses as text. Dump it into a textview then! */
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *textview;
|
||||
|
||||
widget = create_text (&textview, FALSE);
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
if (g_str_has_suffix (resource_name, ".c"))
|
||||
fontify (buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Don't know how to display resource '%s'", resource_name);
|
||||
widget = NULL;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
}
|
||||
|
||||
if (j < G_N_ELEMENTS(display_funcs))
|
||||
widget = display_funcs[j].display_func (resource_name);
|
||||
else
|
||||
widget = display_nothing (resource_name);
|
||||
if (GTK_IS_IMAGE (widget))
|
||||
{
|
||||
GtkWidget *sw;
|
||||
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), widget);
|
||||
widget = sw;
|
||||
}
|
||||
|
||||
label = gtk_label_new (resources[i]);
|
||||
gtk_widget_show (label);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
|
||||
gtk_container_child_set (GTK_CONTAINER (notebook),
|
||||
widget,
|
||||
GTK_WIDGET (widget),
|
||||
"tab-expand", TRUE,
|
||||
NULL);
|
||||
|
||||
@@ -888,6 +825,49 @@ selection_cb (GtkTreeSelection *selection,
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_text (GtkWidget **view,
|
||||
gboolean is_source)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_NONE);
|
||||
|
||||
*view = text_view = gtk_text_view_new ();
|
||||
g_object_set (text_view,
|
||||
"left-margin", 20,
|
||||
"right-margin", 20,
|
||||
"top-margin", 20,
|
||||
"bottom-margin", 20,
|
||||
NULL);
|
||||
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (text_view), TRUE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make it a bit nicer for text. */
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
static void
|
||||
populate_model (GtkTreeModel *model)
|
||||
{
|
||||
@@ -997,41 +977,6 @@ scrollbar_popup (GtkWidget *scrollbar, GtkWidget *menu)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
settings__notify_gtk_theme_name (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
static GtkCssProvider *css_provider;
|
||||
|
||||
GtkWidget *window = data;
|
||||
char *theme_name;
|
||||
|
||||
g_object_get (gobject, "gtk-theme-name", &theme_name, NULL);
|
||||
if (g_strcmp0 (theme_name, "Adwaita") == 0)
|
||||
{
|
||||
if (css_provider == NULL)
|
||||
{
|
||||
css_provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (css_provider, "/ui/theme.css");
|
||||
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
|
||||
GTK_STYLE_PROVIDER (css_provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (css_provider != NULL)
|
||||
{
|
||||
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window),
|
||||
GTK_STYLE_PROVIDER (css_provider));
|
||||
g_clear_object (&css_provider);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (theme_name);
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
@@ -1064,20 +1009,6 @@ activate (GApplication *app)
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
|
||||
g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
|
||||
G_CALLBACK (settings__notify_gtk_theme_name),
|
||||
window);
|
||||
|
||||
if (gtk_get_minor_version () % 2 != 0)
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
||||
gtk_style_context_add_class (context, "devel");
|
||||
}
|
||||
|
||||
settings__notify_gtk_theme_name (G_OBJECT (gtk_widget_get_settings (GTK_WIDGET (window))),
|
||||
NULL,
|
||||
window);
|
||||
|
||||
notebook = (GtkWidget *)gtk_builder_get_object (builder, "notebook");
|
||||
|
||||
info_view = (GtkWidget *)gtk_builder_get_object (builder, "info-textview");
|
||||
|
||||
@@ -26,6 +26,7 @@ demos = files([
|
||||
'expander.c',
|
||||
'filtermodel.c',
|
||||
'fishbowl.c',
|
||||
'widgetbowl.c',
|
||||
'foreigndrawing.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
@@ -44,7 +45,6 @@ demos = files([
|
||||
'modelbutton.c',
|
||||
'overlay.c',
|
||||
'overlay2.c',
|
||||
'paint.c',
|
||||
'paintable.c',
|
||||
'paintable_animated.c',
|
||||
'paintable_mediastream.c',
|
||||
@@ -76,11 +76,8 @@ demos = files([
|
||||
|
||||
gtkdemo_deps = [ libgtk_dep, ]
|
||||
|
||||
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c'])
|
||||
|
||||
if harfbuzz_dep.found() and pangoft_dep.found()
|
||||
demos += files('font_features.c')
|
||||
extra_demo_sources += files(['script-names.c', 'language-names.c'])
|
||||
gtkdemo_deps += [ harfbuzz_dep, ]
|
||||
endif
|
||||
|
||||
@@ -100,12 +97,13 @@ gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
||||
source_dir: '.')
|
||||
|
||||
executable('gtk4-demo',
|
||||
demos, demos_h, extra_demo_sources, gtkdemo_resources,
|
||||
'main.c', 'gtkfishbowl.c', 'fontplane.c', 'script-names.c', 'language-names.c',
|
||||
'gtkgears.c',
|
||||
demos, demos_h, gtkdemo_resources,
|
||||
c_args: gtkdemo_args,
|
||||
dependencies: gtkdemo_deps,
|
||||
include_directories: confinc,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
executable('gtk4-demo-application',
|
||||
@@ -114,7 +112,6 @@ executable('gtk4-demo-application',
|
||||
dependencies: gtkdemo_deps,
|
||||
include_directories: confinc,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
# icons
|
||||
@@ -136,4 +133,4 @@ install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
|
||||
gnome.compile_schemas()
|
||||
|
||||
# appdata
|
||||
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)
|
||||
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)
|
||||
@@ -56,7 +56,6 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'red'</property>
|
||||
<property name="text">Red</property>
|
||||
<property name="inverted">1</property>
|
||||
</object>
|
||||
@@ -64,7 +63,6 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'green'</property>
|
||||
<property name="text">Green</property>
|
||||
<property name="inverted">1</property>
|
||||
</object>
|
||||
@@ -72,7 +70,6 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'blue'</property>
|
||||
<property name="text">Blue</property>
|
||||
<property name="inverted">1</property>
|
||||
</object>
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
/* Paint
|
||||
*
|
||||
* Demonstrates practical handling of drawing tablets in a real world
|
||||
* usecase.
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
GdkRGBA draw_color;
|
||||
} DrawingArea;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
} DrawingAreaClass;
|
||||
|
||||
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
drawing_area_ensure_surface (DrawingArea *area,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
if (!area->surface ||
|
||||
cairo_image_surface_get_width (area->surface) != width ||
|
||||
cairo_image_surface_get_height (area->surface) != height)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
width, height);
|
||||
if (area->surface)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_source_surface (cr, area->surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_surface_destroy (area->surface);
|
||||
cairo_destroy (area->cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
area->surface = surface;
|
||||
area->cr = cairo_create (surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_size_allocate (GtkWidget *widget,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
|
||||
drawing_area_ensure_surface (area, allocation->width, allocation->height);
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation, baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_map (GtkWidget *widget)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->map (widget);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
drawing_area_ensure_surface ((DrawingArea *) widget,
|
||||
allocation.width, allocation.height);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_unmap (GtkWidget *widget)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
|
||||
g_clear_pointer (&area->cr, cairo_destroy);
|
||||
g_clear_pointer (&area->surface, cairo_surface_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
GtkAllocation allocation;
|
||||
cairo_t *cr;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0, 0,
|
||||
allocation.width,
|
||||
allocation.height
|
||||
));
|
||||
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_surface (cr, area->surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 0.6, 0.6, 0.6);
|
||||
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_class_init (DrawingAreaClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
widget_class->size_allocate = drawing_area_size_allocate;
|
||||
widget_class->snapshot = drawing_area_snapshot;
|
||||
widget_class->map = drawing_area_map;
|
||||
widget_class->unmap = drawing_area_unmap;
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_apply_stroke (DrawingArea *area,
|
||||
GdkDeviceTool *tool,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble pressure)
|
||||
{
|
||||
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
|
||||
{
|
||||
cairo_set_line_width (area->cr, 10 * pressure);
|
||||
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_set_line_width (area->cr, 4 * pressure);
|
||||
cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE);
|
||||
}
|
||||
|
||||
cairo_set_source_rgba (area->cr, area->draw_color.red,
|
||||
area->draw_color.green, area->draw_color.blue,
|
||||
area->draw_color.alpha * pressure);
|
||||
|
||||
//cairo_set_source_rgba (area->cr, 0, 0, 0, pressure);
|
||||
|
||||
cairo_line_to (area->cr, x, y);
|
||||
cairo_stroke (area->cr);
|
||||
cairo_move_to (area->cr, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
stylus_gesture_down (GtkGestureStylus *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
cairo_new_path (area->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
stylus_gesture_motion (GtkGestureStylus *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
GdkTimeCoord *backlog;
|
||||
GdkDeviceTool *tool;
|
||||
gdouble pressure;
|
||||
guint n_items;
|
||||
|
||||
tool = gtk_gesture_stylus_get_device_tool (gesture);
|
||||
|
||||
if (gtk_gesture_stylus_get_backlog (gesture, &backlog, &n_items))
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
drawing_area_apply_stroke (area, tool,
|
||||
backlog[i].axes[GDK_AXIS_X],
|
||||
backlog[i].axes[GDK_AXIS_Y],
|
||||
backlog[i].axes[GDK_AXIS_PRESSURE]);
|
||||
}
|
||||
|
||||
g_free (backlog);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gtk_gesture_stylus_get_axis (gesture, GDK_AXIS_PRESSURE, &pressure))
|
||||
pressure = 1;
|
||||
|
||||
drawing_area_apply_stroke (area, tool, x, y, pressure);
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_init (DrawingArea *area)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE);
|
||||
|
||||
gesture = gtk_gesture_stylus_new ();
|
||||
g_signal_connect (gesture, "down",
|
||||
G_CALLBACK (stylus_gesture_down), area);
|
||||
g_signal_connect (gesture, "motion",
|
||||
G_CALLBACK (stylus_gesture_motion), area);
|
||||
gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
drawing_area_new (void)
|
||||
{
|
||||
return g_object_new (drawing_area_get_type (), NULL);
|
||||
}
|
||||
|
||||
void
|
||||
drawing_area_set_color (DrawingArea *area,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
area->draw_color = *color;
|
||||
}
|
||||
|
||||
static void
|
||||
color_button_color_set (GtkColorButton *button,
|
||||
DrawingArea *draw_area)
|
||||
{
|
||||
GdkRGBA color;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
|
||||
drawing_area_set_color (draw_area, &color);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_paint (GtkWidget *toplevel)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *draw_area, *headerbar, *colorbutton;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
draw_area = drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), draw_area);
|
||||
|
||||
headerbar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Paint");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
|
||||
|
||||
colorbutton = gtk_color_button_new ();
|
||||
g_signal_connect (colorbutton, "color-set",
|
||||
G_CALLBACK (color_button_color_set), draw_area);
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
|
||||
&(GdkRGBA) { 0, 0, 0, 1 });
|
||||
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -56,13 +56,15 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot,
|
||||
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
"Yellow background");
|
||||
|
||||
size = MIN (width, height);
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
|
||||
(height - size) / 2.0,
|
||||
size, size));
|
||||
size, size),
|
||||
"Radioactive Icon");
|
||||
cairo_translate (cr, width / 2.0, height / 2.0);
|
||||
cairo_scale (cr, size, size);
|
||||
cairo_rotate (cr, rotation);
|
||||
|
||||
@@ -58,7 +58,8 @@ static void
|
||||
entry_size_allocate_cb (GtkEntry *entry,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline,
|
||||
gpointer user_data)
|
||||
GtkAllocation *out_clip,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkEntryIconPosition popover_pos;
|
||||
GtkPopover *popover = user_data;
|
||||
|
||||
@@ -31,10 +31,7 @@ window_key_press_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GtkSearchBar *bar)
|
||||
{
|
||||
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS)
|
||||
return gtk_search_bar_handle_event (bar, event);
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
return gtk_search_bar_handle_event (bar, event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -102,7 +99,8 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), searchbar);
|
||||
|
||||
/* Hook the search bar to key presses */
|
||||
g_signal_connect (window, "event", G_CALLBACK (window_key_press_event_cb), searchbar);
|
||||
g_signal_connect (window, "key-press-event",
|
||||
G_CALLBACK (window_key_press_event_cb), searchbar);
|
||||
|
||||
/* Help */
|
||||
label = gtk_label_new ("Start Typing to search");
|
||||
|
||||
@@ -33,14 +33,14 @@ hex_spin_output (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
gchar *buf;
|
||||
gdouble val;
|
||||
gint val;
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||
val = gtk_adjustment_get_value (adjustment);
|
||||
val = (gint) gtk_adjustment_get_value (adjustment);
|
||||
if (fabs (val) < 1e-5)
|
||||
buf = g_strdup ("0x00");
|
||||
else
|
||||
buf = g_strdup_printf ("0x%.2X", (gint) val);
|
||||
buf = g_strdup_printf ("0x%.2X", val);
|
||||
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, buf);
|
||||
g_free (buf);
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
window.devel headerbar {
|
||||
background: #cbd2d9 -gtk-icontheme("system-run-symbolic") 70% 0/64px 64px no-repeat, linear-gradient(to left, #a5b1bd 0%, #a5b1bd 8%, @theme_bg_color 25%);
|
||||
box-shadow: inset 0 1px #f1f3f5;
|
||||
border-color: #909fae;
|
||||
color: rgba(46, 52, 54, 0.2);
|
||||
}
|
||||
|
||||
window.devel headerbar label {
|
||||
color: @theme_fg_color;
|
||||
}
|
||||
412
demos/gtk-demo/widgetbowl.c
Normal file
412
demos/gtk-demo/widgetbowl.c
Normal file
@@ -0,0 +1,412 @@
|
||||
/* Benchmark/Widgetbowl
|
||||
*
|
||||
* This is a version of the Fishbowl demo that instead shows different
|
||||
* kinds of widgets, which is useful for comparing the rendering performance
|
||||
* of theme specifics.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkfishbowl.h"
|
||||
#include "gtkgears.h"
|
||||
|
||||
const char *const css =
|
||||
".blurred-button {"
|
||||
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
|
||||
"}"
|
||||
"";
|
||||
|
||||
GtkWidget *fishbowl;
|
||||
|
||||
static GtkWidget *
|
||||
create_button (void)
|
||||
{
|
||||
return gtk_button_new_with_label ("Button");
|
||||
}
|
||||
static GtkWidget *
|
||||
create_blurred_button (void)
|
||||
{
|
||||
GtkWidget *w = gtk_button_new ();
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_font_button (void)
|
||||
{
|
||||
return gtk_font_button_new ();
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_level_bar (void)
|
||||
{
|
||||
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
|
||||
|
||||
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
|
||||
|
||||
/* Force them to be a bit larger */
|
||||
gtk_widget_set_size_request (w, 200, -1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinner (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spinner_new ();
|
||||
|
||||
gtk_spinner_start (GTK_SPINNER (w));
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinbutton (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_label (void)
|
||||
{
|
||||
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
|
||||
|
||||
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_video (void)
|
||||
{
|
||||
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
GtkWidget *w = gtk_image_new_from_paintable (GDK_PAINTABLE (stream));
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
gtk_media_stream_play (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gears (void)
|
||||
{
|
||||
GtkWidget *w = gtk_gears_new ();
|
||||
|
||||
gtk_widget_set_size_request (w, 100, 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
GtkWidget * (*create_func) (void);
|
||||
} widget_types[] = {
|
||||
{ "Button", create_button },
|
||||
{ "Blurbutton", create_blurred_button },
|
||||
{ "Fontbutton", create_font_button },
|
||||
{ "Levelbar" , create_level_bar },
|
||||
{ "Label" , create_label },
|
||||
{ "Spinner" , create_spinner },
|
||||
{ "Spinbutton", create_spinbutton },
|
||||
{ "Video", create_video },
|
||||
{ "Gears", create_gears },
|
||||
};
|
||||
|
||||
static int selected_widget_type = -1;
|
||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||
|
||||
#define N_STATS 5
|
||||
|
||||
#define STATS_UPDATE_TIME G_USEC_PER_SEC
|
||||
|
||||
static void
|
||||
set_widget_type (GtkWidget *headerbar,
|
||||
int widget_type_index)
|
||||
{
|
||||
GList *children, *l;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return;
|
||||
|
||||
/* Remove everything */
|
||||
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget*)l->data);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
selected_widget_type = widget_type_index;
|
||||
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
|
||||
|
||||
typedef struct _Stats Stats;
|
||||
struct _Stats {
|
||||
gint64 last_stats;
|
||||
gint64 last_frame;
|
||||
gint last_suggestion;
|
||||
guint frame_counter_max;
|
||||
|
||||
guint stats_index;
|
||||
guint frame_counter[N_STATS];
|
||||
guint item_counter[N_STATS];
|
||||
};
|
||||
|
||||
static Stats *
|
||||
get_stats (GtkWidget *widget)
|
||||
{
|
||||
static GQuark stats_quark = 0;
|
||||
Stats *stats;
|
||||
|
||||
if (G_UNLIKELY (stats_quark == 0))
|
||||
stats_quark = g_quark_from_static_string ("stats");
|
||||
|
||||
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
|
||||
if (stats == NULL)
|
||||
{
|
||||
stats = g_new0 (Stats, 1);
|
||||
g_object_set_qdata_full (G_OBJECT (widget), stats_quark, stats, g_free);
|
||||
stats->last_frame = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
stats->last_stats = stats->last_frame;
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
static void
|
||||
do_stats (GtkWidget *widget,
|
||||
GtkWidget *info_label,
|
||||
gint *suggested_change)
|
||||
{
|
||||
Stats *stats;
|
||||
gint64 frame_time;
|
||||
|
||||
stats = get_stats (widget);
|
||||
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
|
||||
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
|
||||
{
|
||||
char *new_label;
|
||||
guint i, n_frames;
|
||||
|
||||
n_frames = 0;
|
||||
for (i = 0; i < N_STATS; i++)
|
||||
{
|
||||
n_frames += stats->frame_counter[i];
|
||||
}
|
||||
|
||||
new_label = g_strdup_printf ("widgets - %.1f fps",
|
||||
(double) G_USEC_PER_SEC * n_frames
|
||||
/ (N_STATS * STATS_UPDATE_TIME));
|
||||
gtk_label_set_label (GTK_LABEL (info_label), new_label);
|
||||
g_free (new_label);
|
||||
|
||||
if (stats->frame_counter[stats->stats_index] >= 19 * stats->frame_counter_max / 20)
|
||||
{
|
||||
if (stats->last_suggestion > 0)
|
||||
stats->last_suggestion *= 2;
|
||||
else
|
||||
stats->last_suggestion = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stats->last_suggestion < 0)
|
||||
stats->last_suggestion--;
|
||||
else
|
||||
stats->last_suggestion = -1;
|
||||
stats->last_suggestion = MAX (stats->last_suggestion, 1 - (int) stats->item_counter[stats->stats_index]);
|
||||
}
|
||||
|
||||
stats->stats_index = (stats->stats_index + 1) % N_STATS;
|
||||
stats->frame_counter[stats->stats_index] = 0;
|
||||
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
|
||||
stats->last_stats = frame_time;
|
||||
|
||||
if (suggested_change)
|
||||
*suggested_change = stats->last_suggestion;
|
||||
else
|
||||
stats->last_suggestion = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (suggested_change)
|
||||
*suggested_change = 0;
|
||||
}
|
||||
|
||||
stats->last_frame = frame_time;
|
||||
stats->frame_counter[stats->stats_index]++;
|
||||
stats->frame_counter_max = MAX (stats->frame_counter_max, stats->frame_counter[stats->stats_index]);
|
||||
}
|
||||
|
||||
static void
|
||||
stats_update (GtkWidget *widget)
|
||||
{
|
||||
Stats *stats;
|
||||
|
||||
stats = get_stats (widget);
|
||||
|
||||
stats->item_counter[stats->stats_index] = gtk_fishbowl_get_count (GTK_FISHBOWL (widget));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_fish (GtkWidget *bowl,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer info_label)
|
||||
{
|
||||
gint suggested_change = 0;
|
||||
|
||||
do_stats (bowl, info_label, &suggested_change);
|
||||
|
||||
if (suggested_change > 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < suggested_change; i ++)
|
||||
{
|
||||
GtkWidget *new_widget = widget_types[selected_widget_type].create_func ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
|
||||
|
||||
}
|
||||
}
|
||||
else if (suggested_change < 0)
|
||||
{
|
||||
GList *children, *l;
|
||||
int n_removed = 0;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget *)l->data);
|
||||
n_removed ++;
|
||||
|
||||
if (n_removed >= (-suggested_change))
|
||||
break;
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
stats_update (bowl);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *headerbar = user_data;
|
||||
int new_index;
|
||||
|
||||
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = selected_widget_type + 1;
|
||||
|
||||
set_widget_type (headerbar, new_index);
|
||||
}
|
||||
|
||||
static void
|
||||
prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *headerbar = user_data;
|
||||
int new_index;
|
||||
|
||||
if (selected_widget_type - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = selected_widget_type - 1;
|
||||
|
||||
set_widget_type (headerbar, new_index);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_widgetbowl (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkCssProvider *provider = NULL;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
if (provider == NULL)
|
||||
{
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *info_label;
|
||||
GtkWidget *count_label;
|
||||
GtkWidget *titlebar;
|
||||
GtkWidget *title_box;
|
||||
GtkWidget *left_box;
|
||||
GtkWidget *next_button;
|
||||
GtkWidget *prev_button;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
titlebar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (titlebar), TRUE);
|
||||
info_label = gtk_label_new ("widget - 00.0 fps");
|
||||
count_label = gtk_label_new ("0");
|
||||
fishbowl = gtk_fishbowl_new ();
|
||||
title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
prev_button = gtk_button_new_from_icon_name ("pan-start-symbolic");
|
||||
next_button = gtk_button_new_from_icon_name ("pan-end-symbolic");
|
||||
left_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
g_object_bind_property (fishbowl, "count", count_label, "label", 0);
|
||||
g_signal_connect (next_button, "clicked", G_CALLBACK (next_button_clicked_cb), titlebar);
|
||||
g_signal_connect (prev_button, "clicked", G_CALLBACK (prev_button_clicked_cb), titlebar);
|
||||
|
||||
gtk_fishbowl_set_animating (GTK_FISHBOWL (fishbowl), TRUE);
|
||||
|
||||
gtk_widget_set_hexpand (title_box, TRUE);
|
||||
gtk_widget_set_halign (title_box, GTK_ALIGN_END);
|
||||
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), titlebar);
|
||||
gtk_container_add (GTK_CONTAINER (title_box), count_label);
|
||||
gtk_container_add (GTK_CONTAINER (title_box), info_label);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (titlebar), title_box);
|
||||
gtk_container_add (GTK_CONTAINER (window), fishbowl);
|
||||
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (left_box), "linked");
|
||||
gtk_container_add (GTK_CONTAINER (left_box), prev_button);
|
||||
gtk_container_add (GTK_CONTAINER (left_box), next_button);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (titlebar), left_box);
|
||||
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
gtk_widget_add_tick_callback (fishbowl, move_fish, info_label, NULL);
|
||||
|
||||
set_widget_type (titlebar, 0);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ media-view-subtitles=The icon used to show subtitles in a media player
|
||||
|
||||
[network]
|
||||
Name=Network
|
||||
Description=Icons related to network status
|
||||
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
|
||||
|
||||
@@ -286,16 +286,13 @@ populate (IconBrowserWindow *win)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
key_event_cb (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
gpointer data)
|
||||
key_press_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
IconBrowserWindow *win = data;
|
||||
|
||||
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar),
|
||||
gtk_get_current_event ());
|
||||
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar), event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -454,7 +451,6 @@ static void
|
||||
icon_browser_window_init (IconBrowserWindow *win)
|
||||
{
|
||||
GdkContentFormats *list;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
@@ -484,30 +480,12 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
|
||||
gtk_widget_add_controller (GTK_WIDGET (win), controller);
|
||||
|
||||
populate (win);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_finalize (GObject *object)
|
||||
{
|
||||
IconBrowserWindow *win = ICON_BROWSER_WINDOW (object);
|
||||
|
||||
g_hash_table_unref (win->contexts);
|
||||
|
||||
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->finalize = icon_browser_window_finalize;
|
||||
|
||||
g_type_ensure (ICON_STORE_TYPE);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
@@ -538,6 +516,7 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), item_activated);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), selected_context_changed);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), key_press_event_cb);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), copy_to_clipboard);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ executable('gtk4-icon-browser',
|
||||
dependencies: libgtk_dep,
|
||||
include_directories: confinc,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
install_data('gtk4-icon-browser.desktop', install_dir: gtk_applicationsdir)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<signal name="key-press-event" handler="key_press_event_cb"/>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
|
||||
@@ -9,7 +9,6 @@ executable('gtk4-widget-factory',
|
||||
dependencies: libgtk_dep,
|
||||
include_directories: confinc,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
# desktop file
|
||||
|
||||
@@ -1082,7 +1082,7 @@ set_accel (GtkApplication *app, GtkWidget *widget)
|
||||
typedef struct
|
||||
{
|
||||
GtkTextView tv;
|
||||
GdkPixbuf *pixbuf;
|
||||
cairo_surface_t *surface;
|
||||
} MyTextView;
|
||||
|
||||
typedef GtkTextViewClass MyTextViewClass;
|
||||
@@ -1101,10 +1101,10 @@ my_tv_draw_layer (GtkTextView *widget,
|
||||
{
|
||||
MyTextView *tv = (MyTextView *)widget;
|
||||
|
||||
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->pixbuf)
|
||||
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->surface)
|
||||
{
|
||||
cairo_save (cr);
|
||||
gdk_cairo_set_source_pixbuf (cr, tv->pixbuf, 0.0, 0.0);
|
||||
cairo_set_source_surface (cr, tv->surface, 0.0, 0.0);
|
||||
cairo_paint_with_alpha (cr, 0.333);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
@@ -1115,7 +1115,8 @@ my_tv_finalize (GObject *object)
|
||||
{
|
||||
MyTextView *tv = (MyTextView *)object;
|
||||
|
||||
g_clear_object (&tv->pixbuf);
|
||||
if (tv->surface)
|
||||
cairo_surface_destroy (tv->surface);
|
||||
|
||||
G_OBJECT_CLASS (my_text_view_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -1133,14 +1134,18 @@ my_text_view_class_init (MyTextViewClass *class)
|
||||
static void
|
||||
my_text_view_set_background (MyTextView *tv, const gchar *filename)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
|
||||
g_clear_object (&tv->pixbuf);
|
||||
if (tv->surface)
|
||||
cairo_surface_destroy (tv->surface);
|
||||
|
||||
tv->surface = NULL;
|
||||
|
||||
if (filename == NULL)
|
||||
return;
|
||||
|
||||
tv->pixbuf = gdk_pixbuf_new_from_file (filename, &error);
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, &error);
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
@@ -1148,6 +1153,10 @@ my_text_view_set_background (MyTextView *tv, const gchar *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
tv->surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (tv));
|
||||
}
|
||||
|
||||
@@ -1605,27 +1614,6 @@ adjustment3_value_changed (GtkAdjustment *adj, GtkProgressBar *pbar)
|
||||
gtk_progress_bar_set_fraction (pbar, fraction);
|
||||
}
|
||||
|
||||
static void
|
||||
settings__notify_gtk_theme_name (GObject *gobject,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *window = data;
|
||||
char *theme_name = NULL;
|
||||
|
||||
g_object_get (gobject, "gtk-theme-name", &theme_name, NULL);
|
||||
|
||||
if (g_strcmp0 (theme_name, "Adwaita") == 0)
|
||||
{
|
||||
if (gtk_get_minor_version () % 2 != 0)
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (window), "devel");
|
||||
}
|
||||
else
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (window), "devel");
|
||||
|
||||
g_free (theme_name);
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
@@ -1667,6 +1655,7 @@ activate (GApplication *app)
|
||||
gint i;
|
||||
GPermission *permission;
|
||||
GAction *action;
|
||||
GtkGesture *gesture;
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
@@ -1691,7 +1680,6 @@ activate (GApplication *app)
|
||||
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
|
||||
gtk_builder_add_callback_symbol (builder, "scale_format_value", (GCallback)scale_format_value);
|
||||
gtk_builder_add_callback_symbol (builder, "scale_format_value_blank", (GCallback)scale_format_value_blank);
|
||||
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
|
||||
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
@@ -1701,13 +1689,6 @@ activate (GApplication *app)
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
window);
|
||||
|
||||
g_signal_connect (gtk_settings_get_default (), "notify::gtk-theme-name",
|
||||
G_CALLBACK (settings__notify_gtk_theme_name),
|
||||
window);
|
||||
settings__notify_gtk_theme_name (G_OBJECT (gtk_settings_get_default ()),
|
||||
NULL,
|
||||
window);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (accels); i++)
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);
|
||||
|
||||
@@ -1916,6 +1897,10 @@ activate (GApplication *app)
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
|
||||
gesture = gtk_gesture_multi_press_new (widget);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (osd_frame_pressed), widget);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (builder);
|
||||
|
||||
@@ -24,14 +24,3 @@
|
||||
.border-ridge {
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
window.devel headerbar {
|
||||
background: #cbd2d9 -gtk-icontheme("system-run-symbolic") 70% 0/64px 64px no-repeat, linear-gradient(to left, #a5b1bd 0%, #a5b1bd 8%, @theme_bg_color 25%);
|
||||
box-shadow: inset 0 1px #f1f3f5;
|
||||
border-color: #909fae;
|
||||
color: rgba(46, 52, 54, 0.2);
|
||||
}
|
||||
|
||||
window.devel headerbar label {
|
||||
color: @theme_fg_color;
|
||||
}
|
||||
|
||||
@@ -468,8 +468,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="enable-emoji-completion">1</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Click icon to change mode</property>
|
||||
<property name="secondary-icon-name">view-refresh-symbolic</property>
|
||||
<property name="secondary-icon-tooltip-text">Change mode</property>
|
||||
@@ -879,7 +878,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkFontButton" id="fontbutton1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="receives-default">1</property>
|
||||
<property name="level">family|style|size|features|variations</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">6</property>
|
||||
@@ -3101,11 +3099,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGestureMultiPress">
|
||||
<signal name="pressed" handler="osd_frame_pressed" object="osd_frame" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
# These are the people responsible for subsystems in GTK; if you're opening
|
||||
# a merge request for files listed here, please add the following people to
|
||||
# the list of reviewers
|
||||
|
||||
# The syntax of this file is similar to the GitHub CODEOWNERS file:
|
||||
# https://help.github.com/articles/about-codeowners/
|
||||
# Which, in turn, is similar to the .gitignore and .gitattributes files:
|
||||
#
|
||||
# - comments start with `#`
|
||||
# - the first column contains paths and globs
|
||||
# - the second column contains GitLab user names or email addresses,
|
||||
# separated by spaces
|
||||
#
|
||||
# If you want to be responsible for code reviews in specific sections of
|
||||
# the GTK code base, add yourself here.
|
||||
|
||||
# Maintainer
|
||||
* @matthiasc
|
||||
|
||||
# Build system
|
||||
meson.build @ebassi @nirbheek
|
||||
*.py @ebassi
|
||||
|
||||
# CSS
|
||||
gtk/gtkcss*.[ch] @otte @baedert
|
||||
gtk/gtkstyle*.[ch] @otte @baedert
|
||||
|
||||
# Gestures
|
||||
gtk/gtkeventcontroller* @carlosg
|
||||
gtk/gtkgesture*.[ch] @carlosg
|
||||
|
||||
# GtkFileChooser
|
||||
gtk/gtkfilechooser* @federico
|
||||
gtk/gtkfilesystem* @federico
|
||||
gtk/gtkfilefilter* @federico
|
||||
|
||||
# GtkFontChooser
|
||||
gtk/gtkfontchooser* @matthiasc
|
||||
|
||||
# Input methods
|
||||
gtk/gtkimcontext* @carlosg
|
||||
|
||||
# Media
|
||||
gtk/gtkmedia* @otte
|
||||
|
||||
# GSK
|
||||
gsk @otte @baedert @ebassi
|
||||
|
||||
# GL rendering
|
||||
gsk/gl @baedert @ebassi
|
||||
|
||||
# Vulkan rendering
|
||||
gsk/vulkan
|
||||
|
||||
# Documentation
|
||||
docs/ @ebassi @dboles
|
||||
|
||||
# Wayland
|
||||
gdk/wayland @jadahl
|
||||
|
||||
# X11
|
||||
gdk/x11 @ofourdan @matthiasc
|
||||
|
||||
# Themes
|
||||
gtk/themes @lapoc @jimmac
|
||||
|
||||
# Inspector
|
||||
gtk/inspector @otte @matthiasc
|
||||
@@ -71,6 +71,9 @@ straightforward manner.
|
||||
void gdk_drag_status (GdkDragContext *context,
|
||||
GdkDragAction action,
|
||||
guint32 time);
|
||||
void gdk_drop_reply (GdkDragContext *context,
|
||||
gboolean ok,
|
||||
guint32 time);
|
||||
void gdk_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time);
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
<xi:include href="xml/gdkmonitor.xml" />
|
||||
<xi:include href="xml/regions.xml" />
|
||||
<xi:include href="xml/textures.xml" />
|
||||
<xi:include href="xml/gdkpaintable.xml" />
|
||||
<xi:include href="xml/rgba_colors.xml" />
|
||||
<xi:include href="xml/cursors.xml" />
|
||||
<xi:include href="xml/gdksurface.xml" />
|
||||
<xi:include href="xml/windows.xml" />
|
||||
<xi:include href="xml/gdkframeclock.xml" />
|
||||
<xi:include href="xml/gdkframetimings.xml" />
|
||||
<xi:include href="xml/gdkdrawingcontext.xml" />
|
||||
<xi:include href="xml/gdkdrawcontext.xml" />
|
||||
<xi:include href="xml/gdkglcontext.xml" />
|
||||
<xi:include href="xml/gdkvulkancontext.xml" />
|
||||
|
||||
@@ -167,8 +167,8 @@ gdk_rgba_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>GdkSurface</TITLE>
|
||||
<FILE>gdksurface</FILE>
|
||||
<TITLE>Windows</TITLE>
|
||||
<FILE>windows</FILE>
|
||||
GdkSurface
|
||||
GdkSurfaceType
|
||||
GdkSurfaceClass
|
||||
@@ -233,10 +233,13 @@ gdk_surface_set_opaque_region
|
||||
gdk_surface_create_gl_context
|
||||
gdk_surface_create_vulkan_context
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_begin_draw_frame
|
||||
gdk_surface_end_draw_frame
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_invalidate_rect
|
||||
gdk_surface_invalidate_region
|
||||
gdk_surface_queue_expose
|
||||
gdk_surface_freeze_updates
|
||||
gdk_surface_thaw_updates
|
||||
gdk_surface_get_frame_clock
|
||||
@@ -404,12 +407,15 @@ gdk_pango_layout_line_get_clip_region
|
||||
<TITLE>Cairo Interaction</TITLE>
|
||||
<FILE>cairo_interaction</FILE>
|
||||
gdk_surface_create_similar_surface
|
||||
gdk_surface_create_similar_image_surface
|
||||
gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_get_drawing_context
|
||||
gdk_cairo_set_source_rgba
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
gdk_cairo_region_create_from_surface
|
||||
gdk_cairo_surface_create_from_pixbuf
|
||||
gdk_cairo_draw_from_gl
|
||||
gdk_cairo_surface_upload_to_gl
|
||||
</SECTION>
|
||||
@@ -655,7 +661,7 @@ gdk_event_get_crossing_detail
|
||||
gdk_event_get_crossing_mode
|
||||
gdk_event_get_drag_context
|
||||
gdk_event_get_focus_in
|
||||
gdk_event_get_grab_surface
|
||||
gdk_event_get_grab_window
|
||||
gdk_event_get_motion_history
|
||||
gdk_event_get_key_group
|
||||
gdk_event_get_key_is_modifier
|
||||
@@ -698,27 +704,19 @@ gdk_event_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkpaintable</FILE>
|
||||
<TITLE>GdkPaintable/TITLE>
|
||||
<TITLE>Paintable</TITLE>
|
||||
<FILE>paintable</FILE>
|
||||
GdkPaintable
|
||||
GdkPaintableFlags
|
||||
gdk_paintable_get_current_image
|
||||
gdk_paintable_snapshot
|
||||
gdk_paintable_get_current_image
|
||||
gdk_paintable_get_flags
|
||||
gdk_paintable_get_intrinsic_width
|
||||
gdk_paintable_get_intrinsic_height
|
||||
gdk_paintable_get_intrinsic_aspect_ratio
|
||||
gdk_paintable_compute_concrete_size
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_paintable_invalidate_contents
|
||||
gdk_paintable_invalidate_size
|
||||
gdk_paintable_new_empty
|
||||
|
||||
<SUBSECTION Private>
|
||||
GDK_TYPE_PAINTABLE
|
||||
gdk_paintable_get_type
|
||||
</SECTION>
|
||||
<SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Textures</TITLE>
|
||||
@@ -730,9 +728,8 @@ gdk_texture_new_from_file
|
||||
gdk_texture_get_width
|
||||
gdk_texture_get_height
|
||||
gdk_texture_download
|
||||
gdk_texture_save_to_png
|
||||
GdkMemoryFormat
|
||||
GDK_MEMORY_DEFAULT
|
||||
GDK_MEMORY_FORMAT_DEFAULT
|
||||
gdk_memory_texture_new
|
||||
gdk_gl_texture_new
|
||||
gdk_gl_texture_release
|
||||
@@ -782,11 +779,13 @@ gdk_cursor_get_type
|
||||
<FILE>dnd</FILE>
|
||||
GdkDragContext
|
||||
GdkDragCancelReason
|
||||
gdk_drop_reply
|
||||
gdk_drag_drop_done
|
||||
gdk_drag_begin
|
||||
gdk_drop_finish
|
||||
GdkDragAction
|
||||
gdk_drag_status
|
||||
gdk_drag_drop_succeeded
|
||||
|
||||
gdk_drag_context_get_display
|
||||
gdk_drag_context_get_actions
|
||||
@@ -1107,10 +1106,6 @@ gdk_frame_timings_get_type
|
||||
GdkDrawContext
|
||||
gdk_draw_context_get_display
|
||||
gdk_draw_context_get_surface
|
||||
gdk_draw_context_begin_frame
|
||||
gdk_draw_context_end_frame
|
||||
gdk_draw_context_is_in_frame
|
||||
gdk_draw_context_get_frame_region
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAW_CONTEXT
|
||||
@@ -1144,6 +1139,7 @@ gdk_gl_context_is_legacy
|
||||
<SUBSECTION>
|
||||
GdkGLError
|
||||
gdk_gl_context_realize
|
||||
gdk_gl_context_get_damage
|
||||
gdk_gl_context_make_current
|
||||
gdk_gl_context_get_current
|
||||
gdk_gl_context_clear_current
|
||||
@@ -1188,12 +1184,23 @@ GDK_IS_MONITOR
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkcairocontext</FILE>
|
||||
GdkCairoContext
|
||||
gdk_cairo_context_cairo_create
|
||||
<FILE>gdkdrawingcontext</FILE>
|
||||
GdkDrawingContext
|
||||
gdk_drawing_context_get_surface
|
||||
gdk_drawing_context_get_clip
|
||||
gdk_drawing_context_get_cairo_context
|
||||
gdk_drawing_context_is_valid
|
||||
gdk_drawing_context_get_paint_context
|
||||
|
||||
<SUBSECTION Standard>
|
||||
gdk_cairo_context_get_type
|
||||
gdk_drawing_context_get_type
|
||||
GdkDrawingContextClass
|
||||
GDK_TYPE_DRAWING_CONTEXT
|
||||
GDK_DRAWING_CONTEXT_CLASS
|
||||
GDK_DRAWING_CONTEXT_GET_CLASS
|
||||
GDK_IS_DRAWING_CONTEXT_CLASS
|
||||
GDK_DRAWING_CONTEXT
|
||||
GDK_IS_DRAWING_CONTEXT
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -1325,4 +1332,3 @@ GDK_CONTENT_DESERIALIZER
|
||||
GDK_IS_CONTENT_DESERIALIZER
|
||||
gdk_content_deserializer_get_type
|
||||
</SECTION>
|
||||
|
||||
|
||||
@@ -1,26 +1,18 @@
|
||||
gdk_app_launch_context_get_type
|
||||
gdk_clipboard_get_type
|
||||
gdk_content_deserializer_get_type
|
||||
gdk_content_formats_get_type
|
||||
gdk_content_serializer_get_type
|
||||
gdk_cursor_get_type
|
||||
gdk_device_get_type
|
||||
gdk_device_pad_get_type
|
||||
gdk_device_tool_get_type
|
||||
gdk_display_get_type
|
||||
gdk_display_manager_get_type
|
||||
gdk_drag_context_get_type
|
||||
gdk_event_get_type
|
||||
gdk_drawing_context_get_type
|
||||
gdk_frame_clock_get_type
|
||||
gdk_gl_context_get_type
|
||||
gdk_gl_texture_get_type
|
||||
gdk_keymap_get_type
|
||||
gdk_memory_texture_get_type
|
||||
gdk_monitor_get_type
|
||||
gdk_paintable_get_type
|
||||
gdk_rgba_get_type
|
||||
gdk_seat_get_type
|
||||
gdk_snapshot_get_type
|
||||
gdk_surface_get_type
|
||||
gdk_texture_get_type
|
||||
gdk_vulkan_context_get_type
|
||||
gdk_content_serializer_get_type
|
||||
gdk_content_deserializer_get_type
|
||||
gdk_clipboard_get_type
|
||||
gdk_content_formats_get_type
|
||||
|
||||
@@ -3,6 +3,7 @@ private_headers = [
|
||||
'gdkmarshalers.h',
|
||||
'gdkkeysyms.h',
|
||||
'gdkinternals.h',
|
||||
'gdkprivate.h',
|
||||
'gdk-private.h',
|
||||
'gdkapplaunchcontextprivate.h',
|
||||
'gdkclipboardprivate.h',
|
||||
@@ -10,27 +11,21 @@ private_headers = [
|
||||
'gdkcontentproviderprivate.h',
|
||||
'gdkcursorprivate.h',
|
||||
'gdkdeviceprivate.h',
|
||||
'gdkdevicepadprivate.h',
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkdisplaymanagerprivate.h',
|
||||
'gdkdisplayprivate.h',
|
||||
'gdkdndprivate.h',
|
||||
'gdkdrawcontextprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkframeclockidleprivate.h',
|
||||
'gdkframeclockprivate.h',
|
||||
'gdkglcontextprivate.h',
|
||||
'gdkgltextureprivate.h',
|
||||
'gdkkeysprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkmemorytextureprivate.h',
|
||||
'gdkpipeiostreamprivate.h',
|
||||
'gdkscreenprivate.h',
|
||||
'gdkseatdefaultprivate.h',
|
||||
'gdkseatprivate.h',
|
||||
'gdksnapshotprivate.h',
|
||||
'gdksurfaceimpl.h',
|
||||
'gdktextureprivate.h',
|
||||
'gdkvisualprivate.h',
|
||||
'gdkvulkancontextprivate.h',
|
||||
'keyname-table.h',
|
||||
'x11/gdkprivate-x11.h',
|
||||
|
||||
@@ -5,6 +5,8 @@ gsk_renderer_get_surface
|
||||
gsk_renderer_get_display
|
||||
gsk_renderer_realize
|
||||
gsk_renderer_unrealize
|
||||
gsk_renderer_begin_draw_frame
|
||||
gsk_renderer_end_draw_frame
|
||||
gsk_renderer_render
|
||||
gsk_renderer_render_texture
|
||||
<SUBSECTION Standard>
|
||||
@@ -29,6 +31,8 @@ gsk_render_node_serialize
|
||||
gsk_render_node_deserialize
|
||||
gsk_render_node_write_to_file
|
||||
GskScalingFilter
|
||||
gsk_render_node_set_name
|
||||
gsk_render_node_get_name
|
||||
gsk_render_node_get_bounds
|
||||
|
||||
<SUBSECTION Nodes>
|
||||
@@ -68,10 +72,6 @@ gsk_container_node_get_child
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_transform_node_peek_transform
|
||||
gsk_offset_node_new
|
||||
gsk_offset_node_get_child
|
||||
gsk_offset_node_get_x_offset
|
||||
gsk_offset_node_get_y_offset
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
@@ -110,9 +110,6 @@ gsk_text_node_get_y
|
||||
gsk_blur_node_new
|
||||
gsk_blur_node_get_child
|
||||
gsk_blur_node_get_radius
|
||||
gsk_debug_node_new
|
||||
gsk_debug_node_get_child
|
||||
gsk_debug_node_get_message
|
||||
<SUBSECTION Standard>
|
||||
GSK_IS_RENDER_NODE
|
||||
GSK_RENDER_NODE
|
||||
|
||||
@@ -294,52 +294,13 @@ How to compile GTK+ itself
|
||||
<command>meson</command>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dx11-backend=true</arg>
|
||||
<arg choice="plain">-Dx11-backend=false</arg>
|
||||
<arg choice="plain">-Ddocumentation=true</arg>
|
||||
<arg choice="plain">-Ddocumentation=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwayland-backend=true</arg>
|
||||
<arg choice="plain">-Dwayland-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dbroadway-backend=true</arg>
|
||||
<arg choice="plain">-Dbroadway-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwin32-backend=true</arg>
|
||||
<arg choice="plain">-Dwin32-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dquartz-backend=true</arg>
|
||||
<arg choice="plain">-Dquartz-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dmedia=gstreamer</arg>
|
||||
<arg choice="plain">-Dmedia=ffmpeg</arg>
|
||||
<arg choice="plain">-Dmedia=all</arg>
|
||||
<arg choice="plain">-Dmedia=none</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dvulkan=yes</arg>
|
||||
<arg choice="plain">-Dvulkan=no</arg>
|
||||
<arg choice="plain">-Dvulkan=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dxinerama=yes</arg>
|
||||
<arg choice="plain">-Dxinerama=no</arg>
|
||||
<arg choice="plain">-Dxinerama=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dcloudproviders=true</arg>
|
||||
<arg choice="plain">-Dcloudproviders=false</arg>
|
||||
<arg choice="plain">-Dman-pages=true</arg>
|
||||
<arg choice="plain">-Dman-pages=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
@@ -355,13 +316,45 @@ How to compile GTK+ itself
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Ddocumentation=true</arg>
|
||||
<arg choice="plain">-Ddocumentation=false</arg>
|
||||
<arg choice="plain">-Dvulkan=yes</arg>
|
||||
<arg choice="plain">-Dvulkan=no</arg>
|
||||
<arg choice="plain">-Dvulkan=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dman-pages=true</arg>
|
||||
<arg choice="plain">-Dman-pages=false</arg>
|
||||
<arg choice="plain">-Dx11-backend=true</arg>
|
||||
<arg choice="plain">-Dx11-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dcloudproviders=true</arg>
|
||||
<arg choice="plain">-Dcloudproviders=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dxinerama=yes</arg>
|
||||
<arg choice="plain">-Dxinerama=no</arg>
|
||||
<arg choice="plain">-Dxinerama=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwin32-backend=true</arg>
|
||||
<arg choice="plain">-Dwin32-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dquartz-backend=true</arg>
|
||||
<arg choice="plain">-Dquartz-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dbroadway-backend=true</arg>
|
||||
<arg choice="plain">-Dbroadway-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwayland-backend=true</arg>
|
||||
<arg choice="plain">-Dwayland-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
|
||||
@@ -333,7 +333,7 @@
|
||||
|
||||
<para>The full, buildable sources for these examples can be found
|
||||
in the examples/ directory of the GTK+ source distribution, or
|
||||
<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples">online</ulink> in the GTK+ git repository.
|
||||
<ulink url="https://git.gnome.org/browse/gtk+/tree/examples">online</ulink> in the GTK+ git repository.
|
||||
You can build each example separately by using make with the <filename>Makefile.example</filename>
|
||||
file. For more information, see the <filename>README</filename> included in the
|
||||
examples directory.</para>
|
||||
@@ -450,13 +450,13 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application2/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application2/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>You may have noticed that we used the <literal>_from_resource(<!-- -->)</literal> variant
|
||||
of the function that sets a template. Now we need to use <ulink url="https://developer.gnome.org/gio/stable/GResource.html">GLib's resource functionality</ulink>
|
||||
to include the ui file in the binary. This is commonly done by listing
|
||||
all resources in a .gresource.xml file, such as this:
|
||||
of the function that sets a template. Now we need to use GLib's resource
|
||||
functionality to include the ui file in the binary. This is commonly
|
||||
done by listing all resources in a .gresource.xml file, such as this:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
@@ -518,7 +518,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>Now we revisit the example_app_window_open() function that
|
||||
@@ -567,7 +567,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>Note that we did not have to touch the stack switcher
|
||||
@@ -665,7 +665,7 @@ example_app_class_init (ExampleAppClass *class)
|
||||
|
||||
...
|
||||
</programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application4/exampleapp.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application4/exampleapp.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>Our preferences menu item does not do anything yet,
|
||||
@@ -731,7 +731,7 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application5/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application5/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>The code to connect the font setting is a little more involved,
|
||||
@@ -780,7 +780,7 @@ preferences_activated (GSimpleAction *action,
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application6/exampleapp.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application6/exampleapp.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>After all this work, our application can now show
|
||||
@@ -866,7 +866,7 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application7/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application7/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>With the search bar, our application now looks like this:</para>
|
||||
@@ -926,7 +926,7 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application8/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application8/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>What our application looks like now:</para>
|
||||
@@ -989,12 +989,12 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
|
||||
...
|
||||
</programlisting>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application9/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>We also need a function that counts the lines of the currently
|
||||
active tab, and updates the @lines label. See the
|
||||
<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c">full source</ulink>
|
||||
<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application9/exampleappwin.c">full source</ulink>
|
||||
if you are interested in the details.</para>
|
||||
|
||||
<para>This brings our example application to this appearance:</para>
|
||||
|
||||
@@ -99,15 +99,6 @@
|
||||
<xi:include href="xml/gtklevelbar.xml" />
|
||||
<xi:include href="xml/gtkstatusbar.xml" />
|
||||
<xi:include href="xml/gtkaccellabel.xml" />
|
||||
<xi:include href="xml/gtkcalendar.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="MediaSupport">
|
||||
<title>Media Support</title>
|
||||
<xi:include href="xml/gtkvideo.xml" />
|
||||
<xi:include href="xml/gtkmediacontrols.xml" />
|
||||
<xi:include href="xml/gtkmediastream.xml" />
|
||||
<xi:include href="xml/gtkmediafile.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="ButtonWidgets">
|
||||
@@ -219,12 +210,6 @@
|
||||
<xi:include href="xml/gtkfontchooserdialog.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="DrawingWidgets">
|
||||
<title>Widgets for custom drawing</title>
|
||||
<xi:include href="xml/gtkdrawingarea.xml" />
|
||||
<xi:include href="xml/gtkglarea.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Ornaments">
|
||||
<title>Ornaments</title>
|
||||
<xi:include href="xml/gtkframe.xml" />
|
||||
@@ -236,7 +221,6 @@
|
||||
<xi:include href="xml/gtkscrollbar.xml" />
|
||||
<xi:include href="xml/gtkscrolledwindow.xml" />
|
||||
<xi:include href="xml/gtkscrollable.xml" />
|
||||
<xi:include href="xml/gtkviewport.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Printing">
|
||||
@@ -263,12 +247,16 @@
|
||||
<chapter id="MiscObjects">
|
||||
<title>Miscellaneous</title>
|
||||
<xi:include href="xml/gtkadjustment.xml" />
|
||||
<xi:include href="xml/gtkcalendar.xml" />
|
||||
<xi:include href="xml/gtkdrawingarea.xml" />
|
||||
<xi:include href="xml/gtkglarea.xml" />
|
||||
<xi:include href="xml/gtkimcontextsimple.xml" />
|
||||
<xi:include href="xml/gtkimmulticontext.xml" />
|
||||
<xi:include href="xml/gtksizegroup.xml" />
|
||||
<xi:include href="xml/gtktooltip.xml" />
|
||||
<xi:include href="xml/gtkviewport.xml" />
|
||||
<xi:include href="xml/gtkaccessible.xml" />
|
||||
<xi:include href="xml/gtksnapshot.xml" />
|
||||
<xi:include href="xml/gtkwidgetpaintable.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="AbstractObjects">
|
||||
@@ -280,7 +268,6 @@
|
||||
<xi:include href="xml/gtkrange.xml" />
|
||||
<xi:include href="xml/gtkimcontext.xml" />
|
||||
<xi:include href="xml/gtknativedialog.xml" />
|
||||
<xi:include href="xml/gtkaccessible.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="RecentDocuments">
|
||||
@@ -310,7 +297,6 @@
|
||||
<xi:include href="xml/gtkgestureswipe.xml" />
|
||||
<xi:include href="xml/gtkgesturerotate.xml" />
|
||||
<xi:include href="xml/gtkgesturezoom.xml" />
|
||||
<xi:include href="xml/gtkgesturestylus.xml" />
|
||||
<xi:include href="xml/gtkpadcontroller.xml" />
|
||||
</chapter>
|
||||
|
||||
|
||||
@@ -1270,6 +1270,8 @@ gtk_fixed_get_type
|
||||
GtkFontButton
|
||||
gtk_font_button_new
|
||||
gtk_font_button_new_with_font
|
||||
gtk_font_button_set_font_name
|
||||
gtk_font_button_get_font_name
|
||||
gtk_font_button_set_use_font
|
||||
gtk_font_button_get_use_font
|
||||
gtk_font_button_set_use_size
|
||||
@@ -1300,7 +1302,7 @@ gtk_font_chooser_set_font
|
||||
gtk_font_chooser_get_font_desc
|
||||
gtk_font_chooser_set_font_desc
|
||||
gtk_font_chooser_get_font_features
|
||||
gtk_font_chooser_set_language
|
||||
gtk_font_chooser_get_font_language
|
||||
gtk_font_chooser_get_preview_text
|
||||
gtk_font_chooser_set_preview_text
|
||||
gtk_font_chooser_get_show_preview_entry
|
||||
@@ -1481,24 +1483,24 @@ GtkIconViewPrivate
|
||||
<TITLE>GtkImage</TITLE>
|
||||
GtkImage
|
||||
GtkImageType
|
||||
gtk_image_new
|
||||
gtk_image_new_from_file
|
||||
gtk_image_new_from_resource
|
||||
gtk_image_new_from_pixbuf
|
||||
gtk_image_new_from_paintable
|
||||
gtk_image_new_from_icon_name
|
||||
gtk_image_new_from_gicon
|
||||
gtk_image_clear
|
||||
gtk_image_set_from_file
|
||||
gtk_image_set_from_resource
|
||||
gtk_image_set_from_pixbuf
|
||||
gtk_image_set_from_paintable
|
||||
gtk_image_set_from_icon_name
|
||||
gtk_image_set_from_gicon
|
||||
gtk_image_get_storage_type
|
||||
gtk_image_get_paintable
|
||||
gtk_image_get_texture
|
||||
gtk_image_get_icon_name
|
||||
gtk_image_get_gicon
|
||||
gtk_image_get_storage_type
|
||||
gtk_image_new_from_file
|
||||
gtk_image_new_from_pixbuf
|
||||
gtk_image_new_from_icon_name
|
||||
gtk_image_new_from_gicon
|
||||
gtk_image_new_from_resource
|
||||
gtk_image_new_from_texture
|
||||
gtk_image_set_from_file
|
||||
gtk_image_set_from_pixbuf
|
||||
gtk_image_set_from_icon_name
|
||||
gtk_image_set_from_gicon
|
||||
gtk_image_set_from_resource
|
||||
gtk_image_set_from_texture
|
||||
gtk_image_clear
|
||||
gtk_image_new
|
||||
gtk_image_set_pixel_size
|
||||
gtk_image_get_pixel_size
|
||||
gtk_image_set_icon_size
|
||||
@@ -1921,8 +1923,8 @@ gtk_info_bar_set_message_type
|
||||
gtk_info_bar_get_message_type
|
||||
gtk_info_bar_get_action_area
|
||||
gtk_info_bar_get_content_area
|
||||
gtk_info_bar_get_show_close_button
|
||||
gtk_info_bar_set_show_close_button
|
||||
gtk_info_bar_get_show_title_buttons
|
||||
gtk_info_bar_set_show_title_buttons
|
||||
gtk_info_bar_get_revealed
|
||||
gtk_info_bar_set_revealed
|
||||
|
||||
@@ -2395,8 +2397,6 @@ gtk_search_bar_set_search_mode
|
||||
gtk_search_bar_get_show_close_button
|
||||
gtk_search_bar_set_show_close_button
|
||||
gtk_search_bar_handle_event
|
||||
gtk_search_bar_set_key_capture_widget
|
||||
gtk_search_bar_get_key_capture_widget
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SEARCH_BAR
|
||||
GTK_SEARCH_BAR
|
||||
@@ -2414,8 +2414,6 @@ gtk_search_bar_get_type
|
||||
GtkSearchEntry
|
||||
gtk_search_entry_new
|
||||
gtk_search_entry_handle_event
|
||||
gtk_search_entry_set_key_capture_widget
|
||||
gtk_search_entry_get_key_capture_widget
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SEARCH_ENTRY
|
||||
GTK_SEARCH_ENTRY
|
||||
@@ -4170,10 +4168,15 @@ gtk_volume_button_get_type
|
||||
<TITLE>GtkSnapshot</TITLE>
|
||||
GtkSnapshot
|
||||
gtk_snapshot_new
|
||||
gtk_snapshot_ref
|
||||
gtk_snapshot_unref
|
||||
gtk_snapshot_to_node
|
||||
gtk_snapshot_to_paintable
|
||||
gtk_snapshot_free_to_node
|
||||
gtk_snapshot_free_to_paintable
|
||||
gtk_snapshot_get_renderer
|
||||
gtk_snapshot_get_record_names
|
||||
gtk_snapshot_push
|
||||
gtk_snapshot_push_transform
|
||||
gtk_snapshot_push_opacity
|
||||
gtk_snapshot_push_color_matrix
|
||||
@@ -4190,6 +4193,7 @@ gtk_snapshot_append_cairo
|
||||
gtk_snapshot_append_texture
|
||||
gtk_snapshot_append_color
|
||||
gtk_snapshot_append_layout
|
||||
gtk_snapshot_clips_rect
|
||||
gtk_snapshot_render_background
|
||||
gtk_snapshot_render_frame
|
||||
gtk_snapshot_render_focus
|
||||
@@ -4197,24 +4201,6 @@ gtk_snapshot_render_layout
|
||||
gtk_snapshot_render_insertion_cursor
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkwidgetpaintable</FILE>
|
||||
<TITLE>GtkWidgetPaintable</TITLE>
|
||||
gtk_widget_paintable_new
|
||||
gtk_widget_paintable_get_widget
|
||||
gtk_widget_paintable_set_widget
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_WIDGET_PAINTABLE
|
||||
GTK_IS_WIDGET_PAINTABLE
|
||||
GTK_TYPE_WIDGET_PAINTABLE
|
||||
GTK_WIDGET_PAINTABLE_CLASS
|
||||
GTK_IS_WIDGET_PAINTABLE_CLASS
|
||||
GTK_WIDGET_PAINTABLE_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_widget_paintable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkwidget</FILE>
|
||||
<TITLE>GtkWidget</TITLE>
|
||||
@@ -4234,6 +4220,7 @@ gtk_widget_map
|
||||
gtk_widget_unmap
|
||||
gtk_widget_realize
|
||||
gtk_widget_unrealize
|
||||
gtk_widget_draw
|
||||
gtk_widget_queue_draw
|
||||
gtk_widget_queue_resize
|
||||
gtk_widget_queue_resize_no_redraw
|
||||
@@ -4265,8 +4252,6 @@ gtk_widget_get_toplevel
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
gtk_widget_add_controller
|
||||
gtk_widget_remove_controller
|
||||
gtk_widget_set_direction
|
||||
GtkTextDirection
|
||||
gtk_widget_get_direction
|
||||
@@ -4280,6 +4265,8 @@ gtk_widget_get_font_options
|
||||
gtk_widget_set_font_map
|
||||
gtk_widget_get_font_map
|
||||
gtk_widget_create_pango_layout
|
||||
gtk_widget_queue_draw_area
|
||||
gtk_widget_queue_draw_region
|
||||
gtk_widget_get_cursor
|
||||
gtk_widget_set_cursor
|
||||
gtk_widget_set_cursor_from_name
|
||||
@@ -4325,7 +4312,7 @@ gtk_widget_get_allocated_baseline
|
||||
gtk_widget_get_allocated_size
|
||||
gtk_widget_get_width
|
||||
gtk_widget_get_height
|
||||
gtk_widget_compute_bounds
|
||||
gtk_widget_get_clip
|
||||
gtk_widget_contains
|
||||
gtk_widget_pick
|
||||
gtk_widget_get_can_default
|
||||
@@ -4355,6 +4342,7 @@ gtk_widget_set_receives_default
|
||||
gtk_widget_get_receives_default
|
||||
gtk_widget_set_support_multidevice
|
||||
gtk_widget_get_support_multidevice
|
||||
gtk_widget_set_realized
|
||||
gtk_widget_get_realized
|
||||
gtk_widget_get_mapped
|
||||
gtk_widget_device_is_shadowed
|
||||
@@ -4885,6 +4873,7 @@ gtk_render_line
|
||||
gtk_render_option
|
||||
gtk_render_slider
|
||||
gtk_render_activity
|
||||
gtk_render_icon_surface
|
||||
gtk_render_icon
|
||||
gtk_render_insertion_cursor
|
||||
|
||||
@@ -5271,7 +5260,6 @@ gtk_printer_request_details
|
||||
gtk_printer_get_capabilities
|
||||
gtk_printer_get_default_page_size
|
||||
gtk_printer_get_hard_margins
|
||||
gtk_printer_get_hard_margins_for_paper_size
|
||||
GtkPrinterFunc
|
||||
gtk_enumerate_printers
|
||||
|
||||
@@ -6628,39 +6616,15 @@ GTK_PAD_CONTROLLER_GET_CLASS
|
||||
gtk_pad_controller_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgesturestylus</FILE>
|
||||
<TITLE>GtkGestureStylus</TITLE>
|
||||
GtkGestureStylus
|
||||
|
||||
gtk_gesture_stylus_new
|
||||
gtk_gesture_stylus_get_axis
|
||||
gtk_gesture_stylus_get_axes
|
||||
gtk_gesture_stylus_get_backlog
|
||||
gtk_gesture_stylus_get_device_tool
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GESTURE_STYLUS
|
||||
GTK_GESTURE_STYLUS
|
||||
GTK_GESTURE_STYLUS_CLASS
|
||||
GTK_IS_GESTURE_STYLUS
|
||||
GTK_IS_GESTURE_STYLUS_CLASS
|
||||
GTK_GESTURE_STYLUS_GET_CLASS
|
||||
GtkGestureStylusClass
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_gesture_stylus_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkstacksidebar</FILE>
|
||||
GtkStackSidebar
|
||||
GtkStackSidebarClass
|
||||
gtk_stack_sidebar_new
|
||||
gtk_stack_sidebar_set_stack
|
||||
gtk_stack_sidebar_get_stack
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkStackSidebarClass
|
||||
GTK_TYPE_STACK_SIDEBAR
|
||||
GTK_STACK_SIDEBAR
|
||||
GTK_STACK_SIDEBAR_CLASS
|
||||
@@ -6685,6 +6649,8 @@ gtk_gl_area_attach_buffers
|
||||
gtk_gl_area_set_error
|
||||
gtk_gl_area_get_error
|
||||
<SUBSECTION>
|
||||
gtk_gl_area_set_has_alpha
|
||||
gtk_gl_area_get_has_alpha
|
||||
gtk_gl_area_set_has_depth_buffer
|
||||
gtk_gl_area_get_has_depth_buffer
|
||||
gtk_gl_area_set_has_stencil_buffer
|
||||
@@ -6791,102 +6757,3 @@ GTK_SHORTCUT_LABEL_GET_CLASS
|
||||
GTK_IS_SHORTCUT_LABEL
|
||||
GTK_IS_SHORTCUT_LABEL_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkvideo</FILE>
|
||||
GtkVideo
|
||||
gtk_video_new
|
||||
gtk_video_new_for_media_stream
|
||||
gtk_video_new_for_file
|
||||
gtk_video_new_for_filename
|
||||
gtk_video_new_for_resource
|
||||
gtk_video_get_media_stream
|
||||
gtk_video_set_media_stream
|
||||
gtk_video_get_file
|
||||
gtk_video_set_file
|
||||
gtk_video_set_filename
|
||||
gtk_video_set_resource
|
||||
gtk_video_get_autoplay
|
||||
gtk_video_set_autoplay
|
||||
gtk_video_get_loop
|
||||
gtk_video_set_loop
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_video_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmediacontrols</FILE>
|
||||
GtkMediaControls
|
||||
gtk_media_controls_new
|
||||
gtk_media_controls_get_media_stream
|
||||
gtk_media_controls_set_media_stream
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_media_controls_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmediafile</FILE>
|
||||
GtkMediaFile
|
||||
gtk_media_file_new
|
||||
gtk_media_file_new_for_filename
|
||||
gtk_media_file_new_for_resource
|
||||
gtk_media_file_new_for_file
|
||||
gtk_media_file_new_for_input_stream
|
||||
gtk_media_file_clear
|
||||
gtk_media_file_set_filename
|
||||
gtk_media_file_set_resource
|
||||
gtk_media_file_set_file
|
||||
gtk_media_file_get_file
|
||||
gtk_media_file_set_input_stream
|
||||
gtk_media_file_get_input_stream
|
||||
|
||||
<SUBSECTION Private>
|
||||
GTK_TYPE_MEDIA_FILE
|
||||
gtk_media_file_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmediastream</FILE>
|
||||
GtkMediaStream
|
||||
GtkMediaStreamClass
|
||||
|
||||
gtk_media_stream_is_prepared
|
||||
gtk_media_stream_get_error
|
||||
gtk_media_stream_has_audio
|
||||
gtk_media_stream_has_video
|
||||
gtk_media_stream_play
|
||||
gtk_media_stream_pause
|
||||
gtk_media_stream_get_playing
|
||||
gtk_media_stream_set_playing
|
||||
gtk_media_stream_get_ended
|
||||
gtk_media_stream_get_timestamp
|
||||
gtk_media_stream_get_duration
|
||||
gtk_media_stream_is_seekable
|
||||
gtk_media_stream_is_seeking
|
||||
gtk_media_stream_seek
|
||||
gtk_media_stream_get_loop
|
||||
gtk_media_stream_set_loop
|
||||
gtk_media_stream_get_muted
|
||||
gtk_media_stream_set_muted
|
||||
gtk_media_stream_get_volume
|
||||
gtk_media_stream_set_volume
|
||||
gtk_media_stream_realize
|
||||
gtk_media_stream_unrealize
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_media_stream_prepared
|
||||
gtk_media_stream_unprepared
|
||||
gtk_media_stream_update
|
||||
gtk_media_stream_ended
|
||||
gtk_media_stream_seek_success
|
||||
gtk_media_stream_seek_failed
|
||||
gtk_media_stream_gerror
|
||||
gtk_media_stream_error
|
||||
gtk_media_stream_error_valist
|
||||
|
||||
<SUBSECTION Private>
|
||||
GTK_TYPE_MEDIA_STREAM
|
||||
gtk_media_stream_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -53,9 +53,8 @@ gtk_entry_buffer_get_type
|
||||
gtk_entry_completion_get_type
|
||||
gtk_entry_get_type
|
||||
gtk_event_controller_get_type
|
||||
gtk_event_controller_key_get_type
|
||||
gtk_event_controller_motion_get_type
|
||||
gtk_event_controller_scroll_get_type
|
||||
gtk_event_controller_motion_get_type
|
||||
gtk_expander_get_type
|
||||
gtk_file_chooser_button_get_type
|
||||
gtk_file_chooser_dialog_get_type
|
||||
@@ -77,7 +76,6 @@ gtk_gesture_multi_press_get_type
|
||||
gtk_gesture_pan_get_type
|
||||
gtk_gesture_rotate_get_type
|
||||
gtk_gesture_single_get_type
|
||||
gtk_gesture_stylus_get_type
|
||||
gtk_gesture_swipe_get_type
|
||||
gtk_gesture_zoom_get_type
|
||||
gtk_gl_area_get_type
|
||||
@@ -98,9 +96,6 @@ gtk_list_store_get_type
|
||||
gtk_list_box_get_type
|
||||
gtk_list_box_row_get_type
|
||||
gtk_lock_button_get_type
|
||||
gtk_media_controls_get_type
|
||||
gtk_media_file_get_type
|
||||
gtk_media_stream_get_type
|
||||
gtk_menu_bar_get_type
|
||||
gtk_menu_button_get_type
|
||||
gtk_menu_get_type
|
||||
@@ -184,7 +179,6 @@ gtk_tree_sortable_get_type
|
||||
gtk_tree_store_get_type
|
||||
gtk_tree_view_column_get_type
|
||||
gtk_tree_view_get_type
|
||||
gtk_video_get_type
|
||||
gtk_viewport_get_type
|
||||
gtk_volume_button_get_type
|
||||
gtk_widget_get_type
|
||||
|
||||
@@ -217,12 +217,9 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GdkWindow API changes</title>
|
||||
<title>Adapt to GdkSurface API changes</title>
|
||||
<para>
|
||||
GdkWindow has been renamed to GdkSurface.
|
||||
</para>
|
||||
<para>
|
||||
The gdk_window_new() function has been replaced by a number of more
|
||||
The gdk_surface_new() function has been replaced by a number of more
|
||||
specialized constructors: gdk_surface_new_toplevel(), gdk_surface_new_popup(),
|
||||
gdk_surface_new_temp(), gdk_surface_new_child(), gdk_surface_new_input(),
|
||||
gdk_wayland_surface_new_subsurface(). Use the appropriate ones to create
|
||||
@@ -233,7 +230,7 @@
|
||||
complicating the code and could not be supported across backends.
|
||||
</para>
|
||||
<para>
|
||||
gdk_window_reparent() is no longer available.
|
||||
gdk_surface_reparent() is no longer available.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -419,8 +416,8 @@
|
||||
<title>GdkPixbuf is deemphasized</title>
|
||||
<para>
|
||||
A number of #GdkPixbuf-based APIs have been removed. The available replacements
|
||||
are either using #GIcon, or the newly introduced #GdkTexture or #GdkPaintable
|
||||
classes instead.
|
||||
are either using #GIcon, cairo_surface_t or the newly introduced #GdkTexture class
|
||||
instead.
|
||||
</para>
|
||||
<para>
|
||||
If you are dealing with pixbufs, you can use gdk_texture_new_for_pixbuf()
|
||||
@@ -429,37 +426,12 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkWidget event signals are removed</title>
|
||||
<title>GtkWidget event signals are deemphasized</title>
|
||||
<para>
|
||||
Event controllers and #GtkGestures have already been introduced in GTK+ 3 to handle
|
||||
input for many cases. In GTK+ 4, even more are available, such as #GtkEventControllerScroll
|
||||
and GtkEventControllerMotion, and the traditional widget signals for handling input,
|
||||
such as #GtkWidget::motion-event or #GtkWidget::event have been removed.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Invalidation handling has changed</title>
|
||||
<para>
|
||||
Only gtk_widget_queue_draw() is left to mark a widget as needing redraw.
|
||||
Variations like gtk_widget_queue_draw_rectangle() or gtk_widget_queue_draw_region()
|
||||
are no longer available.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using GtkWidget::draw</title>
|
||||
<para>
|
||||
The #GtkWidget::draw signal has been removed. Widgets need to implement the
|
||||
#GtkWidget::snapshot function now. Connecting draw signal handlers is no longer possible.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Window content observation has changed</title>
|
||||
<para>
|
||||
Observing widget contents and widget size is now done by using the
|
||||
#GtkWidgetPaintable object instead of connecting to widget signals.
|
||||
such as #GtkWidget::motion-event or #GtkWidget::event have been deprecated.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -503,7 +475,6 @@
|
||||
#GtkCellRendererPixbuf:icon-size.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -162,10 +162,10 @@ additional environment variables.
|
||||
Linux and Unix, and the ';' character on Windows.
|
||||
</para>
|
||||
<warning>
|
||||
Note that this environment variable is read by GTK+ 2.x and GTK+ 3.x too,
|
||||
which makes it unsuitable for setting it system-wide (or session-wide),
|
||||
since doing so will cause applications using different GTK+ versions
|
||||
to see incompatible modules.
|
||||
Note that this environment variable is read by GTK+ 2.x too, which
|
||||
makes it unsuitable for setting it system-wide (or session-wide),
|
||||
since doing so will cause either GTK+ 2.x applications or GTK+ 3
|
||||
applications to see incompatible modules.
|
||||
</warning>
|
||||
</formalpara>
|
||||
|
||||
@@ -309,7 +309,7 @@ nevertheless.
|
||||
<listitem><para>Use a legacy OpenGL context</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>gl-gles</term>
|
||||
<term>gl-legacy</term>
|
||||
<listitem><para>Use a GLES OpenGL context</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -320,6 +320,11 @@ nevertheless.
|
||||
<term>vulkan-validate</term>
|
||||
<listitem><para>Load the Vulkan validation layer, if available</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>cairo-image</term>
|
||||
<listitem><para>Use image surfaces for cairo rendering. This essentially
|
||||
turns off all hardware acceleration with the cairo renderer</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
The special value <literal>all</literal> can be used to turn on all
|
||||
debug options. The special value <literal>help</literal> can be used
|
||||
@@ -347,14 +352,6 @@ nevertheless.
|
||||
<term>opengl</term>
|
||||
<listitem><para>OpenGL renderer information</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>shaders</term>
|
||||
<listitem><para>Shaders</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>ssurface</term>
|
||||
<listitem><para>Surfaces</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>vulkan</term>
|
||||
<listitem><para>Vulkan renderer information</para></listitem>
|
||||
@@ -370,10 +367,6 @@ nevertheless.
|
||||
</variablelist>
|
||||
A number of options affect behavior instead of logging:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>diff</term>
|
||||
<listitem><para>Show differences</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>geometry</term>
|
||||
<listitem><para>Show borders</para></listitem>
|
||||
@@ -460,44 +453,6 @@ nevertheless.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><envar>GSK_RENDERER</envar></title>
|
||||
|
||||
<para>
|
||||
If set, selects the GSK renderer to use. The following renderers can
|
||||
be selected, provided they are included in the GTK library you are using
|
||||
and the GDK backend supports them:
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>help</term>
|
||||
<listitem><para>Prints information about available options</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>broadway</term>
|
||||
<listitem><para>Selects the Broadway-backend specific renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>cairo</term>
|
||||
<listitem><para>Selects the fallback Cairo renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>gl</term>
|
||||
<listitem><para>Selects the default OpenGL renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>vulkan</term>
|
||||
<listitem><para>Selects the Vulkan renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><envar>GTK_CSD</envar></title>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
|
||||
SRC = main.c exampleapp.c exampleappwin.c
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -26,6 +28,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -34,8 +37,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -46,6 +50,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
||||
@@ -5,86 +5,107 @@
|
||||
<property name="title" translatable="yes">Example Application</property>
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">400</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines_label">
|
||||
<property name="visible">0</property>
|
||||
<property name="label" translatable="yes">Lines:</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines">
|
||||
<property name="visible">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-title-buttons">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
<object class="GtkLabel" id="lines_label">
|
||||
<property name="visible">False</property>
|
||||
<property name="label" translatable="yes">Lines:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines">
|
||||
<property name="visible">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="direction">none</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="direction">none</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<signal name="search-changed" handler="search_text_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="hbox">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition-type">slide-right</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="visible">True</property>
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
|
||||
SRC = exampleapp.c exampleappwin.c main.c
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -19,6 +22,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
|
||||
SRC = exampleapp.c exampleappwin.c main.c
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -19,6 +22,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
|
||||
SRC = exampleapp.c exampleappwin.c main.c
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -19,6 +22,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -19,6 +22,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -26,6 +28,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -34,8 +37,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -46,6 +50,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -19,6 +22,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -26,6 +28,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -34,8 +37,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -46,6 +50,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
||||
@@ -7,22 +7,27 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -35,9 +40,11 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<signal name="search-changed" handler="search_text_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -45,6 +52,7 @@
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -26,6 +28,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -34,8 +37,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -46,6 +50,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
||||
@@ -7,22 +7,27 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -33,7 +38,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="direction">none</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
@@ -46,33 +53,41 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<signal name="search-changed" handler="search_text_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="hbox">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition-type">slide-right</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="visible">True</property>
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -26,6 +28,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -34,8 +37,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -46,6 +50,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
||||
@@ -7,33 +7,44 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines_label">
|
||||
<property name="visible">0</property>
|
||||
<property name="visible">False</property>
|
||||
<property name="label" translatable="yes">Lines:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines">
|
||||
<property name="visible">0</property>
|
||||
<property name="visible">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -44,7 +55,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="direction">none</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
@@ -57,33 +70,41 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<signal name="search-changed" handler="search_text_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="hbox">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition-type">slide-right</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="visible">True</property>
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -4,31 +4,37 @@
|
||||
<property name="modal">1</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsSection">
|
||||
<property name="visible">1</property>
|
||||
<property name="section-name">shortcuts</property>
|
||||
<property name="max-height">12</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="visible">1</property>
|
||||
<property name="title">General</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">app.new</property>
|
||||
<property name="title" translatable="yes">New Window</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">app.quit</property>
|
||||
<property name="title" translatable="yes">Quit</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.fullscreen</property>
|
||||
<property name="title" translatable="yes">Fullscreen</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.show-help-overlay</property>
|
||||
<property name="title" translatable="yes">Shortcuts</property>
|
||||
</object>
|
||||
@@ -37,33 +43,39 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="visible">1</property>
|
||||
<property name="title">Text</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.copy</property>
|
||||
<property name="title" translatable="yes">Copy</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.paste</property>
|
||||
<property name="title" translatable="yes">Paste</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.justify::left</property>
|
||||
<property name="title" translatable="yes">Justify left</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.justify::center</property>
|
||||
<property name="title" translatable="yes">Justify center</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="visible">1</property>
|
||||
<property name="action-name">win.justify::right</property>
|
||||
<property name="title" translatable="yes">Justify right</property>
|
||||
</object>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<interface>
|
||||
<menu id="app-menu">
|
||||
<section>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
<interface>
|
||||
<object id="window" class="GtkWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title">Grid</property>
|
||||
<child>
|
||||
<object id="grid" class="GtkGrid">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object id="button1" class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Button 1</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -14,6 +17,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object id="button2" class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Button 2</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -23,6 +27,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object id="quit" class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">Quit</property>
|
||||
</object>
|
||||
<packing>
|
||||
@@ -32,6 +37,8 @@
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
||||
@@ -21,6 +21,7 @@ static void
|
||||
size_allocate_cb (GtkWidget *widget,
|
||||
GtkAllocation *alloc,
|
||||
int baseline,
|
||||
GdkRectangle *clip,
|
||||
gpointer data)
|
||||
{
|
||||
if (surface)
|
||||
@@ -72,8 +73,8 @@ draw_brush (GtkWidget *widget,
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
/* Now invalidate the drawing area. */
|
||||
gtk_widget_queue_draw (widget);
|
||||
/* Now invalidate the affected region of the drawing area. */
|
||||
gtk_widget_queue_draw_area (widget, x - 3, y - 3, 6, 6);
|
||||
}
|
||||
|
||||
static double start_x;
|
||||
@@ -157,16 +158,17 @@ activate (GtkApplication *app,
|
||||
g_signal_connect_after (drawing_area, "size-allocate",
|
||||
G_CALLBACK (size_allocate_cb), NULL);
|
||||
|
||||
drag = gtk_gesture_drag_new ();
|
||||
drag = gtk_gesture_drag_new (drawing_area);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (drag));
|
||||
g_object_set_data_full (G_OBJECT (drawing_area), "drag", drag, g_object_unref);
|
||||
|
||||
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), drawing_area);
|
||||
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), drawing_area);
|
||||
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), drawing_area);
|
||||
|
||||
press = gtk_gesture_multi_press_new ();
|
||||
press = gtk_gesture_multi_press_new (drawing_area);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (press), GDK_BUTTON_SECONDARY);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (press));
|
||||
g_object_set_data_full (G_OBJECT (drawing_area), "press", press, g_object_unref);
|
||||
|
||||
g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area);
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static gboolean
|
||||
window_key_pressed (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
GtkSearchBar *search_bar)
|
||||
window_key_press_event_cb (GtkWidget *window,
|
||||
GdkEvent *event,
|
||||
GtkSearchBar *search_bar)
|
||||
{
|
||||
return gtk_search_bar_handle_event (search_bar,
|
||||
gtk_get_current_event ());
|
||||
return gtk_search_bar_handle_event (search_bar, event);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -20,7 +17,6 @@ activate_cb (GtkApplication *app,
|
||||
GtkWidget *box;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *menu_button;
|
||||
GtkEventController *controller;
|
||||
|
||||
window = gtk_application_window_new (app);
|
||||
gtk_widget_show (window);
|
||||
@@ -41,11 +37,8 @@ activate_cb (GtkApplication *app,
|
||||
|
||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry));
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (window_key_pressed), search_bar);
|
||||
gtk_widget_add_controller (window, controller);
|
||||
g_signal_connect (window, "key-press-event",
|
||||
G_CALLBACK (window_key_press_event_cb), search_bar);
|
||||
}
|
||||
|
||||
gint
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright © 2018 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkconfig.h"
|
||||
|
||||
#include "gdkcairocontext-broadway.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwayCairoContext, gdk_broadway_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gdk_broadway_cairo_context_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (self));
|
||||
cairo_t *cr;
|
||||
cairo_region_t *repaint_region;
|
||||
int width, height, scale;
|
||||
|
||||
width = gdk_surface_get_width (surface);
|
||||
height = gdk_surface_get_height (surface);
|
||||
scale = gdk_surface_get_scale_factor (surface);
|
||||
self->paint_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
width * scale, height * scale);
|
||||
cairo_surface_set_device_scale (self->paint_surface, scale, scale);
|
||||
|
||||
repaint_region = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { 0, 0, width, height });
|
||||
cairo_region_union (region, repaint_region);
|
||||
cairo_region_destroy (repaint_region);
|
||||
|
||||
/* clear the repaint area */
|
||||
cr = cairo_create (self->paint_surface);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
add_uint32 (GArray *nodes, guint32 v)
|
||||
{
|
||||
g_array_append_val (nodes, v);
|
||||
}
|
||||
|
||||
static void
|
||||
add_float (GArray *nodes, float f)
|
||||
{
|
||||
gint32 i = (gint32) (f * 256.0f);
|
||||
guint u = (guint32) i;
|
||||
g_array_append_val (nodes, u);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||
GdkDisplay *display = gdk_draw_context_get_display (draw_context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkTexture *texture;
|
||||
GPtrArray *node_textures;
|
||||
GArray *nodes;
|
||||
guint32 texture_id;
|
||||
|
||||
nodes = g_array_new (FALSE, FALSE, sizeof(guint32));
|
||||
node_textures = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
texture = gdk_texture_new_for_surface ((cairo_surface_t *)self->paint_surface);
|
||||
g_ptr_array_add (node_textures, g_object_ref (texture)); /* Transfers ownership to node_textures */
|
||||
texture_id = gdk_broadway_display_ensure_texture (display, texture);
|
||||
|
||||
add_uint32 (nodes, BROADWAY_NODE_TEXTURE);
|
||||
add_float (nodes, 0);
|
||||
add_float (nodes, 0);
|
||||
add_float (nodes, cairo_image_surface_get_width (self->paint_surface));
|
||||
add_float (nodes, cairo_image_surface_get_height (self->paint_surface));
|
||||
add_uint32 (nodes, texture_id);
|
||||
|
||||
gdk_broadway_surface_set_nodes (surface, nodes, node_textures);
|
||||
g_array_unref (nodes);
|
||||
g_ptr_array_unref (node_textures);
|
||||
|
||||
cairo_surface_destroy (self->paint_surface);
|
||||
self->paint_surface = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_surface_resized (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static cairo_t *
|
||||
gdk_broadway_cairo_context_cairo_create (GdkCairoContext *context)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (context);
|
||||
|
||||
return cairo_create (self->paint_surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_class_init (GdkBroadwayCairoContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GdkCairoContextClass *cairo_context_class = GDK_CAIRO_CONTEXT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gdk_broadway_cairo_context_dispose;
|
||||
|
||||
draw_context_class->begin_frame = gdk_broadway_cairo_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_broadway_cairo_context_end_frame;
|
||||
draw_context_class->surface_resized = gdk_broadway_cairo_context_surface_resized;
|
||||
|
||||
cairo_context_class->cairo_create = gdk_broadway_cairo_context_cairo_create;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_init (GdkBroadwayCairoContext *self)
|
||||
{
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright © 2018 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_BROADWAY_CAIRO_CONTEXT__
|
||||
#define __GDK_BROADWAY_CAIRO_CONTEXT__
|
||||
|
||||
#include "gdkconfig.h"
|
||||
|
||||
#include "gdkcairocontextprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_BROADWAY_CAIRO_CONTEXT (gdk_broadway_cairo_context_get_type ())
|
||||
#define GDK_BROADWAY_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_BROADWAY_CAIRO_CONTEXT, GdkBroadwayCairoContext))
|
||||
#define GDK_IS_BROADWAY_CAIRO_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_BROADWAY_CAIRO_CONTEXT))
|
||||
#define GDK_BROADWAY_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_CAIRO_CONTEXT, GdkBroadwayCairoContextClass))
|
||||
#define GDK_IS_BROADWAY_CAIRO_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_CAIRO_CONTEXT))
|
||||
#define GDK_BROADWAY_CAIRO_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_CAIRO_CONTEXT, GdkBroadwayCairoContextClass))
|
||||
|
||||
typedef struct _GdkBroadwayCairoContext GdkBroadwayCairoContext;
|
||||
typedef struct _GdkBroadwayCairoContextClass GdkBroadwayCairoContextClass;
|
||||
|
||||
struct _GdkBroadwayCairoContext
|
||||
{
|
||||
GdkCairoContext parent_instance;
|
||||
|
||||
cairo_surface_t *paint_surface;
|
||||
};
|
||||
|
||||
struct _GdkBroadwayCairoContextClass
|
||||
{
|
||||
GdkCairoContextClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_broadway_cairo_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_BROADWAY_CAIRO_CONTEXT__ */
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "gdkdisplay-broadway.h"
|
||||
|
||||
#include "gdkcairocontext-broadway.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkeventsource.h"
|
||||
#include "gdkmonitor-broadway.h"
|
||||
@@ -44,6 +43,92 @@
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
||||
static gboolean
|
||||
compare_surface (cairo_surface_t *a,
|
||||
cairo_surface_t *b,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
unsigned char *data_a, *data_b;
|
||||
int stride_a, stride_b;
|
||||
int y;
|
||||
|
||||
data_a = cairo_image_surface_get_data (a);
|
||||
stride_a = cairo_image_surface_get_stride (a);
|
||||
|
||||
data_b = cairo_image_surface_get_data (b);
|
||||
stride_b = cairo_image_surface_get_stride (b);
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
if (memcmp (data_a, data_b, 4 * width) != 0)
|
||||
return FALSE;
|
||||
data_a += stride_a;
|
||||
data_b += stride_b;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_texture_equal (GdkTexture *a,
|
||||
GdkTexture *b)
|
||||
{
|
||||
cairo_surface_t *surface_a;
|
||||
cairo_surface_t *surface_b;
|
||||
gboolean res;
|
||||
|
||||
if (a == b)
|
||||
return TRUE;
|
||||
|
||||
if (a->width != b->width ||
|
||||
a->height != b->height)
|
||||
return FALSE;
|
||||
|
||||
surface_a = gdk_texture_download_surface (a);
|
||||
surface_b = gdk_texture_download_surface (b);
|
||||
|
||||
res = compare_surface (surface_a, surface_b, a->width, a->height);
|
||||
|
||||
cairo_surface_destroy (surface_a);
|
||||
cairo_surface_destroy (surface_b);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_texture_hash (GdkTexture *self)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
unsigned char *data;
|
||||
int stride;
|
||||
guint32 *row;
|
||||
guint64 sum;
|
||||
int x, y, width, height;
|
||||
guint h;
|
||||
|
||||
surface = gdk_texture_download_surface (self);
|
||||
data = cairo_image_surface_get_data (surface);
|
||||
stride = cairo_image_surface_get_stride (surface);
|
||||
|
||||
width = MIN (self->width, 4);
|
||||
height = MIN (self->height, 4);
|
||||
|
||||
sum = 0;
|
||||
for (y = 0; y < height; y++, data += stride)
|
||||
{
|
||||
row = (guint32 *)data;
|
||||
for (x = 0; x < width; x++)
|
||||
sum += row[x];
|
||||
}
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
h = sum / (width * height);
|
||||
|
||||
return h ^ self->width ^ (self->height << 16);
|
||||
}
|
||||
|
||||
static void gdk_broadway_display_dispose (GObject *object);
|
||||
static void gdk_broadway_display_finalize (GObject *object);
|
||||
|
||||
@@ -63,6 +148,7 @@ gdk_broadway_display_init (GdkBroadwayDisplay *display)
|
||||
NULL);
|
||||
gdk_monitor_set_manufacturer (display->monitor, "browser");
|
||||
gdk_monitor_set_model (display->monitor, "0");
|
||||
display->texture_cache = g_hash_table_new ((GHashFunc)gdk_texture_hash, (GEqualFunc)gdk_texture_equal);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -177,7 +263,7 @@ _gdk_broadway_display_open (const gchar *display_name)
|
||||
broadway_display->server = _gdk_broadway_server_new (display_name, &error);
|
||||
if (broadway_display->server == NULL)
|
||||
{
|
||||
g_printerr ("Unable to init Broadway server: %s\n", error->message);
|
||||
g_printerr ("Unable to init server: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
@@ -352,17 +438,39 @@ gdk_broadway_display_get_last_seen_time (GdkDisplay *display)
|
||||
typedef struct {
|
||||
int id;
|
||||
GdkDisplay *display;
|
||||
GdkTexture *in_cache;
|
||||
GList *textures;
|
||||
} BroadwayTextureData;
|
||||
|
||||
static void
|
||||
broadway_texture_data_free (BroadwayTextureData *data)
|
||||
broadway_texture_data_notify (BroadwayTextureData *data,
|
||||
GdkTexture *disposed_texture)
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (data->display);
|
||||
|
||||
gdk_broadway_server_release_texture (broadway_display->server, data->id);
|
||||
g_object_unref (data->display);
|
||||
g_free (data);
|
||||
if (data->in_cache == disposed_texture)
|
||||
{
|
||||
g_hash_table_remove (broadway_display->texture_cache, disposed_texture);
|
||||
data->in_cache = NULL;
|
||||
}
|
||||
|
||||
g_object_set_data (G_OBJECT (disposed_texture), "broadway-data", NULL);
|
||||
|
||||
data->textures = g_list_remove (data->textures, disposed_texture);
|
||||
if (data->textures == NULL)
|
||||
{
|
||||
gdk_broadway_server_release_texture (broadway_display->server, data->id);
|
||||
g_object_unref (data->display);
|
||||
g_free (data);
|
||||
}
|
||||
else if (data->in_cache == NULL)
|
||||
{
|
||||
GdkTexture *first = data->textures->data;
|
||||
|
||||
data->in_cache = first;
|
||||
g_hash_table_replace (broadway_display->texture_cache,
|
||||
data->in_cache, data->in_cache);
|
||||
}
|
||||
}
|
||||
|
||||
guint32
|
||||
@@ -371,18 +479,35 @@ gdk_broadway_display_ensure_texture (GdkDisplay *display,
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
BroadwayTextureData *data;
|
||||
guint32 id;
|
||||
GdkTexture *cached;
|
||||
|
||||
data = g_object_get_data (G_OBJECT (texture), "broadway-data");
|
||||
if (data != NULL)
|
||||
return data->id;
|
||||
|
||||
cached = g_hash_table_lookup (broadway_display->texture_cache, texture);
|
||||
if (cached)
|
||||
data = g_object_get_data (G_OBJECT (cached), "broadway-data");
|
||||
|
||||
if (data == NULL)
|
||||
{
|
||||
guint32 id = gdk_broadway_server_upload_texture (broadway_display->server, texture);
|
||||
id = gdk_broadway_server_upload_texture (broadway_display->server, texture);
|
||||
|
||||
data = g_new0 (BroadwayTextureData, 1);
|
||||
data->id = id;
|
||||
data->display = g_object_ref (display);
|
||||
g_object_set_data_full (G_OBJECT (texture), "broadway-data", data, (GDestroyNotify)broadway_texture_data_free);
|
||||
|
||||
data->in_cache = texture;
|
||||
g_hash_table_replace (broadway_display->texture_cache,
|
||||
data->in_cache, data->in_cache);
|
||||
}
|
||||
|
||||
data->textures = g_list_prepend (data->textures, texture);
|
||||
|
||||
g_object_weak_ref (G_OBJECT (texture), (GWeakNotify)broadway_texture_data_notify, data);
|
||||
g_object_set_data (G_OBJECT (texture), "broadway-data", data);
|
||||
|
||||
return data->id;
|
||||
}
|
||||
|
||||
@@ -396,7 +521,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
object_class->finalize = gdk_broadway_display_finalize;
|
||||
|
||||
display_class->surface_type = GDK_TYPE_BROADWAY_SURFACE;
|
||||
display_class->cairo_context_type = GDK_TYPE_BROADWAY_CAIRO_CONTEXT;
|
||||
|
||||
display_class->get_name = gdk_broadway_display_get_name;
|
||||
display_class->beep = gdk_broadway_display_beep;
|
||||
|
||||
@@ -84,7 +84,7 @@ gdk_broadway_drag_context_finalize (GObject *object)
|
||||
/* Drag Contexts */
|
||||
|
||||
GdkDragContext *
|
||||
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
_gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
GdkDevice *device,
|
||||
GdkContentProvider *content,
|
||||
GdkDragAction actions,
|
||||
@@ -97,7 +97,7 @@ _gdk_broadway_surface_drag_begin (GdkSurface *surface,
|
||||
g_return_val_if_fail (GDK_SURFACE_IS_BROADWAY (surface), NULL);
|
||||
|
||||
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
|
||||
"device", device,
|
||||
"display", gdk_surface_get_display (surface),
|
||||
"content", content,
|
||||
NULL);
|
||||
|
||||
@@ -128,6 +128,14 @@ gdk_broadway_drag_context_drag_status (GdkDragContext *context,
|
||||
g_return_if_fail (context != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_drop_reply (GdkDragContext *context,
|
||||
gboolean ok,
|
||||
guint32 time)
|
||||
{
|
||||
g_return_if_fail (context != NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_drag_context_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
@@ -141,6 +149,14 @@ _gdk_broadway_surface_register_dnd (GdkSurface *surface)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_drag_context_drop_status (GdkDragContext *context)
|
||||
{
|
||||
g_return_val_if_fail (context != NULL, FALSE);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_display_init_dnd (GdkDisplay *display)
|
||||
{
|
||||
@@ -157,5 +173,7 @@ gdk_broadway_drag_context_class_init (GdkBroadwayDragContextClass *klass)
|
||||
context_class->drag_status = gdk_broadway_drag_context_drag_status;
|
||||
context_class->drag_abort = gdk_broadway_drag_context_drag_abort;
|
||||
context_class->drag_drop = gdk_broadway_drag_context_drag_drop;
|
||||
context_class->drop_reply = gdk_broadway_drag_context_drop_reply;
|
||||
context_class->drop_finish = gdk_broadway_drag_context_drop_finish;
|
||||
context_class->drop_status = gdk_broadway_drag_context_drop_status;
|
||||
}
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright © 2018 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkconfig.h"
|
||||
|
||||
#include "gdkdrawcontext-broadway.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwayDrawContext, gdk_broadway_draw_context, GDK_TYPE_DRAW_CONTEXT)
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_dispose (GObject *object)
|
||||
{
|
||||
G_OBJECT_CLASS (gdk_broadway_draw_context_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (self));
|
||||
|
||||
cairo_region_union_rectangle (region,
|
||||
&(cairo_rectangle_int_t) {
|
||||
0, 0,
|
||||
gdk_surface_get_width (surface),
|
||||
gdk_surface_get_height (surface)
|
||||
});
|
||||
|
||||
g_assert (self->nodes == NULL);
|
||||
g_assert (self->node_textures == NULL);
|
||||
|
||||
self->nodes = g_array_new (FALSE, FALSE, sizeof(guint32));
|
||||
self->node_textures = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted)
|
||||
{
|
||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
|
||||
gdk_broadway_surface_set_nodes (surface, self->nodes, self->node_textures);
|
||||
|
||||
g_array_unref (self->nodes);
|
||||
self->nodes = NULL;
|
||||
g_ptr_array_unref (self->node_textures);
|
||||
self->node_textures = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_surface_resized (GdkDrawContext *draw_context)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_class_init (GdkBroadwayDrawContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gdk_broadway_draw_context_dispose;
|
||||
|
||||
draw_context_class->begin_frame = gdk_broadway_draw_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_broadway_draw_context_end_frame;
|
||||
draw_context_class->surface_resized = gdk_broadway_draw_context_surface_resized;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_init (GdkBroadwayDrawContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
GdkBroadwayDrawContext *
|
||||
gdk_broadway_draw_context_context (GdkSurface *surface)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_BROADWAY_DRAW_CONTEXT,
|
||||
"surface", surface,
|
||||
NULL);
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright © 2018 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_BROADWAY_DRAW_CONTEXT__
|
||||
#define __GDK_BROADWAY_DRAW_CONTEXT__
|
||||
|
||||
#include "gdkconfig.h"
|
||||
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_BROADWAY_DRAW_CONTEXT (gdk_broadway_draw_context_get_type ())
|
||||
#define GDK_BROADWAY_DRAW_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_BROADWAY_DRAW_CONTEXT, GdkBroadwayDrawContext))
|
||||
#define GDK_IS_BROADWAY_DRAW_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_BROADWAY_DRAW_CONTEXT))
|
||||
#define GDK_BROADWAY_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_DRAW_CONTEXT, GdkBroadwayDrawContextClass))
|
||||
#define GDK_IS_BROADWAY_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_DRAW_CONTEXT))
|
||||
#define GDK_BROADWAY_DRAW_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_DRAW_CONTEXT, GdkBroadwayDrawContextClass))
|
||||
|
||||
typedef struct _GdkBroadwayDrawContext GdkBroadwayDrawContext;
|
||||
typedef struct _GdkBroadwayDrawContextClass GdkBroadwayDrawContextClass;
|
||||
|
||||
struct _GdkBroadwayDrawContext
|
||||
{
|
||||
GdkDrawContext parent_instance;
|
||||
|
||||
GPtrArray *node_textures;
|
||||
GArray *nodes;
|
||||
};
|
||||
|
||||
struct _GdkBroadwayDrawContextClass
|
||||
{
|
||||
GdkDrawContextClass parent_class;
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_broadway_draw_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkBroadwayDrawContext *gdk_broadway_draw_context_context (GdkSurface *surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_BROADWAY_DRAW_CONTEXT__ */
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <gdk/gdkinternals.h>
|
||||
#include "gdksurface-broadway.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
#include "gdkdrawcontext-broadway.h"
|
||||
|
||||
#include "gdkbroadwaycursor.h"
|
||||
#include "gdkbroadwaysurface.h"
|
||||
|
||||
@@ -412,10 +412,7 @@ gdk_surface_broadway_move_resize (GdkSurface *surface,
|
||||
surface->width, surface->height);
|
||||
queue_flush (surface);
|
||||
if (size_changed)
|
||||
{
|
||||
surface->resize_count++;
|
||||
_gdk_surface_update_size (surface);
|
||||
}
|
||||
surface->resize_count++;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -874,6 +871,14 @@ gdk_broadway_surface_set_functions (GdkSurface *surface,
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_end_paint (GdkSurface *surface)
|
||||
{
|
||||
GdkSurfaceImplBroadway *impl;
|
||||
impl = GDK_SURFACE_IMPL_BROADWAY (surface->impl);
|
||||
impl->dirty = TRUE;
|
||||
}
|
||||
|
||||
typedef struct _MoveResizeData MoveResizeData;
|
||||
|
||||
struct _MoveResizeData
|
||||
@@ -1370,6 +1375,7 @@ gdk_surface_impl_broadway_class_init (GdkSurfaceImplBroadwayClass *klass)
|
||||
impl_class->get_device_state = gdk_surface_broadway_get_device_state;
|
||||
impl_class->input_shape_combine_region = gdk_surface_broadway_input_shape_combine_region;
|
||||
impl_class->destroy = _gdk_broadway_surface_destroy;
|
||||
impl_class->end_paint = gdk_broadway_surface_end_paint;
|
||||
impl_class->beep = gdk_broadway_surface_beep;
|
||||
|
||||
impl_class->focus = gdk_broadway_surface_focus;
|
||||
|
||||
@@ -3,8 +3,6 @@ gdk_broadway_sources = files([
|
||||
'broadway-server.c',
|
||||
'broadwayd.c',
|
||||
'gdkbroadway-server.c',
|
||||
'gdkcairocontext-broadway.c',
|
||||
'gdkdrawcontext-broadway.c',
|
||||
'gdkcursor-broadway.c',
|
||||
'gdkdevice-broadway.c',
|
||||
'gdkdisplay-broadway.c',
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user