Compare commits
181 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 99cfaf622d | |||
| 80617f01c3 | |||
| 33085457a7 | |||
| df593ee651 | |||
| 4dcd011486 | |||
| 6fe7e373e2 | |||
| 0c3583b4bd | |||
| 5bd0179a88 | |||
| f116efd48e | |||
| 8057bee295 | |||
| ab330f1efc | |||
| eaf4fb68f3 | |||
| bfe193e6e2 | |||
| aa8dec3d27 | |||
| d2e7060150 | |||
| 08f3acb534 | |||
| 525f96f2f8 | |||
| b6b2682bd6 | |||
| 1832964188 | |||
| eb599653e6 | |||
| e1e88ce665 | |||
| 66d21689bc | |||
| 8186cb8bee | |||
| 9b8f28903b | |||
| 1cd42825c2 | |||
| 166444f115 | |||
| 3cd68c5de5 | |||
| 9e2357d5f3 | |||
| bd0c68f641 | |||
| c3a7d79154 | |||
| 25624083dd | |||
| 407b5246a6 | |||
| 6bedcf22bc | |||
| eeb9d6c398 | |||
| cf8d2374c5 | |||
| 9fa5378d83 | |||
| 90352d760d | |||
| c3c1763a9f | |||
| 9f7c9ce6ad | |||
| 1f155bf39a | |||
| 84014e3414 | |||
| 4ced1c90f1 | |||
| 54c3b947fc | |||
| 94007caf8d | |||
| 675c8b45b1 | |||
| ea59d174a0 | |||
| 32935d9fb0 | |||
| b390e1da4f | |||
| cccd1147e7 | |||
| d8db5f3217 | |||
| f5bb364bb5 | |||
| 20c41dce80 | |||
| a9de385ac5 | |||
| ead210c170 | |||
| 2ad471542a | |||
| d73cff5846 | |||
| 213376ee0a | |||
| 1cc100415f | |||
| d9ad7884e9 | |||
| f545d7a910 | |||
| 206eb647a4 | |||
| 00e637b480 | |||
| bfc8b7b7b6 | |||
| c44288c739 | |||
| 2fb5104731 | |||
| 0ae4d80766 | |||
| f5098e4fc5 | |||
| 28607f082c | |||
| f3968f2f1e | |||
| 88fa226223 | |||
| c4c496a31c | |||
| c1eac4a421 | |||
| b5d1323f49 | |||
| e297ac319d | |||
| bf852bea24 | |||
| a652507b7b | |||
| 4a2a76c231 | |||
| 8cb7369b7a | |||
| 588076d166 | |||
| 3a98b28ab7 | |||
| cfeedcc321 | |||
| d0aedbc9fc | |||
| 5557a528b6 | |||
| 5316eb0c35 | |||
| e6afe28de5 | |||
| eaf0353205 | |||
| f9f9bd3f5b | |||
| ca79688f52 | |||
| efa8f903c2 | |||
| f7d0b91267 | |||
| ed4f0de2b0 | |||
| 50b96dcdd5 | |||
| cf25f2c04b | |||
| ddf07ffe22 | |||
| 82f1eaacc9 | |||
| 4cdb07fa02 | |||
| bdd5393084 | |||
| 27b87ebec5 | |||
| 8c0df66d5f | |||
| e5238bf54f | |||
| e9abcde031 | |||
| d45281e6c7 | |||
| 3fd5ebffcb | |||
| 88a621fa13 | |||
| ce4b799f1e | |||
| 4dcacff312 | |||
| fd7667246d | |||
| b8cb15f28d | |||
| 51607ce93c | |||
| 66284cd245 | |||
| f9faecd5b7 | |||
| 92261b5022 | |||
| 91f5bfd211 | |||
| 63f20b173d | |||
| 25b3bd64af | |||
| fc4d36e50a | |||
| dbede0b115 | |||
| 1e40033852 | |||
| 478bf45320 | |||
| dac0b7d609 | |||
| d14987e819 | |||
| 3a0077f65f | |||
| 03882ef8e5 | |||
| 505e10f3ea | |||
| 1e01444de8 | |||
| 4404c43cd3 | |||
| 92a7c7cdc3 | |||
| 33db142eab | |||
| 68319afd23 | |||
| 25f4e597ee | |||
| db8339ca66 | |||
| 5ba02e3459 | |||
| 999509be61 | |||
| 5dca6dce91 | |||
| d3acfa8c2b | |||
| c1cc8c979b | |||
| eed74f6ea0 | |||
| e5a4b91997 | |||
| 885b34d382 | |||
| 3faf9d85bb | |||
| 4cd4c25c25 | |||
| bffa5dfddd | |||
| 2fe20878c3 | |||
| b28c3ef3d9 | |||
| ed5fb4bbfe | |||
| 2dd86aaa00 | |||
| eaf952d902 | |||
| 88cb6a46f2 | |||
| c76b4bdc77 | |||
| 62fe4eae16 | |||
| 99a40de8ad | |||
| b8376407a4 | |||
| a5643b0c83 | |||
| 828688d5cd | |||
| fc47b913b1 | |||
| 7d8b3357a5 | |||
| e0b98bc7de | |||
| 493b145496 | |||
| 1b2c11d7f5 | |||
| a56828237a | |||
| 56e2a7e8bb | |||
| f278f3610b | |||
| c111e633e9 | |||
| eea7cf30bb | |||
| 36bdcfaccb | |||
| 45bb820656 | |||
| 617deb8bb6 | |||
| 8efcd34dbe | |||
| a78b573f8b | |||
| 226f0e0567 | |||
| 4304a494ae | |||
| b71ff21530 | |||
| 6a7da77980 | |||
| c5f92340ee | |||
| 572a884e90 | |||
| 69bc9d0702 | |||
| 34ff9e359b | |||
| de705c2a2b | |||
| d1102f586c | |||
| ab65e8e178 | |||
| 4d741bac98 |
@@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
|
||||
|
||||
:: FIXME: make warnings fatal
|
||||
pip3 install --upgrade --user meson==0.59 || goto :error
|
||||
meson -Dmedia-gstreamer=disabled _build || goto :error
|
||||
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
|
||||
ninja -C _build || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
@@ -1040,7 +1040,7 @@ out:
|
||||
g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app);
|
||||
}
|
||||
else
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
gtk_window_present (GTK_WINDOW (window));
|
||||
|
||||
if (autoquit)
|
||||
g_timeout_add_seconds (1, auto_quit, app);
|
||||
|
||||
@@ -160,7 +160,7 @@ endif
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
glib_compile_resources = find_program('glib-compile-resources')
|
||||
|
||||
# Create the resource blob
|
||||
|
||||
@@ -871,7 +871,7 @@ activate (GApplication *app)
|
||||
|
||||
update_ui ();
|
||||
|
||||
gtk_widget_show (main_window);
|
||||
gtk_window_present (GTK_WINDOW (main_window));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -8,7 +8,7 @@ endif
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
glib_compile_resources = find_program('glib-compile-resources')
|
||||
|
||||
# Create the resource blob
|
||||
|
||||
@@ -2360,7 +2360,7 @@ activate (GApplication *app)
|
||||
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
|
||||
set_up_context_popover (widget, model);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
gtk_window_present (window);
|
||||
|
||||
g_object_unref (builder);
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ library you are using:
|
||||
The `test` accessibility backend is recommended for test suites and remote
|
||||
continuous integration pipelines.
|
||||
|
||||
### `XDG_DTA_HOME`, `XDG_DATA_DIRS`
|
||||
### `XDG_DATA_HOME`, `XDG_DATA_DIRS`
|
||||
|
||||
GTK uses these environment variables to locate icon themes
|
||||
and MIME information. For more information, see the
|
||||
|
||||
@@ -576,7 +576,7 @@ gdk_content_deserialize_async (GInputStream *stream,
|
||||
/**
|
||||
* gdk_content_deserialize_finish:
|
||||
* @result: the `GAsyncResult`
|
||||
* @value: return location for the result of the operation
|
||||
* @value: (out): return location for the result of the operation
|
||||
* @error: return location for an error
|
||||
*
|
||||
* Finishes a content deserialization operation.
|
||||
|
||||
@@ -1721,8 +1721,6 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
|
||||
self->have_egl_buffer_age =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
|
||||
self->have_egl_swap_buffers_with_damage =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
|
||||
self->have_egl_no_config_context =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
|
||||
self->have_egl_pixel_format_float =
|
||||
|
||||
@@ -107,7 +107,6 @@ struct _GdkDisplay
|
||||
|
||||
/* egl info */
|
||||
guint have_egl_buffer_age : 1;
|
||||
guint have_egl_swap_buffers_with_damage : 1;
|
||||
guint have_egl_no_config_context : 1;
|
||||
guint have_egl_pixel_format_float : 1;
|
||||
guint have_egl_win32_libangle : 1;
|
||||
|
||||
+8
-2
@@ -117,6 +117,7 @@ typedef struct {
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
EGLContext egl_context;
|
||||
EGLBoolean (*eglSwapBuffersWithDamage) (EGLDisplay, EGLSurface, const EGLint *, EGLint);
|
||||
#endif
|
||||
} GdkGLContextPrivate;
|
||||
|
||||
@@ -420,6 +421,11 @@ gdk_gl_context_real_realize (GdkGLContext *context,
|
||||
|
||||
gdk_gl_context_set_is_legacy (context, legacy_bit);
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_KHR_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageKHR");
|
||||
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
|
||||
priv->eglSwapBuffersWithDamage = (gpointer)epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
|
||||
|
||||
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
|
||||
|
||||
return api;
|
||||
@@ -608,7 +614,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL", "swap buffers");
|
||||
|
||||
if (display->have_egl_swap_buffers_with_damage)
|
||||
if (priv->eglSwapBuffersWithDamage)
|
||||
{
|
||||
EGLint stack_rects[4 * 4]; /* 4 rects */
|
||||
EGLint *heap_rects = NULL;
|
||||
@@ -632,7 +638,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
rects[j++] = rect.width * scale;
|
||||
rects[j++] = rect.height * scale;
|
||||
}
|
||||
eglSwapBuffersWithDamageEXT (gdk_display_get_egl_display (display), egl_surface, rects, n_rects);
|
||||
priv->eglSwapBuffersWithDamage (gdk_display_get_egl_display (display), egl_surface, rects, n_rects);
|
||||
g_free (heap_rects);
|
||||
}
|
||||
else
|
||||
|
||||
+86
-73
@@ -25,10 +25,6 @@
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
#ifdef __ARM_NEON
|
||||
#include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
typedef struct _GdkMemoryFormatDescription GdkMemoryFormatDescription;
|
||||
|
||||
#define TYPED_FUNCS(name, T, R, G, B, A, bpp, scale) \
|
||||
@@ -170,75 +166,54 @@ r32g32b32a32_float_from_float (guchar *dest,
|
||||
memcpy (dest, src, sizeof (float) * n * 4);
|
||||
}
|
||||
|
||||
// This one conversion is quite important, it converts from RGBA with straight
|
||||
// alpha (as found in PNG for instance) to BGRA with premultiplied alpha (the
|
||||
// sole cairo format available).
|
||||
static void
|
||||
r8g8b8a8_to_b8g8r8a8_premultiplied (guchar *dest,
|
||||
const guchar *src,
|
||||
gsize n)
|
||||
{
|
||||
#ifdef __ARM_NEON
|
||||
uint16x8_t one = vdupq_n_u16 (1);
|
||||
uint16x8_t half = vdupq_n_u16 (127);
|
||||
|
||||
for (gsize i = n / 8; i > 0; i--)
|
||||
{
|
||||
// Work on “just” 8 pixels at once, since we need the full 16-bytes of
|
||||
// the q registers for the multiplication.
|
||||
uint8x8x4_t rgba = vld4_u8 (src);
|
||||
uint8x8_t r8 = rgba.val[0];
|
||||
uint8x8_t g8 = rgba.val[1];
|
||||
uint8x8_t b8 = rgba.val[2];
|
||||
uint8x8_t a8 = rgba.val[3];
|
||||
|
||||
// This is the same algorithm as premultiply(), but on packed 16-bit
|
||||
// instead of float.
|
||||
uint16x8_t r16 = vmull_u8 (r8, a8);
|
||||
uint16x8_t g16 = vmull_u8 (g8, a8);
|
||||
uint16x8_t b16 = vmull_u8 (b8, a8);
|
||||
|
||||
r16 = vaddq_u16 (r16, half);
|
||||
g16 = vaddq_u16 (g16, half);
|
||||
b16 = vaddq_u16 (b16, half);
|
||||
|
||||
r16 = vsraq_n_u16 (r16, r16, 8);
|
||||
g16 = vsraq_n_u16 (g16, g16, 8);
|
||||
b16 = vsraq_n_u16 (b16, b16, 8);
|
||||
|
||||
r16 = vaddq_u16 (r16, one);
|
||||
g16 = vaddq_u16 (g16, one);
|
||||
b16 = vaddq_u16 (b16, one);
|
||||
|
||||
// Just like the other one, here we use BGRA instead of RGBA!
|
||||
rgba.val[0] = vshrn_n_u16 (b16, 8);
|
||||
rgba.val[1] = vshrn_n_u16 (g16, 8);
|
||||
rgba.val[2] = vshrn_n_u16 (r16, 8);
|
||||
|
||||
vst4_u8 (dest, rgba);
|
||||
src += 32;
|
||||
dest += 32;
|
||||
}
|
||||
|
||||
// We want the fallthrough here for the last (up to) seven bytes of the row.
|
||||
n = n % 8;
|
||||
#endif // __ARM_NEON
|
||||
|
||||
for (; n > 0; n--)
|
||||
{
|
||||
guchar a = src[3];
|
||||
guint16 r = (guint16)src[0] * a + 127;
|
||||
guint16 g = (guint16)src[1] * a + 127;
|
||||
guint16 b = (guint16)src[2] * a + 127;
|
||||
dest[0] = (b + (b >> 8) + 1) >> 8;
|
||||
dest[1] = (g + (g >> 8) + 1) >> 8;
|
||||
dest[2] = (r + (r >> 8) + 1) >> 8;
|
||||
dest[3] = a;
|
||||
dest += 4;
|
||||
src += 4;
|
||||
}
|
||||
#define PREMULTIPLY_FUNC(name, R1, G1, B1, A1, R2, G2, B2, A2) \
|
||||
static void \
|
||||
name (guchar *dest, \
|
||||
const guchar *src, \
|
||||
gsize n) \
|
||||
{ \
|
||||
for (; n > 0; n--) \
|
||||
{ \
|
||||
guchar a = src[A1]; \
|
||||
guint16 r = (guint16)src[R1] * a + 127; \
|
||||
guint16 g = (guint16)src[G1] * a + 127; \
|
||||
guint16 b = (guint16)src[B1] * a + 127; \
|
||||
dest[R2] = (r + (r >> 8) + 1) >> 8; \
|
||||
dest[G2] = (g + (g >> 8) + 1) >> 8; \
|
||||
dest[B2] = (b + (b >> 8) + 1) >> 8; \
|
||||
dest[A2] = a; \
|
||||
dest += 4; \
|
||||
src += 4; \
|
||||
} \
|
||||
}
|
||||
|
||||
PREMULTIPLY_FUNC(r8g8b8a8_to_r8g8b8a8_premultiplied, 0, 1, 2, 3, 0, 1, 2, 3)
|
||||
PREMULTIPLY_FUNC(r8g8b8a8_to_b8g8r8a8_premultiplied, 0, 1, 2, 3, 2, 1, 0, 3)
|
||||
PREMULTIPLY_FUNC(r8g8b8a8_to_a8r8g8b8_premultiplied, 0, 1, 2, 3, 1, 2, 3, 0)
|
||||
PREMULTIPLY_FUNC(r8g8b8a8_to_a8b8g8r8_premultiplied, 0, 1, 2, 3, 3, 2, 1, 0)
|
||||
|
||||
#define ADD_ALPHA_FUNC(name, R1, G1, B1, R2, G2, B2, A2) \
|
||||
static void \
|
||||
name (guchar *dest, \
|
||||
const guchar *src, \
|
||||
gsize n) \
|
||||
{ \
|
||||
for (; n > 0; n--) \
|
||||
{ \
|
||||
dest[R2] = src[R1]; \
|
||||
dest[G2] = src[G1]; \
|
||||
dest[B2] = src[B1]; \
|
||||
dest[A2] = 255; \
|
||||
dest += 4; \
|
||||
src += 3; \
|
||||
} \
|
||||
}
|
||||
|
||||
ADD_ALPHA_FUNC(r8g8b8_to_r8g8b8a8, 0, 1, 2, 0, 1, 2, 3)
|
||||
ADD_ALPHA_FUNC(r8g8b8_to_b8g8r8a8, 0, 1, 2, 2, 1, 0, 3)
|
||||
ADD_ALPHA_FUNC(r8g8b8_to_a8r8g8b8, 0, 1, 2, 1, 2, 3, 0)
|
||||
ADD_ALPHA_FUNC(r8g8b8_to_a8b8g8r8, 0, 1, 2, 3, 2, 1, 0)
|
||||
|
||||
struct _GdkMemoryFormatDescription
|
||||
{
|
||||
GdkMemoryAlpha alpha;
|
||||
@@ -548,15 +523,53 @@ gdk_memory_convert (guchar *dest_data,
|
||||
const GdkMemoryFormatDescription *src_desc = &memory_formats[src_format];
|
||||
float *tmp;
|
||||
gsize y;
|
||||
void (*func) (guchar *, const guchar *, gsize) = NULL;
|
||||
|
||||
g_assert (dest_format < GDK_MEMORY_N_FORMATS);
|
||||
g_assert (src_format < GDK_MEMORY_N_FORMATS);
|
||||
|
||||
if (src_format == GDK_MEMORY_R8G8B8A8 && dest_format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED)
|
||||
if (src_format == GDK_MEMORY_R8G8B8A8 && dest_format == GDK_MEMORY_R8G8B8A8_PREMULTIPLIED)
|
||||
func = r8g8b8a8_to_r8g8b8a8_premultiplied;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8A8 && dest_format == GDK_MEMORY_R8G8B8A8_PREMULTIPLIED)
|
||||
func = r8g8b8a8_to_b8g8r8a8_premultiplied;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8A8 && dest_format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED)
|
||||
func = r8g8b8a8_to_b8g8r8a8_premultiplied;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8A8 && dest_format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED)
|
||||
func = r8g8b8a8_to_r8g8b8a8_premultiplied;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8A8 && dest_format == GDK_MEMORY_A8R8G8B8_PREMULTIPLIED)
|
||||
func = r8g8b8a8_to_a8r8g8b8_premultiplied;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8A8 && dest_format == GDK_MEMORY_A8R8G8B8_PREMULTIPLIED)
|
||||
func = r8g8b8a8_to_a8b8g8r8_premultiplied;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8 && dest_format == GDK_MEMORY_R8G8B8A8_PREMULTIPLIED)
|
||||
func = r8g8b8_to_r8g8b8a8;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8 && dest_format == GDK_MEMORY_R8G8B8A8_PREMULTIPLIED)
|
||||
func = r8g8b8_to_b8g8r8a8;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8 && dest_format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED)
|
||||
func = r8g8b8_to_b8g8r8a8;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8 && dest_format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED)
|
||||
func = r8g8b8_to_r8g8b8a8;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8 && dest_format == GDK_MEMORY_A8R8G8B8_PREMULTIPLIED)
|
||||
func = r8g8b8_to_a8r8g8b8;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8 && dest_format == GDK_MEMORY_A8R8G8B8_PREMULTIPLIED)
|
||||
func = r8g8b8_to_a8b8g8r8;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8 && dest_format == GDK_MEMORY_R8G8B8A8)
|
||||
func = r8g8b8_to_r8g8b8a8;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8 && dest_format == GDK_MEMORY_R8G8B8A8)
|
||||
func = r8g8b8_to_b8g8r8a8;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8 && dest_format == GDK_MEMORY_B8G8R8A8)
|
||||
func = r8g8b8_to_b8g8r8a8;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8 && dest_format == GDK_MEMORY_B8G8R8A8)
|
||||
func = r8g8b8_to_r8g8b8a8;
|
||||
else if (src_format == GDK_MEMORY_R8G8B8 && dest_format == GDK_MEMORY_A8R8G8B8)
|
||||
func = r8g8b8_to_a8r8g8b8;
|
||||
else if (src_format == GDK_MEMORY_B8G8R8 && dest_format == GDK_MEMORY_A8R8G8B8)
|
||||
func = r8g8b8_to_a8b8g8r8;
|
||||
|
||||
if (func != NULL)
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
r8g8b8a8_to_b8g8r8a8_premultiplied (dest_data, src_data, width);
|
||||
func (dest_data, src_data, width);
|
||||
src_data += src_stride;
|
||||
dest_data += dest_stride;
|
||||
}
|
||||
|
||||
@@ -108,6 +108,16 @@
|
||||
*/
|
||||
#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
|
||||
|
||||
/**
|
||||
* GDK_VERSION_4_8:
|
||||
*
|
||||
* A macro that evaluates to the 4.8 version of GDK, in a format
|
||||
* that can be used by the C pre-processor.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
|
||||
|
||||
|
||||
/* evaluates to the current stable version; for development cycles,
|
||||
* this means the next stable target, with a hard backstop to the
|
||||
@@ -249,4 +259,18 @@
|
||||
# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_8
|
||||
# define GDK_AVAILABLE_IN_4_8 GDK_UNAVAILABLE(4, 8)
|
||||
#else
|
||||
# define GDK_AVAILABLE_IN_4_8 _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_8
|
||||
# define GDK_DEPRECATED_IN_4_8 GDK_DEPRECATED
|
||||
# define GDK_DEPRECATED_IN_4_8_FOR(f) GDK_DEPRECATED_FOR(f)
|
||||
#else
|
||||
# define GDK_DEPRECATED_IN_4_8 _GDK_EXTERN
|
||||
# define GDK_DEPRECATED_IN_4_8_FOR(f) _GDK_EXTERN
|
||||
#endif
|
||||
|
||||
#endif /* __GDK_VERSION_MACROS_H__ */
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#import "GdkMacosLayer.h"
|
||||
#import "GdkMacosView.h"
|
||||
#import "GdkMacosWindow.h"
|
||||
|
||||
@implementation GdkMacosView
|
||||
|
||||
@@ -56,6 +57,19 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(void)mouseDown:(NSEvent *)nsevent
|
||||
{
|
||||
if ([(GdkMacosWindow *)[self window] needsMouseDownQuirk])
|
||||
/* We should only hit this when we are trying to click through
|
||||
* the shadow of a window into another window. Just request
|
||||
* that the application not activate this window on mouseUp.
|
||||
* See gdkmacosdisplay-translate.c for the other half of this.
|
||||
*/
|
||||
[NSApp preventWindowOrdering];
|
||||
else
|
||||
[super mouseDown:nsevent];
|
||||
}
|
||||
|
||||
-(void)setFrame:(NSRect)rect
|
||||
{
|
||||
[super setFrame:rect];
|
||||
|
||||
@@ -253,7 +253,8 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return GDK_IS_TOPLEVEL (gdk_surface) || GDK_IS_POPUP (gdk_surface);
|
||||
return GDK_IS_TOPLEVEL (gdk_surface) ||
|
||||
(GDK_IS_POPUP (gdk_surface) && GDK_SURFACE (gdk_surface)->input_region != NULL);
|
||||
}
|
||||
|
||||
-(void)showAndMakeKey:(BOOL)makeKey
|
||||
@@ -261,9 +262,12 @@ typedef NSString *CALayerContentsGravity;
|
||||
inShowOrHide = YES;
|
||||
|
||||
if (makeKey && [self canBecomeKeyWindow])
|
||||
[self makeKeyAndOrderFront:nil];
|
||||
[self makeKeyAndOrderFront:self];
|
||||
else
|
||||
[self orderFront:nil];
|
||||
[self orderFront:self];
|
||||
|
||||
if (makeKey && [self canBecomeMainWindow])
|
||||
[self makeMainWindow];
|
||||
|
||||
inShowOrHide = NO;
|
||||
|
||||
@@ -373,9 +377,17 @@ typedef NSString *CALayerContentsGravity;
|
||||
_gdk_macos_surface_configure ([self gdkSurface]);
|
||||
}
|
||||
|
||||
- (void)windowDidResize:(NSNotification *)notification
|
||||
-(void)windowDidResize:(NSNotification *)notification
|
||||
{
|
||||
_gdk_macos_surface_configure ([self gdkSurface]);
|
||||
_gdk_macos_surface_configure (gdk_surface);
|
||||
|
||||
/* If we're using server-side decorations, this notification is coming
|
||||
* in from a display-side change. We need to request a layout in
|
||||
* addition to the configure event.
|
||||
*/
|
||||
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface) &&
|
||||
GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated)
|
||||
gdk_surface_request_layout (GDK_SURFACE (gdk_surface));
|
||||
}
|
||||
|
||||
/* Used by gdkmacosdisplay-translate.c to decide if our sendEvent() handler
|
||||
@@ -668,7 +680,12 @@ typedef NSString *CALayerContentsGravity;
|
||||
is_opaque = (([self styleMask] & NSWindowStyleMaskTitled) != 0);
|
||||
|
||||
if (was_fullscreen != is_fullscreen)
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
{
|
||||
if (was_fullscreen)
|
||||
[self setFrame:lastUnfullscreenFrame display:NO];
|
||||
|
||||
_gdk_macos_surface_update_fullscreen_state (gdk_surface);
|
||||
}
|
||||
|
||||
if (was_opaque != is_opaque)
|
||||
{
|
||||
@@ -753,7 +770,6 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
-(void)windowWillExitFullScreen:(NSNotification *)aNotification
|
||||
{
|
||||
[self setFrame:lastUnfullscreenFrame display:NO];
|
||||
}
|
||||
|
||||
-(void)windowDidExitFullScreen:(NSNotification *)aNotification
|
||||
@@ -814,4 +830,10 @@ typedef NSString *CALayerContentsGravity;
|
||||
[(GdkMacosView *)[self contentView] swapBuffer:buffer withDamage:damage];
|
||||
}
|
||||
|
||||
-(BOOL)needsMouseDownQuirk
|
||||
{
|
||||
return GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface) &&
|
||||
!GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -69,5 +69,6 @@
|
||||
-(BOOL)trackManualResize;
|
||||
-(void)setDecorated:(BOOL)decorated;
|
||||
-(void)swapBuffer:(GdkMacosBuffer *)buffer withDamage:(const cairo_region_t *)damage;
|
||||
-(BOOL)needsMouseDownQuirk;
|
||||
|
||||
@end
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
|
||||
#include "gdkdisplaylinksource.h"
|
||||
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkmacoseventsource-private.h"
|
||||
#include "gdkmacosmonitor-private.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
static gint64 host_to_frame_clock_time (gint64 val);
|
||||
@@ -65,7 +67,7 @@ gdk_display_link_source_dispatch (GSource *source,
|
||||
|
||||
impl->needs_dispatch = FALSE;
|
||||
|
||||
if (callback != NULL)
|
||||
if (!impl->paused && callback != NULL)
|
||||
ret = callback (user_data);
|
||||
|
||||
return ret;
|
||||
@@ -76,7 +78,9 @@ gdk_display_link_source_finalize (GSource *source)
|
||||
{
|
||||
GdkDisplayLinkSource *impl = (GdkDisplayLinkSource *)source;
|
||||
|
||||
CVDisplayLinkStop (impl->display_link);
|
||||
if (!impl->paused)
|
||||
CVDisplayLinkStop (impl->display_link);
|
||||
|
||||
CVDisplayLinkRelease (impl->display_link);
|
||||
}
|
||||
|
||||
@@ -90,12 +94,18 @@ static GSourceFuncs gdk_display_link_source_funcs = {
|
||||
void
|
||||
gdk_display_link_source_pause (GdkDisplayLinkSource *source)
|
||||
{
|
||||
g_return_if_fail (source->paused == FALSE);
|
||||
|
||||
source->paused = TRUE;
|
||||
CVDisplayLinkStop (source->display_link);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_link_source_unpause (GdkDisplayLinkSource *source)
|
||||
{
|
||||
g_return_if_fail (source->paused == TRUE);
|
||||
|
||||
source->paused = FALSE;
|
||||
CVDisplayLinkStart (source->display_link);
|
||||
}
|
||||
|
||||
@@ -147,6 +157,7 @@ gdk_display_link_source_frame_cb (CVDisplayLinkRef display_link,
|
||||
|
||||
/**
|
||||
* gdk_display_link_source_new:
|
||||
* @display_id: the identifier of the monitor
|
||||
*
|
||||
* Creates a new `GSource` that will activate the dispatch function upon
|
||||
* notification from a CVDisplayLink that a new frame should be drawn.
|
||||
@@ -159,41 +170,61 @@ gdk_display_link_source_frame_cb (CVDisplayLinkRef display_link,
|
||||
* Returns: (transfer full): A newly created `GSource`
|
||||
*/
|
||||
GSource *
|
||||
gdk_display_link_source_new (void)
|
||||
gdk_display_link_source_new (CGDirectDisplayID display_id,
|
||||
CGDisplayModeRef mode)
|
||||
{
|
||||
GdkDisplayLinkSource *impl;
|
||||
GSource *source;
|
||||
CVReturn ret;
|
||||
double period;
|
||||
char *name;
|
||||
|
||||
source = g_source_new (&gdk_display_link_source_funcs, sizeof *impl);
|
||||
impl = (GdkDisplayLinkSource *)source;
|
||||
impl->display_id = display_id;
|
||||
impl->paused = TRUE;
|
||||
|
||||
/*
|
||||
* Create our link based on currently connected displays.
|
||||
* If there are multiple displays, this will be something that tries
|
||||
* to work for all of them. In the future, we may want to explore multiple
|
||||
* links based on the connected displays.
|
||||
/* Create DisplayLink for timing information for the display in
|
||||
* question so that we can produce graphics for that display at whatever
|
||||
* rate it can provide.
|
||||
*/
|
||||
ret = CVDisplayLinkCreateWithActiveCGDisplays (&impl->display_link);
|
||||
if (ret != kCVReturnSuccess)
|
||||
if (CVDisplayLinkCreateWithCGDisplay (display_id, &impl->display_link) != kCVReturnSuccess)
|
||||
{
|
||||
g_warning ("Failed to initialize CVDisplayLink!");
|
||||
return source;
|
||||
goto failure;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine our nominal period between frames.
|
||||
*/
|
||||
period = CVDisplayLinkGetActualOutputVideoRefreshPeriod (impl->display_link);
|
||||
if (period == 0.0)
|
||||
period = 1.0 / 60.0;
|
||||
impl->refresh_interval = period * 1000000L;
|
||||
impl->refresh_rate = 1.0 / period * 1000L;
|
||||
impl->refresh_rate = CGDisplayModeGetRefreshRate (mode) * 1000.0;
|
||||
|
||||
/*
|
||||
* Wire up our callback to be executed within the high-priority thread.
|
||||
*/
|
||||
if (impl->refresh_rate == 0)
|
||||
{
|
||||
const CVTime time = CVDisplayLinkGetNominalOutputVideoRefreshPeriod (impl->display_link);
|
||||
if (!(time.flags & kCVTimeIsIndefinite))
|
||||
impl->refresh_rate = (double)time.timeScale / (double)time.timeValue * 1000.0;
|
||||
}
|
||||
|
||||
if (impl->refresh_rate != 0)
|
||||
{
|
||||
impl->refresh_interval = 1000000.0 / (double)impl->refresh_rate * 1000.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double period = CVDisplayLinkGetActualOutputVideoRefreshPeriod (impl->display_link);
|
||||
|
||||
if (period == 0.0)
|
||||
period = 1.0 / 60.0;
|
||||
|
||||
impl->refresh_rate = 1.0 / period * 1000L;
|
||||
impl->refresh_interval = period * 1000000L;
|
||||
}
|
||||
|
||||
name = _gdk_macos_monitor_get_connector_name (display_id);
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("Monitor \"%s\" discovered with Refresh Rate %d and Interval %"G_GINT64_FORMAT,
|
||||
name ? name : "unknown",
|
||||
impl->refresh_rate,
|
||||
impl->refresh_interval));
|
||||
g_free (name);
|
||||
|
||||
/* Wire up our callback to be executed within the high-priority thread. */
|
||||
CVDisplayLinkSetOutputCallback (impl->display_link,
|
||||
gdk_display_link_source_frame_cb,
|
||||
source);
|
||||
@@ -201,6 +232,10 @@ gdk_display_link_source_new (void)
|
||||
g_source_set_static_name (source, "[gdk] quartz frame clock");
|
||||
|
||||
return source;
|
||||
|
||||
failure:
|
||||
g_source_unref (source);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gint64
|
||||
|
||||
@@ -30,17 +30,20 @@ G_BEGIN_DECLS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GSource source;
|
||||
GSource source;
|
||||
|
||||
CVDisplayLinkRef display_link;
|
||||
gint64 refresh_interval;
|
||||
guint refresh_rate;
|
||||
CGDirectDisplayID display_id;
|
||||
CVDisplayLinkRef display_link;
|
||||
gint64 refresh_interval;
|
||||
guint refresh_rate;
|
||||
guint paused : 1;
|
||||
|
||||
volatile gint64 presentation_time;
|
||||
volatile guint needs_dispatch;
|
||||
volatile gint64 presentation_time;
|
||||
volatile guint needs_dispatch;
|
||||
} GdkDisplayLinkSource;
|
||||
|
||||
GSource *gdk_display_link_source_new (void);
|
||||
GSource *gdk_display_link_source_new (CGDirectDisplayID display_id,
|
||||
CGDisplayModeRef mode);
|
||||
void gdk_display_link_source_pause (GdkDisplayLinkSource *source);
|
||||
void gdk_display_link_source_unpause (GdkDisplayLinkSource *source);
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ GdkMacosBuffer *_gdk_macos_buffer_new (int width
|
||||
IOSurfaceRef _gdk_macos_buffer_get_native (GdkMacosBuffer *self);
|
||||
void _gdk_macos_buffer_lock (GdkMacosBuffer *self);
|
||||
void _gdk_macos_buffer_unlock (GdkMacosBuffer *self);
|
||||
void _gdk_macos_buffer_read_lock (GdkMacosBuffer *self);
|
||||
void _gdk_macos_buffer_read_unlock (GdkMacosBuffer *self);
|
||||
guint _gdk_macos_buffer_get_width (GdkMacosBuffer *self);
|
||||
guint _gdk_macos_buffer_get_height (GdkMacosBuffer *self);
|
||||
guint _gdk_macos_buffer_get_stride (GdkMacosBuffer *self);
|
||||
|
||||
@@ -192,6 +192,45 @@ _gdk_macos_buffer_unlock (GdkMacosBuffer *self)
|
||||
IOSurfaceUnlock (self->surface, 0, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gdk_macos_buffer_lock_readonly:
|
||||
*
|
||||
* Like _gdk_macos_buffer_lock() but uses the read-only flag to
|
||||
* indicate we are not interested in retrieving the updates from
|
||||
* the GPU before modifying the CPU-side cache.
|
||||
*
|
||||
* Must be used with _gdk_macos_buffer_unlock_readonly().
|
||||
*/
|
||||
void
|
||||
_gdk_macos_buffer_read_lock (GdkMacosBuffer *self)
|
||||
{
|
||||
kern_return_t ret;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_BUFFER (self));
|
||||
g_return_if_fail (self->lock_count == 0);
|
||||
|
||||
self->lock_count++;
|
||||
|
||||
ret = IOSurfaceLock (self->surface, kIOSurfaceLockReadOnly, NULL);
|
||||
|
||||
g_return_if_fail (ret == KERN_SUCCESS);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_buffer_read_unlock (GdkMacosBuffer *self)
|
||||
{
|
||||
kern_return_t ret;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_BUFFER (self));
|
||||
g_return_if_fail (self->lock_count == 1);
|
||||
|
||||
self->lock_count--;
|
||||
|
||||
ret = IOSurfaceUnlock (self->surface, kIOSurfaceLockReadOnly, NULL);
|
||||
|
||||
g_return_if_fail (ret == KERN_SUCCESS);
|
||||
}
|
||||
|
||||
guint
|
||||
_gdk_macos_buffer_get_width (GdkMacosBuffer *self)
|
||||
{
|
||||
@@ -242,7 +281,7 @@ _gdk_macos_buffer_set_damage (GdkMacosBuffer *self,
|
||||
return;
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
self->damage = cairo_region_reference (damage);
|
||||
self->damage = cairo_region_copy (damage);
|
||||
}
|
||||
|
||||
gpointer
|
||||
|
||||
@@ -42,19 +42,6 @@ struct _GdkMacosCairoContextClass
|
||||
|
||||
G_DEFINE_TYPE (GdkMacosCairoContext, _gdk_macos_cairo_context, GDK_TYPE_CAIRO_CONTEXT)
|
||||
|
||||
static const cairo_user_data_key_t buffer_key;
|
||||
|
||||
static void
|
||||
unlock_buffer (gpointer data)
|
||||
{
|
||||
GdkMacosBuffer *buffer = data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_BUFFER (buffer));
|
||||
|
||||
_gdk_macos_buffer_unlock (buffer);
|
||||
g_clear_object (&buffer);
|
||||
}
|
||||
|
||||
static cairo_t *
|
||||
_gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
|
||||
{
|
||||
@@ -106,12 +93,9 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
|
||||
stride);
|
||||
cairo_surface_set_device_scale (image_surface, scale, scale);
|
||||
|
||||
/* Lock the buffer so we can modify it safely */
|
||||
_gdk_macos_buffer_lock (buffer);
|
||||
cairo_surface_set_user_data (image_surface,
|
||||
&buffer_key,
|
||||
g_object_ref (buffer),
|
||||
unlock_buffer);
|
||||
/* The buffer should already be locked at this point, and will
|
||||
* be unlocked as part of end_frame.
|
||||
*/
|
||||
|
||||
if (!(cr = cairo_create (image_surface)))
|
||||
goto failure;
|
||||
@@ -158,6 +142,52 @@ failure:
|
||||
return cr;
|
||||
}
|
||||
|
||||
static void
|
||||
copy_surface_data (GdkMacosBuffer *from,
|
||||
GdkMacosBuffer *to,
|
||||
const cairo_region_t *region,
|
||||
int scale)
|
||||
{
|
||||
const guint8 *from_base;
|
||||
guint8 *to_base;
|
||||
guint from_stride;
|
||||
guint to_stride;
|
||||
guint n_rects;
|
||||
|
||||
g_assert (GDK_IS_MACOS_BUFFER (from));
|
||||
g_assert (GDK_IS_MACOS_BUFFER (to));
|
||||
g_assert (region != NULL);
|
||||
g_assert (!cairo_region_is_empty (region));
|
||||
|
||||
from_base = _gdk_macos_buffer_get_data (from);
|
||||
from_stride = _gdk_macos_buffer_get_stride (from);
|
||||
|
||||
to_base = _gdk_macos_buffer_get_data (to);
|
||||
to_stride = _gdk_macos_buffer_get_stride (to);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
|
||||
for (guint i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
int y2;
|
||||
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
|
||||
rect.y *= scale;
|
||||
rect.height *= scale;
|
||||
rect.x *= scale;
|
||||
rect.width *= scale;
|
||||
|
||||
y2 = rect.y + rect.height;
|
||||
|
||||
for (int y = rect.y; y < y2; y++)
|
||||
memcpy (&to_base[y * to_stride + rect.x * 4],
|
||||
&from_base[y * from_stride + rect.x * 4],
|
||||
rect.width * 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean prefers_high_depth,
|
||||
@@ -165,34 +195,68 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
{
|
||||
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
|
||||
GdkMacosBuffer *buffer;
|
||||
GdkSurface *surface;
|
||||
GdkMacosSurface *surface;
|
||||
|
||||
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (self));
|
||||
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
surface = gdk_draw_context_get_surface (draw_context);
|
||||
buffer = _gdk_macos_surface_get_buffer (GDK_MACOS_SURFACE (surface));
|
||||
surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (draw_context));
|
||||
buffer = _gdk_macos_surface_get_buffer (surface);
|
||||
|
||||
_gdk_macos_buffer_set_damage (buffer, region);
|
||||
_gdk_macos_buffer_set_flipped (buffer, FALSE);
|
||||
|
||||
_gdk_macos_buffer_lock (buffer);
|
||||
|
||||
/* If there is damage that was on the previous frame that is not on
|
||||
* this frame, we need to copy that rendered region over to the back
|
||||
* buffer so that when swapping buffers, we still have that content.
|
||||
* This is done with a read-only lock on the IOSurface to avoid
|
||||
* invalidating the buffer contents.
|
||||
*/
|
||||
if (surface->front != NULL)
|
||||
{
|
||||
const cairo_region_t *previous = _gdk_macos_buffer_get_damage (surface->front);
|
||||
|
||||
if (previous != NULL)
|
||||
{
|
||||
cairo_region_t *copy;
|
||||
|
||||
copy = cairo_region_copy (previous);
|
||||
cairo_region_subtract (copy, region);
|
||||
|
||||
if (!cairo_region_is_empty (copy))
|
||||
{
|
||||
int scale = gdk_surface_get_scale_factor (GDK_SURFACE (surface));
|
||||
|
||||
_gdk_macos_buffer_read_lock (surface->front);
|
||||
copy_surface_data (surface->front, buffer, copy, scale);
|
||||
_gdk_macos_buffer_read_unlock (surface->front);
|
||||
}
|
||||
|
||||
cairo_region_destroy (copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_cairo_context_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted)
|
||||
{
|
||||
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
|
||||
GdkMacosSurface *surface;
|
||||
GdkMacosBuffer *buffer;
|
||||
GdkSurface *surface;
|
||||
|
||||
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (draw_context));
|
||||
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (self));
|
||||
|
||||
surface = gdk_draw_context_get_surface (draw_context);
|
||||
buffer = _gdk_macos_surface_get_buffer (GDK_MACOS_SURFACE (surface));
|
||||
surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (draw_context));
|
||||
buffer = _gdk_macos_surface_get_buffer (surface);
|
||||
|
||||
_gdk_macos_surface_swap_buffers (GDK_MACOS_SURFACE (surface), painted);
|
||||
_gdk_macos_buffer_set_damage (buffer, NULL);
|
||||
_gdk_macos_buffer_unlock (buffer);
|
||||
|
||||
_gdk_macos_surface_swap_buffers (surface, painted);
|
||||
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright © 2022 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <AppKit/AppKit.h>
|
||||
|
||||
#include "gdkmacosdisplay-private.h"
|
||||
#include "gdkmacossurface-private.h"
|
||||
|
||||
static void
|
||||
gdk_macos_display_user_defaults_changed_cb (CFNotificationCenterRef center,
|
||||
void *observer,
|
||||
CFStringRef name,
|
||||
const void *object,
|
||||
CFDictionaryRef userInfo)
|
||||
{
|
||||
GdkMacosDisplay *self = observer;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
_gdk_macos_display_reload_settings (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_display_monitors_changed_cb (CFNotificationCenterRef center,
|
||||
void *observer,
|
||||
CFStringRef name,
|
||||
const void *object,
|
||||
CFDictionaryRef userInfo)
|
||||
{
|
||||
GdkMacosDisplay *self = observer;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
_gdk_macos_display_reload_monitors (self);
|
||||
|
||||
/* Now we need to update all our surface positions since they
|
||||
* probably just changed origins.
|
||||
*/
|
||||
for (const GList *iter = _gdk_macos_display_get_surfaces (self);
|
||||
iter != NULL;
|
||||
iter = iter->next)
|
||||
{
|
||||
GdkMacosSurface *surface = iter->data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
_gdk_macos_surface_monitor_changed (surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_gdk_macos_display_feedback_init (GdkMacosDisplay *self)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
CFNotificationCenterAddObserver (CFNotificationCenterGetLocalCenter (),
|
||||
self,
|
||||
gdk_macos_display_monitors_changed_cb,
|
||||
CFSTR ("NSApplicationDidChangeScreenParametersNotification"),
|
||||
NULL,
|
||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||
|
||||
CFNotificationCenterAddObserver (CFNotificationCenterGetDistributedCenter (),
|
||||
self,
|
||||
gdk_macos_display_user_defaults_changed_cb,
|
||||
CFSTR ("NSUserDefaultsDidChangeNotification"),
|
||||
NULL,
|
||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_feedback_destroy (GdkMacosDisplay *self)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
CFNotificationCenterRemoveObserver (CFNotificationCenterGetDistributedCenter (),
|
||||
self,
|
||||
CFSTR ("NSApplicationDidChangeScreenParametersNotification"),
|
||||
NULL);
|
||||
|
||||
CFNotificationCenterRemoveObserver (CFNotificationCenterGetDistributedCenter (),
|
||||
self,
|
||||
CFSTR ("NSUserDefaultsDidChangeNotification"),
|
||||
NULL);
|
||||
|
||||
}
|
||||
@@ -43,6 +43,8 @@ G_BEGIN_DECLS
|
||||
#define GIC_FILTER_PASSTHRU 0
|
||||
#define GIC_FILTER_FILTERED 1
|
||||
|
||||
#define GDK_MACOS_EVENT_DROP (GdkEvent *)GSIZE_TO_POINTER(1)
|
||||
|
||||
struct _GdkMacosDisplay
|
||||
{
|
||||
GdkDisplay parent_instance;
|
||||
@@ -68,16 +70,6 @@ struct _GdkMacosDisplay
|
||||
*/
|
||||
GQueue sorted_surfaces;
|
||||
|
||||
/* Our CVDisplayLink based GSource which we use to freeze/thaw the
|
||||
* GdkFrameClock for the surface.
|
||||
*/
|
||||
GSource *frame_source;
|
||||
|
||||
/* A queue of surfaces which we know are awaiting frames to be drawn. This
|
||||
* uses the GdkMacosSurface.frame link.
|
||||
*/
|
||||
GQueue awaiting_frames;
|
||||
|
||||
/* The surface that is receiving keyboard events */
|
||||
GdkMacosSurface *keyboard_surface;
|
||||
|
||||
@@ -92,6 +84,14 @@ struct _GdkMacosDisplay
|
||||
int min_y;
|
||||
int max_x;
|
||||
int max_y;
|
||||
|
||||
/* A GSource to select a new main/key window */
|
||||
guint select_key_in_idle;
|
||||
|
||||
/* Note if we have a key window that is not a GdkMacosWindow
|
||||
* such as a NSPanel used for native dialogs.
|
||||
*/
|
||||
guint key_window_is_foregin : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosDisplayClass
|
||||
@@ -124,6 +124,8 @@ GdkMonitor *_gdk_macos_display_get_monitor_at_display_coords (GdkMacosDisp
|
||||
int y);
|
||||
GdkEvent *_gdk_macos_display_translate (GdkMacosDisplay *self,
|
||||
NSEvent *event);
|
||||
void _gdk_macos_display_feedback_init (GdkMacosDisplay *self);
|
||||
void _gdk_macos_display_feedback_destroy (GdkMacosDisplay *self);
|
||||
void _gdk_macos_display_break_all_grabs (GdkMacosDisplay *self,
|
||||
guint32 time);
|
||||
GdkModifierType _gdk_macos_display_get_current_keyboard_modifiers (GdkMacosDisplay *self);
|
||||
@@ -136,10 +138,6 @@ GdkMacosSurface *_gdk_macos_display_get_surface_at_display_coords (GdkMacosDisp
|
||||
void _gdk_macos_display_reload_monitors (GdkMacosDisplay *self);
|
||||
void _gdk_macos_display_surface_removed (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_display_add_frame_callback (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_display_remove_frame_callback (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface);
|
||||
NSWindow *_gdk_macos_display_find_native_under_pointer (GdkMacosDisplay *self,
|
||||
int *x,
|
||||
int *y);
|
||||
@@ -155,7 +153,6 @@ void _gdk_macos_display_surface_resigned_key (GdkMacosDisp
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_display_surface_became_key (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface);
|
||||
int _gdk_macos_display_get_nominal_refresh_rate (GdkMacosDisplay *self);
|
||||
void _gdk_macos_display_clear_sorting (GdkMacosDisplay *self);
|
||||
const GList *_gdk_macos_display_get_surfaces (GdkMacosDisplay *self);
|
||||
void _gdk_macos_display_send_button_event (GdkMacosDisplay *self,
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef struct
|
||||
const char *font_name;
|
||||
int xft_dpi;
|
||||
int double_click_time;
|
||||
int cursor_blink_timeout;
|
||||
int cursor_blink_time;
|
||||
guint enable_animations : 1;
|
||||
guint shell_shows_desktop : 1;
|
||||
guint shell_shows_menubar : 1;
|
||||
@@ -65,9 +65,9 @@ _gdk_macos_settings_load (GdkMacosSettings *settings)
|
||||
|
||||
ival = [defaults integerForKey:@"NSTextInsertionPointBlinkPeriod"];
|
||||
if (ival > 0)
|
||||
settings->cursor_blink_timeout = ival;
|
||||
settings->cursor_blink_time = ival;
|
||||
else
|
||||
settings->cursor_blink_timeout = 1000;
|
||||
settings->cursor_blink_time = 1000;
|
||||
|
||||
settings->primary_button_warps_slider =
|
||||
[[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollerPagingBehavior"] == YES;
|
||||
@@ -124,9 +124,9 @@ _gdk_macos_display_get_setting (GdkMacosDisplay *self,
|
||||
g_value_set_int (value, current_settings.xft_dpi);
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (strcmp (setting, "gtk-cursor-blink-timeout") == 0)
|
||||
else if (strcmp (setting, "gtk-cursor-blink-time") == 0)
|
||||
{
|
||||
g_value_set_int (value, current_settings.cursor_blink_timeout);
|
||||
g_value_set_int (value, current_settings.cursor_blink_time);
|
||||
ret = TRUE;
|
||||
}
|
||||
else if (strcmp (setting, "gtk-double-click-time") == 0)
|
||||
|
||||
@@ -612,6 +612,8 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
GdkModifierType state;
|
||||
GdkDevice *pointer;
|
||||
GdkEvent *ret = NULL;
|
||||
NSEventPhase phase;
|
||||
NSEventPhase momentumPhase;
|
||||
GdkSeat *seat;
|
||||
double dx;
|
||||
double dy;
|
||||
@@ -619,11 +621,31 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
g_assert (nsevent != NULL);
|
||||
|
||||
phase = [nsevent phase];
|
||||
momentumPhase = [nsevent momentumPhase];
|
||||
|
||||
/* Ignore kinetic scroll events from the display server as we already
|
||||
* handle those internally.
|
||||
*/
|
||||
if (phase == 0 && momentumPhase != 0)
|
||||
return GDK_MACOS_EVENT_DROP;
|
||||
|
||||
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
|
||||
pointer = gdk_seat_get_pointer (seat);
|
||||
state = _gdk_macos_display_get_current_mouse_modifiers (self) |
|
||||
_gdk_macos_display_get_current_keyboard_modifiers (self);
|
||||
|
||||
/* If we are starting a new phase, send a stop so any previous
|
||||
* scrolling immediately stops.
|
||||
*/
|
||||
if (phase == NSEventPhaseMayBegin)
|
||||
return gdk_scroll_event_new (GDK_SURFACE (surface),
|
||||
pointer,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
0.0, 0.0, TRUE);
|
||||
|
||||
dx = [nsevent deltaX];
|
||||
dy = [nsevent deltaY];
|
||||
|
||||
@@ -667,34 +689,32 @@ fill_scroll_event (GdkMacosDisplay *self,
|
||||
dy = 0.0;
|
||||
}
|
||||
|
||||
if (dx != 0.0 || dy != 0.0)
|
||||
if ((dx != 0.0 || dy != 0.0) && ![nsevent hasPreciseScrollingDeltas])
|
||||
{
|
||||
if ([nsevent hasPreciseScrollingDeltas])
|
||||
{
|
||||
GdkEvent *emulated;
|
||||
g_assert (ret == NULL);
|
||||
|
||||
emulated = gdk_scroll_event_new_discrete (GDK_SURFACE (surface),
|
||||
pointer,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
direction,
|
||||
TRUE);
|
||||
_gdk_event_queue_append (GDK_DISPLAY (self), emulated);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert (ret == NULL);
|
||||
ret = gdk_scroll_event_new_discrete (GDK_SURFACE (surface),
|
||||
pointer,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
direction,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
|
||||
pointer,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
-dx * 32,
|
||||
-dy * 32,
|
||||
FALSE);
|
||||
}
|
||||
if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled)
|
||||
{
|
||||
/* The user must have released their fingers in a touchpad
|
||||
* scroll, so try to send a scroll is_stop event.
|
||||
*/
|
||||
if (ret != NULL)
|
||||
_gdk_event_queue_append (GDK_DISPLAY (self), g_steal_pointer (&ret));
|
||||
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
|
||||
pointer,
|
||||
NULL,
|
||||
get_time_from_ns_event (nsevent),
|
||||
state,
|
||||
0.0, 0.0, TRUE);
|
||||
}
|
||||
|
||||
return g_steal_pointer (&ret);
|
||||
@@ -1066,6 +1086,7 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface;
|
||||
GdkMacosWindow *window;
|
||||
NSEventType event_type;
|
||||
NSWindow *event_window;
|
||||
GdkEvent *ret = NULL;
|
||||
int x;
|
||||
int y;
|
||||
@@ -1108,6 +1129,15 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If the event was delivered to NSWindow that is foreign (or rather,
|
||||
* Cocoa native), then we should pass the event along to that window.
|
||||
*/
|
||||
if ((event_window = [nsevent window]) && !GDK_IS_MACOS_WINDOW (event_window))
|
||||
return NULL;
|
||||
|
||||
/* If we can't find a GdkSurface to deliver the event to, then we
|
||||
* should pass it along to the NSApp.
|
||||
*/
|
||||
if (!(surface = find_surface_for_ns_event (self, nsevent, &x, &y)))
|
||||
return NULL;
|
||||
|
||||
@@ -1139,15 +1169,31 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
|
||||
if (test_resize (nsevent, surface, x, y))
|
||||
return NULL;
|
||||
|
||||
if ((event_type == NSEventTypeRightMouseDown ||
|
||||
event_type == NSEventTypeOtherMouseDown ||
|
||||
event_type == NSEventTypeLeftMouseDown))
|
||||
if (event_type == NSEventTypeRightMouseDown ||
|
||||
event_type == NSEventTypeOtherMouseDown ||
|
||||
event_type == NSEventTypeLeftMouseDown)
|
||||
{
|
||||
if (![NSApp isActive])
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
if (![window isKeyWindow])
|
||||
[window makeKeyWindow];
|
||||
{
|
||||
NSWindow *orig_window = [nsevent window];
|
||||
|
||||
/* To get NSApp to supress activating the window we might
|
||||
* have clicked through the shadow of, we need to dispatch
|
||||
* the event and handle it in GdkMacosView:mouseDown to call
|
||||
* [NSApp preventWindowOrdering]. Calling it here will not
|
||||
* do anything as the event is not registered.
|
||||
*/
|
||||
if (orig_window &&
|
||||
GDK_IS_MACOS_WINDOW (orig_window) &&
|
||||
[(GdkMacosWindow *)orig_window needsMouseDownQuirk])
|
||||
[NSApp sendEvent:nsevent];
|
||||
|
||||
[window showAndMakeKey:YES];
|
||||
_gdk_macos_display_clear_sorting (self);
|
||||
}
|
||||
}
|
||||
|
||||
switch ((int)event_type)
|
||||
@@ -1180,7 +1226,11 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
|
||||
GdkDevice *pointer = gdk_seat_get_pointer (seat);
|
||||
GdkDeviceGrabInfo *grab = _gdk_display_get_last_device_grab (GDK_DISPLAY (self), pointer);
|
||||
|
||||
if (grab == NULL)
|
||||
if ([(GdkMacosWindow *)window isInManualResizeOrMove])
|
||||
{
|
||||
ret = GDK_MACOS_EVENT_DROP;
|
||||
}
|
||||
else if (grab == NULL)
|
||||
{
|
||||
if (event_type == NSEventTypeMouseExited)
|
||||
[[NSCursor arrowCursor] set];
|
||||
|
||||
@@ -20,10 +20,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkmacosdisplay-private.h"
|
||||
#include "gdkmacosmonitor.h"
|
||||
#include "gdkmacosmonitor-private.h"
|
||||
#include "gdkmacossurface-private.h"
|
||||
#include "gdkmacostoplevelsurface-private.h"
|
||||
|
||||
#define WARP_OFFSET_X 15
|
||||
#define WARP_OFFSET_Y 15
|
||||
|
||||
static void
|
||||
_gdk_macos_display_position_toplevel_with_parent (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
@@ -33,52 +36,49 @@ _gdk_macos_display_position_toplevel_with_parent (GdkMacosDisplay *self,
|
||||
{
|
||||
GdkRectangle surface_rect;
|
||||
GdkRectangle parent_rect;
|
||||
GdkRectangle workarea;
|
||||
GdkMonitor *monitor;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (surface));
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (parent));
|
||||
|
||||
/* If x/y is set, we should place relative to parent */
|
||||
if (GDK_SURFACE (surface)->x != 0 || GDK_SURFACE (surface)->y != 0)
|
||||
{
|
||||
*x = parent->root_x + GDK_SURFACE (surface)->x;
|
||||
*y = parent->root_y + GDK_SURFACE (surface)->y;
|
||||
return;
|
||||
}
|
||||
monitor = _gdk_macos_surface_get_best_monitor (parent);
|
||||
|
||||
/* Try to center on top of the parent but also try to make the whole thing
|
||||
* visible in case that lands us under the topbar/panel/etc.
|
||||
*/
|
||||
surface_rect.x = surface->root_x + surface->shadow_left;
|
||||
surface_rect.y = surface->root_y + surface->shadow_top;
|
||||
parent_rect.x = parent->root_x + parent->shadow_left;
|
||||
parent_rect.y = parent->root_y + parent->shadow_top;
|
||||
parent_rect.width = GDK_SURFACE (parent)->width - parent->shadow_left - parent->shadow_right;
|
||||
parent_rect.height = GDK_SURFACE (parent)->height - parent->shadow_top - parent->shadow_bottom;
|
||||
|
||||
surface_rect.width = GDK_SURFACE (surface)->width - surface->shadow_left - surface->shadow_right;
|
||||
surface_rect.height = GDK_SURFACE (surface)->height - surface->shadow_top - surface->shadow_bottom;
|
||||
|
||||
parent_rect.x = parent->root_x + surface->shadow_left;
|
||||
parent_rect.y = parent->root_y + surface->shadow_top;
|
||||
parent_rect.width = GDK_SURFACE (parent)->width - surface->shadow_left - surface->shadow_right;
|
||||
parent_rect.height = GDK_SURFACE (parent)->height - surface->shadow_top - surface->shadow_bottom;
|
||||
|
||||
/* Try to place centered atop parent */
|
||||
surface_rect.x = parent_rect.x + ((parent_rect.width - surface_rect.width) / 2);
|
||||
surface_rect.y = parent_rect.y + ((parent_rect.height - surface_rect.height) / 2);
|
||||
|
||||
/* Now make sure that we don't overlap the top-bar */
|
||||
monitor = _gdk_macos_surface_get_best_monitor (parent);
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
|
||||
if (surface_rect.x < workarea.x)
|
||||
surface_rect.x = workarea.x;
|
||||
|
||||
if (surface_rect.y < workarea.y)
|
||||
surface_rect.y = workarea.y;
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x - surface->shadow_left;
|
||||
*y = surface_rect.y - surface->shadow_top;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
has_surface_at_origin (const GList *surfaces,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
for (const GList *iter = surfaces; iter; iter = iter->next)
|
||||
{
|
||||
GdkMacosSurface *surface = iter->data;
|
||||
|
||||
if (surface->root_x == x && surface->root_y == y)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface,
|
||||
@@ -87,6 +87,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
{
|
||||
cairo_rectangle_int_t surface_rect;
|
||||
GdkRectangle workarea;
|
||||
const GList *surfaces;
|
||||
GdkMonitor *monitor;
|
||||
CGPoint mouse;
|
||||
|
||||
@@ -103,16 +104,29 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
|
||||
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
|
||||
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
|
||||
|
||||
if (surface_rect.x < workarea.x)
|
||||
surface_rect.x = workarea.x;
|
||||
|
||||
if (surface_rect.y < workarea.y)
|
||||
surface_rect.y = workarea.y;
|
||||
|
||||
/* TODO: If there is another window at this same position, perhaps we should move it */
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
|
||||
|
||||
*x = surface_rect.x - surface->shadow_left;
|
||||
*y = surface_rect.y - surface->shadow_top;
|
||||
|
||||
/* Try to see if there are any other surfaces at this origin and if so,
|
||||
* adjust until we get something better.
|
||||
*/
|
||||
surfaces = _gdk_macos_display_get_surfaces (self);
|
||||
while (has_surface_at_origin (surfaces, *x, *y))
|
||||
{
|
||||
*x += WARP_OFFSET_X;
|
||||
*y += WARP_OFFSET_Y;
|
||||
|
||||
/* If we reached the bottom right, just bail and try the workspace origin */
|
||||
if (*x + surface->shadow_left + WARP_OFFSET_X > workarea.x + workarea.width ||
|
||||
*y + surface->shadow_top + WARP_OFFSET_Y > workarea.y + workarea.height)
|
||||
{
|
||||
*x = workarea.x - surface->shadow_left;
|
||||
*y = workarea.y - surface->shadow_top;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*<private>
|
||||
|
||||
+56
-207
@@ -156,51 +156,13 @@ gdk_macos_display_update_bounds (GdkMacosDisplay *self)
|
||||
self->width = self->max_x - self->min_x;
|
||||
self->height = self->max_y - self->min_y;
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("Displays reconfigured to bounds %d,%d %dx%d",
|
||||
self->min_x, self->min_y, self->width, self->height));
|
||||
|
||||
GDK_END_MACOS_ALLOC_POOL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_display_monitors_changed_cb (CFNotificationCenterRef center,
|
||||
void *observer,
|
||||
CFStringRef name,
|
||||
const void *object,
|
||||
CFDictionaryRef userInfo)
|
||||
{
|
||||
GdkMacosDisplay *self = observer;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
_gdk_macos_display_reload_monitors (self);
|
||||
|
||||
/* Now we need to update all our surface positions since they
|
||||
* probably just changed origins.
|
||||
*/
|
||||
for (const GList *iter = _gdk_macos_display_get_surfaces (self);
|
||||
iter != NULL;
|
||||
iter = iter->next)
|
||||
{
|
||||
GdkMacosSurface *surface = iter->data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
_gdk_macos_surface_monitor_changed (surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_display_user_defaults_changed_cb (CFNotificationCenterRef center,
|
||||
void *observer,
|
||||
CFStringRef name,
|
||||
const void *object,
|
||||
CFDictionaryRef userInfo)
|
||||
{
|
||||
GdkMacosDisplay *self = observer;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
_gdk_macos_display_reload_settings (self);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_reload_monitors (GdkMacosDisplay *self)
|
||||
{
|
||||
@@ -273,56 +235,6 @@ gdk_macos_display_load_seat (GdkMacosDisplay *self)
|
||||
g_object_unref (seat);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_macos_display_frame_cb (gpointer data)
|
||||
{
|
||||
GdkMacosDisplay *self = data;
|
||||
GdkDisplayLinkSource *source;
|
||||
gint64 presentation_time;
|
||||
gint64 now;
|
||||
GList *iter;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
source = (GdkDisplayLinkSource *)self->frame_source;
|
||||
|
||||
presentation_time = source->presentation_time;
|
||||
now = g_source_get_time ((GSource *)source);
|
||||
|
||||
iter = self->awaiting_frames.head;
|
||||
|
||||
while (iter != NULL)
|
||||
{
|
||||
GdkMacosSurface *surface = iter->data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
iter = iter->next;
|
||||
|
||||
_gdk_macos_surface_publish_timings (surface,
|
||||
source->presentation_time,
|
||||
source->refresh_interval);
|
||||
|
||||
_gdk_macos_display_remove_frame_callback (self, surface);
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (surface)))
|
||||
gdk_surface_thaw_updates (GDK_SURFACE (surface));
|
||||
}
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_display_load_display_link (GdkMacosDisplay *self)
|
||||
{
|
||||
self->frame_source = gdk_display_link_source_new ();
|
||||
g_source_set_callback (self->frame_source,
|
||||
gdk_macos_display_frame_cb,
|
||||
self,
|
||||
NULL);
|
||||
g_source_attach (self->frame_source, NULL);
|
||||
}
|
||||
|
||||
static const char *
|
||||
gdk_macos_display_get_name (GdkDisplay *display)
|
||||
{
|
||||
@@ -398,11 +310,15 @@ gdk_macos_display_queue_events (GdkDisplay *display)
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
if ((nsevent = _gdk_macos_event_source_get_pending ()))
|
||||
while ((nsevent = _gdk_macos_event_source_get_pending ()))
|
||||
{
|
||||
GdkEvent *event = _gdk_macos_display_translate (self, nsevent);
|
||||
|
||||
if (event != NULL)
|
||||
if (event == GDK_MACOS_EVENT_DROP)
|
||||
{
|
||||
[nsevent release];
|
||||
}
|
||||
else if (event != NULL)
|
||||
{
|
||||
push_nsevent (event, nsevent);
|
||||
_gdk_windowing_got_event (GDK_DISPLAY (self),
|
||||
@@ -426,7 +342,6 @@ _gdk_macos_display_surface_added (GdkMacosDisplay *self,
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
g_assert (!queue_contains (&self->sorted_surfaces, &surface->sorted));
|
||||
g_assert (!queue_contains (&self->main_surfaces, &surface->main));
|
||||
g_assert (!queue_contains (&self->awaiting_frames, &surface->frame));
|
||||
g_assert (surface->sorted.data == surface);
|
||||
g_assert (surface->main.data == surface);
|
||||
g_assert (surface->frame.data == surface);
|
||||
@@ -453,9 +368,6 @@ _gdk_macos_display_surface_removed (GdkMacosDisplay *self,
|
||||
if (queue_contains (&self->main_surfaces, &surface->main))
|
||||
_gdk_macos_display_surface_resigned_main (self, surface);
|
||||
|
||||
if (queue_contains (&self->awaiting_frames, &surface->frame))
|
||||
g_queue_unlink (&self->awaiting_frames, &surface->frame);
|
||||
|
||||
g_return_if_fail (self->keyboard_surface != surface);
|
||||
}
|
||||
|
||||
@@ -501,6 +413,38 @@ _gdk_macos_display_surface_became_key (GdkMacosDisplay *self,
|
||||
gdk_surface_request_motion (GDK_SURFACE (surface));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
select_key_in_idle_cb (gpointer data)
|
||||
{
|
||||
GdkMacosDisplay *self = data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_DISPLAY (self));
|
||||
|
||||
self->select_key_in_idle = 0;
|
||||
|
||||
/* Don't steal focus from NSPanel, etc */
|
||||
if (self->key_window_is_foregin)
|
||||
return G_SOURCE_REMOVE;
|
||||
|
||||
if (self->keyboard_surface == NULL)
|
||||
{
|
||||
const GList *surfaces = _gdk_macos_display_get_surfaces (self);
|
||||
|
||||
for (const GList *iter = surfaces; iter; iter = iter->next)
|
||||
{
|
||||
GdkMacosSurface *surface = iter->data;
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (surface)))
|
||||
{
|
||||
[surface->window showAndMakeKey:YES];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface)
|
||||
@@ -545,6 +489,9 @@ _gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
|
||||
}
|
||||
|
||||
_gdk_macos_display_clear_sorting (self);
|
||||
|
||||
if (self->select_key_in_idle == 0)
|
||||
self->select_key_in_idle = g_idle_add (select_key_in_idle_cb, self);
|
||||
}
|
||||
|
||||
/* Raises a transient window.
|
||||
@@ -583,8 +530,6 @@ void
|
||||
_gdk_macos_display_surface_resigned_main (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
GdkMacosSurface *new_surface = NULL;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
@@ -592,40 +537,6 @@ _gdk_macos_display_surface_resigned_main (GdkMacosDisplay *self,
|
||||
g_queue_unlink (&self->main_surfaces, &surface->main);
|
||||
|
||||
_gdk_macos_display_clear_sorting (self);
|
||||
|
||||
if (GDK_SURFACE (surface)->transient_for &&
|
||||
gdk_surface_get_mapped (GDK_SURFACE (surface)->transient_for))
|
||||
{
|
||||
new_surface = GDK_MACOS_SURFACE (GDK_SURFACE (surface)->transient_for);
|
||||
}
|
||||
else
|
||||
{
|
||||
const GList *surfaces = _gdk_macos_display_get_surfaces (self);
|
||||
|
||||
for (const GList *iter = surfaces; iter; iter = iter->next)
|
||||
{
|
||||
GdkMacosSurface *item = iter->data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (item));
|
||||
|
||||
if (item == surface)
|
||||
continue;
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (item)))
|
||||
{
|
||||
new_surface = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (new_surface != NULL)
|
||||
{
|
||||
NSWindow *nswindow = _gdk_macos_surface_get_native (new_surface);
|
||||
[nswindow makeKeyAndOrderFront:nswindow];
|
||||
}
|
||||
|
||||
_gdk_macos_display_clear_sorting (self);
|
||||
}
|
||||
|
||||
static GdkSurface *
|
||||
@@ -686,20 +597,12 @@ gdk_macos_display_finalize (GObject *object)
|
||||
{
|
||||
GdkMacosDisplay *self = (GdkMacosDisplay *)object;
|
||||
|
||||
CFNotificationCenterRemoveObserver (CFNotificationCenterGetDistributedCenter (),
|
||||
self,
|
||||
CFSTR ("NSApplicationDidChangeScreenParametersNotification"),
|
||||
NULL);
|
||||
|
||||
CFNotificationCenterRemoveObserver (CFNotificationCenterGetDistributedCenter (),
|
||||
self,
|
||||
CFSTR ("NSUserDefaultsDidChangeNotification"),
|
||||
NULL);
|
||||
_gdk_macos_display_feedback_destroy (self);
|
||||
|
||||
g_clear_handle_id (&self->select_key_in_idle, g_source_remove);
|
||||
g_clear_pointer (&self->active_drags, g_hash_table_unref);
|
||||
g_clear_pointer (&self->active_drops, g_hash_table_unref);
|
||||
g_clear_object (&GDK_DISPLAY (self)->clipboard);
|
||||
g_clear_pointer (&self->frame_source, g_source_unref);
|
||||
g_clear_object (&self->monitors);
|
||||
g_clear_pointer (&self->name, g_free);
|
||||
|
||||
@@ -774,24 +677,10 @@ _gdk_macos_display_open (const char *display_name)
|
||||
|
||||
gdk_macos_display_load_seat (self);
|
||||
gdk_macos_display_load_clipboard (self);
|
||||
|
||||
/* Load CVDisplayLink before monitors to access refresh rates */
|
||||
gdk_macos_display_load_display_link (self);
|
||||
_gdk_macos_display_reload_monitors (self);
|
||||
|
||||
CFNotificationCenterAddObserver (CFNotificationCenterGetLocalCenter (),
|
||||
self,
|
||||
gdk_macos_display_monitors_changed_cb,
|
||||
CFSTR ("NSApplicationDidChangeScreenParametersNotification"),
|
||||
NULL,
|
||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||
|
||||
CFNotificationCenterAddObserver (CFNotificationCenterGetDistributedCenter (),
|
||||
self,
|
||||
gdk_macos_display_user_defaults_changed_cb,
|
||||
CFSTR ("NSUserDefaultsDidChangeNotification"),
|
||||
NULL,
|
||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||
/* Initialize feedback from display server */
|
||||
_gdk_macos_display_feedback_init (self);
|
||||
|
||||
if (event_source == NULL)
|
||||
{
|
||||
@@ -803,6 +692,8 @@ _gdk_macos_display_open (const char *display_name)
|
||||
|
||||
gdk_display_emit_opened (GDK_DISPLAY (self));
|
||||
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
|
||||
return GDK_DISPLAY (self);
|
||||
}
|
||||
|
||||
@@ -1033,42 +924,6 @@ _gdk_macos_display_get_surface_at_display_coords (GdkMacosDisplay *self,
|
||||
return _gdk_macos_display_get_surface_at_coords (self, x_gdk, y_gdk, surface_x, surface_y);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_add_frame_callback (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
if (!queue_contains (&self->awaiting_frames, &surface->frame))
|
||||
{
|
||||
/* Processing frames is always head to tail, so push to the
|
||||
* head so that we don't possibly re-enter this right after
|
||||
* adding to the queue.
|
||||
*/
|
||||
g_queue_push_head_link (&self->awaiting_frames, &surface->frame);
|
||||
|
||||
if (self->awaiting_frames.length == 1)
|
||||
gdk_display_link_source_unpause ((GdkDisplayLinkSource *)self->frame_source);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_remove_frame_callback (GdkMacosDisplay *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
if (queue_contains (&self->awaiting_frames, &surface->frame))
|
||||
{
|
||||
g_queue_unlink (&self->awaiting_frames, &surface->frame);
|
||||
|
||||
if (self->awaiting_frames.length == 0)
|
||||
gdk_display_link_source_pause ((GdkDisplayLinkSource *)self->frame_source);
|
||||
}
|
||||
}
|
||||
|
||||
NSWindow *
|
||||
_gdk_macos_display_find_native_under_pointer (GdkMacosDisplay *self,
|
||||
int *x,
|
||||
@@ -1088,17 +943,6 @@ _gdk_macos_display_find_native_under_pointer (GdkMacosDisplay *self,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int
|
||||
_gdk_macos_display_get_nominal_refresh_rate (GdkMacosDisplay *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (self), 60 * 1000);
|
||||
|
||||
if (self->frame_source == NULL)
|
||||
return 60 * 1000;
|
||||
|
||||
return ((GdkDisplayLinkSource *)self->frame_source)->refresh_rate;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_display_clear_sorting (GdkMacosDisplay *self)
|
||||
{
|
||||
@@ -1120,11 +964,16 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self)
|
||||
NSArray *array = [NSApp orderedWindows];
|
||||
GQueue sorted = G_QUEUE_INIT;
|
||||
|
||||
self->key_window_is_foregin = FALSE;
|
||||
|
||||
for (id obj in array)
|
||||
{
|
||||
NSWindow *nswindow = (NSWindow *)obj;
|
||||
GdkMacosSurface *surface;
|
||||
|
||||
if ([nswindow isKeyWindow])
|
||||
self->key_window_is_foregin = !GDK_IS_MACOS_WINDOW (nswindow);
|
||||
|
||||
if (!GDK_IS_MACOS_WINDOW (nswindow))
|
||||
continue;
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@ struct _GdkMacosGLContext
|
||||
{
|
||||
GdkGLContext parent_instance;
|
||||
|
||||
cairo_region_t *damage;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
CGLContextObj cgl_context;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
@@ -469,6 +469,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
||||
buffer = _gdk_macos_surface_get_buffer (GDK_MACOS_SURFACE (surface));
|
||||
|
||||
_gdk_macos_buffer_set_flipped (buffer, TRUE);
|
||||
_gdk_macos_buffer_set_damage (buffer, region);
|
||||
|
||||
/* Create our render target and bind it */
|
||||
gdk_gl_context_make_current (GDK_GL_CONTEXT (self));
|
||||
@@ -476,9 +477,6 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, prefers_high_depth, region);
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
self->damage = g_steal_pointer (©);
|
||||
|
||||
gdk_gl_context_make_current (GDK_GL_CONTEXT (self));
|
||||
CHECK_GL (NULL, glBindFramebuffer (GL_FRAMEBUFFER, self->fbo));
|
||||
}
|
||||
@@ -531,8 +529,6 @@ gdk_macos_gl_context_surface_resized (GdkDrawContext *draw_context)
|
||||
|
||||
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
|
||||
if (self->cgl_context != NULL)
|
||||
CGLUpdateContext (self->cgl_context);
|
||||
}
|
||||
@@ -587,9 +583,16 @@ static cairo_region_t *
|
||||
gdk_macos_gl_context_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
|
||||
const cairo_region_t *damage;
|
||||
GdkMacosBuffer *buffer;
|
||||
GdkSurface *surface;
|
||||
|
||||
if (self->damage)
|
||||
return cairo_region_copy (self->damage);
|
||||
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
|
||||
|
||||
if ((surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context))) &&
|
||||
(buffer = GDK_MACOS_SURFACE (surface)->front) &&
|
||||
(damage = _gdk_macos_buffer_get_damage (buffer)))
|
||||
return cairo_region_copy (damage);
|
||||
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->get_damage (context);
|
||||
}
|
||||
@@ -619,8 +622,6 @@ gdk_macos_gl_context_dispose (GObject *gobject)
|
||||
CGLDestroyContext (cgl_context);
|
||||
}
|
||||
|
||||
g_clear_pointer (&self->damage, cairo_region_destroy);
|
||||
|
||||
G_OBJECT_CLASS (gdk_macos_gl_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,16 +24,25 @@
|
||||
|
||||
#include "gdkmacosdisplay.h"
|
||||
#include "gdkmacosmonitor.h"
|
||||
#include "gdkmacossurface.h"
|
||||
|
||||
#include "gdkmonitorprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GdkMacosMonitor *_gdk_macos_monitor_new (GdkMacosDisplay *display,
|
||||
CGDirectDisplayID screen_id);
|
||||
CGDirectDisplayID _gdk_macos_monitor_get_screen_id (GdkMacosMonitor *self);
|
||||
gboolean _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self);
|
||||
CGColorSpaceRef _gdk_macos_monitor_copy_colorspace (GdkMacosMonitor *self);
|
||||
char *_gdk_macos_monitor_get_localized_name (NSScreen *screen);
|
||||
char *_gdk_macos_monitor_get_connector_name (CGDirectDisplayID screen_id);
|
||||
GdkMacosMonitor *_gdk_macos_monitor_new (GdkMacosDisplay *display,
|
||||
CGDirectDisplayID screen_id);
|
||||
CGDirectDisplayID _gdk_macos_monitor_get_screen_id (GdkMacosMonitor *self);
|
||||
gboolean _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self);
|
||||
CGColorSpaceRef _gdk_macos_monitor_copy_colorspace (GdkMacosMonitor *self);
|
||||
void _gdk_macos_monitor_add_frame_callback (GdkMacosMonitor *self,
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_monitor_remove_frame_callback (GdkMacosMonitor *self,
|
||||
GdkMacosSurface *surface);
|
||||
void _gdk_macos_monitor_clamp (GdkMacosMonitor *self,
|
||||
GdkRectangle *area);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+166
-11
@@ -22,16 +22,21 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdisplaylinksource.h"
|
||||
#include "gdkmacosdisplay-private.h"
|
||||
#include "gdkmacosmonitor-private.h"
|
||||
#include "gdkmacossurface-private.h"
|
||||
#include "gdkmacosutils-private.h"
|
||||
|
||||
struct _GdkMacosMonitor
|
||||
{
|
||||
GdkMonitor parent_instance;
|
||||
CGDirectDisplayID screen_id;
|
||||
NSRect workarea;
|
||||
guint has_opengl : 1;
|
||||
GdkMonitor parent_instance;
|
||||
CGDirectDisplayID screen_id;
|
||||
GdkDisplayLinkSource *display_link;
|
||||
NSRect workarea;
|
||||
GQueue awaiting_frames;
|
||||
guint has_opengl : 1;
|
||||
guint in_frame : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosMonitorClass
|
||||
@@ -75,9 +80,26 @@ gdk_macos_monitor_get_workarea (GdkMonitor *monitor,
|
||||
geometry->height = self->workarea.size.height;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_monitor_dispose (GObject *object)
|
||||
{
|
||||
GdkMacosMonitor *self = (GdkMacosMonitor *)object;
|
||||
|
||||
if (self->display_link)
|
||||
{
|
||||
g_source_destroy ((GSource *)self->display_link);
|
||||
g_clear_pointer ((GSource **)&self->display_link, g_source_unref);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gdk_macos_monitor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_macos_monitor_class_init (GdkMacosMonitorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gdk_macos_monitor_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -138,8 +160,8 @@ GetSubpixelLayout (CGDirectDisplayID screen_id)
|
||||
return GDK_SUBPIXEL_LAYOUT_UNKNOWN;
|
||||
}
|
||||
|
||||
static char *
|
||||
GetLocalizedName (NSScreen *screen)
|
||||
char *
|
||||
_gdk_macos_monitor_get_localized_name (NSScreen *screen)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
GDK_BEGIN_MACOS_ALLOC_POOL;
|
||||
@@ -160,8 +182,8 @@ GetLocalizedName (NSScreen *screen)
|
||||
#endif
|
||||
}
|
||||
|
||||
static char *
|
||||
GetConnectorName (CGDirectDisplayID screen_id)
|
||||
char *
|
||||
_gdk_macos_monitor_get_connector_name (CGDirectDisplayID screen_id)
|
||||
{
|
||||
guint unit = CGDisplayUnitNumber (screen_id);
|
||||
return g_strdup_printf ("unit-%u", unit);
|
||||
@@ -188,6 +210,68 @@ find_screen (CGDirectDisplayID screen_id)
|
||||
return screen;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_macos_monitor_display_link_cb (GdkMacosMonitor *self)
|
||||
{
|
||||
gint64 presentation_time;
|
||||
gint64 refresh_interval;
|
||||
gint64 now;
|
||||
GList *iter;
|
||||
|
||||
g_assert (GDK_IS_MACOS_MONITOR (self));
|
||||
g_assert (!self->display_link->paused);
|
||||
|
||||
self->in_frame = TRUE;
|
||||
|
||||
presentation_time = self->display_link->presentation_time;
|
||||
refresh_interval = self->display_link->refresh_interval;
|
||||
now = g_source_get_time ((GSource *)self->display_link);
|
||||
|
||||
iter = self->awaiting_frames.head;
|
||||
|
||||
while (iter != NULL)
|
||||
{
|
||||
GdkMacosSurface *surface = iter->data;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (surface));
|
||||
|
||||
iter = iter->next;
|
||||
|
||||
g_queue_unlink (&self->awaiting_frames, &surface->frame);
|
||||
_gdk_macos_surface_frame_presented (surface, presentation_time, refresh_interval);
|
||||
}
|
||||
|
||||
if (self->awaiting_frames.length == 0 && !self->display_link->paused)
|
||||
gdk_display_link_source_pause (self->display_link);
|
||||
|
||||
self->in_frame = FALSE;
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_monitor_reset_display_link (GdkMacosMonitor *self,
|
||||
CGDisplayModeRef mode)
|
||||
{
|
||||
GSource *source;
|
||||
|
||||
g_assert (GDK_IS_MACOS_MONITOR (self));
|
||||
|
||||
if (self->display_link)
|
||||
{
|
||||
g_source_destroy ((GSource *)self->display_link);
|
||||
g_clear_pointer ((GSource **)&self->display_link, g_source_unref);
|
||||
}
|
||||
|
||||
source = gdk_display_link_source_new (self->screen_id, mode);
|
||||
self->display_link = (GdkDisplayLinkSource *)source;
|
||||
g_source_set_callback (source,
|
||||
(GSourceFunc) gdk_macos_monitor_display_link_cb,
|
||||
self,
|
||||
NULL);
|
||||
g_source_attach (source, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gdk_macos_monitor_reconfigure (GdkMacosMonitor *self)
|
||||
{
|
||||
@@ -222,8 +306,8 @@ _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self)
|
||||
pixel_width = CGDisplayModeGetPixelWidth (mode);
|
||||
has_opengl = CGDisplayUsesOpenGLAcceleration (self->screen_id);
|
||||
subpixel_layout = GetSubpixelLayout (self->screen_id);
|
||||
name = GetLocalizedName (screen);
|
||||
connector = GetConnectorName (self->screen_id);
|
||||
name = _gdk_macos_monitor_get_localized_name (screen);
|
||||
connector = _gdk_macos_monitor_get_connector_name (self->screen_id);
|
||||
|
||||
if (width != 0 && pixel_width != 0)
|
||||
scale_factor = MAX (1, pixel_width / width);
|
||||
@@ -241,7 +325,7 @@ _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self)
|
||||
* setting (which is also used by the frame clock).
|
||||
*/
|
||||
if (!(refresh_rate = CGDisplayModeGetRefreshRate (mode)))
|
||||
refresh_rate = _gdk_macos_display_get_nominal_refresh_rate (display);
|
||||
refresh_rate = 60 * 1000;
|
||||
|
||||
gdk_monitor_set_connector (GDK_MONITOR (self), connector);
|
||||
gdk_monitor_set_model (GDK_MONITOR (self), name);
|
||||
@@ -261,6 +345,9 @@ _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self)
|
||||
*/
|
||||
self->has_opengl = !!has_opengl;
|
||||
|
||||
/* Create a new display link to receive feedback about when to render */
|
||||
_gdk_macos_monitor_reset_display_link (self, mode);
|
||||
|
||||
CGDisplayModeRelease (mode);
|
||||
g_free (name);
|
||||
g_free (connector);
|
||||
@@ -302,3 +389,71 @@ _gdk_macos_monitor_copy_colorspace (GdkMacosMonitor *self)
|
||||
|
||||
return CGDisplayCopyColorSpace (self->screen_id);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_monitor_add_frame_callback (GdkMacosMonitor *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_MONITOR (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
g_return_if_fail (surface->frame.data == (gpointer)surface);
|
||||
g_return_if_fail (surface->frame.prev == NULL);
|
||||
g_return_if_fail (surface->frame.next == NULL);
|
||||
g_return_if_fail (self->awaiting_frames.head != &surface->frame);
|
||||
g_return_if_fail (self->awaiting_frames.tail != &surface->frame);
|
||||
|
||||
/* Processing frames is always head to tail, so push to the
|
||||
* head so that we don't possibly re-enter this right after
|
||||
* adding to the queue.
|
||||
*/
|
||||
if (!queue_contains (&self->awaiting_frames, &surface->frame))
|
||||
{
|
||||
g_queue_push_head_link (&self->awaiting_frames, &surface->frame);
|
||||
|
||||
if (!self->in_frame && self->awaiting_frames.length == 1)
|
||||
gdk_display_link_source_unpause (self->display_link);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_monitor_remove_frame_callback (GdkMacosMonitor *self,
|
||||
GdkMacosSurface *surface)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_MONITOR (self));
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
|
||||
g_return_if_fail (surface->frame.data == (gpointer)surface);
|
||||
|
||||
if (queue_contains (&self->awaiting_frames, &surface->frame))
|
||||
{
|
||||
g_queue_unlink (&self->awaiting_frames, &surface->frame);
|
||||
|
||||
if (!self->in_frame && self->awaiting_frames.length == 0)
|
||||
gdk_display_link_source_pause (self->display_link);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_monitor_clamp (GdkMacosMonitor *self,
|
||||
GdkRectangle *area)
|
||||
{
|
||||
GdkRectangle workarea;
|
||||
GdkRectangle geom;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_MONITOR (self));
|
||||
g_return_if_fail (area != NULL);
|
||||
|
||||
gdk_macos_monitor_get_workarea (GDK_MONITOR (self), &workarea);
|
||||
gdk_monitor_get_geometry (GDK_MONITOR (self), &geom);
|
||||
|
||||
if (area->x + area->width > workarea.x + workarea.width)
|
||||
area->x = workarea.x + workarea.width - area->width;
|
||||
|
||||
if (area->x < workarea.x)
|
||||
area->x = workarea.x;
|
||||
|
||||
if (area->y + area->height > workarea.y + workarea.height)
|
||||
area->y = workarea.y + workarea.height - area->height;
|
||||
|
||||
if (area->y < workarea.y)
|
||||
area->y = workarea.y;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ struct _GdkMacosPopupSurface
|
||||
{
|
||||
GdkMacosSurface parent_instance;
|
||||
GdkPopupLayout *layout;
|
||||
guint attached : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosPopupSurfaceClass
|
||||
@@ -87,6 +88,9 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
|
||||
gdk_surface_get_origin (GDK_SURFACE (self)->parent, &x, &y);
|
||||
|
||||
GDK_SURFACE (self)->x = final_rect.x;
|
||||
GDK_SURFACE (self)->y = final_rect.y;
|
||||
|
||||
x += final_rect.x;
|
||||
y += final_rect.y;
|
||||
|
||||
@@ -135,6 +139,9 @@ gdk_macos_popup_surface_present (GdkPopup *popup,
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
|
||||
return TRUE;
|
||||
|
||||
if (!self->attached && GDK_SURFACE (self)->parent != NULL)
|
||||
_gdk_macos_popup_surface_attach_to_parent (self);
|
||||
|
||||
if (GDK_SURFACE (self)->autohide)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (GDK_SURFACE (popup));
|
||||
@@ -200,6 +207,19 @@ enum {
|
||||
LAST_PROP,
|
||||
};
|
||||
|
||||
static void
|
||||
_gdk_macos_popup_surface_hide (GdkSurface *surface)
|
||||
{
|
||||
GdkMacosPopupSurface *self = (GdkMacosPopupSurface *)surface;
|
||||
|
||||
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||
|
||||
if (self->attached)
|
||||
_gdk_macos_popup_surface_detach_from_parent (self);
|
||||
|
||||
GDK_SURFACE_CLASS (_gdk_macos_popup_surface_parent_class)->hide (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_popup_surface_finalize (GObject *object)
|
||||
{
|
||||
@@ -267,12 +287,15 @@ static void
|
||||
_gdk_macos_popup_surface_class_init (GdkMacosPopupSurfaceClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkSurfaceClass *surface_class = GDK_SURFACE_CLASS (klass);
|
||||
|
||||
object_class->finalize = _gdk_macos_popup_surface_finalize;
|
||||
object_class->get_property = _gdk_macos_popup_surface_get_property;
|
||||
object_class->set_property = _gdk_macos_popup_surface_set_property;
|
||||
|
||||
gdk_popup_install_properties (object_class, 1);
|
||||
surface_class->hide = _gdk_macos_popup_surface_hide;
|
||||
|
||||
gdk_popup_install_properties (object_class, LAST_PROP);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -323,14 +346,8 @@ _gdk_macos_popup_surface_new (GdkMacosDisplay *display,
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
|
||||
#if 0
|
||||
/* NOTE: We could set these to be popup level, but then
|
||||
* [NSApp orderedWindows] would not give us the windows
|
||||
* back with the stacking order applied.
|
||||
*/
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setLevel:NSPopUpMenuWindowLevel];
|
||||
#endif
|
||||
|
||||
self = g_object_new (GDK_TYPE_MACOS_POPUP_SURFACE,
|
||||
"display", display,
|
||||
@@ -361,6 +378,8 @@ _gdk_macos_popup_surface_attach_to_parent (GdkMacosPopupSurface *self)
|
||||
|
||||
[parent addChildWindow:window ordered:NSWindowAbove];
|
||||
|
||||
self->attached = TRUE;
|
||||
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
|
||||
}
|
||||
}
|
||||
@@ -382,6 +401,8 @@ _gdk_macos_popup_surface_detach_from_parent (GdkMacosPopupSurface *self)
|
||||
|
||||
[parent removeChildWindow:window];
|
||||
|
||||
self->attached = FALSE;
|
||||
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
|
||||
}
|
||||
}
|
||||
@@ -391,9 +412,7 @@ _gdk_macos_popup_surface_reposition (GdkMacosPopupSurface *self)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||
|
||||
if (self->layout == NULL ||
|
||||
!gdk_surface_get_mapped (GDK_SURFACE (self)) ||
|
||||
GDK_SURFACE (self)->parent == NULL)
|
||||
if (self->layout == NULL || GDK_SURFACE (self)->parent == NULL)
|
||||
return;
|
||||
|
||||
gdk_macos_popup_surface_layout (self,
|
||||
|
||||
@@ -49,7 +49,7 @@ struct _GdkMacosSurface
|
||||
GdkMacosBuffer *buffer;
|
||||
GdkMacosBuffer *front;
|
||||
GPtrArray *monitors;
|
||||
cairo_region_t *opaque_region;
|
||||
GdkMonitor *best_monitor;
|
||||
char *title;
|
||||
|
||||
int root_x;
|
||||
@@ -75,6 +75,9 @@ struct _GdkMacosSurface
|
||||
guint geometry_dirty : 1;
|
||||
guint next_frame_set : 1;
|
||||
guint show_on_next_swap : 1;
|
||||
guint in_change_monitor : 1;
|
||||
guint in_frame : 1;
|
||||
guint awaiting_frame : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosSurfaceClass
|
||||
@@ -116,11 +119,11 @@ void _gdk_macos_surface_resize (GdkMacosSurface
|
||||
int width,
|
||||
int height);
|
||||
void _gdk_macos_surface_update_fullscreen_state (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_update_position (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_show (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_publish_timings (GdkMacosSurface *self,
|
||||
void _gdk_macos_surface_request_frame (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_frame_presented (GdkMacosSurface *self,
|
||||
gint64 predicted_presentation_time,
|
||||
gint64 refresh_interval);
|
||||
void _gdk_macos_surface_show (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_synthesize_null_key (GdkMacosSurface *self);
|
||||
void _gdk_macos_surface_move (GdkMacosSurface *self,
|
||||
int x,
|
||||
|
||||
+250
-123
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "gdkmacossurface-private.h"
|
||||
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
@@ -63,16 +64,87 @@ window_is_fullscreen (GdkMacosSurface *self)
|
||||
return ([self->window styleMask] & NSWindowStyleMaskFullScreen) != 0;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_request_frame (GdkMacosSurface *self)
|
||||
{
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (self->awaiting_frame)
|
||||
return;
|
||||
|
||||
if (self->best_monitor != NULL)
|
||||
{
|
||||
self->awaiting_frame = TRUE;
|
||||
_gdk_macos_monitor_add_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
||||
gdk_surface_freeze_updates (GDK_SURFACE (self));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_surface_cancel_frame (GdkMacosSurface *self)
|
||||
{
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (!self->awaiting_frame)
|
||||
return;
|
||||
|
||||
if (self->best_monitor != NULL)
|
||||
{
|
||||
self->awaiting_frame = FALSE;
|
||||
_gdk_macos_monitor_remove_frame_callback (GDK_MACOS_MONITOR (self->best_monitor), self);
|
||||
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_frame_presented (GdkMacosSurface *self,
|
||||
gint64 presentation_time,
|
||||
gint64 refresh_interval)
|
||||
{
|
||||
GdkFrameTimings *timings;
|
||||
GdkFrameClock *frame_clock;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
self->awaiting_frame = FALSE;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (self))
|
||||
return;
|
||||
|
||||
frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self));
|
||||
|
||||
if (self->pending_frame_counter)
|
||||
{
|
||||
timings = gdk_frame_clock_get_timings (frame_clock, self->pending_frame_counter);
|
||||
|
||||
if (timings != NULL)
|
||||
{
|
||||
timings->presentation_time = presentation_time - refresh_interval;
|
||||
timings->complete = TRUE;
|
||||
}
|
||||
|
||||
self->pending_frame_counter = 0;
|
||||
}
|
||||
|
||||
timings = gdk_frame_clock_get_current_timings (frame_clock);
|
||||
|
||||
if (timings != NULL)
|
||||
{
|
||||
timings->refresh_interval = refresh_interval;
|
||||
timings->predicted_presentation_time = presentation_time;
|
||||
}
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
|
||||
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_reposition_children (GdkMacosSurface *self)
|
||||
{
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (self))
|
||||
return;
|
||||
|
||||
if (!gdk_surface_get_mapped (GDK_SURFACE (self)))
|
||||
if (GDK_SURFACE_DESTROYED (self))
|
||||
return;
|
||||
|
||||
for (const GList *iter = GDK_SURFACE (self)->children;
|
||||
@@ -86,9 +158,6 @@ _gdk_macos_surface_reposition_children (GdkMacosSurface *self)
|
||||
if (GDK_IS_MACOS_POPUP_SURFACE (child))
|
||||
_gdk_macos_popup_surface_reposition (GDK_MACOS_POPUP_SURFACE (child));
|
||||
}
|
||||
|
||||
if (GDK_IS_POPUP (self) && self->did_initial_present)
|
||||
gdk_surface_request_layout (GDK_SURFACE (self));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -117,12 +186,6 @@ gdk_macos_surface_set_opaque_region (GdkSurface *surface,
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (region != self->opaque_region)
|
||||
{
|
||||
g_clear_pointer (&self->opaque_region, cairo_region_destroy);
|
||||
self->opaque_region = cairo_region_copy (region);
|
||||
}
|
||||
|
||||
if ((nsview = _gdk_macos_surface_get_view (GDK_MACOS_SURFACE (surface))))
|
||||
[(GdkMacosView *)nsview setOpaqueRegion:region];
|
||||
}
|
||||
@@ -139,9 +202,9 @@ gdk_macos_surface_hide (GdkSurface *surface)
|
||||
|
||||
self->show_on_next_swap = FALSE;
|
||||
|
||||
_gdk_macos_display_remove_frame_callback (GDK_MACOS_DISPLAY (surface->display), self);
|
||||
_gdk_macos_surface_cancel_frame (self);
|
||||
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
||||
was_key = [self->window isKeyWindow];
|
||||
|
||||
seat = gdk_display_get_default_seat (surface->display);
|
||||
@@ -156,17 +219,21 @@ gdk_macos_surface_hide (GdkSurface *surface)
|
||||
|
||||
if (was_key)
|
||||
{
|
||||
GdkSurface *parent;
|
||||
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
parent = surface->transient_for;
|
||||
else
|
||||
parent = surface->parent;
|
||||
|
||||
/* Return key input to the parent window if necessary */
|
||||
if (surface->parent != NULL && GDK_SURFACE_IS_MAPPED (surface->parent))
|
||||
if (parent != NULL && GDK_SURFACE_IS_MAPPED (parent))
|
||||
{
|
||||
GdkMacosWindow *parentWindow = GDK_MACOS_SURFACE (surface->parent)->window;
|
||||
GdkMacosWindow *parentWindow = GDK_MACOS_SURFACE (parent)->window;
|
||||
|
||||
[parentWindow showAndMakeKey:YES];
|
||||
}
|
||||
}
|
||||
|
||||
if (was_mapped)
|
||||
gdk_surface_freeze_updates (GDK_SURFACE (self));
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -210,6 +277,7 @@ gdk_macos_surface_begin_frame (GdkMacosSurface *self)
|
||||
{
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
self->in_frame = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -230,11 +298,9 @@ gdk_macos_surface_end_frame (GdkMacosSurface *self)
|
||||
if ((timings = gdk_frame_clock_get_current_timings (frame_clock)))
|
||||
self->pending_frame_counter = timings->frame_counter;
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
|
||||
{
|
||||
_gdk_macos_display_add_frame_callback (GDK_MACOS_DISPLAY (display), self);
|
||||
gdk_surface_freeze_updates (GDK_SURFACE (self));
|
||||
}
|
||||
self->in_frame = FALSE;
|
||||
|
||||
_gdk_macos_surface_request_frame (self);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -408,6 +474,9 @@ gdk_macos_surface_destroy (GdkSurface *surface,
|
||||
GdkMacosWindow *window = g_steal_pointer (&self->window);
|
||||
GdkFrameClock *frame_clock;
|
||||
|
||||
_gdk_macos_surface_cancel_frame (self);
|
||||
g_clear_object (&self->best_monitor);
|
||||
|
||||
if ((frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
@@ -419,7 +488,6 @@ gdk_macos_surface_destroy (GdkSurface *surface,
|
||||
}
|
||||
|
||||
g_clear_pointer (&self->title, g_free);
|
||||
g_clear_pointer (&self->opaque_region, cairo_region_destroy);
|
||||
|
||||
if (window != NULL)
|
||||
[window close];
|
||||
@@ -528,6 +596,11 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
|
||||
surface_class->set_input_region = gdk_macos_surface_set_input_region;
|
||||
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
|
||||
|
||||
/**
|
||||
* GdkMacosSurface:native: (attributes org.gtk.Property.get=gdk_macos_surface_get_native_window)
|
||||
*
|
||||
* The "native" property contains the underlying NSWindow.
|
||||
*/
|
||||
properties [PROP_NATIVE] =
|
||||
g_param_spec_pointer ("native",
|
||||
"Native",
|
||||
@@ -561,7 +634,7 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
|
||||
g_return_val_if_fail (GDK_IS_MACOS_DISPLAY (display), NULL);
|
||||
|
||||
if (parent != NULL)
|
||||
frame_clock = g_object_ref (gdk_surface_get_frame_clock (parent));
|
||||
frame_clock = g_object_ref (parent->frame_clock);
|
||||
else
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
|
||||
@@ -621,14 +694,16 @@ _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
|
||||
gboolean
|
||||
_gdk_macos_surface_is_opaque (GdkMacosSurface *self)
|
||||
{
|
||||
GdkSurface *surface = (GdkSurface *)self;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), FALSE);
|
||||
|
||||
if (self->opaque_region != NULL &&
|
||||
cairo_region_num_rectangles (self->opaque_region) == 1)
|
||||
if (surface->opaque_region != NULL &&
|
||||
cairo_region_num_rectangles (surface->opaque_region) == 1)
|
||||
{
|
||||
cairo_rectangle_int_t extents;
|
||||
|
||||
cairo_region_get_extents (self->opaque_region, &extents);
|
||||
cairo_region_get_extents (surface->opaque_region, &extents);
|
||||
|
||||
return (extents.x == 0 &&
|
||||
extents.y == 0 &&
|
||||
@@ -688,6 +763,27 @@ _gdk_macos_surface_get_native (GdkMacosSurface *self)
|
||||
return (NSWindow *)self->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_macos_surface_get_native_window: (attributes org.gtk.Method.get_property=native)
|
||||
* @self: a #GdkMacosSurface
|
||||
*
|
||||
* Gets the underlying NSWindow used by the surface.
|
||||
*
|
||||
* The NSWindow's contentView is an implementation detail and may change
|
||||
* between releases of GTK.
|
||||
*
|
||||
* Returns: (nullable): a #NSWindow or %NULL
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
gpointer
|
||||
gdk_macos_surface_get_native_window (GdkMacosSurface *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), NULL);
|
||||
|
||||
return _gdk_macos_surface_get_native (self);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_set_geometry_hints (GdkMacosSurface *self,
|
||||
const GdkGeometry *geometry,
|
||||
@@ -748,8 +844,9 @@ _gdk_macos_surface_update_fullscreen_state (GdkMacosSurface *self)
|
||||
void
|
||||
_gdk_macos_surface_configure (GdkMacosSurface *self)
|
||||
{
|
||||
GdkMacosDisplay *display;
|
||||
GdkSurface *surface = (GdkSurface *)self;
|
||||
GdkMacosDisplay *display;
|
||||
GdkMacosSurface *parent;
|
||||
NSRect frame_rect;
|
||||
NSRect content_rect;
|
||||
|
||||
@@ -758,6 +855,13 @@ _gdk_macos_surface_configure (GdkMacosSurface *self)
|
||||
if (GDK_SURFACE_DESTROYED (self))
|
||||
return;
|
||||
|
||||
if (surface->parent != NULL)
|
||||
parent = GDK_MACOS_SURFACE (surface->parent);
|
||||
else if (surface->transient_for != NULL)
|
||||
parent = GDK_MACOS_SURFACE (surface->transient_for);
|
||||
else
|
||||
parent = NULL;
|
||||
|
||||
display = GDK_MACOS_DISPLAY (GDK_SURFACE (self)->display);
|
||||
frame_rect = [self->window frame];
|
||||
content_rect = [self->window contentRectForFrameRect:frame_rect];
|
||||
@@ -767,18 +871,15 @@ _gdk_macos_surface_configure (GdkMacosSurface *self)
|
||||
content_rect.origin.y + content_rect.size.height,
|
||||
&self->root_x, &self->root_y);
|
||||
|
||||
if (self->did_initial_present)
|
||||
if (parent != NULL)
|
||||
{
|
||||
if (surface->parent != NULL)
|
||||
{
|
||||
surface->x = self->root_x - GDK_MACOS_SURFACE (surface->parent)->root_x;
|
||||
surface->y = self->root_y - GDK_MACOS_SURFACE (surface->parent)->root_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->x = self->root_x;
|
||||
surface->y = self->root_y;
|
||||
}
|
||||
surface->x = self->root_x - parent->root_x;
|
||||
surface->y = self->root_y - parent->root_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->x = self->root_x;
|
||||
surface->y = self->root_y;
|
||||
}
|
||||
|
||||
if (surface->width != content_rect.size.width ||
|
||||
@@ -791,48 +892,12 @@ _gdk_macos_surface_configure (GdkMacosSurface *self)
|
||||
g_clear_object (&self->front);
|
||||
|
||||
_gdk_surface_update_size (surface);
|
||||
gdk_surface_request_layout (surface);
|
||||
gdk_surface_invalidate_rect (surface, NULL);
|
||||
}
|
||||
|
||||
_gdk_macos_surface_reposition_children (self);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_publish_timings (GdkMacosSurface *self,
|
||||
gint64 presentation_time,
|
||||
gint64 refresh_interval)
|
||||
{
|
||||
GdkFrameTimings *timings;
|
||||
GdkFrameClock *frame_clock;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (!(frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
|
||||
return;
|
||||
|
||||
if (self->pending_frame_counter)
|
||||
{
|
||||
timings = gdk_frame_clock_get_timings (frame_clock, self->pending_frame_counter);
|
||||
|
||||
if (timings != NULL)
|
||||
{
|
||||
timings->presentation_time = presentation_time - refresh_interval;
|
||||
timings->complete = TRUE;
|
||||
}
|
||||
|
||||
self->pending_frame_counter = 0;
|
||||
}
|
||||
|
||||
timings = gdk_frame_clock_get_current_timings (frame_clock);
|
||||
|
||||
if (timings != NULL)
|
||||
{
|
||||
timings->refresh_interval = refresh_interval;
|
||||
timings->predicted_presentation_time = presentation_time;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_macos_surface_show (GdkMacosSurface *self)
|
||||
{
|
||||
@@ -843,22 +908,17 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
|
||||
if (GDK_SURFACE_DESTROYED (self))
|
||||
return;
|
||||
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (GDK_SURFACE (self)->display));
|
||||
self->show_on_next_swap = TRUE;
|
||||
|
||||
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
|
||||
|
||||
if (!was_mapped)
|
||||
gdk_surface_set_is_mapped (GDK_SURFACE (self), TRUE);
|
||||
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (GDK_SURFACE (self)->display));
|
||||
|
||||
self->show_on_next_swap = TRUE;
|
||||
|
||||
if (!was_mapped)
|
||||
{
|
||||
if (gdk_surface_get_mapped (GDK_SURFACE (self)))
|
||||
{
|
||||
_gdk_macos_surface_configure (self);
|
||||
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
||||
}
|
||||
gdk_surface_set_is_mapped (GDK_SURFACE (self), TRUE);
|
||||
gdk_surface_request_layout (GDK_SURFACE (self));
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
|
||||
gdk_surface_thaw_updates (GDK_SURFACE (self));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -911,36 +971,59 @@ _gdk_macos_surface_move_resize (GdkMacosSurface *self,
|
||||
GdkDisplay *display;
|
||||
NSRect content_rect;
|
||||
NSRect frame_rect;
|
||||
gboolean ignore_move;
|
||||
gboolean ignore_size;
|
||||
GdkRectangle current;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if ((x == -1 || (x == self->root_x)) &&
|
||||
(y == -1 || (y == self->root_y)) &&
|
||||
(width == -1 || (width == surface->width)) &&
|
||||
(height == -1 || (height == surface->height)))
|
||||
/* Query for up-to-date values in case we're racing against
|
||||
* an incoming frame notify which could be queued behind whatever
|
||||
* we're processing right now.
|
||||
*/
|
||||
frame_rect = [self->window frame];
|
||||
content_rect = [self->window contentRectForFrameRect:frame_rect];
|
||||
_gdk_macos_display_from_display_coords (GDK_MACOS_DISPLAY (GDK_SURFACE (self)->display),
|
||||
content_rect.origin.x, content_rect.origin.y,
|
||||
¤t.x, ¤t.y);
|
||||
current.width = content_rect.size.width;
|
||||
current.height = content_rect.size.height;
|
||||
|
||||
/* Check if we can ignore the operation all together */
|
||||
ignore_move = (x == -1 || (x == current.x)) &&
|
||||
(y == -1 || (y == current.y));
|
||||
ignore_size = (width == -1 || (width == current.width)) &&
|
||||
(height == -1 || (height == current.height));
|
||||
|
||||
if (ignore_move && ignore_size)
|
||||
return;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
|
||||
if (width == -1)
|
||||
width = surface->width;
|
||||
width = current.width;
|
||||
|
||||
if (height == -1)
|
||||
height = surface->height;
|
||||
height = current.height;
|
||||
|
||||
if (x == -1)
|
||||
x = self->root_x;
|
||||
x = current.x;
|
||||
|
||||
if (y == -1)
|
||||
y = self->root_y;
|
||||
y = current.y;
|
||||
|
||||
_gdk_macos_display_to_display_coords (GDK_MACOS_DISPLAY (display),
|
||||
x, y + height,
|
||||
&x, &y);
|
||||
|
||||
content_rect = NSMakeRect (x, y, width, height);
|
||||
if (!ignore_move)
|
||||
content_rect.origin = NSMakePoint (x, y);
|
||||
|
||||
if (!ignore_size)
|
||||
content_rect.size = NSMakeSize (width, height);
|
||||
|
||||
frame_rect = [self->window frameRectForContentRect:content_rect];
|
||||
[self->window setFrame:frame_rect display:YES];
|
||||
[self->window setFrame:frame_rect display:NO];
|
||||
}
|
||||
|
||||
void
|
||||
@@ -995,14 +1078,24 @@ void
|
||||
_gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
|
||||
{
|
||||
GListModel *monitors;
|
||||
GdkMonitor *best = NULL;
|
||||
GdkRectangle rect;
|
||||
GdkRectangle intersect;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
guint n_monitors;
|
||||
int best_area = 0;
|
||||
|
||||
g_return_if_fail (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (self->in_change_monitor)
|
||||
return;
|
||||
|
||||
self->in_change_monitor = TRUE;
|
||||
|
||||
_gdk_macos_surface_cancel_frame (self);
|
||||
_gdk_macos_surface_configure (self);
|
||||
|
||||
rect.x = self->root_x;
|
||||
rect.y = self->root_y;
|
||||
rect.width = GDK_SURFACE (self)->width;
|
||||
@@ -1042,29 +1135,10 @@ _gdk_macos_surface_monitor_changed (GdkMacosSurface *self)
|
||||
g_clear_object (&self->buffer);
|
||||
g_clear_object (&self->front);
|
||||
|
||||
_gdk_macos_surface_configure (self);
|
||||
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
|
||||
}
|
||||
|
||||
GdkMonitor *
|
||||
_gdk_macos_surface_get_best_monitor (GdkMacosSurface *self)
|
||||
{
|
||||
GdkMonitor *best = NULL;
|
||||
GdkRectangle rect;
|
||||
int best_area = 0;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), NULL);
|
||||
|
||||
rect.x = self->root_x;
|
||||
rect.y = self->root_y;
|
||||
rect.width = GDK_SURFACE (self)->width;
|
||||
rect.height = GDK_SURFACE (self)->height;
|
||||
|
||||
/* Determine the best-fit monitor */
|
||||
for (guint i = 0; i < self->monitors->len; i++)
|
||||
{
|
||||
GdkMonitor *monitor = g_ptr_array_index (self->monitors, i);
|
||||
GdkRectangle intersect;
|
||||
monitor = g_ptr_array_index (self->monitors, i);
|
||||
|
||||
if (gdk_rectangle_intersect (&monitor->geometry, &rect, &intersect))
|
||||
{
|
||||
@@ -1072,13 +1146,62 @@ _gdk_macos_surface_get_best_monitor (GdkMacosSurface *self)
|
||||
|
||||
if (area > best_area)
|
||||
{
|
||||
best = monitor;
|
||||
best_area = area;
|
||||
best = monitor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return best;
|
||||
if (g_set_object (&self->best_monitor, best))
|
||||
{
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("Surface \"%s\" moved to monitor \"%s\"",
|
||||
self->title ? self->title : "unknown",
|
||||
gdk_monitor_get_connector (best)));
|
||||
|
||||
_gdk_macos_surface_configure (self);
|
||||
|
||||
if (GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self)))
|
||||
{
|
||||
_gdk_macos_surface_request_frame (self);
|
||||
gdk_surface_request_layout (GDK_SURFACE (self));
|
||||
}
|
||||
|
||||
for (const GList *iter = GDK_SURFACE (self)->children;
|
||||
iter != NULL;
|
||||
iter = iter->next)
|
||||
{
|
||||
GdkMacosSurface *child = iter->data;
|
||||
GdkRectangle area;
|
||||
|
||||
g_set_object (&child->best_monitor, best);
|
||||
|
||||
area.x = self->root_x + GDK_SURFACE (child)->x + child->shadow_left;
|
||||
area.y = self->root_y + GDK_SURFACE (child)->y + child->shadow_top;
|
||||
area.width = GDK_SURFACE (child)->width - child->shadow_left - child->shadow_right;
|
||||
area.height = GDK_SURFACE (child)->height - child->shadow_top - child->shadow_bottom;
|
||||
|
||||
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (best), &area);
|
||||
|
||||
area.x -= child->shadow_left;
|
||||
area.y -= child->shadow_top;
|
||||
|
||||
_gdk_macos_surface_move (child, area.x, area.y);
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (child), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
|
||||
|
||||
self->in_change_monitor = FALSE;
|
||||
}
|
||||
|
||||
GdkMonitor *
|
||||
_gdk_macos_surface_get_best_monitor (GdkMacosSurface *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), NULL);
|
||||
|
||||
return self->best_monitor;
|
||||
}
|
||||
|
||||
NSView *
|
||||
@@ -1154,11 +1277,15 @@ _gdk_macos_surface_get_buffer (GdkMacosSurface *self)
|
||||
static void
|
||||
_gdk_macos_surface_do_delayed_show (GdkMacosSurface *self)
|
||||
{
|
||||
GdkSurface *surface = (GdkSurface *)self;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
self->show_on_next_swap = FALSE;
|
||||
[self->window showAndMakeKey:YES];
|
||||
gdk_surface_request_motion (GDK_SURFACE (self));
|
||||
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
|
||||
gdk_surface_request_motion (surface);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -36,7 +36,9 @@ typedef struct _GdkMacosSurfaceClass GdkMacosSurfaceClass;
|
||||
#define GDK_IS_MACOS_SURFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_MACOS_SURFACE))
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_macos_surface_get_type (void);
|
||||
GType gdk_macos_surface_get_type (void);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
gpointer gdk_macos_surface_get_native_window (GdkMacosSurface *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -174,6 +174,14 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("Resizing \"%s\" to %dx%d",
|
||||
GDK_MACOS_SURFACE (self)->title ?
|
||||
GDK_MACOS_SURFACE (self)->title :
|
||||
"untitled",
|
||||
width, height));
|
||||
|
||||
_gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height);
|
||||
|
||||
/* Maximized state */
|
||||
@@ -202,6 +210,13 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
GDK_MACOS_SURFACE (self),
|
||||
&x, &y);
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
g_message ("Placing new toplevel \"%s\" at %d,%d",
|
||||
GDK_MACOS_SURFACE (self)->title ?
|
||||
GDK_MACOS_SURFACE (self)->title :
|
||||
"untitled",
|
||||
x, y));
|
||||
|
||||
_gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y);
|
||||
}
|
||||
|
||||
@@ -421,7 +436,8 @@ _gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED))
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED) ||
|
||||
[macos_surface->window inLiveResize])
|
||||
return FALSE;
|
||||
|
||||
/* If we delayed a user resize until the beginning of the frame,
|
||||
@@ -632,10 +648,10 @@ _gdk_macos_toplevel_surface_new (GdkMacosDisplay *display,
|
||||
|
||||
GdkMacosWindow *window;
|
||||
GdkMacosSurface *self;
|
||||
NSScreen *screen;
|
||||
NSUInteger style_mask;
|
||||
NSRect content_rect;
|
||||
NSRect screen_rect;
|
||||
NSRect visible_frame;
|
||||
NSScreen *screen;
|
||||
int nx;
|
||||
int ny;
|
||||
|
||||
@@ -648,14 +664,17 @@ _gdk_macos_toplevel_surface_new (GdkMacosDisplay *display,
|
||||
NSWindowStyleMaskMiniaturizable |
|
||||
NSWindowStyleMaskResizable);
|
||||
|
||||
_gdk_macos_display_to_display_coords (display, x, y, &nx, &ny);
|
||||
if (parent != NULL)
|
||||
{
|
||||
x += GDK_MACOS_SURFACE (parent)->root_x;
|
||||
y += GDK_MACOS_SURFACE (parent)->root_y;
|
||||
}
|
||||
|
||||
_gdk_macos_display_to_display_coords (display, x, y + height, &nx, &ny);
|
||||
|
||||
screen = _gdk_macos_display_get_screen_at_display_coords (display, nx, ny);
|
||||
screen_rect = [screen visibleFrame];
|
||||
nx -= screen_rect.origin.x;
|
||||
ny -= screen_rect.origin.y;
|
||||
content_rect = NSMakeRect (nx, ny - height, width, height);
|
||||
|
||||
visible_frame = [screen visibleFrame];
|
||||
content_rect = NSMakeRect (nx - visible_frame.origin.x, ny - visible_frame.origin.y, width, height);
|
||||
window = [[GdkMacosWindow alloc] initWithContentRect:content_rect
|
||||
styleMask:style_mask
|
||||
backing:NSBackingStoreBuffered
|
||||
@@ -691,13 +710,21 @@ _gdk_macos_toplevel_surface_attach_to_parent (GdkMacosToplevelSurface *self)
|
||||
{
|
||||
NSWindow *parent = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface->transient_for));
|
||||
NSWindow *window = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
|
||||
int x, y;
|
||||
|
||||
[parent addChildWindow:window ordered:NSWindowAbove];
|
||||
|
||||
if (GDK_SURFACE (self)->modal_hint)
|
||||
[window setLevel:NSModalPanelWindowLevel];
|
||||
|
||||
surface->x = 0;
|
||||
surface->y = 0;
|
||||
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
|
||||
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (surface->display),
|
||||
GDK_MACOS_SURFACE (surface),
|
||||
&x, &y);
|
||||
_gdk_macos_surface_move (GDK_MACOS_SURFACE (surface), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ gdk_macos_sources = files([
|
||||
'gdkmacoscursor.c',
|
||||
'gdkmacosdevice.c',
|
||||
'gdkmacosdisplay.c',
|
||||
'gdkmacosdisplay-feedback.c',
|
||||
'gdkmacosdisplay-settings.c',
|
||||
'gdkmacosdisplay-translate.c',
|
||||
'gdkmacosdisplay-wm.c',
|
||||
|
||||
@@ -73,8 +73,9 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
||||
xdg_activation_token_v1_set_serial (token,
|
||||
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
||||
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
||||
xdg_activation_token_v1_set_surface (token,
|
||||
gdk_wayland_surface_get_wl_surface (focus_surface));
|
||||
if (focus_surface)
|
||||
xdg_activation_token_v1_set_surface (token,
|
||||
gdk_wayland_surface_get_wl_surface (focus_surface));
|
||||
xdg_activation_token_v1_commit (token);
|
||||
|
||||
while (app_launch_data.token == NULL)
|
||||
|
||||
@@ -854,6 +854,10 @@ gdk_wayland_display_notify_startup_complete (GdkDisplay *display,
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
char *free_this = NULL;
|
||||
|
||||
/* Will be signaled with focus activation */
|
||||
if (display_wayland->xdg_activation)
|
||||
return;
|
||||
|
||||
if (startup_id == NULL)
|
||||
{
|
||||
startup_id = free_this = display_wayland->startup_notification_id;
|
||||
|
||||
@@ -3453,39 +3453,80 @@ gdk_wayland_surface_destroy (GdkSurface *surface,
|
||||
display->toplevels = g_list_remove (display->toplevels, surface);
|
||||
}
|
||||
|
||||
static void
|
||||
token_done (gpointer data,
|
||||
struct xdg_activation_token_v1 *provider,
|
||||
const char *token)
|
||||
{
|
||||
char **token_out = data;
|
||||
|
||||
*token_out = g_strdup (token);
|
||||
}
|
||||
|
||||
static const struct xdg_activation_token_v1_listener token_listener = {
|
||||
token_done,
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_wayland_surface_focus (GdkSurface *surface,
|
||||
guint32 timestamp)
|
||||
{
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
gchar *startup_id = NULL;
|
||||
|
||||
if (!impl->display_server.gtk_surface)
|
||||
return;
|
||||
startup_id = g_steal_pointer (&display_wayland->startup_notification_id);
|
||||
|
||||
if (timestamp == GDK_CURRENT_TIME)
|
||||
if (display_wayland->xdg_activation)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland =
|
||||
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
|
||||
GdkWaylandSeat *seat =
|
||||
GDK_WAYLAND_SEAT (gdk_display_get_default_seat (display));
|
||||
|
||||
if (display_wayland->startup_notification_id)
|
||||
/* If the focus request does not have a startup ID associated, get a
|
||||
* new token to activate the window.
|
||||
*/
|
||||
if (!startup_id)
|
||||
{
|
||||
if (display_wayland->xdg_activation)
|
||||
{
|
||||
xdg_activation_v1_activate (display_wayland->xdg_activation,
|
||||
display_wayland->startup_notification_id,
|
||||
impl->display_server.wl_surface);
|
||||
}
|
||||
else if (display_wayland->gtk_shell_version >= 3)
|
||||
{
|
||||
gtk_surface1_request_focus (impl->display_server.gtk_surface,
|
||||
display_wayland->startup_notification_id);
|
||||
}
|
||||
struct xdg_activation_token_v1 *token;
|
||||
struct wl_event_queue *event_queue;
|
||||
|
||||
g_clear_pointer (&display_wayland->startup_notification_id, g_free);
|
||||
event_queue = wl_display_create_queue (display_wayland->wl_display);
|
||||
|
||||
token = xdg_activation_v1_get_activation_token (display_wayland->xdg_activation);
|
||||
wl_proxy_set_queue ((struct wl_proxy *) token, event_queue);
|
||||
|
||||
xdg_activation_token_v1_add_listener (token,
|
||||
&token_listener,
|
||||
&startup_id);
|
||||
xdg_activation_token_v1_set_serial (token,
|
||||
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
||||
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
||||
xdg_activation_token_v1_set_surface (token,
|
||||
gdk_wayland_surface_get_wl_surface (surface));
|
||||
xdg_activation_token_v1_commit (token);
|
||||
|
||||
while (startup_id == NULL)
|
||||
wl_display_dispatch_queue (display_wayland->wl_display, event_queue);
|
||||
|
||||
xdg_activation_token_v1_destroy (token);
|
||||
wl_event_queue_destroy (event_queue);
|
||||
}
|
||||
|
||||
xdg_activation_v1_activate (display_wayland->xdg_activation,
|
||||
startup_id,
|
||||
impl->display_server.wl_surface);
|
||||
}
|
||||
else
|
||||
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
|
||||
else if (impl->display_server.gtk_surface)
|
||||
{
|
||||
if (timestamp != GDK_CURRENT_TIME)
|
||||
gtk_surface1_present (impl->display_server.gtk_surface, timestamp);
|
||||
else if (startup_id && display_wayland->gtk_shell_version >= 3)
|
||||
gtk_surface1_request_focus (impl->display_server.gtk_surface,
|
||||
startup_id);
|
||||
}
|
||||
|
||||
g_free (startup_id);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -1219,11 +1219,10 @@ inner_clipboard_window_procedure (HWND hwnd,
|
||||
return DefWindowProcW (hwnd, message, wparam, lparam);
|
||||
}
|
||||
|
||||
SetLastError (0);
|
||||
hwnd_owner = GetClipboardOwner ();
|
||||
|
||||
if ((hwnd_owner == NULL) &&
|
||||
(GetLastError () != ERROR_SUCCESS))
|
||||
WIN32_API_FAILED ("GetClipboardOwner");
|
||||
if (hwnd_owner == NULL && GetLastError () != 0)
|
||||
WIN32_API_FAILED ("GetClipboardOwner");
|
||||
|
||||
hwnd_opener = GetOpenClipboardWindow ();
|
||||
|
||||
|
||||
+25
-24
@@ -229,14 +229,9 @@ fail1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the file path of the keyboard layout dll.
|
||||
* The result is heap-allocated and should be freed with g_free().
|
||||
*/
|
||||
static char*
|
||||
get_keyboard_layout_file (const char *layout_name)
|
||||
_get_keyboard_layout_file (const char *layout_name)
|
||||
{
|
||||
char *final_layout_name = NULL;
|
||||
HKEY hkey = 0;
|
||||
DWORD var_type = REG_SZ;
|
||||
char *result = NULL;
|
||||
@@ -249,24 +244,8 @@ get_keyboard_layout_file (const char *layout_name)
|
||||
"Keyboard Layouts\\";
|
||||
char kbdKeyPath[sizeof (prefix) + KL_NAMELENGTH];
|
||||
|
||||
/* The user may have a keyboard substitute configured */
|
||||
final_layout_name = get_keyboard_layout_substituted_name (layout_name);
|
||||
if (final_layout_name != NULL)
|
||||
{
|
||||
g_debug ("Substituting keyboard layout name from '%s' to '%s'",
|
||||
layout_name, final_layout_name);
|
||||
g_snprintf (kbdKeyPath, sizeof (prefix) + KL_NAMELENGTH, "%s%s",
|
||||
prefix, final_layout_name);
|
||||
g_free (final_layout_name);
|
||||
final_layout_name = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_debug ("Could not get substitute keyboard layout name for '%s', "
|
||||
"will use '%s' directly", layout_name, layout_name);
|
||||
g_snprintf (kbdKeyPath, sizeof (prefix) + KL_NAMELENGTH, "%s%s",
|
||||
prefix, layout_name);
|
||||
}
|
||||
g_snprintf (kbdKeyPath, sizeof (prefix) + KL_NAMELENGTH, "%s%s",
|
||||
prefix, layout_name);
|
||||
|
||||
status = RegOpenKeyExA (HKEY_LOCAL_MACHINE, (LPCSTR) kbdKeyPath, 0,
|
||||
KEY_QUERY_VALUE, &hkey);
|
||||
@@ -326,6 +305,28 @@ fail1:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the file path of the keyboard layout dll.
|
||||
* The result is heap-allocated and should be freed with g_free().
|
||||
*/
|
||||
static char*
|
||||
get_keyboard_layout_file (const char *layout_name)
|
||||
{
|
||||
char *result = _get_keyboard_layout_file (layout_name);
|
||||
|
||||
/* If we could not retrieve a path, it may be that we need to perform layout
|
||||
* substitution
|
||||
*/
|
||||
if (result == NULL)
|
||||
{
|
||||
char *substituted = get_keyboard_layout_substituted_name (layout_name);
|
||||
result = _get_keyboard_layout_file (substituted);
|
||||
g_free (substituted);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
clear_keyboard_layout_info (gpointer data)
|
||||
{
|
||||
|
||||
@@ -4152,6 +4152,9 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
g_object_set_data (G_OBJECT (window), "fullscreen-info", fi);
|
||||
fi->style = GetWindowLong (GDK_SURFACE_HWND (window), GWL_STYLE);
|
||||
|
||||
impl->inhibit_configure = TRUE;
|
||||
impl->force_recompute_size = FALSE;
|
||||
|
||||
/* Send state change before configure event */
|
||||
gdk_synthesize_surface_state (window, 0, GDK_TOPLEVEL_STATE_FULLSCREEN);
|
||||
|
||||
@@ -4160,7 +4163,7 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
|
||||
|
||||
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_TOP,
|
||||
x, y, width, height,
|
||||
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
|
||||
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4184,11 +4187,17 @@ gdk_win32_surface_unfullscreen (GdkSurface *window)
|
||||
API_CALL (SetWindowPos, (GDK_SURFACE_HWND (window), HWND_NOTOPMOST,
|
||||
fi->r.left, fi->r.top,
|
||||
fi->r.right - fi->r.left, fi->r.bottom - fi->r.top,
|
||||
SWP_NOCOPYBITS | SWP_SHOWWINDOW));
|
||||
SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED));
|
||||
|
||||
g_object_set_data (G_OBJECT (window), "fullscreen-info", NULL);
|
||||
g_free (fi);
|
||||
_gdk_win32_surface_update_style_bits (window);
|
||||
|
||||
if (impl->inhibit_configure)
|
||||
{
|
||||
impl->inhibit_configure = FALSE;
|
||||
impl->force_recompute_size = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+37
-3
@@ -306,10 +306,9 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
GskGLRenderer *self = (GskGLRenderer *)renderer;
|
||||
GskGLRenderTarget *render_target;
|
||||
GskGLRenderJob *job;
|
||||
GdkTexture *texture = NULL;
|
||||
GdkTexture *texture;
|
||||
guint texture_id;
|
||||
int width;
|
||||
int height;
|
||||
int width, height, max_size;
|
||||
int format;
|
||||
|
||||
g_assert (GSK_IS_GL_RENDERER (renderer));
|
||||
@@ -317,6 +316,37 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
width = ceilf (viewport->size.width);
|
||||
height = ceilf (viewport->size.height);
|
||||
max_size = self->command_queue->max_texture_size;
|
||||
if (width > max_size || height > max_size)
|
||||
{
|
||||
gsize x, y, size, stride;
|
||||
GBytes *bytes;
|
||||
guchar *data;
|
||||
|
||||
stride = width * 4;
|
||||
size = stride * height;
|
||||
data = g_malloc_n (stride, height);
|
||||
|
||||
for (y = 0; y < height; y += max_size)
|
||||
{
|
||||
for (x = 0; x < width; x += max_size)
|
||||
{
|
||||
texture = gsk_gl_renderer_render_texture (renderer, root,
|
||||
&GRAPHENE_RECT_INIT (x, y,
|
||||
MIN (max_size, viewport->size.width - x),
|
||||
MIN (max_size, viewport->size.height - y)));
|
||||
gdk_texture_download (texture,
|
||||
data + stride * y + x * 4,
|
||||
stride);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
||||
bytes = g_bytes_new_take (data, size);
|
||||
texture = gdk_memory_texture_new (width, height, GDK_MEMORY_DEFAULT, bytes, stride);
|
||||
g_bytes_unref (bytes);
|
||||
return texture;
|
||||
}
|
||||
|
||||
format = gsk_render_node_prefers_high_depth (root) ? GL_RGBA32F : GL_RGBA8;
|
||||
|
||||
@@ -342,6 +372,10 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
|
||||
|
||||
gsk_gl_driver_after_frame (self->driver);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return g_steal_pointer (&texture);
|
||||
}
|
||||
|
||||
+37
-1
@@ -107,8 +107,44 @@ gsk_cairo_renderer_render_texture (GskRenderer *renderer,
|
||||
GdkTexture *texture;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
int width, height;
|
||||
/* limit from cairo's source code */
|
||||
#define MAX_IMAGE_SIZE 32767
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, ceil (viewport->size.width), ceil (viewport->size.height));
|
||||
width = ceil (viewport->size.width);
|
||||
height = ceil (viewport->size.height);
|
||||
if (width > MAX_IMAGE_SIZE || height > MAX_IMAGE_SIZE)
|
||||
{
|
||||
gsize x, y, size, stride;
|
||||
GBytes *bytes;
|
||||
guchar *data;
|
||||
|
||||
stride = width * 4;
|
||||
size = stride * height;
|
||||
data = g_malloc_n (stride, height);
|
||||
|
||||
for (y = 0; y < height; y += MAX_IMAGE_SIZE)
|
||||
{
|
||||
for (x = 0; x < width; x += MAX_IMAGE_SIZE)
|
||||
{
|
||||
texture = gsk_cairo_renderer_render_texture (renderer, root,
|
||||
&GRAPHENE_RECT_INIT (x, y,
|
||||
MIN (MAX_IMAGE_SIZE, viewport->size.width - x),
|
||||
MIN (MAX_IMAGE_SIZE, viewport->size.height - y)));
|
||||
gdk_texture_download (texture,
|
||||
data + stride * y + x * 4,
|
||||
stride);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
}
|
||||
|
||||
bytes = g_bytes_new_take (data, size);
|
||||
texture = gdk_memory_texture_new (width, height, GDK_MEMORY_DEFAULT, bytes, stride);
|
||||
g_bytes_unref (bytes);
|
||||
return texture;
|
||||
}
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
cairo_translate (cr, - viewport->origin.x, - viewport->origin.y);
|
||||
|
||||
@@ -5130,10 +5130,10 @@ gsk_gl_shader_node_diff (GskRenderNode *node1,
|
||||
* @shader: the `GskGLShader`
|
||||
* @bounds: the rectangle to render the shader into
|
||||
* @args: Arguments for the uniforms
|
||||
* @children: (array length=n_children): array of child nodes, these will
|
||||
* be rendered to textures and used as input.
|
||||
* @children: (nullable) (array length=n_children): array of child nodes,
|
||||
* these will be rendered to textures and used as input.
|
||||
* @n_children: Length of @children (currenly the GL backend supports
|
||||
* up to 4 children)
|
||||
* up to 4 children)
|
||||
*
|
||||
* Creates a `GskRenderNode` that will render the given @shader into the
|
||||
* area given by @bounds.
|
||||
@@ -5167,10 +5167,10 @@ gsk_gl_shader_node_new (GskGLShader *shader,
|
||||
|
||||
g_return_val_if_fail (GSK_IS_GL_SHADER (shader), NULL);
|
||||
g_return_val_if_fail (bounds != NULL, NULL);
|
||||
g_return_val_if_fail ((args == NULL && gsk_gl_shader_get_n_uniforms (shader) == 0) ||
|
||||
(args != NULL && g_bytes_get_size (args) == gsk_gl_shader_get_args_size (shader)), NULL);
|
||||
g_return_val_if_fail (args != NULL, NULL);
|
||||
g_return_val_if_fail (g_bytes_get_size (args) == gsk_gl_shader_get_args_size (shader), NULL);
|
||||
g_return_val_if_fail ((children == NULL && n_children == 0) ||
|
||||
(children != NULL && n_children == gsk_gl_shader_get_n_textures (shader)), NULL);
|
||||
(n_children == gsk_gl_shader_get_n_textures (shader)), NULL);
|
||||
|
||||
self = gsk_render_node_alloc (GSK_GL_SHADER_NODE);
|
||||
node = (GskRenderNode *) self;
|
||||
|
||||
+1
-1
@@ -425,7 +425,7 @@ gtk_accessible_reset_property (GtkAccessible *self,
|
||||
* gtk_accessible_update_relation (accessible,
|
||||
* GTK_ACCESSIBLE_RELATION_CONTROLS,
|
||||
* ref1, NULL,
|
||||
* GTK_ACCESSIBLE_LABELLED_BY,
|
||||
* GTK_ACCESSIBLE_RELATION_LABELLED_BY,
|
||||
* ref1, ref2, ref3, NULL,
|
||||
* -1);
|
||||
* ```
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ struct _GtkBinLayout
|
||||
GtkLayoutManager parent_instance;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkBinLayout, gtk_bin_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
G_DEFINE_FINAL_TYPE (GtkBinLayout, gtk_bin_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static void
|
||||
gtk_bin_layout_measure (GtkLayoutManager *layout_manager,
|
||||
|
||||
@@ -117,8 +117,8 @@ static void bookmark_file_changed (GFileMonitor *monitor,
|
||||
static void gtk_bookmark_list_set_filename (GtkBookmarkList *self,
|
||||
const char *filename);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkBookmarkList, gtk_bookmark_list, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_bookmark_list_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkBookmarkList, gtk_bookmark_list, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_bookmark_list_model_init))
|
||||
|
||||
static void
|
||||
gtk_bookmark_list_set_property (GObject *object,
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ enum {
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkBoolFilter, gtk_bool_filter, GTK_TYPE_FILTER)
|
||||
G_DEFINE_FINAL_TYPE (GtkBoolFilter, gtk_bool_filter, GTK_TYPE_FILTER)
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
@@ -106,7 +106,7 @@ gtk_bool_filter_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_bool_filter_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
|
||||
+3
-3
@@ -58,8 +58,8 @@ struct _GtkBoxLayout
|
||||
GtkBaselinePosition baseline_position;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkBoxLayout, gtk_box_layout, GTK_TYPE_LAYOUT_MANAGER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkBoxLayout, gtk_box_layout, GTK_TYPE_LAYOUT_MANAGER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL))
|
||||
|
||||
enum {
|
||||
PROP_HOMOGENEOUS = 1,
|
||||
@@ -342,7 +342,7 @@ distribute_remaining_size (GtkRequestedSize *sizes,
|
||||
else
|
||||
max = test;
|
||||
}
|
||||
|
||||
|
||||
return available - total_size;
|
||||
}
|
||||
|
||||
|
||||
+23
-17
@@ -54,7 +54,7 @@ struct _GtkCenterLayout
|
||||
};
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkCenterLayout, gtk_center_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
G_DEFINE_FINAL_TYPE (GtkCenterLayout, gtk_center_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static int
|
||||
get_spacing (GtkCenterLayout *self,
|
||||
@@ -523,11 +523,26 @@ gtk_center_layout_allocate (GtkLayoutManager *layout_manager,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_center_layout_dispose (GObject *object)
|
||||
{
|
||||
GtkCenterLayout *self = GTK_CENTER_LAYOUT (object);
|
||||
|
||||
g_clear_object (&self->start_widget);
|
||||
g_clear_object (&self->center_widget);
|
||||
g_clear_object (&self->end_widget);
|
||||
|
||||
G_OBJECT_CLASS (gtk_center_layout_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_center_layout_class_init (GtkCenterLayoutClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkLayoutManagerClass *layout_class = GTK_LAYOUT_MANAGER_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_center_layout_dispose;
|
||||
|
||||
layout_class->get_request_mode = gtk_center_layout_get_request_mode;
|
||||
layout_class->measure = gtk_center_layout_measure;
|
||||
layout_class->allocate = gtk_center_layout_allocate;
|
||||
@@ -641,11 +656,8 @@ gtk_center_layout_set_start_widget (GtkCenterLayout *self,
|
||||
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
if (self->start_widget == widget)
|
||||
return;
|
||||
|
||||
self->start_widget = widget;
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
if (g_set_object (&self->start_widget, widget))
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -680,11 +692,8 @@ gtk_center_layout_set_center_widget (GtkCenterLayout *self,
|
||||
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
if (self->center_widget == widget)
|
||||
return;
|
||||
|
||||
self->center_widget = widget;
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
if (g_set_object (&self->center_widget, widget))
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -706,7 +715,7 @@ gtk_center_layout_get_center_widget (GtkCenterLayout *self)
|
||||
/**
|
||||
* gtk_center_layout_set_end_widget:
|
||||
* @self: a `GtkCenterLayout`
|
||||
* @widget: (nullable) (transfer none): the new end widget
|
||||
* @widget: (nullable): the new end widget
|
||||
*
|
||||
* Sets the new end widget of @self.
|
||||
*
|
||||
@@ -719,11 +728,8 @@ gtk_center_layout_set_end_widget (GtkCenterLayout *self,
|
||||
g_return_if_fail (GTK_IS_CENTER_LAYOUT (self));
|
||||
g_return_if_fail (widget == NULL || GTK_IS_WIDGET (widget));
|
||||
|
||||
if (self->end_widget == widget)
|
||||
return;
|
||||
|
||||
self->end_widget = widget;
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
if (g_set_object (&self->end_widget, widget))
|
||||
gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (self));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ enum {
|
||||
|
||||
static GParamSpec *obj_props[N_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE (GtkConstraint, gtk_constraint, G_TYPE_OBJECT)
|
||||
G_DEFINE_FINAL_TYPE (GtkConstraint, gtk_constraint, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_constraint_set_property (GObject *gobject,
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef enum {
|
||||
} GuideValue;
|
||||
|
||||
struct _GtkConstraintGuide
|
||||
{
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
char *name;
|
||||
@@ -104,9 +104,9 @@ gtk_constraint_guide_constraint_target_iface_init (GtkConstraintTargetInterface
|
||||
{
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkConstraintGuide, gtk_constraint_guide, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_CONSTRAINT_TARGET,
|
||||
gtk_constraint_guide_constraint_target_iface_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkConstraintGuide, gtk_constraint_guide, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_CONSTRAINT_TARGET,
|
||||
gtk_constraint_guide_constraint_target_iface_init))
|
||||
|
||||
static void
|
||||
gtk_constraint_guide_init (GtkConstraintGuide *guide)
|
||||
|
||||
@@ -266,7 +266,7 @@ struct _GtkConstraintLayout
|
||||
GListStore *guides_observer;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkConstraintLayoutChild, gtk_constraint_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
G_DEFINE_FINAL_TYPE (GtkConstraintLayoutChild, gtk_constraint_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
|
||||
GtkConstraintSolver *
|
||||
gtk_constraint_layout_get_solver (GtkConstraintLayout *self)
|
||||
@@ -537,8 +537,8 @@ gtk_constraint_layout_child_init (GtkConstraintLayoutChild *self)
|
||||
|
||||
static void gtk_buildable_interface_init (GtkBuildableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkConstraintLayout, gtk_constraint_layout, GTK_TYPE_LAYOUT_MANAGER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_buildable_interface_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkConstraintLayout, gtk_constraint_layout, GTK_TYPE_LAYOUT_MANAGER,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_buildable_interface_init))
|
||||
|
||||
static void
|
||||
gtk_constraint_layout_finalize (GObject *gobject)
|
||||
|
||||
@@ -38,7 +38,7 @@ struct _GtkCustomFilter
|
||||
GDestroyNotify user_destroy;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkCustomFilter, gtk_custom_filter, GTK_TYPE_FILTER)
|
||||
G_DEFINE_FINAL_TYPE (GtkCustomFilter, gtk_custom_filter, GTK_TYPE_FILTER)
|
||||
|
||||
static gboolean
|
||||
gtk_custom_filter_match (GtkFilter *filter,
|
||||
|
||||
@@ -22,7 +22,7 @@ struct _GtkCustomLayout
|
||||
GtkCustomAllocateFunc allocate_func;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkCustomLayout, gtk_custom_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
G_DEFINE_FINAL_TYPE (GtkCustomLayout, gtk_custom_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static GtkSizeRequestMode
|
||||
gtk_custom_layout_get_request_mode (GtkLayoutManager *manager,
|
||||
|
||||
@@ -39,7 +39,7 @@ struct _GtkCustomSorter
|
||||
GDestroyNotify user_destroy;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkCustomSorter, gtk_custom_sorter, GTK_TYPE_SORTER)
|
||||
G_DEFINE_FINAL_TYPE (GtkCustomSorter, gtk_custom_sorter, GTK_TYPE_SORTER)
|
||||
|
||||
static GtkOrdering
|
||||
gtk_custom_sorter_compare (GtkSorter *sorter,
|
||||
|
||||
@@ -144,8 +144,8 @@ gtk_directory_list_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_directory_list_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkDirectoryList, gtk_directory_list, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_directory_list_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkDirectoryList, gtk_directory_list, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_directory_list_model_init))
|
||||
|
||||
static void
|
||||
gtk_directory_list_set_property (GObject *object,
|
||||
|
||||
+5
-5
@@ -79,11 +79,11 @@ static GParamSpec *properties[LAST_ARG] = { NULL, };
|
||||
static void gtk_drag_icon_root_init (GtkRootInterface *iface);
|
||||
static void gtk_drag_icon_native_init (GtkNativeInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkDragIcon, gtk_drag_icon, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_NATIVE,
|
||||
gtk_drag_icon_native_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ROOT,
|
||||
gtk_drag_icon_root_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkDragIcon, gtk_drag_icon, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_NATIVE,
|
||||
gtk_drag_icon_native_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ROOT,
|
||||
gtk_drag_icon_root_init))
|
||||
|
||||
static GdkDisplay *
|
||||
gtk_drag_icon_root_get_display (GtkRoot *self)
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ enum
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkDropDown, gtk_drop_down, GTK_TYPE_WIDGET)
|
||||
G_DEFINE_FINAL_TYPE (GtkDropDown, gtk_drop_down, GTK_TYPE_WIDGET)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
@@ -103,9 +103,9 @@ gtk_editable_label_editable_init (GtkEditableInterface *iface)
|
||||
}
|
||||
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkEditableLabel, gtk_editable_label, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
||||
gtk_editable_label_editable_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkEditableLabel, gtk_editable_label, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
||||
gtk_editable_label_editable_init))
|
||||
|
||||
static void
|
||||
start_editing (GtkWidget *widget,
|
||||
|
||||
@@ -149,7 +149,8 @@ gtk_event_controller_focus_handle_crossing (GtkEventController *controller,
|
||||
double x,
|
||||
double y)
|
||||
{
|
||||
if (crossing->type == GTK_CROSSING_FOCUS)
|
||||
if (crossing->type == GTK_CROSSING_FOCUS ||
|
||||
crossing->type == GTK_CROSSING_ACTIVE)
|
||||
update_focus (controller, crossing);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,9 +206,9 @@ static GParamSpec *native_props[LAST_ARG] = { NULL, };
|
||||
|
||||
static void _gtk_file_chooser_native_iface_init (GtkFileChooserIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserNative, gtk_file_chooser_native, GTK_TYPE_NATIVE_DIALOG,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
|
||||
_gtk_file_chooser_native_iface_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkFileChooserNative, gtk_file_chooser_native, GTK_TYPE_NATIVE_DIALOG,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_FILE_CHOOSER,
|
||||
_gtk_file_chooser_native_iface_init))
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "gtkfilefilterprivate.h"
|
||||
|
||||
#include "macos/gdkmacos.h"
|
||||
#include "macos/gdkmacosdisplay-private.h"
|
||||
#include "macos/gdkmacossurface-private.h"
|
||||
|
||||
typedef struct {
|
||||
@@ -368,6 +369,9 @@ filechooser_quartz_launch (FileChooserQuartzData *data)
|
||||
[data->key_window makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
/* Need to clear our cached copy of ordered windows */
|
||||
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (gdk_display_get_default ()));
|
||||
|
||||
if (!data->skip_response)
|
||||
{
|
||||
g_slist_free_full (self->custom_files, g_object_unref);
|
||||
|
||||
@@ -134,8 +134,8 @@ gtk_filter_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_filter_list_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFilterListModel, gtk_filter_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_filter_list_model_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkFilterListModel, gtk_filter_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_filter_list_model_model_init))
|
||||
|
||||
static gboolean
|
||||
gtk_filter_list_model_run_filter_on_item (GtkFilterListModel *self,
|
||||
@@ -163,7 +163,7 @@ gtk_filter_list_model_run_filter (GtkFilterListModel *self,
|
||||
gboolean more;
|
||||
|
||||
g_return_if_fail (GTK_IS_FILTER_LIST_MODEL (self));
|
||||
|
||||
|
||||
if (self->pending == NULL)
|
||||
return;
|
||||
|
||||
@@ -346,7 +346,7 @@ gtk_filter_list_model_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_filter_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
@@ -473,7 +473,7 @@ gtk_filter_list_model_refilter (GtkFilterListModel *self,
|
||||
case GTK_FILTER_MATCH_SOME:
|
||||
{
|
||||
GtkBitset *old, *pending;
|
||||
|
||||
|
||||
if (self->matches == NULL)
|
||||
{
|
||||
if (self->strictness == GTK_FILTER_MATCH_ALL)
|
||||
|
||||
@@ -92,7 +92,7 @@ enum
|
||||
|
||||
static GParamSpec *child_props[N_CHILD_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE (GtkFixedLayoutChild, gtk_fixed_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
G_DEFINE_FINAL_TYPE (GtkFixedLayoutChild, gtk_fixed_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
|
||||
static void
|
||||
gtk_fixed_layout_child_set_property (GObject *gobject,
|
||||
@@ -215,7 +215,7 @@ gtk_fixed_layout_child_get_transform (GtkFixedLayoutChild *child)
|
||||
return child->transform;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GtkFixedLayout, gtk_fixed_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
G_DEFINE_FINAL_TYPE (GtkFixedLayout, gtk_fixed_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static GtkSizeRequestMode
|
||||
gtk_fixed_layout_get_request_mode (GtkLayoutManager *layout_manager,
|
||||
|
||||
+17
-17
@@ -72,8 +72,8 @@ static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
static FlattenNode *
|
||||
gtk_flatten_list_model_get_nth (GtkRbTree *tree,
|
||||
guint position,
|
||||
guint *model_position)
|
||||
guint position,
|
||||
guint *model_position)
|
||||
{
|
||||
FlattenNode *node, *tmp;
|
||||
guint model_n_items;
|
||||
@@ -110,8 +110,8 @@ gtk_flatten_list_model_get_nth (GtkRbTree *tree,
|
||||
|
||||
static FlattenNode *
|
||||
gtk_flatten_list_model_get_nth_model (GtkRbTree *tree,
|
||||
guint position,
|
||||
guint *items_before)
|
||||
guint position,
|
||||
guint *items_before)
|
||||
{
|
||||
FlattenNode *node, *tmp;
|
||||
guint before;
|
||||
@@ -198,15 +198,15 @@ gtk_flatten_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_flatten_list_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkFlattenListModel, gtk_flatten_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_flatten_list_model_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkFlattenListModel, gtk_flatten_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_flatten_list_model_model_init))
|
||||
|
||||
static void
|
||||
gtk_flatten_list_model_items_changed_cb (GListModel *model,
|
||||
guint position,
|
||||
guint removed,
|
||||
guint added,
|
||||
gpointer _node)
|
||||
gtk_flatten_list_model_items_changed_cb (GListModel *model,
|
||||
guint position,
|
||||
guint removed,
|
||||
guint added,
|
||||
gpointer _node)
|
||||
{
|
||||
FlattenNode *node = _node, *parent, *left;
|
||||
GtkFlattenListModel *self = node->list;
|
||||
@@ -322,11 +322,11 @@ gtk_flatten_list_model_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_flatten_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
static void
|
||||
gtk_flatten_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkFlattenListModel *self = GTK_FLATTEN_LIST_MODEL (object);
|
||||
|
||||
@@ -463,7 +463,7 @@ gtk_flatten_list_model_set_model (GtkFlattenListModel *self,
|
||||
if (self->model == model)
|
||||
return;
|
||||
|
||||
removed = g_list_model_get_n_items (G_LIST_MODEL (self));
|
||||
removed = g_list_model_get_n_items (G_LIST_MODEL (self));
|
||||
gtk_flatten_list_clear_model (self);
|
||||
|
||||
self->model = model;
|
||||
|
||||
+2
-2
@@ -84,7 +84,7 @@ enum {
|
||||
|
||||
static GParamSpec *child_props[N_CHILD_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE (GtkGridLayoutChild, gtk_grid_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
G_DEFINE_FINAL_TYPE (GtkGridLayoutChild, gtk_grid_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
|
||||
static void
|
||||
gtk_grid_layout_child_set_property (GObject *gobject,
|
||||
@@ -454,7 +454,7 @@ enum {
|
||||
|
||||
static GParamSpec *layout_props[N_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE (GtkGridLayout, gtk_grid_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
G_DEFINE_FINAL_TYPE (GtkGridLayout, gtk_grid_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static inline GtkGridLayoutChild *
|
||||
get_grid_child (GtkGridLayout *self,
|
||||
|
||||
+1
-1
@@ -1291,7 +1291,7 @@ gtk_grid_view_set_factory (GtkGridView *self,
|
||||
GtkListItemFactory *factory)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_GRID_VIEW (self));
|
||||
g_return_if_fail (factory == NULL || GTK_LIST_ITEM_FACTORY (factory));
|
||||
g_return_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory));
|
||||
|
||||
if (factory == gtk_list_item_manager_get_factory (self->item_manager))
|
||||
return;
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
* maximize and close buttons, or the window icon.
|
||||
*
|
||||
* For these reasons, `GtkHeaderBar` is the natural choice for use as the
|
||||
* custom titlebar widget of a `GtkWindow (see [method@Gtk.Window.set_titlebar]),
|
||||
* custom titlebar widget of a `GtkWindow` (see [method@Gtk.Window.set_titlebar]),
|
||||
* as it gives features typical of titlebars while allowing the addition of
|
||||
* child widgets.
|
||||
*
|
||||
|
||||
@@ -357,7 +357,7 @@ notify_cursor_location (GtkIMContextWayland *context)
|
||||
{
|
||||
GtkIMContextWaylandGlobal *global;
|
||||
cairo_rectangle_int_t rect;
|
||||
double x, y;
|
||||
double x, y, sx, sy;
|
||||
|
||||
global = gtk_im_context_wayland_get_global (context);
|
||||
if (global == NULL)
|
||||
@@ -369,8 +369,11 @@ notify_cursor_location (GtkIMContextWayland *context)
|
||||
rect.x, rect.y,
|
||||
&x, &y);
|
||||
|
||||
rect.x = x;
|
||||
rect.y = y;
|
||||
gtk_native_get_surface_transform (gtk_widget_get_native (context->widget),
|
||||
&sx, &sy);
|
||||
|
||||
rect.x = x + sx;
|
||||
rect.y = y + sy;
|
||||
zwp_text_input_v3_set_cursor_rectangle (global->text_input,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
|
||||
@@ -825,7 +825,7 @@ gtk_list_item_manager_set_factory (GtkListItemManager *self,
|
||||
GSList *l;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_MANAGER (self));
|
||||
g_return_if_fail (GTK_IS_LIST_ITEM_FACTORY (factory));
|
||||
g_return_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory));
|
||||
|
||||
if (self->factory == factory)
|
||||
return;
|
||||
|
||||
+1
-1
@@ -1032,7 +1032,7 @@ gtk_list_view_set_factory (GtkListView *self,
|
||||
GtkListItemFactory *factory)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_LIST_VIEW (self));
|
||||
g_return_if_fail (factory == NULL || GTK_LIST_ITEM_FACTORY (factory));
|
||||
g_return_if_fail (factory == NULL || GTK_IS_LIST_ITEM_FACTORY (factory));
|
||||
|
||||
if (factory == gtk_list_item_manager_get_factory (self->item_manager))
|
||||
return;
|
||||
|
||||
@@ -147,7 +147,7 @@ static guint
|
||||
gtk_map_list_model_get_n_items (GListModel *list)
|
||||
{
|
||||
GtkMapListModel *self = GTK_MAP_LIST_MODEL (list);
|
||||
|
||||
|
||||
if (self->model == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -205,8 +205,8 @@ gtk_map_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_map_list_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkMapListModel, gtk_map_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_map_list_model_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkMapListModel, gtk_map_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_map_list_model_model_init))
|
||||
|
||||
static void
|
||||
gtk_map_list_model_items_changed_cb (GListModel *model,
|
||||
@@ -291,7 +291,7 @@ gtk_map_list_model_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_map_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
@@ -527,7 +527,7 @@ gtk_map_list_model_set_map_func (GtkMapListModel *self,
|
||||
self->map_func = map_func;
|
||||
self->user_data = user_data;
|
||||
self->user_destroy = user_destroy;
|
||||
|
||||
|
||||
gtk_map_list_model_init_items (self);
|
||||
|
||||
if (self->model)
|
||||
@@ -579,7 +579,7 @@ gtk_map_list_model_set_model (GtkMapListModel *self,
|
||||
}
|
||||
|
||||
gtk_map_list_model_init_items (self);
|
||||
|
||||
|
||||
if (removed > 0 || added > 0)
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ enum
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkMediaControls, gtk_media_controls, GTK_TYPE_WIDGET)
|
||||
G_DEFINE_FINAL_TYPE (GtkMediaControls, gtk_media_controls, GTK_TYPE_WIDGET)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
@@ -138,7 +138,7 @@ time_adjustment_changed (GtkAdjustment *adjustment,
|
||||
if (gtk_adjustment_get_value (adjustment) == (double) gtk_media_stream_get_timestamp (controls->stream) / G_USEC_PER_SEC)
|
||||
return;
|
||||
|
||||
gtk_media_stream_seek (controls->stream,
|
||||
gtk_media_stream_seek (controls->stream,
|
||||
gtk_adjustment_get_value (adjustment) * G_USEC_PER_SEC + 0.5);
|
||||
}
|
||||
|
||||
|
||||
@@ -201,11 +201,11 @@ gtk_multi_selection_selection_model_init (GtkSelectionModelInterface *iface)
|
||||
iface->set_selection = gtk_multi_selection_set_selection;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GtkMultiSelection, gtk_multi_selection, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_multi_selection_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL,
|
||||
gtk_multi_selection_selection_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkMultiSelection, gtk_multi_selection, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_multi_selection_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL,
|
||||
gtk_multi_selection_selection_model_init))
|
||||
|
||||
static void
|
||||
gtk_multi_selection_items_changed_cb (GListModel *model,
|
||||
|
||||
@@ -240,9 +240,9 @@ gtk_multi_sorter_buildable_init (GtkBuildableIface *iface)
|
||||
iface->add_child = gtk_multi_sorter_buildable_add_child;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkMultiSorter, gtk_multi_sorter, GTK_TYPE_SORTER,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_multi_sorter_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_multi_sorter_buildable_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkMultiSorter, gtk_multi_sorter, GTK_TYPE_SORTER,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_multi_sorter_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE, gtk_multi_sorter_buildable_init))
|
||||
|
||||
static GtkOrdering
|
||||
gtk_multi_sorter_compare (GtkSorter *sorter,
|
||||
|
||||
@@ -113,11 +113,11 @@ gtk_no_selection_selection_model_init (GtkSelectionModelInterface *iface)
|
||||
iface->get_selection_in_range = gtk_no_selection_get_selection_in_range;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GtkNoSelection, gtk_no_selection, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_no_selection_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL,
|
||||
gtk_no_selection_selection_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkNoSelection, gtk_no_selection, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_no_selection_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL,
|
||||
gtk_no_selection_selection_model_init))
|
||||
|
||||
static void
|
||||
gtk_no_selection_clear_model (GtkNoSelection *self)
|
||||
@@ -125,7 +125,7 @@ gtk_no_selection_clear_model (GtkNoSelection *self)
|
||||
if (self->model == NULL)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
g_list_model_items_changed,
|
||||
self);
|
||||
g_clear_object (&self->model);
|
||||
|
||||
@@ -52,7 +52,7 @@ enum {
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkNumericSorter, gtk_numeric_sorter, GTK_TYPE_SORTER)
|
||||
G_DEFINE_FINAL_TYPE (GtkNumericSorter, gtk_numeric_sorter, GTK_TYPE_SORTER)
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
@@ -491,7 +491,7 @@ gtk_numeric_sorter_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_numeric_sorter_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
|
||||
@@ -72,7 +72,7 @@ enum
|
||||
|
||||
static GParamSpec *child_props[N_CHILD_PROPERTIES];
|
||||
|
||||
G_DEFINE_TYPE (GtkOverlayLayoutChild, gtk_overlay_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
G_DEFINE_FINAL_TYPE (GtkOverlayLayoutChild, gtk_overlay_layout_child, GTK_TYPE_LAYOUT_CHILD)
|
||||
|
||||
static void
|
||||
gtk_overlay_layout_child_set_property (GObject *gobject,
|
||||
@@ -247,7 +247,7 @@ gtk_overlay_layout_child_get_clip_overlay (GtkOverlayLayoutChild *child)
|
||||
return child->clip_overlay;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GtkOverlayLayout, gtk_overlay_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
G_DEFINE_FINAL_TYPE (GtkOverlayLayout, gtk_overlay_layout, GTK_TYPE_LAYOUT_MANAGER)
|
||||
|
||||
static void
|
||||
gtk_overlay_layout_measure (GtkLayoutManager *layout_manager,
|
||||
|
||||
@@ -104,7 +104,7 @@ enum {
|
||||
PROP_ACTIVATES_DEFAULT,
|
||||
PROP_SHOW_PEEK_ICON,
|
||||
PROP_EXTRA_MENU,
|
||||
NUM_PROPERTIES
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
|
||||
@@ -112,9 +112,9 @@ static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
|
||||
static void gtk_password_entry_editable_init (GtkEditableInterface *iface);
|
||||
static void gtk_password_entry_accessible_init (GtkAccessibleInterface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPasswordEntry, gtk_password_entry, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE, gtk_password_entry_accessible_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, gtk_password_entry_editable_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkPasswordEntry, gtk_password_entry, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE, gtk_password_entry_accessible_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, gtk_password_entry_editable_init))
|
||||
|
||||
static void
|
||||
caps_lock_state_changed (GdkDevice *device,
|
||||
|
||||
@@ -29,15 +29,10 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_PASSWORD_ENTRY (gtk_password_entry_get_type ())
|
||||
#define GTK_PASSWORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PASSWORD_ENTRY, GtkPasswordEntry))
|
||||
#define GTK_IS_PASSWORD_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PASSWORD_ENTRY))
|
||||
|
||||
typedef struct _GtkPasswordEntry GtkPasswordEntry;
|
||||
typedef struct _GtkPasswordEntryClass GtkPasswordEntryClass;
|
||||
#define GTK_TYPE_PASSWORD_ENTRY (gtk_password_entry_get_type ())
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_password_entry_get_type (void) G_GNUC_CONST;
|
||||
G_DECLARE_FINAL_TYPE (GtkPasswordEntry, gtk_password_entry, GTK, PASSWORD_ENTRY, GtkWidget)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget * gtk_password_entry_new (void);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* gtkpasswordentrybuffer.c: Entry buffer with secure allocation
|
||||
/* gtkpasswordentrybuffer.c: Entry buffer with secure allocation
|
||||
*
|
||||
Copyright 2009 Stefan Walter
|
||||
* Copyright 2020 GNOME Foundation
|
||||
@@ -50,7 +50,7 @@ struct _GtkPasswordEntryBuffer
|
||||
guint text_chars;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkPasswordEntryBuffer, gtk_password_entry_buffer, GTK_TYPE_ENTRY_BUFFER)
|
||||
G_DEFINE_FINAL_TYPE (GtkPasswordEntryBuffer, gtk_password_entry_buffer, GTK_TYPE_ENTRY_BUFFER)
|
||||
|
||||
static const char *
|
||||
gtk_password_entry_buffer_real_get_text (GtkEntryBuffer *buffer,
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ struct _GtkPictureClass
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE (GtkPicture, gtk_picture, GTK_TYPE_WIDGET)
|
||||
G_DEFINE_FINAL_TYPE (GtkPicture, gtk_picture, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
gtk_picture_snapshot (GtkWidget *widget,
|
||||
|
||||
@@ -921,7 +921,8 @@ create_cloud_provider_account_row (GtkPlacesSidebar *sidebar,
|
||||
|
||||
g_free (tooltip);
|
||||
g_free (mount_uri);
|
||||
g_object_unref (end_icon);
|
||||
g_clear_object (&end_icon);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
||||
+20
-12
@@ -1052,7 +1052,8 @@ gtk_scrolled_window_decelerate (GtkScrolledWindow *scrolled_window,
|
||||
|
||||
if (priv->x_velocity != 0 || priv->y_velocity != 0 || overshoot)
|
||||
{
|
||||
gtk_scrolled_window_start_deceleration (scrolled_window);
|
||||
if (priv->deceleration_id == 0)
|
||||
gtk_scrolled_window_start_deceleration (scrolled_window);
|
||||
priv->x_velocity = priv->y_velocity = 0;
|
||||
}
|
||||
}
|
||||
@@ -1225,16 +1226,15 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
|
||||
}
|
||||
|
||||
static double
|
||||
get_scroll_unit (GtkScrolledWindow *sw,
|
||||
GtkOrientation orientation)
|
||||
get_scroll_unit (GtkScrolledWindow *sw,
|
||||
GtkOrientation orientation,
|
||||
GtkEventControllerScroll *scroll)
|
||||
{
|
||||
double scroll_unit;
|
||||
|
||||
#ifndef GDK_WINDOWING_MACOS
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (sw);
|
||||
GtkScrollbar *scrollbar;
|
||||
GtkAdjustment *adj;
|
||||
double page_size;
|
||||
double scroll_unit;
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
scrollbar = GTK_SCROLLBAR (priv->hscrollbar);
|
||||
@@ -1247,8 +1247,16 @@ get_scroll_unit (GtkScrolledWindow *sw,
|
||||
adj = gtk_scrollbar_get_adjustment (scrollbar);
|
||||
page_size = gtk_adjustment_get_page_size (adj);
|
||||
scroll_unit = pow (page_size, 2.0 / 3.0);
|
||||
#else
|
||||
scroll_unit = 1;
|
||||
|
||||
#ifdef GDK_WINDOWING_MACOS
|
||||
{
|
||||
GdkEvent *event = gtk_event_controller_get_current_event (GTK_EVENT_CONTROLLER (scroll));
|
||||
|
||||
if (event != NULL &&
|
||||
gdk_event_get_event_type (event) == GDK_SCROLL &&
|
||||
gdk_scroll_event_get_direction (event) == GDK_SCROLL_SMOOTH)
|
||||
scroll_unit = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return scroll_unit;
|
||||
@@ -1396,7 +1404,7 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
double scroll_unit;
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
|
||||
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL);
|
||||
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL, scroll);
|
||||
|
||||
new_value = priv->unclamped_hadj_value + delta_x * scroll_unit;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
|
||||
@@ -1411,7 +1419,7 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
double scroll_unit;
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
|
||||
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL);
|
||||
scroll_unit = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL, scroll);
|
||||
|
||||
new_value = priv->unclamped_vadj_value + delta_y * scroll_unit;
|
||||
_gtk_scrolled_window_set_adjustment_value (scrolled_window, adj,
|
||||
@@ -1469,8 +1477,8 @@ scroll_controller_decelerate (GtkEventControllerScroll *scroll,
|
||||
|
||||
shifted = (state & GDK_SHIFT_MASK) != 0;
|
||||
|
||||
unit_x = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL);
|
||||
unit_y = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL);
|
||||
unit_x = get_scroll_unit (scrolled_window, GTK_ORIENTATION_HORIZONTAL, scroll);
|
||||
unit_y = get_scroll_unit (scrolled_window, GTK_ORIENTATION_VERTICAL, scroll);
|
||||
|
||||
if (shifted)
|
||||
{
|
||||
|
||||
+76
-6
@@ -106,6 +106,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_PLACEHOLDER_TEXT,
|
||||
PROP_ACTIVATES_DEFAULT,
|
||||
PROP_SEARCH_DELAY,
|
||||
NUM_PROPERTIES,
|
||||
};
|
||||
|
||||
@@ -122,6 +123,8 @@ struct _GtkSearchEntry
|
||||
GtkWidget *capture_widget;
|
||||
GtkEventController *capture_widget_controller;
|
||||
|
||||
guint search_delay;
|
||||
|
||||
GtkWidget *entry;
|
||||
GtkWidget *icon;
|
||||
|
||||
@@ -150,9 +153,6 @@ G_DEFINE_TYPE_WITH_CODE (GtkSearchEntry, gtk_search_entry, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE,
|
||||
gtk_search_entry_editable_init))
|
||||
|
||||
/* 150 mseconds of delay */
|
||||
#define DELAYED_TIMEOUT_ID 150
|
||||
|
||||
static void
|
||||
text_changed (GtkSearchEntry *entry)
|
||||
{
|
||||
@@ -224,6 +224,10 @@ gtk_search_entry_set_property (GObject *object,
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SEARCH_DELAY:
|
||||
gtk_search_entry_set_search_delay (entry, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -250,6 +254,10 @@ gtk_search_entry_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_text_get_activates_default (GTK_TEXT (entry->entry)));
|
||||
break;
|
||||
|
||||
case PROP_SEARCH_DELAY:
|
||||
g_value_set_uint (value, entry->search_delay);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
@@ -315,6 +323,19 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkSearchEntry:search-delay:
|
||||
*
|
||||
* The delay in milliseconds from last keypress to the search
|
||||
* changed signal.
|
||||
*/
|
||||
props[PROP_SEARCH_DELAY] =
|
||||
g_param_spec_uint ("search-delay",
|
||||
P_("Search delay"),
|
||||
P_("The delay from last keypress to the search-changed signal. If this is not set, it defaults to 150ms"),
|
||||
0, G_MAXUINT, 150,
|
||||
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
|
||||
gtk_editable_install_properties (object_class, NUM_PROPERTIES);
|
||||
|
||||
@@ -339,8 +360,9 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
|
||||
* GtkSearchEntry::search-changed:
|
||||
* @entry: the entry on which the signal was emitted
|
||||
*
|
||||
* Emitted with a short delay of 150 milliseconds after the
|
||||
* last change to the entry text.
|
||||
* Emitted with a delay. The length of the delay can be
|
||||
* changed with the [property@Gtk.SearchEntry:search-delay]
|
||||
* property.
|
||||
*/
|
||||
signals[SEARCH_CHANGED] =
|
||||
g_signal_new (I_("search-changed"),
|
||||
@@ -526,7 +548,7 @@ reset_timeout (GtkSearchEntry *entry)
|
||||
{
|
||||
if (entry->delayed_changed_id > 0)
|
||||
g_source_remove (entry->delayed_changed_id);
|
||||
entry->delayed_changed_id = g_timeout_add (DELAYED_TIMEOUT_ID,
|
||||
entry->delayed_changed_id = g_timeout_add (entry->search_delay,
|
||||
gtk_search_entry_changed_timeout_cb,
|
||||
entry);
|
||||
gdk_source_set_static_name_by_id (entry->delayed_changed_id, "[gtk] gtk_search_entry_changed_timeout_cb");
|
||||
@@ -595,6 +617,8 @@ gtk_search_entry_init (GtkSearchEntry *entry)
|
||||
GtkWidget *icon;
|
||||
GtkGesture *press, *catchall;
|
||||
|
||||
entry->search_delay = 150;
|
||||
|
||||
/* The search icon is purely presentational */
|
||||
icon = g_object_new (GTK_TYPE_IMAGE,
|
||||
"accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
|
||||
@@ -773,6 +797,52 @@ gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry)
|
||||
return entry->capture_widget;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_search_entry_set_searcH-delay:
|
||||
* @entry: a `GtkSearchEntry`
|
||||
* @delay: a delay in milliseconds
|
||||
*
|
||||
* Set the delay to be used between the last keypress and the
|
||||
* [signal@Gtk.SearchEntry::search-changed] signal being emitted.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
void
|
||||
gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
|
||||
guint delay)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_SEARCH_ENTRY (entry));
|
||||
|
||||
if (entry->search_delay == delay)
|
||||
return;
|
||||
|
||||
entry->search_delay = delay;
|
||||
|
||||
/* Apply the updated timeout */
|
||||
reset_timeout (entry);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SEARCH_DELAY]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_search_entry_get_search_delay
|
||||
* @entry: a `GtkSearchEntry`
|
||||
*
|
||||
* Get the delay to be used between the last keypress and the
|
||||
* [signal@Gtk.SearchEntry::search-changed] signal being emitted.
|
||||
*
|
||||
* Returns: a delay in milliseconds.
|
||||
*
|
||||
* Since: 4.8
|
||||
*/
|
||||
guint
|
||||
gtk_search_entry_get_search_delay (GtkSearchEntry *entry)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_SEARCH_ENTRY (entry), 0);
|
||||
|
||||
return entry->search_delay;
|
||||
}
|
||||
|
||||
GtkEventController *
|
||||
gtk_search_entry_get_key_controller (GtkSearchEntry *entry)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,11 @@ void gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkWidget* gtk_search_entry_get_key_capture_widget (GtkSearchEntry *entry);
|
||||
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
void gtk_search_entry_set_search_delay (GtkSearchEntry *entry,
|
||||
guint delay);
|
||||
GDK_AVAILABLE_IN_4_8
|
||||
guint gtk_search_entry_get_search_delay (GtkSearchEntry *entry);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -95,8 +95,8 @@ gtk_selection_filter_model_list_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_selection_filter_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkSelectionFilterModel, gtk_selection_filter_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_selection_filter_model_list_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkSelectionFilterModel, gtk_selection_filter_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_selection_filter_model_list_model_init))
|
||||
|
||||
static void
|
||||
selection_filter_model_items_changed (GtkSelectionFilterModel *self,
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ enum
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkShortcut, gtk_shortcut, G_TYPE_OBJECT)
|
||||
G_DEFINE_FINAL_TYPE (GtkShortcut, gtk_shortcut, G_TYPE_OBJECT)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
@@ -387,7 +387,7 @@ gtk_shortcut_set_arguments (GtkShortcut *self,
|
||||
|
||||
if (self->args == args)
|
||||
return;
|
||||
|
||||
|
||||
g_clear_pointer (&self->args, g_variant_unref);
|
||||
if (args)
|
||||
self->args = g_variant_ref_sink (args);
|
||||
|
||||
+12
-12
@@ -157,17 +157,17 @@ gtk_single_selection_unselect_item (GtkSelectionModel *model,
|
||||
static void
|
||||
gtk_single_selection_selection_model_init (GtkSelectionModelInterface *iface)
|
||||
{
|
||||
iface->is_selected = gtk_single_selection_is_selected;
|
||||
iface->get_selection_in_range = gtk_single_selection_get_selection_in_range;
|
||||
iface->select_item = gtk_single_selection_select_item;
|
||||
iface->unselect_item = gtk_single_selection_unselect_item;
|
||||
iface->is_selected = gtk_single_selection_is_selected;
|
||||
iface->get_selection_in_range = gtk_single_selection_get_selection_in_range;
|
||||
iface->select_item = gtk_single_selection_select_item;
|
||||
iface->unselect_item = gtk_single_selection_unselect_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GtkSingleSelection, gtk_single_selection, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_single_selection_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL,
|
||||
gtk_single_selection_selection_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkSingleSelection, gtk_single_selection, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_single_selection_list_model_init)
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SELECTION_MODEL,
|
||||
gtk_single_selection_selection_model_init))
|
||||
|
||||
static void
|
||||
gtk_single_selection_items_changed_cb (GListModel *model,
|
||||
@@ -281,7 +281,7 @@ gtk_single_selection_clear_model (GtkSingleSelection *self)
|
||||
if (self->model == NULL)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
g_signal_handlers_disconnect_by_func (self->model,
|
||||
gtk_single_selection_items_changed_cb,
|
||||
self);
|
||||
g_clear_object (&self->model);
|
||||
@@ -510,7 +510,7 @@ gtk_single_selection_set_model (GtkSingleSelection *self,
|
||||
return;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
|
||||
n_items_before = self->model ? g_list_model_get_n_items (self->model) : 0;
|
||||
gtk_single_selection_clear_model (self);
|
||||
|
||||
@@ -674,7 +674,7 @@ gtk_single_selection_set_autoselect (GtkSingleSelection *self,
|
||||
self->autoselect = autoselect;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (self));
|
||||
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_AUTOSELECT]);
|
||||
|
||||
if (self->autoselect && !self->selected_item)
|
||||
|
||||
@@ -73,7 +73,7 @@ gtk_slice_list_model_get_n_items (GListModel *list)
|
||||
{
|
||||
GtkSliceListModel *self = GTK_SLICE_LIST_MODEL (list);
|
||||
guint n_items;
|
||||
|
||||
|
||||
if (self->model == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -110,8 +110,8 @@ gtk_slice_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_slice_list_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkSliceListModel, gtk_slice_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_slice_list_model_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkSliceListModel, gtk_slice_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_slice_list_model_model_init))
|
||||
|
||||
static void
|
||||
gtk_slice_list_model_items_changed_cb (GListModel *model,
|
||||
@@ -193,7 +193,7 @@ gtk_slice_list_model_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_slice_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
|
||||
@@ -173,8 +173,8 @@ gtk_sort_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_sort_list_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkSortListModel, gtk_sort_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_sort_list_model_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkSortListModel, gtk_sort_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_sort_list_model_model_init))
|
||||
|
||||
static gboolean
|
||||
gtk_sort_list_model_is_sorting (GtkSortListModel *self)
|
||||
@@ -253,7 +253,7 @@ gtk_sort_list_model_sort_step (GtkSortListModel *self,
|
||||
start_change = MIN (start_change, (gpointer *) change.base);
|
||||
end_change = MAX (end_change, ((gpointer *) change.base) + change.len);
|
||||
}
|
||||
|
||||
|
||||
if (g_get_monotonic_time () >= end_time && !finish)
|
||||
break;
|
||||
}
|
||||
@@ -419,7 +419,7 @@ gtk_sort_list_model_clear_items (GtkSortListModel *self,
|
||||
g_clear_pointer (&self->positions, g_free);
|
||||
|
||||
gtk_sort_list_model_clear_keys (self);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_sort_list_model_should_sort (GtkSortListModel *self)
|
||||
@@ -478,7 +478,7 @@ gtk_sort_list_model_update_items (GtkSortListModel *self,
|
||||
n_items = self->n_items;
|
||||
start = n_items;
|
||||
end = n_items;
|
||||
|
||||
|
||||
/* first, move the keys over */
|
||||
old_keys = self->keys;
|
||||
gtk_sort_list_model_clear_sort_keys (self, position, removed);
|
||||
@@ -523,7 +523,7 @@ gtk_sort_list_model_update_items (GtkSortListModel *self,
|
||||
if (pos >= position + removed)
|
||||
pos = pos - removed + added;
|
||||
else if (pos >= position)
|
||||
{
|
||||
{
|
||||
start = MIN (start, valid);
|
||||
end = n_items - i - 1;
|
||||
continue;
|
||||
@@ -650,7 +650,7 @@ gtk_sort_list_model_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_sort_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
@@ -903,7 +903,7 @@ gtk_sort_list_model_set_model (GtkSortListModel *self,
|
||||
gtk_sort_list_model_finish_sorting (self, &ignore1, &ignore2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (removed > 0 || self->n_items > 0)
|
||||
g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, self->n_items);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ enum {
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkStringFilter, gtk_string_filter, GTK_TYPE_FILTER)
|
||||
G_DEFINE_FINAL_TYPE (GtkStringFilter, gtk_string_filter, GTK_TYPE_FILTER)
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
@@ -190,7 +190,7 @@ gtk_string_filter_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_string_filter_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
|
||||
+6
-6
@@ -83,7 +83,7 @@ enum {
|
||||
PROP_NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkStringObject, gtk_string_object, G_TYPE_OBJECT);
|
||||
G_DEFINE_FINAL_TYPE (GtkStringObject, gtk_string_object, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_string_object_init (GtkStringObject *object)
|
||||
@@ -395,11 +395,11 @@ gtk_string_list_buildable_init (GtkBuildableIface *iface)
|
||||
iface->custom_finished = gtk_string_list_buildable_custom_finished;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkStringList, gtk_string_list, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_string_list_buildable_init)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_string_list_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkStringList, gtk_string_list, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
||||
gtk_string_list_buildable_init)
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL,
|
||||
gtk_string_list_model_init))
|
||||
|
||||
static void
|
||||
gtk_string_list_dispose (GObject *object)
|
||||
|
||||
@@ -54,7 +54,7 @@ enum {
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkStringSorter, gtk_string_sorter, GTK_TYPE_SORTER)
|
||||
G_DEFINE_FINAL_TYPE (GtkStringSorter, gtk_string_sorter, GTK_TYPE_SORTER)
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
@@ -238,7 +238,7 @@ gtk_string_sorter_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_string_sorter_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
|
||||
+11
-7
@@ -181,6 +181,7 @@ struct _GtkTextPrivate
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *key_controller;
|
||||
GtkEventController *focus_controller;
|
||||
|
||||
GtkCssNode *selection_node;
|
||||
GtkCssNode *block_cursor_node;
|
||||
@@ -529,6 +530,7 @@ static void gtk_text_schedule_im_reset (GtkText *self);
|
||||
static gboolean gtk_text_mnemonic_activate (GtkWidget *widget,
|
||||
gboolean group_cycling);
|
||||
static void gtk_text_check_cursor_blink (GtkText *self);
|
||||
static void remove_blink_timeout (GtkText *self);
|
||||
static void gtk_text_pend_cursor_blink (GtkText *self);
|
||||
static void gtk_text_reset_blink_time (GtkText *self);
|
||||
static void gtk_text_update_cached_style_values(GtkText *self);
|
||||
@@ -1949,11 +1951,11 @@ gtk_text_init (GtkText *self)
|
||||
priv->im_context);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), priv->key_controller);
|
||||
|
||||
controller = gtk_event_controller_focus_new ();
|
||||
gtk_event_controller_set_name (controller, "gtk-text-focus-controller");
|
||||
g_signal_connect (controller, "notify::is-focus",
|
||||
priv->focus_controller = gtk_event_controller_focus_new ();
|
||||
gtk_event_controller_set_name (priv->focus_controller, "gtk-text-focus-controller");
|
||||
g_signal_connect (priv->focus_controller, "notify::is-focus",
|
||||
G_CALLBACK (gtk_text_focus_changed), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), priv->focus_controller);
|
||||
|
||||
widget_node = gtk_widget_get_css_node (GTK_WIDGET (self));
|
||||
for (i = 0; i < 2; i++)
|
||||
@@ -3261,6 +3263,7 @@ gtk_text_focus_changed (GtkEventControllerFocus *controller,
|
||||
|
||||
gtk_text_im_set_focus_in (self);
|
||||
gtk_text_reset_blink_time (self);
|
||||
gtk_text_check_cursor_blink (self);
|
||||
}
|
||||
else /* Focus out */
|
||||
{
|
||||
@@ -3277,9 +3280,10 @@ gtk_text_focus_changed (GtkEventControllerFocus *controller,
|
||||
gtk_text_schedule_im_reset (self);
|
||||
gtk_im_context_focus_out (priv->im_context);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_check_cursor_blink (self);
|
||||
if (priv->blink_tick)
|
||||
remove_blink_timeout (self);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -6426,7 +6430,7 @@ cursor_blinks (GtkText *self)
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
|
||||
if (gtk_widget_has_focus (GTK_WIDGET (self)) &&
|
||||
if (gtk_event_controller_focus_is_focus (GTK_EVENT_CONTROLLER_FOCUS (priv->focus_controller)) &&
|
||||
priv->editable &&
|
||||
priv->selection_bound == priv->current_pos)
|
||||
{
|
||||
|
||||
@@ -101,7 +101,7 @@ enum
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkTreeExpander, gtk_tree_expander, GTK_TYPE_WIDGET)
|
||||
G_DEFINE_FINAL_TYPE (GtkTreeExpander, gtk_tree_expander, GTK_TYPE_WIDGET)
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
|
||||
+11
-11
@@ -165,7 +165,7 @@ tree_node_get_local_position (GtkRbTree *tree,
|
||||
TreeNode *left, *parent;
|
||||
TreeAugment *left_aug;
|
||||
guint n;
|
||||
|
||||
|
||||
left = gtk_rb_tree_node_get_left (node);
|
||||
if (left)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ tree_node_get_position (TreeNode *node)
|
||||
TreeNode *left, *parent;
|
||||
TreeAugment *left_aug;
|
||||
guint n;
|
||||
|
||||
|
||||
for (n = 0;
|
||||
!node->is_root;
|
||||
node = node->parent, n++)
|
||||
@@ -520,7 +520,7 @@ gtk_tree_list_model_expand_node (GtkTreeListModel *self,
|
||||
|
||||
if (node->empty)
|
||||
return 0;
|
||||
|
||||
|
||||
if (node->model != NULL)
|
||||
return 0;
|
||||
|
||||
@@ -528,18 +528,18 @@ gtk_tree_list_model_expand_node (GtkTreeListModel *self,
|
||||
|
||||
if (model == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
gtk_tree_list_model_init_node (self, node, model);
|
||||
|
||||
tree_node_mark_dirty (node);
|
||||
|
||||
|
||||
return tree_node_get_n_children (node);
|
||||
}
|
||||
|
||||
static guint
|
||||
gtk_tree_list_model_collapse_node (GtkTreeListModel *self,
|
||||
TreeNode *node)
|
||||
{
|
||||
{
|
||||
guint n_items;
|
||||
|
||||
if (node->model == NULL)
|
||||
@@ -604,8 +604,8 @@ gtk_tree_list_model_model_init (GListModelInterface *iface)
|
||||
iface->get_item = gtk_tree_list_model_get_item;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkTreeListModel, gtk_tree_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_tree_list_model_model_init))
|
||||
G_DEFINE_FINAL_TYPE_WITH_CODE (GtkTreeListModel, gtk_tree_list_model, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, gtk_tree_list_model_model_init))
|
||||
|
||||
static void
|
||||
gtk_tree_list_model_set_property (GObject *object,
|
||||
@@ -631,7 +631,7 @@ gtk_tree_list_model_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_tree_list_model_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
@@ -956,7 +956,7 @@ enum {
|
||||
|
||||
static GParamSpec *row_properties[NUM_ROW_PROPERTIES] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE (GtkTreeListRow, gtk_tree_list_row, G_TYPE_OBJECT)
|
||||
G_DEFINE_FINAL_TYPE (GtkTreeListRow, gtk_tree_list_row, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gtk_tree_list_row_destroy (GtkTreeListRow *self)
|
||||
@@ -993,7 +993,7 @@ gtk_tree_list_row_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
gtk_tree_list_row_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user