Compare commits
45 Commits
xpresent
...
search-ent
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46fd9fa4ef | ||
|
|
38cda97e04 | ||
|
|
bef9d05812 | ||
|
|
3a5d15358e | ||
|
|
c1ca7986ee | ||
|
|
16e863ce65 | ||
|
|
c7f3b93d99 | ||
|
|
8d6d73e8d9 | ||
|
|
c64bfa5751 | ||
|
|
464536b460 | ||
|
|
d0d41dfeba | ||
|
|
7d35351c7a | ||
|
|
a09ff50a1d | ||
|
|
f95fb6f893 | ||
|
|
ff4f918a69 | ||
|
|
44c412ecc7 | ||
|
|
6b95810aae | ||
|
|
a7ba57f751 | ||
|
|
0a37493384 | ||
|
|
d09f66579b | ||
|
|
af12993c4b | ||
|
|
f38081a4a5 | ||
|
|
38c3600d8b | ||
|
|
d2aad06513 | ||
|
|
85380f22f3 | ||
|
|
fe5f9c560b | ||
|
|
c2326aa5cf | ||
|
|
9e3d0651e1 | ||
|
|
7a1c5845ef | ||
|
|
2ea3171ff9 | ||
|
|
5b7233f136 | ||
|
|
84463b78e5 | ||
|
|
9fb2d6a6b9 | ||
|
|
72a501fe15 | ||
|
|
10a7a89311 | ||
|
|
c01e37a9a5 | ||
|
|
6ffba866a6 | ||
|
|
37ad6e1147 | ||
|
|
7312c01f62 | ||
|
|
37697f1817 | ||
|
|
28846536cb | ||
|
|
3f0c84f7ad | ||
|
|
8976e84ded | ||
|
|
ec2925a5bf | ||
|
|
1730bb0e81 |
75
NEWS
75
NEWS
@@ -1,3 +1,78 @@
|
||||
Overview of Changes in GTK+ 3.15.2
|
||||
==================================
|
||||
|
||||
* GtkPopoverMenu: A GtkPopover subclass that makes it easy
|
||||
to manually build menu-like popovers which can include
|
||||
arbitrary controls.
|
||||
|
||||
* GtkModelButton: A button widget that is optimized for
|
||||
use inside popovers with a GAction as 'model'.
|
||||
|
||||
* GL support:
|
||||
- Try harder to pick good visuals
|
||||
- Rework the way GL rendering is done in GtkGLArea
|
||||
- Support input events in GtkGLArea
|
||||
- Use shaders
|
||||
- The GDK_GL environment variable can be used for debugging
|
||||
|
||||
* Inspector:
|
||||
- Make picking widgets work in Wayland
|
||||
- Rework search in all pages
|
||||
- Improve space use
|
||||
- Support GL information and debug flags
|
||||
- Shield the inspector window from more debug settings
|
||||
- Hide empty tabs
|
||||
|
||||
* Theming:
|
||||
- Include the HighContrast theme
|
||||
- Add borders to menus in non-composited environments
|
||||
- Load themes from versioned directories like
|
||||
.../themes/Emerald/gtk-3-14/.
|
||||
|
||||
* Wayland:
|
||||
- Make window opacity work
|
||||
- Propagate clipboard owner changes
|
||||
|
||||
* Mir:
|
||||
- Improved event handling
|
||||
- Support cursors
|
||||
- Enable CSD
|
||||
- Better monitor support
|
||||
- Add OpenGL support
|
||||
|
||||
* Deprecations:
|
||||
- gdk_cursor_new
|
||||
- gdk_device_grab_info_libgtk_only
|
||||
- gdk_display_open_default_libgtk_only
|
||||
- gdk_add_option_entries_libgtk_only
|
||||
- gdk_pre_parse_libgtk_only
|
||||
|
||||
* Bugs fixed:
|
||||
687963 Extend warning "Icon '%s' not present in theme" to mention...
|
||||
734140 Gnome apps spam stderr with warnings if Gnome Session Manager...
|
||||
737891 mounting LUKS partition from nautilus takes very long
|
||||
738321 GtkMenu has unnecessary scroll buttons
|
||||
738648 gdk_window_get_content() causes creation/destruction of back...
|
||||
738670 GL Context on NVIDIA
|
||||
738800 Menu border missing in Adwaita when no compositor is running
|
||||
738887 "Cannot commit NULL buffer to xdg_surface" error too pervasive
|
||||
739474 radiobutton: don't consider hidden buttons in the group for focus
|
||||
739750 Fix handling of windows with sizes that aren't a multiple of...
|
||||
739781 Make global GDK libgtk_only functions more private
|
||||
739885 gtk3-3.14.5 - fail to link - undefined reference to `GTK_IS_PLUG'
|
||||
739977 Don't wait for ENTER to initiate search
|
||||
740011 overscroll overlay is opaque in unfocused mode sidebars
|
||||
740346 Mir backend needs support for GdkGLContext
|
||||
|
||||
* Translation updates:
|
||||
Greek
|
||||
Hebrew
|
||||
Kazakh
|
||||
Norwegian bokmål
|
||||
Spanish
|
||||
Swedish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.15.1
|
||||
==================================
|
||||
|
||||
|
||||
18
configure.ac
18
configure.ac
@@ -10,7 +10,7 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [15])
|
||||
m4_define([gtk_micro_version], [1])
|
||||
m4_define([gtk_micro_version], [2])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -310,10 +310,6 @@ AC_ARG_ENABLE(xdamage,
|
||||
[AS_HELP_STRING([--enable-xdamage],
|
||||
[support X Damage extension [default=maybe]])],,
|
||||
[enable_xdamage="maybe"])
|
||||
AC_ARG_ENABLE(xpresent,
|
||||
[AS_HELP_STRING([--enable-xpresent],
|
||||
[support X Present extension [default=maybe]])],,
|
||||
[enable_xpresent="maybe"])
|
||||
|
||||
AC_ARG_ENABLE(x11-backend,
|
||||
[AS_HELP_STRING([--enable-x11-backend],
|
||||
@@ -1290,18 +1286,6 @@ if test "x$enable_x11_backend" = xyes; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$enable_xpresent" != xno; then
|
||||
if $PKG_CONFIG --exists xcb-present ; then
|
||||
AC_DEFINE(HAVE_PRESENT, 1, [Have the Present X extension])
|
||||
|
||||
X_PACKAGES="$X_PACKAGES xcb-present"
|
||||
X_EXTENSIONS="$X_EXTENSIONS Present"
|
||||
GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xcb-present"
|
||||
elif test x"$enable_xpresent" = xyes; then
|
||||
AC_MSG_ERROR([Present support requested but xcb-present not found])
|
||||
fi
|
||||
fi
|
||||
|
||||
if $have_base_x_pc ; then
|
||||
GDK_EXTRA_LIBS="$x_extra_libs"
|
||||
else
|
||||
|
||||
@@ -8224,12 +8224,21 @@ GtkGLArea
|
||||
GtkGLAreaClass
|
||||
gtk_gl_area_new
|
||||
gtk_gl_area_get_context
|
||||
gtk_gl_area_make_current
|
||||
gtk_gl_area_queue_render
|
||||
gtk_gl_area_set_error
|
||||
gtk_gl_area_get_error
|
||||
gtk_gl_area_set_profile
|
||||
gtk_gl_area_get_profile
|
||||
<SUBSECTION>
|
||||
gtk_gl_area_set_has_alpha
|
||||
gtk_gl_area_get_has_alpha
|
||||
gtk_gl_area_set_has_depth_buffer
|
||||
gtk_gl_area_get_has_depth_buffer
|
||||
gtk_gl_area_make_current
|
||||
gtk_gl_area_set_has_stencil_buffer
|
||||
gtk_gl_area_get_has_stencil_buffer
|
||||
gtk_gl_area_set_auto_render
|
||||
gtk_gl_area_get_auto_render
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GL_AREA
|
||||
GTK_GL_AREA
|
||||
|
||||
219
gdk/gdkgl.c
219
gdk/gdkgl.c
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
static cairo_user_data_key_t direct_key;
|
||||
|
||||
@@ -82,50 +83,53 @@ create_shader (int type, const char const *code)
|
||||
return shader;
|
||||
}
|
||||
|
||||
static guint
|
||||
make_program (const char const *vertex_shader_code, const char const *fragment_shader_code)
|
||||
static void
|
||||
make_program (GdkGLContextProgram *program,
|
||||
const char const *vertex_shader_code,
|
||||
const char const *fragment_shader_code)
|
||||
{
|
||||
guint program, vertex_shader, fragment_shader;
|
||||
guint vertex_shader, fragment_shader;
|
||||
int status;
|
||||
|
||||
vertex_shader = create_shader (GL_VERTEX_SHADER, vertex_shader_code);
|
||||
if (vertex_shader == 0)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
fragment_shader = create_shader (GL_FRAGMENT_SHADER, fragment_shader_code);
|
||||
if (fragment_shader == 0)
|
||||
{
|
||||
glDeleteShader (vertex_shader);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
program = glCreateProgram ();
|
||||
glAttachShader (program, vertex_shader);
|
||||
glAttachShader (program, fragment_shader);
|
||||
program->program = glCreateProgram ();
|
||||
glAttachShader (program->program, vertex_shader);
|
||||
glAttachShader (program->program, fragment_shader);
|
||||
|
||||
glLinkProgram (program);
|
||||
glLinkProgram (program->program);
|
||||
|
||||
glDeleteShader (vertex_shader);
|
||||
glDeleteShader (fragment_shader);
|
||||
|
||||
glGetProgramiv (program, GL_LINK_STATUS, &status);
|
||||
glGetProgramiv (program->program, GL_LINK_STATUS, &status);
|
||||
if (status == GL_FALSE)
|
||||
{
|
||||
int log_len;
|
||||
char *buffer;
|
||||
|
||||
glGetProgramiv (program, GL_INFO_LOG_LENGTH, &log_len);
|
||||
glGetProgramiv (program->program, GL_INFO_LOG_LENGTH, &log_len);
|
||||
|
||||
buffer = g_malloc (log_len + 1);
|
||||
glGetProgramInfoLog (program, log_len, NULL, buffer);
|
||||
glGetProgramInfoLog (program->program, log_len, NULL, buffer);
|
||||
g_warning ("Linker failure: %s\n", buffer);
|
||||
g_free (buffer);
|
||||
|
||||
glDeleteProgram (program);
|
||||
return 0;
|
||||
glDeleteProgram (program->program);
|
||||
}
|
||||
|
||||
return program;
|
||||
program->position_location = glGetAttribLocation (program->program, "position");
|
||||
program->uv_location = glGetAttribLocation (program->program, "uv");
|
||||
program->map_location = glGetUniformLocation (program->program, "map");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -140,10 +144,7 @@ bind_vao (GdkGLContextPaintData *paint_data)
|
||||
}
|
||||
|
||||
static void
|
||||
use_texture_2d_program (GdkGLContextPaintData *paint_data,
|
||||
guint *position_location,
|
||||
guint *uv_location,
|
||||
guint *map_location)
|
||||
use_texture_2d_program (GdkGLContextPaintData *paint_data)
|
||||
{
|
||||
const char *vertex_shader_code =
|
||||
"#version 120\n"
|
||||
@@ -163,30 +164,18 @@ use_texture_2d_program (GdkGLContextPaintData *paint_data,
|
||||
" gl_FragColor = texture2D (map, vUv);\n"
|
||||
"}\n";
|
||||
|
||||
if (paint_data->texture_quad_program == 0)
|
||||
{
|
||||
paint_data->texture_quad_program = make_program (vertex_shader_code, fragment_shader_code);
|
||||
paint_data->texture_quad_program_position_location = glGetAttribLocation (paint_data->texture_quad_program, "position");
|
||||
paint_data->texture_quad_program_uv_location = glGetAttribLocation (paint_data->texture_quad_program, "uv");
|
||||
paint_data->texture_quad_program_map_location = glGetUniformLocation (paint_data->texture_quad_program, "map");
|
||||
}
|
||||
if (paint_data->texture_2d_quad_program.program == 0)
|
||||
make_program (&paint_data->texture_2d_quad_program, vertex_shader_code, fragment_shader_code);
|
||||
|
||||
if (paint_data->current_program != paint_data->texture_quad_program)
|
||||
if (paint_data->current_program != &paint_data->texture_2d_quad_program)
|
||||
{
|
||||
glUseProgram (paint_data->texture_quad_program);
|
||||
paint_data->current_program = paint_data->texture_quad_program;
|
||||
paint_data->current_program = &paint_data->texture_2d_quad_program;
|
||||
glUseProgram (paint_data->current_program->program);
|
||||
}
|
||||
|
||||
*position_location = paint_data->texture_quad_program_position_location;
|
||||
*uv_location = paint_data->texture_quad_program_uv_location;
|
||||
*map_location = paint_data->texture_quad_program_map_location;
|
||||
}
|
||||
|
||||
static void
|
||||
use_texture_rect_program (GdkGLContextPaintData *paint_data,
|
||||
guint *position_location,
|
||||
guint *uv_location,
|
||||
guint *map_location)
|
||||
use_texture_rect_program (GdkGLContextPaintData *paint_data)
|
||||
{
|
||||
const char *vertex_shader_code =
|
||||
"#version 120\n"
|
||||
@@ -206,83 +195,87 @@ use_texture_rect_program (GdkGLContextPaintData *paint_data,
|
||||
" gl_FragColor = texture2DRect (map, vUv);\n"
|
||||
"}\n";
|
||||
|
||||
if (paint_data->texture_quad_rect_program == 0)
|
||||
{
|
||||
paint_data->texture_quad_rect_program = make_program (vertex_shader_code, fragment_shader_code);
|
||||
paint_data->texture_quad_rect_program_position_location = glGetAttribLocation (paint_data->texture_quad_rect_program, "position");
|
||||
paint_data->texture_quad_rect_program_uv_location = glGetAttribLocation (paint_data->texture_quad_rect_program, "uv");
|
||||
paint_data->texture_quad_rect_program_map_location = glGetUniformLocation (paint_data->texture_quad_rect_program, "map");
|
||||
}
|
||||
if (paint_data->texture_rect_quad_program.program == 0)
|
||||
make_program (&paint_data->texture_rect_quad_program, vertex_shader_code, fragment_shader_code);
|
||||
|
||||
if (paint_data->current_program != paint_data->texture_quad_rect_program)
|
||||
if (paint_data->current_program != &paint_data->texture_rect_quad_program)
|
||||
{
|
||||
glUseProgram (paint_data->texture_quad_rect_program);
|
||||
paint_data->current_program = paint_data->texture_quad_rect_program;
|
||||
paint_data->current_program = &paint_data->texture_rect_quad_program;
|
||||
glUseProgram (paint_data->current_program->program);
|
||||
}
|
||||
|
||||
*position_location = paint_data->texture_quad_rect_program_position_location;
|
||||
*uv_location = paint_data->texture_quad_rect_program_uv_location;
|
||||
*map_location = paint_data->texture_quad_rect_program_map_location;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gdk_gl_texture_quad (GdkGLContext *paint_context,
|
||||
guint texture_target,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
float u1, float v1,
|
||||
float u2, float v2)
|
||||
gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
guint texture_target,
|
||||
int n_quads,
|
||||
GdkTexturedQuad *quads)
|
||||
{
|
||||
GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context);
|
||||
GdkGLContextProgram *program;
|
||||
GdkWindow *window = gdk_gl_context_get_window (paint_context);
|
||||
int window_scale = gdk_window_get_scale_factor (window);
|
||||
float w = gdk_window_get_width (window) * window_scale;
|
||||
float h = gdk_window_get_height (window) * window_scale;
|
||||
float vertex_buffer_data[] = {
|
||||
(x2 * 2) / w - 1, (y1 * 2) / h - 1,
|
||||
(x2 * 2) / w - 1, (y2 * 2) / h - 1,
|
||||
(x1 * 2) / w - 1, (y2 * 2) / h - 1,
|
||||
(x1 * 2) / w - 1, (y1 * 2) / h - 1,
|
||||
};
|
||||
float uv_buffer_data[] = {
|
||||
u2, v1,
|
||||
u2, v2,
|
||||
u1, v2,
|
||||
u1, v1,
|
||||
};
|
||||
guint position_location, uv_location, map_location;
|
||||
int i;
|
||||
float *vertex_buffer_data;
|
||||
|
||||
bind_vao (paint_data);
|
||||
|
||||
if (paint_data->tmp_vertex_buffer == 0)
|
||||
glGenBuffers(1, &paint_data->tmp_vertex_buffer);
|
||||
|
||||
if (paint_data->tmp_uv_buffer == 0)
|
||||
glGenBuffers(1, &paint_data->tmp_uv_buffer);
|
||||
|
||||
if (texture_target == GL_TEXTURE_RECTANGLE_ARB)
|
||||
use_texture_rect_program (paint_data, &position_location, &uv_location, &map_location);
|
||||
use_texture_rect_program (paint_data);
|
||||
else
|
||||
use_texture_2d_program (paint_data, &position_location, &uv_location, &map_location);
|
||||
use_texture_2d_program (paint_data);
|
||||
|
||||
program = paint_data->current_program;
|
||||
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
glUniform1i(map_location, 0); /* Use texture unit 0 */
|
||||
glUniform1i(program->map_location, 0); /* Use texture unit 0 */
|
||||
|
||||
glEnableVertexAttribArray (0);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_vertex_buffer);
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof(vertex_buffer_data), vertex_buffer_data, GL_STREAM_DRAW);
|
||||
glVertexAttribPointer (position_location, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glEnableVertexAttribArray (1);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_uv_buffer);
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof(uv_buffer_data), uv_buffer_data, GL_STREAM_DRAW);
|
||||
glVertexAttribPointer (uv_location, 2, GL_FLOAT, GL_FALSE, 0, NULL);
|
||||
glDrawArrays (GL_TRIANGLE_FAN, 0, 4);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_vertex_buffer);
|
||||
|
||||
glVertexAttribPointer (program->position_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL);
|
||||
glVertexAttribPointer (program->uv_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void *) (sizeof(float) * 2));
|
||||
|
||||
#define VERTEX_SIZE 4
|
||||
|
||||
#define QUAD_N_VERTICES 6
|
||||
|
||||
#define QUAD_SIZE (VERTEX_SIZE * QUAD_N_VERTICES)
|
||||
|
||||
vertex_buffer_data = g_new (float, n_quads * QUAD_SIZE);
|
||||
|
||||
for (i = 0; i < n_quads; i++)
|
||||
{
|
||||
GdkTexturedQuad *quad = &quads[i];
|
||||
float vertex_data[] = {
|
||||
(quad->x1 * 2) / w - 1, (quad->y1 * 2) / h - 1, quad->u1, quad->v1,
|
||||
(quad->x1 * 2) / w - 1, (quad->y2 * 2) / h - 1, quad->u1, quad->v2,
|
||||
(quad->x2 * 2) / w - 1, (quad->y1 * 2) / h - 1, quad->u2, quad->v1,
|
||||
|
||||
(quad->x2 * 2) / w - 1, (quad->y2 * 2) / h - 1, quad->u2, quad->v2,
|
||||
(quad->x1 * 2) / w - 1, (quad->y2 * 2) / h - 1, quad->u1, quad->v2,
|
||||
(quad->x2 * 2) / w - 1, (quad->y1 * 2) / h - 1, quad->u2, quad->v1,
|
||||
};
|
||||
|
||||
float *vertex = &vertex_buffer_data[i * QUAD_SIZE];
|
||||
memcpy (vertex, vertex_data, sizeof(vertex_data));
|
||||
}
|
||||
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof(float) * n_quads * QUAD_SIZE, vertex_buffer_data, GL_STREAM_DRAW);
|
||||
glDrawArrays (GL_TRIANGLES, 0, n_quads * QUAD_N_VERTICES);
|
||||
|
||||
g_free (vertex_buffer_data);
|
||||
|
||||
glDisableVertexAttribArray (0);
|
||||
glDisableVertexAttribArray (1);
|
||||
}
|
||||
|
||||
|
||||
/* x,y,width,height describes a rectangle in the gl render buffer
|
||||
coordinate space, and its top left corner is drawn at the current
|
||||
position according to the cairo translation. */
|
||||
@@ -484,7 +477,9 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
int unscaled_window_height;
|
||||
GLint texture_width;
|
||||
GLint texture_height;
|
||||
int i;
|
||||
int i, n_rects;
|
||||
GdkTexturedQuad *quads;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
|
||||
/* Translate to impl coords */
|
||||
cairo_region_translate (clip_region, dx, dy);
|
||||
@@ -530,9 +525,16 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
|
||||
#define FLIP_Y(_y) (unscaled_window_height - (_y))
|
||||
|
||||
for (i = 0; i < cairo_region_num_rectangles (clip_region); i++)
|
||||
cairo_region_get_extents (clip_region, &clip_rect);
|
||||
|
||||
glScissor (clip_rect.x, FLIP_Y (clip_rect.y + clip_rect.height),
|
||||
clip_rect.width, clip_rect.height);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (clip_region);
|
||||
quads = g_new (GdkTexturedQuad, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect, dest;
|
||||
cairo_rectangle_int_t dest;
|
||||
|
||||
cairo_region_get_rectangle (clip_region, i, &clip_rect);
|
||||
|
||||
@@ -541,9 +543,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
clip_rect.width *= window_scale;
|
||||
clip_rect.height *= window_scale;
|
||||
|
||||
glScissor (clip_rect.x, FLIP_Y (clip_rect.y + clip_rect.height),
|
||||
clip_rect.width, clip_rect.height);
|
||||
|
||||
dest.x = dx * window_scale;
|
||||
dest.y = dy * window_scale;
|
||||
dest.width = width * window_scale / buffer_scale;
|
||||
@@ -553,13 +552,14 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
{
|
||||
int clipped_src_x = x + (dest.x - dx * window_scale);
|
||||
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
|
||||
GdkTexturedQuad quad = {
|
||||
dest.x, FLIP_Y(dest.y),
|
||||
dest.x + dest.width, FLIP_Y(dest.y + dest.height),
|
||||
clipped_src_x / (float)texture_width, (clipped_src_y + dest.height) / (float)texture_height,
|
||||
(clipped_src_x + dest.width) / (float)texture_width, clipped_src_y / (float)texture_height,
|
||||
};
|
||||
|
||||
gdk_gl_texture_quad (paint_context,
|
||||
GL_TEXTURE_2D,
|
||||
dest.x, FLIP_Y(dest.y),
|
||||
dest.x + dest.width, FLIP_Y(dest.y + dest.height),
|
||||
clipped_src_x / (float)texture_width, (clipped_src_y + dest.height) / (float)texture_height,
|
||||
(clipped_src_x + dest.width) / (float)texture_width, clipped_src_y / (float)texture_height);
|
||||
quads[i] = quad;
|
||||
|
||||
if (impl_window->current_paint.flushed_region)
|
||||
{
|
||||
@@ -578,11 +578,13 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
}
|
||||
}
|
||||
|
||||
gdk_gl_texture_quads (paint_context, GL_TEXTURE_2D, n_rects, quads);
|
||||
g_free (quads);
|
||||
|
||||
if (alpha_size != 0)
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
|
||||
#undef FLIP_Y
|
||||
|
||||
@@ -659,6 +661,7 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
float umax, vmax;
|
||||
gboolean use_texture_rectangle;
|
||||
guint target;
|
||||
GdkTexturedQuad *quads;
|
||||
|
||||
paint_context = gdk_gl_context_get_current ();
|
||||
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_SURFACE) == 0 &&
|
||||
@@ -696,6 +699,8 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
quads = g_new (GdkTexturedQuad, n_rects);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
@@ -733,13 +738,21 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
vmax = 1.0;
|
||||
}
|
||||
|
||||
gdk_gl_texture_quad (paint_context, target,
|
||||
rect.x * window_scale, FLIP_Y(rect.y),
|
||||
(rect.x + rect.width) * window_scale, FLIP_Y((rect.y + rect.height) * window_scale),
|
||||
0, 0,
|
||||
umax, vmax);
|
||||
{
|
||||
GdkTexturedQuad quad = {
|
||||
rect.x * window_scale, FLIP_Y(rect.y),
|
||||
(rect.x + rect.width) * window_scale, FLIP_Y((rect.y + rect.height) * window_scale),
|
||||
0, 0,
|
||||
umax, vmax,
|
||||
};
|
||||
|
||||
quads[i] = quad;
|
||||
}
|
||||
}
|
||||
|
||||
gdk_gl_texture_quads (paint_context, target, n_rects, quads);
|
||||
g_free (quads);
|
||||
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
glDisable (target);
|
||||
glDeleteTextures (1, &texture_id);
|
||||
|
||||
@@ -48,20 +48,22 @@ struct _GdkGLContextClass
|
||||
cairo_region_t *region);
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
guint program;
|
||||
guint position_location;
|
||||
guint uv_location;
|
||||
guint map_location;
|
||||
} GdkGLContextProgram;
|
||||
|
||||
typedef struct {
|
||||
guint vertex_array_object;
|
||||
guint tmp_framebuffer;
|
||||
guint tmp_vertex_buffer;
|
||||
guint tmp_uv_buffer;
|
||||
guint current_program;
|
||||
guint texture_quad_program;
|
||||
guint texture_quad_program_position_location;
|
||||
guint texture_quad_program_uv_location;
|
||||
guint texture_quad_program_map_location;
|
||||
guint texture_quad_rect_program;
|
||||
guint texture_quad_rect_program_position_location;
|
||||
guint texture_quad_rect_program_uv_location;
|
||||
guint texture_quad_rect_program_map_location;
|
||||
|
||||
GdkGLContextProgram texture_2d_quad_program;
|
||||
GdkGLContextProgram texture_rect_quad_program;
|
||||
|
||||
GdkGLContextProgram *current_program;
|
||||
} GdkGLContextPaintData;
|
||||
|
||||
GdkGLContextPaintData *gdk_gl_context_get_paint_data (GdkGLContext *context);
|
||||
|
||||
@@ -216,15 +216,82 @@ struct _GdkWindow
|
||||
|
||||
cairo_pattern_t *background;
|
||||
|
||||
/* The paint logic here is a bit complex because of our intermingling of
|
||||
* cairo and GL. Let's first go over the cairo-alone case:
|
||||
*
|
||||
* 1) gdk_window_begin_paint_region() is called with an update region. If
|
||||
* the backend wants it, we redirect drawing to a temporary surface
|
||||
* sized the same as the update region and set `surface_needs_composite`
|
||||
* to TRUE. Otherwise, we paint directly onto the real server-side window.
|
||||
*
|
||||
* 2) Things paint with cairo using gdk_cairo_create().
|
||||
*
|
||||
* 3) When everything is painted, the user calls gdk_window_end_paint().
|
||||
* If there was a temporary surface, this is composited back onto the
|
||||
* real backing surface in the appropriate places.
|
||||
*
|
||||
* This is similar to double buffering, except we only have partial surfaces
|
||||
* of undefined contents, and instead of swapping between two buffers, we
|
||||
* create a new temporary buffer every time.
|
||||
*
|
||||
* When we add GL to the mix, we have this instead:
|
||||
*
|
||||
* 1) gdk_window_begin_paint_region() is called with an update region like
|
||||
* before. We always redirect cairo drawing to a temporary surface when
|
||||
* GL is enabled.
|
||||
*
|
||||
* 2) Things paint with cairo using gdk_cairo_create(). Whenever
|
||||
* something paints, it calls gdk_window_mark_paint_from_clip() to mark
|
||||
* which regions it has painted in software. We'll learn what this does
|
||||
* soon.
|
||||
*
|
||||
* 3) Something paints with GL and uses gdk_cairo_draw_from_gl() to
|
||||
* composite back into the scene. We paint this onto the backing
|
||||
* store for the window *immediately* by using GL, rather than
|
||||
* painting to the temporary surface, and keep track of the area that
|
||||
* we've painted in `flushed_region`.
|
||||
*
|
||||
* 4) Something paints using software again. It calls
|
||||
* gdk_window_mark_paint_from_clip(), which subtracts the region it
|
||||
* has painted from `flushed_region` and adds the region to
|
||||
* `needs_blended_region`.
|
||||
*
|
||||
* 5) Something paints using GL again, using gdk_cairo_draw_from_gl().
|
||||
* It paints directly to the backing store, removes the region it
|
||||
* painted from `needs_blended_region`, and adds to `flushed_region`.
|
||||
*
|
||||
* 6) gdk_window_end_paint() is called. It composites the temporary surface
|
||||
* back to the window, using GL, except it doesn't bother copying
|
||||
* `flushed_region`, and when it paints `needs_blended_region`, it also
|
||||
* turns on GL blending.
|
||||
*
|
||||
* That means that at any point in time, we have three regions:
|
||||
*
|
||||
* * `region` - This is the original invalidated region and is never
|
||||
* touched.
|
||||
*
|
||||
* * `flushed_region` - This is the portion of `region` that has GL
|
||||
* contents that have been painted directly to the window, and
|
||||
* doesn't have any cairo drawing painted over it.
|
||||
*
|
||||
* * `needs_blended_region` - This is the portion of `region` that
|
||||
* GL contents that have part cairo drawing painted over it.
|
||||
* gdk_window_end_paint() will draw this region using blending.
|
||||
*
|
||||
* `flushed_region` and `needs_blended_region` never intersect, and the
|
||||
* rest of `region` that isn't covered by either is the "opaque region",
|
||||
* which is any area of cairo drawing that didn't ever intersect with GL.
|
||||
* We can paint these from GL without turning on blending.
|
||||
**/
|
||||
|
||||
struct {
|
||||
cairo_region_t *region;
|
||||
/* The temporary surface that we're painting to. This will be composited
|
||||
* back into the window when we call end_paint. This is our poor-man's
|
||||
* way of doing double buffering. */
|
||||
cairo_surface_t *surface;
|
||||
|
||||
/* Areas of region that have been copied to the back buffer already */
|
||||
cairo_region_t *region;
|
||||
cairo_region_t *flushed_region;
|
||||
/* Areas of region that have been copied to the back buffer but
|
||||
needs furter blending of surface data. These two regions are
|
||||
always non-intersecting. */
|
||||
cairo_region_t *need_blend_region;
|
||||
|
||||
gboolean surface_needs_composite;
|
||||
@@ -350,12 +417,17 @@ gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
|
||||
GdkRectangle *extents);
|
||||
void gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
cairo_region_t *region);
|
||||
void gdk_gl_texture_quad (GdkGLContext *paint_context,
|
||||
guint texture_target,
|
||||
float x1, float y1,
|
||||
float x2, float y2,
|
||||
float u1, float v1,
|
||||
float u2, float v2);
|
||||
|
||||
typedef struct {
|
||||
float x1, y1, x2, y2;
|
||||
float u1, v1, u2, v2;
|
||||
} GdkTexturedQuad;
|
||||
|
||||
void gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
guint texture_target,
|
||||
int n_quads,
|
||||
GdkTexturedQuad *quads);
|
||||
|
||||
void gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
|
||||
GdkWindow *window);
|
||||
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||
|
||||
@@ -2891,8 +2891,8 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
|
||||
|
||||
needs_surface = TRUE;
|
||||
if (impl_class->begin_paint_region)
|
||||
needs_surface = impl_class->begin_paint_region (window, region);
|
||||
if (impl_class->begin_paint)
|
||||
needs_surface = impl_class->begin_paint (window);
|
||||
|
||||
window->current_paint.region = cairo_region_copy (region);
|
||||
cairo_region_intersect (window->current_paint.region, window->clip_region);
|
||||
@@ -3100,7 +3100,7 @@ gdk_window_end_paint (GdkWindow *window)
|
||||
window->current_paint.region,
|
||||
window->active_update_area);
|
||||
}
|
||||
else if (!impl_class->do_composite (window))
|
||||
else
|
||||
{
|
||||
surface = gdk_window_ref_impl_surface (window);
|
||||
cr = cairo_create (surface);
|
||||
|
||||
@@ -46,18 +46,11 @@ gdk_window_impl_process_updates_recurse (GdkWindow *window,
|
||||
_gdk_window_process_updates_recurse (window, region);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_impl_do_composite (GdkWindow *window)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_impl_class_init (GdkWindowImplClass *impl_class)
|
||||
{
|
||||
impl_class->beep = gdk_window_impl_beep;
|
||||
impl_class->process_updates_recurse = gdk_window_impl_process_updates_recurse;
|
||||
impl_class->do_composite = gdk_window_impl_do_composite;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -106,8 +106,7 @@ struct _GdkWindowImplClass
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
GdkModifierType *mask);
|
||||
gboolean (* begin_paint_region) (GdkWindow *window,
|
||||
const cairo_region_t *region);
|
||||
gboolean (* begin_paint) (GdkWindow *window);
|
||||
void (* end_paint) (GdkWindow *window);
|
||||
|
||||
cairo_region_t * (* get_shape) (GdkWindow *window);
|
||||
@@ -299,7 +298,6 @@ struct _GdkWindowImplClass
|
||||
GError **error);
|
||||
void (*invalidate_for_new_frame)(GdkWindow *window,
|
||||
cairo_region_t *update_area);
|
||||
gboolean (*do_composite) (GdkWindow *window);
|
||||
};
|
||||
|
||||
/* Interface Functions */
|
||||
|
||||
@@ -186,7 +186,7 @@ create_mir_surface (GdkDisplay *display,
|
||||
MirSurfaceParameters parameters;
|
||||
MirConnection *connection;
|
||||
|
||||
parameters.name = "GTK+ Mir";
|
||||
parameters.name = g_get_prgname ();
|
||||
parameters.width = width;
|
||||
parameters.height = height;
|
||||
parameters.pixel_format = _gdk_mir_display_get_pixel_format (display, buffer_usage);
|
||||
@@ -665,10 +665,9 @@ gdk_mir_window_impl_get_device_state (GdkWindow *window,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_window_impl_begin_paint_region (GdkWindow *window,
|
||||
const cairo_region_t *region)
|
||||
gdk_mir_window_impl_begin_paint (GdkWindow *window)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_begin_paint_region window=%p\n", window);
|
||||
//g_printerr ("gdk_mir_window_impl_begin_paint window=%p\n", window);
|
||||
/* Indicate we are ready to be drawn onto directly? */
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1557,7 +1556,7 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass)
|
||||
impl_class->get_geometry = gdk_mir_window_impl_get_geometry;
|
||||
impl_class->get_root_coords = gdk_mir_window_impl_get_root_coords;
|
||||
impl_class->get_device_state = gdk_mir_window_impl_get_device_state;
|
||||
impl_class->begin_paint_region = gdk_mir_window_impl_begin_paint_region;
|
||||
impl_class->begin_paint = gdk_mir_window_impl_begin_paint;
|
||||
impl_class->end_paint = gdk_mir_window_impl_end_paint;
|
||||
impl_class->get_shape = gdk_mir_window_impl_get_shape;
|
||||
impl_class->get_input_shape = gdk_mir_window_impl_get_input_shape;
|
||||
|
||||
@@ -211,9 +211,6 @@ gdk_window_impl_quartz_finalize (GObject *object)
|
||||
|
||||
check_grab_destroy (GDK_WINDOW_IMPL_QUARTZ (object)->wrapper);
|
||||
|
||||
if (impl->paint_clip_region)
|
||||
cairo_region_destroy (impl->paint_clip_region);
|
||||
|
||||
if (impl->transient_for)
|
||||
g_object_unref (impl->transient_for);
|
||||
|
||||
@@ -337,63 +334,11 @@ gdk_window_impl_quartz_init (GdkWindowImplQuartz *impl)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_impl_quartz_begin_paint_region (GdkWindow *window,
|
||||
const cairo_region_t *region)
|
||||
gdk_window_impl_quartz_begin_paint (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
|
||||
cairo_region_t *clipped_and_offset_region;
|
||||
cairo_t *cr;
|
||||
|
||||
clipped_and_offset_region = cairo_region_copy (region);
|
||||
|
||||
cairo_region_intersect (clipped_and_offset_region,
|
||||
window->clip_region);
|
||||
cairo_region_translate (clipped_and_offset_region,
|
||||
window->abs_x, window->abs_y);
|
||||
|
||||
impl->paint_clip_region = cairo_region_reference (clipped_and_offset_region);
|
||||
|
||||
if (cairo_region_is_empty (clipped_and_offset_region))
|
||||
goto done;
|
||||
|
||||
cr = gdk_cairo_create (window);
|
||||
|
||||
cairo_translate (cr, -window->abs_x, -window->abs_y);
|
||||
|
||||
gdk_cairo_region (cr, clipped_and_offset_region);
|
||||
cairo_clip (cr);
|
||||
|
||||
while (window->background == NULL && window->parent)
|
||||
{
|
||||
cairo_translate (cr, -window->x, window->y);
|
||||
window = window->parent;
|
||||
}
|
||||
|
||||
if (window->background)
|
||||
cairo_set_source (cr, window->background);
|
||||
else
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, 0);
|
||||
|
||||
/* Can use cairo_paint() here, we clipped above */
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
|
||||
done:
|
||||
cairo_region_destroy (clipped_and_offset_region);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_impl_quartz_end_paint (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
|
||||
|
||||
cairo_region_destroy (impl->paint_clip_region);
|
||||
impl->paint_clip_region = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
|
||||
cairo_region_t *region)
|
||||
@@ -2946,8 +2891,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
|
||||
impl_class->get_shape = gdk_quartz_window_get_shape;
|
||||
impl_class->get_input_shape = gdk_quartz_window_get_input_shape;
|
||||
impl_class->begin_paint_region = gdk_window_impl_quartz_begin_paint_region;
|
||||
impl_class->end_paint = gdk_window_impl_quartz_end_paint;
|
||||
impl_class->begin_paint = gdk_window_impl_quartz_begin_paint;
|
||||
impl_class->get_scale_factor = gdk_quartz_window_get_scale_factor;
|
||||
|
||||
impl_class->focus = gdk_quartz_window_focus;
|
||||
|
||||
@@ -50,7 +50,6 @@ struct _GdkWindowImplQuartz
|
||||
|
||||
GdkWindowTypeHint type_hint;
|
||||
|
||||
cairo_region_t *paint_clip_region;
|
||||
gint in_paint_rect_count;
|
||||
|
||||
GdkWindow *transient_for;
|
||||
|
||||
@@ -570,8 +570,7 @@ gdk_wayland_window_create_similar_image_surface (GdkWindow * window,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_impl_wayland_begin_paint_region (GdkWindow *window,
|
||||
const cairo_region_t *region)
|
||||
gdk_window_impl_wayland_begin_paint (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
gdk_wayland_window_ensure_cairo_surface (window);
|
||||
@@ -684,23 +683,17 @@ static void
|
||||
gdk_wayland_window_sync_margin (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
gint x, y, width, height;
|
||||
|
||||
if (!impl->xdg_surface)
|
||||
return;
|
||||
|
||||
/* XXX: xdg_surface now has xdg_surface_set_window_geometry.
|
||||
*
|
||||
* We need to have a GdkToplevel or some other class in order
|
||||
* to make this work correctly. For now, don't do anything with
|
||||
* the shadow widths.
|
||||
*/
|
||||
#if 0
|
||||
xdg_surface_set_margin (impl->xdg_surface,
|
||||
impl->margin_left,
|
||||
impl->margin_right,
|
||||
impl->margin_top,
|
||||
impl->margin_bottom);
|
||||
#endif
|
||||
x = impl->margin_left;
|
||||
y = impl->margin_top;
|
||||
width = window->width - (impl->margin_left + impl->margin_right);
|
||||
height = window->height - (impl->margin_top + impl->margin_bottom);
|
||||
|
||||
xdg_surface_set_window_geometry (impl->xdg_surface, x, y, width, height);
|
||||
}
|
||||
|
||||
static struct wl_region *
|
||||
@@ -859,8 +852,8 @@ xdg_surface_configure (void *data,
|
||||
{
|
||||
gdk_window_constrain_size (&impl->geometry_hints,
|
||||
impl->geometry_mask,
|
||||
width,
|
||||
height,
|
||||
width + impl->margin_left + impl->margin_right,
|
||||
height + impl->margin_top + impl->margin_bottom,
|
||||
&width,
|
||||
&height);
|
||||
|
||||
@@ -890,6 +883,7 @@ xdg_surface_configure (void *data,
|
||||
}
|
||||
|
||||
_gdk_set_window_state (window, new_state);
|
||||
gdk_wayland_window_sync_margin (window);
|
||||
xdg_surface_ack_configure (xdg_surface, serial);
|
||||
}
|
||||
|
||||
@@ -1026,6 +1020,12 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
|
||||
x = window->x - parent_x;
|
||||
y = window->y - parent_y;
|
||||
|
||||
if (parent_impl->xdg_surface)
|
||||
{
|
||||
x -= parent_impl->margin_left;
|
||||
y -= parent_impl->margin_top;
|
||||
}
|
||||
|
||||
impl->xdg_popup = xdg_shell_get_xdg_popup (display_wayland->xdg_shell,
|
||||
impl->surface,
|
||||
parent_impl->surface,
|
||||
@@ -2048,10 +2048,22 @@ gdk_wayland_window_set_shadow_width (GdkWindow *window,
|
||||
int bottom)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
gint new_width, new_height;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
if (left == impl->margin_left && right == impl->margin_right &&
|
||||
top == impl->margin_top && bottom == impl->margin_bottom)
|
||||
return;
|
||||
|
||||
/* Reconfigure window to keep the same window geometry */
|
||||
new_width = window->width -
|
||||
(impl->margin_left + impl->margin_right) + (left + right);
|
||||
new_height = window->height -
|
||||
(impl->margin_top + impl->margin_bottom) + (top + bottom);
|
||||
gdk_wayland_window_configure (window, new_width, new_height);
|
||||
|
||||
impl->margin_left = left;
|
||||
impl->margin_right = right;
|
||||
impl->margin_top = top;
|
||||
@@ -2125,7 +2137,7 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->destroy_foreign = gdk_window_wayland_destroy_foreign;
|
||||
impl_class->get_shape = gdk_wayland_window_get_shape;
|
||||
impl_class->get_input_shape = gdk_wayland_window_get_input_shape;
|
||||
impl_class->begin_paint_region = gdk_window_impl_wayland_begin_paint_region;
|
||||
impl_class->begin_paint = gdk_window_impl_wayland_begin_paint;
|
||||
impl_class->end_paint = gdk_window_impl_wayland_end_paint;
|
||||
/* impl_class->beep */
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/Xlib-xcb.h>
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
#include <X11/XKBlib.h>
|
||||
@@ -73,10 +72,6 @@
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PRESENT
|
||||
#include <xcb/present.h>
|
||||
#endif
|
||||
|
||||
typedef struct _GdkErrorTrap GdkErrorTrap;
|
||||
|
||||
struct _GdkErrorTrap
|
||||
@@ -1371,7 +1366,6 @@ _gdk_x11_display_open (const gchar *display_name)
|
||||
GdkWindowAttr attr;
|
||||
gint argc;
|
||||
gchar *argv[1];
|
||||
xcb_connection_t *xcb_conn;
|
||||
|
||||
XClassHint *class_hint;
|
||||
gulong pid;
|
||||
@@ -1392,8 +1386,6 @@ _gdk_x11_display_open (const gchar *display_name)
|
||||
|
||||
_gdk_x11_precache_atoms (display, precache_atoms, G_N_ELEMENTS (precache_atoms));
|
||||
|
||||
xcb_conn = XGetXCBConnection (display_x11->xdisplay);
|
||||
|
||||
/* RandR must be initialized before we initialize the screens */
|
||||
display_x11->have_randr12 = FALSE;
|
||||
display_x11->have_randr13 = FALSE;
|
||||
@@ -1458,14 +1450,6 @@ _gdk_x11_display_open (const gchar *display_name)
|
||||
#endif
|
||||
display_x11->have_xfixes = FALSE;
|
||||
|
||||
#ifdef HAVE_PRESENT
|
||||
if (xcb_get_extension_data (xcb_conn, &xcb_present_id))
|
||||
{
|
||||
(void) xcb_present_query_version (xcb_conn, XCB_PRESENT_MAJOR_VERSION, XCB_PRESENT_MINOR_VERSION);
|
||||
display_x11->have_present = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_XCOMPOSITE
|
||||
if (XCompositeQueryExtension (display_x11->xdisplay,
|
||||
&ignore, &ignore))
|
||||
|
||||
@@ -68,8 +68,6 @@ struct _GdkX11Display
|
||||
gboolean have_randr13;
|
||||
gint xrandr_event_base;
|
||||
|
||||
gboolean have_present;
|
||||
|
||||
/* If the SECURITY extension is in place, whether this client holds
|
||||
* a trusted authorization and so is allowed to make various requests
|
||||
* (grabs, properties etc.) Otherwise always TRUE.
|
||||
|
||||
@@ -431,6 +431,7 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
|
||||
guint target;
|
||||
double sx, sy;
|
||||
float uscale, vscale;
|
||||
GdkTexturedQuad *quads;
|
||||
|
||||
if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_XLIB)
|
||||
return FALSE;
|
||||
@@ -470,23 +471,28 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
|
||||
glXBindTexImageEXT (glx_pixmap->display, glx_pixmap->drawable,
|
||||
GLX_FRONT_LEFT_EXT, NULL);
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
quads = g_new (GdkTexturedQuad, n_rects);
|
||||
|
||||
#define FLIP_Y(_y) (window_height - (_y))
|
||||
|
||||
cairo_region_get_extents (region, &rect);
|
||||
glScissor (rect.x * window_scale, FLIP_Y(rect.y) * window_scale,
|
||||
(rect.x + rect.width) * window_scale, FLIP_Y (rect.y + rect.height) * window_scale);
|
||||
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
int src_x, src_y, src_height, src_width;
|
||||
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
|
||||
glScissor (rect.x * window_scale, (window_height - rect.y - rect.height) * window_scale,
|
||||
rect.width * window_scale, rect.height * window_scale);
|
||||
|
||||
src_x = rect.x * sx + device_x_offset;
|
||||
src_y = rect.y * sy + device_y_offset;
|
||||
src_width = rect.width * sx;
|
||||
src_height = rect.height * sy;
|
||||
|
||||
#define FLIP_Y(_y) (window_height - (_y))
|
||||
|
||||
if (use_texture_rectangle)
|
||||
{
|
||||
uscale = 1.0;
|
||||
@@ -498,13 +504,25 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
|
||||
vscale = 1.0 / cairo_xlib_surface_get_height (surface);
|
||||
}
|
||||
|
||||
gdk_gl_texture_quad (paint_context, target,
|
||||
rect.x * window_scale, FLIP_Y(rect.y) * window_scale,
|
||||
(rect.x + rect.width) * window_scale, FLIP_Y(rect.y + rect.height) * window_scale,
|
||||
uscale * src_x, vscale * src_y,
|
||||
uscale * (src_x + src_width), vscale * (src_y + src_height));
|
||||
{
|
||||
GdkTexturedQuad quad = {
|
||||
rect.x * window_scale, FLIP_Y(rect.y) * window_scale,
|
||||
(rect.x + rect.width) * window_scale, FLIP_Y(rect.y + rect.height) * window_scale,
|
||||
uscale * src_x, vscale * src_y,
|
||||
uscale * (src_x + src_width), vscale * (src_y + src_height),
|
||||
};
|
||||
|
||||
quads[i] = quad;
|
||||
}
|
||||
}
|
||||
|
||||
#undef FLIP_Y
|
||||
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
|
||||
gdk_gl_texture_quads (paint_context, target, n_rects, quads);
|
||||
g_free (quads);
|
||||
|
||||
glXReleaseTexImageEXT (glx_pixmap->display, glx_pixmap->drawable,
|
||||
GLX_FRONT_LEFT_EXT);
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib-xcb.h>
|
||||
|
||||
#include <X11/extensions/shape.h>
|
||||
|
||||
@@ -73,10 +72,6 @@
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PRESENT
|
||||
#include <xcb/present.h>
|
||||
#endif
|
||||
|
||||
const int _gdk_x11_event_mask_table[21] =
|
||||
{
|
||||
ExposureMask,
|
||||
@@ -1927,10 +1922,8 @@ _gdk_x11_window_set_window_scale (GdkWindow *window,
|
||||
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||
|
||||
impl->window_scale = scale;
|
||||
#ifdef HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE
|
||||
if (impl->cairo_surface)
|
||||
cairo_surface_set_device_scale (impl->cairo_surface, impl->window_scale, impl->window_scale);
|
||||
#endif
|
||||
_gdk_window_update_size (window);
|
||||
|
||||
toplevel = _gdk_x11_window_get_toplevel (window);
|
||||
@@ -3403,7 +3396,7 @@ do_shape_combine_region (GdkWindow *window,
|
||||
_gdk_x11_region_get_xrectangles (shape_region,
|
||||
0, 0, impl->window_scale,
|
||||
&xrects, &n_rects);
|
||||
|
||||
|
||||
if (shape == ShapeBounding)
|
||||
{
|
||||
_gdk_x11_window_tmp_unset_parent_bg (window);
|
||||
@@ -5688,56 +5681,6 @@ gdk_x11_window_show_window_menu (GdkWindow *window,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_window_do_composite (GdkWindow *window)
|
||||
{
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
#ifdef HAVE_PRESENT
|
||||
if (display_x11->have_present)
|
||||
{
|
||||
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||
xcb_connection_t *xcb_conn = XGetXCBConnection (xdisplay);
|
||||
XserverRegion update_region;
|
||||
XRectangle *rects;
|
||||
int n_rects;
|
||||
double sx, sy;
|
||||
double offs_x, offs_y;
|
||||
|
||||
cairo_surface_get_device_scale (window->current_paint.surface, &sx, &sy);
|
||||
cairo_surface_get_device_offset (window->current_paint.surface, &offs_x, &offs_y);
|
||||
|
||||
_gdk_x11_region_get_xrectangles (window->current_paint.region,
|
||||
offs_x / sx, offs_y / sy, sx, &rects, &n_rects);
|
||||
update_region = XFixesCreateRegion (xdisplay, rects, n_rects);
|
||||
|
||||
xcb_present_pixmap (xcb_conn,
|
||||
GDK_WINDOW_XID (window),
|
||||
cairo_xlib_surface_get_drawable (window->current_paint.surface),
|
||||
XNextRequest (xdisplay),
|
||||
update_region,
|
||||
update_region,
|
||||
-offs_x,
|
||||
-offs_y,
|
||||
None, /* target_crtc */
|
||||
None, /* wait_fence */
|
||||
None, /* idle_fence */
|
||||
0, /* options */
|
||||
0, /* target_msc */
|
||||
0, /* divisor */
|
||||
0, /* remainder */
|
||||
0, NULL /* notifies */ );
|
||||
|
||||
XFixesDestroyRegion (xdisplay, update_region);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
|
||||
{
|
||||
@@ -5828,5 +5771,4 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
|
||||
impl_class->create_gl_context = gdk_x11_window_create_gl_context;
|
||||
impl_class->invalidate_for_new_frame = gdk_x11_window_invalidate_for_new_frame;
|
||||
impl_class->get_unscaled_size = gdk_x11_window_get_unscaled_size;
|
||||
impl_class->do_composite = gdk_x11_window_do_composite;
|
||||
}
|
||||
|
||||
164
gtk/gtkglarea.c
164
gtk/gtkglarea.c
@@ -190,7 +190,7 @@ gtk_gl_area_set_property (GObject *gobject,
|
||||
{
|
||||
case PROP_AUTO_RENDER:
|
||||
gtk_gl_area_set_auto_render (GTK_GL_AREA(gobject),
|
||||
g_value_get_boolean (value));
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_HAS_ALPHA:
|
||||
@@ -210,7 +210,7 @@ gtk_gl_area_set_property (GObject *gobject,
|
||||
|
||||
case PROP_PROFILE:
|
||||
gtk_gl_area_set_profile (GTK_GL_AREA(gobject),
|
||||
g_value_get_enum (value));
|
||||
g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -281,7 +281,7 @@ gtk_gl_area_realize (GtkWidget *widget)
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y;
|
||||
|
||||
priv->event_window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
&attributes, attributes_mask);
|
||||
gtk_widget_register_window (widget, priv->event_window);
|
||||
|
||||
|
||||
@@ -352,8 +352,8 @@ gtk_gl_area_create_buffers (GtkGLArea *area)
|
||||
|
||||
scale = gtk_widget_get_scale_factor (widget);
|
||||
gtk_gl_area_allocate_buffers (area,
|
||||
gtk_widget_get_allocated_width (widget) * scale,
|
||||
gtk_widget_get_allocated_height (widget) * scale);
|
||||
gtk_widget_get_allocated_width (widget) * scale,
|
||||
gtk_widget_get_allocated_height (widget) * scale);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -387,9 +387,9 @@ gtk_gl_area_allocate_buffers (GtkGLArea *area, int width, int height)
|
||||
{
|
||||
glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
|
||||
if (priv->has_stencil_buffer)
|
||||
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, width, height);
|
||||
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, width, height);
|
||||
else
|
||||
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width, height);
|
||||
glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, width, height);
|
||||
}
|
||||
|
||||
priv->needs_render = TRUE;
|
||||
@@ -408,8 +408,8 @@ gtk_gl_area_maybe_allocate_buffers (GtkGLArea *area)
|
||||
gtk_gl_area_make_current (area);
|
||||
scale = gtk_widget_get_scale_factor (widget);
|
||||
gtk_gl_area_allocate_buffers (area,
|
||||
gtk_widget_get_allocated_width (widget) * scale,
|
||||
gtk_widget_get_allocated_height (widget) * scale);
|
||||
gtk_widget_get_allocated_width (widget) * scale,
|
||||
gtk_widget_get_allocated_height (widget) * scale);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,19 +440,19 @@ gtk_gl_area_attach_buffers (GtkGLArea *area)
|
||||
|
||||
if (priv->texture)
|
||||
glFramebufferTexture2D (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, priv->texture, 0);
|
||||
GL_TEXTURE_2D, priv->texture, 0);
|
||||
else if (priv->render_buffer)
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, priv->render_buffer);
|
||||
GL_RENDERBUFFER_EXT, priv->render_buffer);
|
||||
|
||||
if (priv->depth_stencil_buffer)
|
||||
{
|
||||
if (priv->has_depth_buffer)
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
|
||||
if (priv->has_stencil_buffer)
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT,
|
||||
GL_RENDERBUFFER_EXT, priv->depth_stencil_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,10 +520,10 @@ gtk_gl_area_unrealize (GtkWidget *widget)
|
||||
if (priv->context != NULL)
|
||||
{
|
||||
if (priv->have_buffers)
|
||||
{
|
||||
gtk_gl_area_make_current (area);
|
||||
gtk_gl_area_delete_buffers (area);
|
||||
}
|
||||
{
|
||||
gtk_gl_area_make_current (area);
|
||||
gtk_gl_area_delete_buffers (area);
|
||||
}
|
||||
|
||||
/* Make sure to destroy if current */
|
||||
if (priv->context == gdk_gl_context_get_current ())
|
||||
@@ -580,11 +580,11 @@ gtk_gl_area_size_allocate (GtkWidget *widget,
|
||||
if (gtk_widget_get_realized (widget))
|
||||
{
|
||||
if (priv->event_window != NULL)
|
||||
gdk_window_move_resize (priv->event_window,
|
||||
allocation->x,
|
||||
allocation->y,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
gdk_window_move_resize (priv->event_window,
|
||||
allocation->x,
|
||||
allocation->y,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
|
||||
priv->needs_resize = TRUE;
|
||||
}
|
||||
@@ -651,15 +651,15 @@ gtk_gl_area_draw (GtkWidget *widget,
|
||||
if (status == GL_FRAMEBUFFER_COMPLETE_EXT)
|
||||
{
|
||||
if (priv->needs_render || priv->auto_render)
|
||||
{
|
||||
if (priv->needs_resize)
|
||||
{
|
||||
g_signal_emit (area, area_signals[RESIZE], 0, w, h, NULL);
|
||||
priv->needs_resize = FALSE;
|
||||
}
|
||||
{
|
||||
if (priv->needs_resize)
|
||||
{
|
||||
g_signal_emit (area, area_signals[RESIZE], 0, w, h, NULL);
|
||||
priv->needs_resize = FALSE;
|
||||
}
|
||||
|
||||
g_signal_emit (area, area_signals[RENDER], 0, priv->context, &unused);
|
||||
}
|
||||
g_signal_emit (area, area_signals[RENDER], 0, priv->context, &unused);
|
||||
}
|
||||
|
||||
priv->needs_render = FALSE;
|
||||
|
||||
@@ -731,7 +731,7 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
/**
|
||||
* GdkGLArea:profile:
|
||||
*
|
||||
* The #GdkGLProfile to use to create the GL context for the area
|
||||
* The #GdkGLProfile to use to create the GL context for the area.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -743,18 +743,21 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
GDK_GL_PROFILE_DEFAULT,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT |
|
||||
G_PARAM_EXPLICIT_NOTIFY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GtkGLArea:auto-render:
|
||||
*
|
||||
* If set to %TRUE the #GtkGLArea::render signal will be emitted every time the widget
|
||||
* draws. This is the default and is useful if drawing the widget is fastr.
|
||||
* If set to %TRUE the #GtkGLArea::render signal will be emitted every time
|
||||
* the widget draws. This is the default and is useful if drawing the widget
|
||||
* is faster.
|
||||
*
|
||||
* If set to %FALSE the data from previous rendering is kept around and will be used
|
||||
* for drawing the widget the next time, unless the window is resized. In order to
|
||||
* force a rendering gtk_gl_area_queue_render() must be called. This mode is useful
|
||||
* when the scene changes seldom, but takes a long time to redraw.
|
||||
* If set to %FALSE the data from previous rendering is kept around and will
|
||||
* be used for drawing the widget the next time, unless the window is resized.
|
||||
* In order to force a rendering gtk_gl_area_queue_render() must be called.
|
||||
* This mode is useful when the scene changes seldomly, but takes a long time
|
||||
* to redraw.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -763,17 +766,19 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
P_("Auto render"),
|
||||
P_("Whether the gl area renders on each redraw"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
GTK_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkGLArea:has-alpha:
|
||||
*
|
||||
* If set to %TRUE the buffer allocated by the widget will have an alpha channel component,
|
||||
* and when rendering to the window the result will be composited over whatever is below
|
||||
* the widget.
|
||||
* If set to %TRUE the buffer allocated by the widget will have an alpha channel
|
||||
* component, and when rendering to the window the result will be composited over
|
||||
* whatever is below the widget.
|
||||
*
|
||||
* If set to %FALSE there will be no alpha channel, and the buffer will fully replace anything
|
||||
* below the widget.
|
||||
* If set to %FALSE there will be no alpha channel, and the buffer will fully
|
||||
* replace anything below the widget.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -782,13 +787,15 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
P_("Has alpha"),
|
||||
P_("Whether the gl area color buffer has an alpha component"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
GTK_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkGLArea:has-depth-buffer:
|
||||
*
|
||||
* If set to %TRUE the widget will allocate and enable a depth buffer for the target
|
||||
* framebuffer.
|
||||
* If set to %TRUE the widget will allocate and enable a depth buffer for the
|
||||
* target framebuffer.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -797,13 +804,15 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
P_("Has depth buffer"),
|
||||
P_("Whether a depth buffer is allocated"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
GTK_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkGLArea:has-stencil-buffer:
|
||||
*
|
||||
* If set to %TRUE the widget will allocate and enable a stencil buffer for the target
|
||||
* framebuffer.
|
||||
* If set to %TRUE the widget will allocate and enable a stencil buffer for the
|
||||
* target framebuffer.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -812,7 +821,9 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
P_("Has stencil buffer"),
|
||||
P_("Whether a stencil buffer is allocated"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
GTK_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
gobject_class->set_property = gtk_gl_area_set_property;
|
||||
gobject_class->get_property = gtk_gl_area_get_property;
|
||||
@@ -838,13 +849,13 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
*/
|
||||
area_signals[RENDER] =
|
||||
g_signal_new (I_("render"),
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkGLAreaClass, render),
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
GDK_TYPE_GL_CONTEXT);
|
||||
G_TYPE_FROM_CLASS (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (GtkGLAreaClass, render),
|
||||
_gtk_boolean_handled_accumulator, NULL,
|
||||
NULL,
|
||||
G_TYPE_BOOLEAN, 1,
|
||||
GDK_TYPE_GL_CONTEXT);
|
||||
|
||||
/**
|
||||
* GtkGLArea::resized:
|
||||
@@ -855,9 +866,10 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
* in order to keep GL state up to date with the widget size, like for
|
||||
* instance camera properties which may depend on the width/height ratio.
|
||||
*
|
||||
* The GL context for the area is guaranteed to be current when this is emitted.
|
||||
* The GL context for the area is guaranteed to be current when this signal
|
||||
* is emitted.
|
||||
*
|
||||
* The default handler sets up the gl Viewport.
|
||||
* The default handler sets up the GL viewport.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -885,8 +897,8 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
|
||||
* gtk_gl_area_set_error() to register a more detailed error
|
||||
* of how the construction failed.
|
||||
*
|
||||
* Returns: (transfer full): a newly created #GdkGLContext; the
|
||||
* #GtkGLArea widget will take ownership of the returned value.
|
||||
* Returns: (transfer full): a newly created #GdkGLContext;
|
||||
* the #GtkGLArea widget will take ownership of the returned value.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
@@ -934,13 +946,13 @@ gtk_gl_area_new (void)
|
||||
* @error: (allow-none): a new #GError, or %NULL to unset the error
|
||||
*
|
||||
* Sets an error on the area which will be shown instead of the
|
||||
* gl rendering. This is useful in the ::create-context signal
|
||||
* if GL context creation fails.
|
||||
* GL rendering. This is useful in the #GtkGLArea::create-context
|
||||
* signal if GL context creation fails.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gtk_gl_area_set_error (GtkGLArea *area,
|
||||
gtk_gl_area_set_error (GtkGLArea *area,
|
||||
const GError *error)
|
||||
{
|
||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||
@@ -983,7 +995,7 @@ gtk_gl_area_get_error (GtkGLArea *area)
|
||||
* Since: 3.16
|
||||
*/
|
||||
GdkGLProfile
|
||||
gtk_gl_area_get_profile (GtkGLArea *area)
|
||||
gtk_gl_area_get_profile (GtkGLArea *area)
|
||||
{
|
||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||
|
||||
@@ -1003,8 +1015,8 @@ gtk_gl_area_get_profile (GtkGLArea *area)
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gtk_gl_area_set_profile (GtkGLArea *area,
|
||||
GdkGLProfile profile)
|
||||
gtk_gl_area_set_profile (GtkGLArea *area,
|
||||
GdkGLProfile profile)
|
||||
{
|
||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||
|
||||
@@ -1156,7 +1168,7 @@ gtk_gl_area_get_has_stencil_buffer (GtkGLArea *area)
|
||||
*/
|
||||
void
|
||||
gtk_gl_area_set_has_stencil_buffer (GtkGLArea *area,
|
||||
gboolean has_stencil_buffer)
|
||||
gboolean has_stencil_buffer)
|
||||
{
|
||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||
|
||||
@@ -1178,8 +1190,8 @@ gtk_gl_area_set_has_stencil_buffer (GtkGLArea *area,
|
||||
* gtk_gl_area_queue_render:
|
||||
* @area: a #GtkGLArea
|
||||
*
|
||||
* Marks the currently rendered data (if any) as invalid, and queues a
|
||||
* redraw of the widget, ensuring that the #GtkGLArea::render signal
|
||||
* Marks the currently rendered data (if any) as invalid, and queues
|
||||
* a redraw of the widget, ensuring that the #GtkGLArea::render signal
|
||||
* is emitted during the draw.
|
||||
*
|
||||
* This is only needed when the gtk_gl_area_set_auto_render() has
|
||||
@@ -1228,19 +1240,19 @@ gtk_gl_area_get_auto_render (GtkGLArea *area)
|
||||
*
|
||||
* If @auto_render is %TRUE the #GtkGLArea::render signal will be
|
||||
* emitted every time the widget draws. This is the default and is
|
||||
* useful if drawing the widget is fastr.
|
||||
* useful if drawing the widget is faster.
|
||||
*
|
||||
* If @auto_render is %FALSE the data from previous rendering is kept
|
||||
* around and will be used for drawing the widget the next time,
|
||||
* unless the window is resized. In order to force a rendering
|
||||
* gtk_gl_area_queue_render() must be called. This mode is useful when
|
||||
* the scene changes seldom, but takes a long time to redraw.
|
||||
* the scene changes seldomly, but takes a long time to redraw.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gtk_gl_area_set_auto_render (GtkGLArea *area,
|
||||
gboolean auto_render)
|
||||
gboolean auto_render)
|
||||
{
|
||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||
|
||||
@@ -1255,7 +1267,7 @@ gtk_gl_area_set_auto_render (GtkGLArea *area,
|
||||
g_object_notify (G_OBJECT (area), "auto-render");
|
||||
|
||||
if (auto_render)
|
||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -879,7 +879,7 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
|
||||
g_param_spec_string ("text",
|
||||
P_("Text"),
|
||||
P_("The text"),
|
||||
NULL,
|
||||
"",
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
@@ -956,7 +956,7 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
|
||||
g_param_spec_boolean ("iconic",
|
||||
P_("Iconic"),
|
||||
P_("Whether to prefer the icon over text"),
|
||||
TRUE,
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
g_object_class_install_properties (object_class, LAST_PROPERTY, properties);
|
||||
|
||||
@@ -986,6 +986,15 @@ gtk_model_button_init (GtkModelButton *button)
|
||||
GTK_STYLE_CLASS_MENUITEM);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_model_button_new:
|
||||
*
|
||||
* Creates a new GtkModelButton.
|
||||
*
|
||||
* Returns: the newly created #GtkModelButton widget
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
GtkWidget *
|
||||
gtk_model_button_new (void)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "gtksearchentry.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkbindings.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtksearchentry
|
||||
@@ -60,6 +61,9 @@
|
||||
|
||||
enum {
|
||||
SEARCH_CHANGED,
|
||||
NEXT_MATCH,
|
||||
PREVIOUS_MATCH,
|
||||
STOP_SEARCH,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@@ -67,6 +71,8 @@ static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
typedef struct {
|
||||
guint delayed_changed_id;
|
||||
gboolean content_changed;
|
||||
gboolean search_stopped;
|
||||
} GtkSearchEntryPrivate;
|
||||
|
||||
static void gtk_search_entry_icon_release (GtkEntry *entry,
|
||||
@@ -88,6 +94,28 @@ G_DEFINE_TYPE_WITH_CODE (GtkSearchEntry, gtk_search_entry, GTK_TYPE_ENTRY,
|
||||
* that we cannot now have one without breaking ABI */
|
||||
#define GET_PRIV(e) ((GtkSearchEntryPrivate *) gtk_search_entry_get_instance_private ((GtkSearchEntry *) (e)))
|
||||
|
||||
static void
|
||||
gtk_search_entry_preedit_changed (GtkEntry *entry,
|
||||
const gchar *preedit)
|
||||
{
|
||||
GtkSearchEntryPrivate *priv = GET_PRIV (entry);
|
||||
|
||||
priv->content_changed = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_entry_notify (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkSearchEntryPrivate *priv = GET_PRIV (object);
|
||||
|
||||
if (strcmp (pspec->name, "text") == 0)
|
||||
priv->content_changed = TRUE;
|
||||
|
||||
if (G_OBJECT_CLASS (gtk_search_entry_parent_class)->notify)
|
||||
G_OBJECT_CLASS (gtk_search_entry_parent_class)->notify (object, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_entry_finalize (GObject *object)
|
||||
{
|
||||
@@ -99,17 +127,33 @@ gtk_search_entry_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_search_entry_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_entry_stop_search (GtkSearchEntry *entry)
|
||||
{
|
||||
GtkSearchEntryPrivate *priv = GET_PRIV (entry);
|
||||
|
||||
priv->search_stopped = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_search_entry_class_init (GtkSearchEntryClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkBindingSet *binding_set;
|
||||
|
||||
object_class->finalize = gtk_search_entry_finalize;
|
||||
object_class->notify = gtk_search_entry_notify;
|
||||
|
||||
klass->stop_search = gtk_search_entry_stop_search;
|
||||
|
||||
g_signal_override_class_handler ("icon-release",
|
||||
GTK_TYPE_SEARCH_ENTRY,
|
||||
G_CALLBACK (gtk_search_entry_icon_release));
|
||||
|
||||
g_signal_override_class_handler ("preedit-changed",
|
||||
GTK_TYPE_SEARCH_ENTRY,
|
||||
G_CALLBACK (gtk_search_entry_preedit_changed));
|
||||
|
||||
/**
|
||||
* GtkSearchEntry::search-changed:
|
||||
* @entry: the entry on which the signal was emitted
|
||||
@@ -127,6 +171,86 @@ gtk_search_entry_class_init (GtkSearchEntryClass *klass)
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkSearchEntry::next-match:
|
||||
* @entry: the entry on which the signal was emitted
|
||||
*
|
||||
* The ::next-match signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user initiates a move to the next match
|
||||
* for the current search string.
|
||||
*
|
||||
* Applications should connect to it, to implement moving between
|
||||
* matches.
|
||||
*
|
||||
* The default bindings for this signal is Ctrl-g.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
signals[NEXT_MATCH] =
|
||||
g_signal_new (I_("next-match"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkSearchEntryClass, next_match),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkSearchEntry::previous-match:
|
||||
* @entry: the entry on which the signal was emitted
|
||||
*
|
||||
* The ::previous-match signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user initiates a move to the previous match
|
||||
* for the current search string.
|
||||
*
|
||||
* Applications should connect to it, to implement moving between
|
||||
* matches.
|
||||
*
|
||||
* The default bindings for this signal is Ctrl-Shift-g.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
signals[PREVIOUS_MATCH] =
|
||||
g_signal_new (I_("previous-match"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkSearchEntryClass, previous_match),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* GtkSearchEntry::stop-search:
|
||||
* @entry: the entry on which the signal was emitted
|
||||
*
|
||||
* The ::stop-search signal is a [keybinding signal][GtkBindingSignal]
|
||||
* which gets emitted when the user stops a search via keyboard input.
|
||||
*
|
||||
* Applications should connect to it, to implement hiding the search
|
||||
* entry in this case.
|
||||
*
|
||||
* The default bindings for this signal is Escape.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
signals[STOP_SEARCH] =
|
||||
g_signal_new (I_("stop-search"),
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (GtkSearchEntryClass, stop_search),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
binding_set = gtk_binding_set_by_class (klass);
|
||||
|
||||
gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_CONTROL_MASK,
|
||||
"next-match", 0);
|
||||
gtk_binding_entry_add_signal (binding_set, GDK_KEY_g, GDK_SHIFT_MASK | GDK_CONTROL_MASK,
|
||||
"previous-match", 0);
|
||||
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
|
||||
"stop-search", 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -253,3 +377,75 @@ gtk_search_entry_new (void)
|
||||
{
|
||||
return GTK_WIDGET (g_object_new (GTK_TYPE_SEARCH_ENTRY, NULL));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_keynav_event (GdkEvent *event)
|
||||
{
|
||||
GdkModifierType state = 0;
|
||||
guint keyval;
|
||||
|
||||
if (!gdk_event_get_keyval (event, &keyval))
|
||||
return FALSE;
|
||||
|
||||
gdk_event_get_state (event, &state);
|
||||
|
||||
if (keyval == GDK_KEY_Tab || keyval == GDK_KEY_KP_Tab ||
|
||||
keyval == GDK_KEY_Up || keyval == GDK_KEY_KP_Up ||
|
||||
keyval == GDK_KEY_Down || keyval == GDK_KEY_KP_Down ||
|
||||
keyval == GDK_KEY_Left || keyval == GDK_KEY_KP_Left ||
|
||||
keyval == GDK_KEY_Right || keyval == GDK_KEY_KP_Right ||
|
||||
keyval == GDK_KEY_Home || keyval == GDK_KEY_KP_Home ||
|
||||
keyval == GDK_KEY_End || keyval == GDK_KEY_KP_End ||
|
||||
keyval == GDK_KEY_Page_Up || keyval == GDK_KEY_KP_Page_Up ||
|
||||
keyval == GDK_KEY_Page_Down || keyval == GDK_KEY_KP_Page_Down ||
|
||||
((state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)) != 0))
|
||||
return TRUE;
|
||||
|
||||
/* Other navigation events should get automatically
|
||||
* ignored as they will not change the content of the entry
|
||||
*/
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_search_entry_handle_event:
|
||||
* @entry: a #GtkSearchEntry
|
||||
* @event: a key event
|
||||
*
|
||||
* This function should be called when the top-level
|
||||
* window which contains the search entry received a
|
||||
* key event.
|
||||
*
|
||||
* If the key event is handled by the search bar and starts
|
||||
* or continues a search, %GDK_EVENT_STOP will be returned.
|
||||
* The caller should ensure that the entry is shown in
|
||||
* this case, and not propagate the event further.
|
||||
*
|
||||
* Returns: %GDK_EVENT_STOP if the key press event resulted
|
||||
* in a search beginning or continuing, %GDK_EVENT_PROPAGATE
|
||||
* otherwise.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
gboolean
|
||||
gtk_search_entry_handle_event (GtkSearchEntry *entry,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkSearchEntryPrivate *priv = GET_PRIV (entry);
|
||||
gboolean handled;
|
||||
|
||||
if (!gtk_widget_get_realized (GTK_WIDGET (entry)))
|
||||
gtk_widget_realize (GTK_WIDGET (entry));
|
||||
|
||||
if (is_keynav_event (event) ||
|
||||
event->key.keyval == GDK_KEY_space ||
|
||||
event->key.keyval == GDK_KEY_Menu)
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
|
||||
priv->content_changed = FALSE;
|
||||
priv->search_stopped = FALSE;
|
||||
|
||||
handled = gtk_widget_event (GTK_WIDGET (entry), event);
|
||||
|
||||
return handled && priv->content_changed && !priv->search_stopped ? GDK_EVENT_STOP : GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,9 @@ struct _GtkSearchEntryClass
|
||||
GtkEntryClass parent_class;
|
||||
|
||||
void (*search_changed) (GtkSearchEntry *entry);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (*_gtk_reserved1) (void);
|
||||
void (*_gtk_reserved2) (void);
|
||||
void (*_gtk_reserved3) (void);
|
||||
void (*next_match) (GtkSearchEntry *entry);
|
||||
void (*previous_match) (GtkSearchEntry *entry);
|
||||
void (*stop_search) (GtkSearchEntry *entry);
|
||||
};
|
||||
|
||||
GDK_AVAILABLE_IN_3_6
|
||||
@@ -69,6 +67,10 @@ GType gtk_search_entry_get_type (void) G_GNUC_CONST;
|
||||
GDK_AVAILABLE_IN_3_6
|
||||
GtkWidget* gtk_search_entry_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
gboolean gtk_search_entry_handle_event (GtkSearchEntry *entry,
|
||||
GdkEvent *event);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SEARCH_ENTRY_H__ */
|
||||
|
||||
@@ -3716,6 +3716,21 @@ gtk_window_get_destroy_with_parent (GtkWindow *window)
|
||||
return window->priv->destroy_with_parent;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_apply_hide_titlebar_when_maximized (GtkWindow *window)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
GdkWindow *gdk_window;
|
||||
gboolean setting;
|
||||
|
||||
setting = window->priv->hide_titlebar_when_maximized;
|
||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
|
||||
|
||||
if (GDK_IS_X11_WINDOW (gdk_window))
|
||||
gdk_x11_window_set_hide_titlebar_when_maximized (gdk_window, setting);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_window_set_hide_titlebar_when_maximized:
|
||||
* @window: a #GtkWindow
|
||||
@@ -3743,18 +3758,9 @@ gtk_window_set_hide_titlebar_when_maximized (GtkWindow *window,
|
||||
if (window->priv->hide_titlebar_when_maximized == setting)
|
||||
return;
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
{
|
||||
GdkWindow *gdk_window;
|
||||
|
||||
gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
|
||||
|
||||
if (GDK_IS_X11_WINDOW (gdk_window))
|
||||
gdk_x11_window_set_hide_titlebar_when_maximized (gdk_window, setting);
|
||||
}
|
||||
#endif
|
||||
|
||||
window->priv->hide_titlebar_when_maximized = setting;
|
||||
gtk_window_apply_hide_titlebar_when_maximized (window);
|
||||
|
||||
g_object_notify (G_OBJECT (window), "hide-titlebar-when-maximized");
|
||||
}
|
||||
|
||||
@@ -5972,8 +5978,7 @@ gtk_window_map (GtkWidget *widget)
|
||||
if (priv->type == GTK_WINDOW_TOPLEVEL)
|
||||
{
|
||||
gtk_window_set_theme_variant (window);
|
||||
gtk_window_set_hide_titlebar_when_maximized (window,
|
||||
priv->hide_titlebar_when_maximized);
|
||||
gtk_window_apply_hide_titlebar_when_maximized (window);
|
||||
}
|
||||
|
||||
/* No longer use the default settings */
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "gtkliststore.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -43,6 +44,7 @@ struct _GtkInspectorActionsPrivate
|
||||
GtkListStore *model;
|
||||
GHashTable *groups;
|
||||
GHashTable *iters;
|
||||
GtkWidget *object_title;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorActions, gtk_inspector_actions, GTK_TYPE_BOX)
|
||||
@@ -229,6 +231,13 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl,
|
||||
g_free (prefixes);
|
||||
}
|
||||
}
|
||||
|
||||
if (G_IS_OBJECT (object))
|
||||
{
|
||||
const gchar *title;
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -277,6 +286,7 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/actions.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, row_activated);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,15 @@
|
||||
</object>
|
||||
<template class="GtkInspectorActions" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "gtkbutton.h"
|
||||
#include "gtkdialog.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -49,6 +50,7 @@ struct _GtkInspectorClassesListPrivate
|
||||
{
|
||||
GtkListStore *model;
|
||||
GtkStyleContext *context;
|
||||
GtkWidget *object_title;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorClassesList, gtk_inspector_classes_list, GTK_TYPE_BOX)
|
||||
@@ -257,6 +259,7 @@ gtk_inspector_classes_list_set_object (GtkInspectorClassesList *cl,
|
||||
GHashTable *hash_context;
|
||||
GtkTreeIter tree_iter;
|
||||
GtkInspectorClassesListByContext *c;
|
||||
const gchar *title;
|
||||
|
||||
cleanup_context (cl);
|
||||
|
||||
@@ -272,6 +275,9 @@ gtk_inspector_classes_list_set_object (GtkInspectorClassesList *cl,
|
||||
|
||||
g_object_weak_ref (G_OBJECT (cl->priv->context), gtk_inspector_classes_list_remove_dead_object, cl);
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (cl->priv->object_title), title);
|
||||
|
||||
hash_context = get_hash_context (cl);
|
||||
if (hash_context)
|
||||
{
|
||||
@@ -313,6 +319,7 @@ gtk_inspector_classes_list_class_init (GtkInspectorClassesListClass *klass)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/classes-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorClassesList, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, add_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, restore_defaults_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, enabled_toggled);
|
||||
|
||||
@@ -10,23 +10,56 @@
|
||||
<template class="GtkInspectorClassesList" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">small-toolbar</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Add a class</property>
|
||||
<signal name="clicked" handler="add_clicked"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkButton">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-undo-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Restore defaults for this widget</property>
|
||||
<signal name="clicked" handler="restore_defaults_clicked"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-undo-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
#include "gtktextview.h"
|
||||
#include "gtkmessagedialog.h"
|
||||
#include "gtkfilechooserdialog.h"
|
||||
#include "gtktoggletoolbutton.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
#define GTK_INSPECTOR_CSS_EDITOR_TEXT "inspector-css-editor-text"
|
||||
#define GTK_INSPECTOR_CSS_EDITOR_PROVIDER "inspector-css-editor-provider"
|
||||
@@ -57,13 +58,13 @@ typedef struct
|
||||
|
||||
struct _GtkInspectorCssEditorPrivate
|
||||
{
|
||||
GtkWidget *toolbar;
|
||||
GtkWidget *view;
|
||||
GtkWidget *object_title;
|
||||
GtkTextBuffer *text;
|
||||
GtkCssProvider *provider;
|
||||
gboolean global;
|
||||
GtkStyleContext *context;
|
||||
GtkToggleToolButton *disable_button;
|
||||
GtkToggleButton *disable_button;
|
||||
guint timeout;
|
||||
};
|
||||
|
||||
@@ -102,10 +103,10 @@ set_initial_text (GtkInspectorCssEditor *ce)
|
||||
}
|
||||
|
||||
static void
|
||||
disable_toggled (GtkToggleToolButton *button,
|
||||
disable_toggled (GtkToggleButton *button,
|
||||
GtkInspectorCssEditor *ce)
|
||||
{
|
||||
if (gtk_toggle_tool_button_get_active (button))
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
{
|
||||
if (ce->priv->global)
|
||||
gtk_style_context_remove_provider_for_screen (gdk_screen_get_default (),
|
||||
@@ -187,7 +188,7 @@ save_response (GtkWidget *dialog,
|
||||
}
|
||||
|
||||
static void
|
||||
save_clicked (GtkToolButton *button,
|
||||
save_clicked (GtkButton *button,
|
||||
GtkInspectorCssEditor *ce)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
@@ -439,10 +440,10 @@ gtk_inspector_css_editor_class_init (GtkInspectorCssEditorClass *klass)
|
||||
TRUE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/css-editor.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, toolbar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, text);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, disable_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorCssEditor, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, disable_toggled);
|
||||
gtk_widget_class_bind_template_callback (widget_class, save_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_changed);
|
||||
@@ -463,6 +464,7 @@ gtk_inspector_css_editor_set_object (GtkInspectorCssEditor *ce,
|
||||
{
|
||||
gchar *text;
|
||||
GtkCssProvider *provider;
|
||||
const gchar *title;
|
||||
|
||||
g_return_if_fail (GTK_INSPECTOR_IS_CSS_EDITOR (ce));
|
||||
g_return_if_fail (!ce->priv->global);
|
||||
@@ -485,6 +487,9 @@ gtk_inspector_css_editor_set_object (GtkInspectorCssEditor *ce,
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (ce));
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (ce->priv->object_title), title);
|
||||
|
||||
ce->priv->context = gtk_widget_get_style_context (GTK_WIDGET (object));
|
||||
|
||||
provider = g_object_get_data (G_OBJECT (ce->priv->context), GTK_INSPECTOR_CSS_EDITOR_PROVIDER);
|
||||
|
||||
@@ -19,29 +19,56 @@
|
||||
<template class="GtkInspectorCssEditor" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">small-toolbar</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="disable_button">
|
||||
<object class="GtkToggleButton" id="disable_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">media-playback-pause-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Disable this custom CSS</property>
|
||||
<signal name="toggled" handler="disable_toggled"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">media-playback-pause-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="save_button">
|
||||
<object class="GtkButton" id="save_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">document-save-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Save the current CSS</property>
|
||||
<signal name="clicked" handler="save_clicked"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">document-save-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -22,13 +22,16 @@
|
||||
|
||||
#include "gtktreeview.h"
|
||||
#include "gtkcellrenderertext.h"
|
||||
#include "gtktoggletoolbutton.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
|
||||
struct _GtkInspectorDataListPrivate
|
||||
{
|
||||
GtkTreeModel *object;
|
||||
GtkTreeModel *types;
|
||||
GtkTreeView *view;
|
||||
GtkWidget *object_title;
|
||||
gboolean show_data;
|
||||
};
|
||||
|
||||
@@ -111,6 +114,8 @@ void
|
||||
gtk_inspector_data_list_set_object (GtkInspectorDataList *sl,
|
||||
GObject *object)
|
||||
{
|
||||
const gchar *title;
|
||||
|
||||
clear_view (sl);
|
||||
sl->priv->object = NULL;
|
||||
sl->priv->show_data = FALSE;
|
||||
@@ -121,6 +126,9 @@ gtk_inspector_data_list_set_object (GtkInspectorDataList *sl,
|
||||
return;
|
||||
}
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (sl));
|
||||
|
||||
sl->priv->object = GTK_TREE_MODEL (object);
|
||||
@@ -129,13 +137,13 @@ gtk_inspector_data_list_set_object (GtkInspectorDataList *sl,
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_show (GtkToggleToolButton *button,
|
||||
toggle_show (GtkToggleButton *button,
|
||||
GtkInspectorDataList *sl)
|
||||
{
|
||||
if (gtk_toggle_tool_button_get_active (button) == sl->priv->show_data)
|
||||
if (gtk_toggle_button_get_active (button) == sl->priv->show_data)
|
||||
return;
|
||||
|
||||
if (gtk_toggle_tool_button_get_active (button))
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
show_data (sl);
|
||||
else
|
||||
show_types (sl);
|
||||
@@ -148,6 +156,7 @@ gtk_inspector_data_list_class_init (GtkInspectorDataListClass *klass)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/data-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorDataList, view);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorDataList, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, toggle_show);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,35 @@
|
||||
<template class="GtkInspectorDataList" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">small-toolbar</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="show_button">
|
||||
<object class="GtkToggleButton" id="show_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">view-refresh-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Show data</property>
|
||||
<signal name="toggled" handler="toggle_show"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">view-refresh-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -39,7 +39,7 @@ struct _GtkInspectorGesturesPrivate
|
||||
{
|
||||
GtkSizeGroup *sizegroup;
|
||||
GObject *object;
|
||||
GtkWidget *object_tree;
|
||||
GtkInspectorObjectTree *object_tree;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorGestures, gtk_inspector_gestures, GTK_TYPE_BOX)
|
||||
@@ -51,7 +51,9 @@ gtk_inspector_gestures_init (GtkInspectorGestures *sl)
|
||||
sl->priv->sizegroup = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
g_object_set (sl,
|
||||
"orientation", GTK_ORIENTATION_VERTICAL,
|
||||
"margin", 60,
|
||||
"margin-start", 60,
|
||||
"margin-end", 60,
|
||||
"margin-bottom", 60,
|
||||
"spacing", 10,
|
||||
NULL);
|
||||
}
|
||||
@@ -92,8 +94,7 @@ row_activated (GtkListBox *box,
|
||||
GObject *gesture;
|
||||
|
||||
gesture = G_OBJECT (g_object_get_data (G_OBJECT (row), "gesture"));
|
||||
gtk_inspector_object_tree_select_object (GTK_INSPECTOR_OBJECT_TREE (sl->priv->object_tree),
|
||||
gesture);
|
||||
gtk_inspector_object_tree_select_object (sl->priv->object_tree, gesture);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -181,6 +182,8 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
|
||||
GHashTableIter iter;
|
||||
GList *list, *l;
|
||||
gint phase;
|
||||
const gchar *title;
|
||||
GtkWidget *label;
|
||||
|
||||
clear_all (sl);
|
||||
gtk_widget_hide (GTK_WIDGET (sl));
|
||||
@@ -188,6 +191,16 @@ gtk_inspector_gestures_set_object (GtkInspectorGestures *sl,
|
||||
if (!GTK_IS_WIDGET (object))
|
||||
return;
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
label = gtk_label_new (title);
|
||||
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_margin_top (label, 12);
|
||||
gtk_widget_set_margin_bottom (label, 30);
|
||||
gtk_widget_show (label);
|
||||
gtk_container_add (GTK_CONTAINER (sl), label);
|
||||
|
||||
hash = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
for (phase = GTK_PHASE_NONE; phase <= GTK_PHASE_TARGET; phase++)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "gtktreestore.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -35,6 +37,7 @@ enum
|
||||
struct _GtkInspectorMenuPrivate
|
||||
{
|
||||
GtkTreeStore *model;
|
||||
GtkWidget *object_title;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorMenu, gtk_inspector_menu, GTK_TYPE_BOX)
|
||||
@@ -130,6 +133,13 @@ gtk_inspector_menu_set_object (GtkInspectorMenu *sl,
|
||||
|
||||
if (G_IS_MENU_MODEL (object))
|
||||
add_menu (sl, G_MENU_MODEL (object), NULL);
|
||||
|
||||
if (G_IS_OBJECT (object))
|
||||
{
|
||||
const gchar *title;
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -139,6 +149,7 @@ gtk_inspector_menu_class_init (GtkInspectorMenuClass *klass)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/menu.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMenu, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMenu, object_title);
|
||||
}
|
||||
|
||||
// vim: set et sw=2 ts=2:
|
||||
|
||||
@@ -11,13 +11,21 @@
|
||||
</object>
|
||||
<template class="GtkInspectorMenu" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="hscrollbar-policy">automatic</property>
|
||||
<property name="vscrollbar-policy">always</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<child>
|
||||
<object class= "GtkTreeView">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -70,6 +70,7 @@ struct _GtkInspectorMiscInfoPrivate {
|
||||
GtkWidget *is_toplevel;
|
||||
GtkWidget *child_visible_row;
|
||||
GtkWidget *child_visible;
|
||||
GtkWidget *object_title;
|
||||
|
||||
guint update_source_id;
|
||||
gint64 last_frame;
|
||||
@@ -169,7 +170,6 @@ disconnect_each_other (gpointer still_alive,
|
||||
static void
|
||||
show_object (GtkInspectorMiscInfo *sl,
|
||||
GObject *object,
|
||||
const gchar *name,
|
||||
const gchar *tab)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
@@ -183,7 +183,7 @@ show_object (GtkInspectorMiscInfo *sl,
|
||||
gtk_inspector_object_tree_find_object (sl->priv->object_tree, G_OBJECT (gtk_widget_get_parent (GTK_WIDGET (object))), &iter))
|
||||
|
||||
{
|
||||
gtk_inspector_object_tree_append_object (sl->priv->object_tree, object, &iter, name);
|
||||
gtk_inspector_object_tree_append_object (sl->priv->object_tree, object, &iter, NULL);
|
||||
gtk_inspector_object_tree_select_object (sl->priv->object_tree, object);
|
||||
}
|
||||
else
|
||||
@@ -221,7 +221,7 @@ show_default_widget (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
update_default_widget (sl);
|
||||
widget = gtk_window_get_default_widget (GTK_WINDOW (sl->priv->object));
|
||||
if (widget)
|
||||
show_object (sl, G_OBJECT (widget), NULL, "properties");
|
||||
show_object (sl, G_OBJECT (widget), "properties");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -258,7 +258,7 @@ show_focus_widget (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
|
||||
widget = gtk_window_get_focus (GTK_WINDOW (sl->priv->object));
|
||||
if (widget)
|
||||
show_object (sl, G_OBJECT (widget), NULL, "properties");
|
||||
show_object (sl, G_OBJECT (widget), "properties");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -268,7 +268,7 @@ show_mnemonic_label (GtkWidget *button, GtkInspectorMiscInfo *sl)
|
||||
|
||||
widget = g_object_get_data (G_OBJECT (button), "mnemonic-label");
|
||||
if (widget)
|
||||
show_object (sl, G_OBJECT (widget), NULL, "properties");
|
||||
show_object (sl, G_OBJECT (widget), "properties");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -373,6 +373,8 @@ void
|
||||
gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
|
||||
GObject *object)
|
||||
{
|
||||
const gchar *title;
|
||||
|
||||
if (sl->priv->object)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (sl->priv->object, state_flags_changed, sl);
|
||||
@@ -389,6 +391,9 @@ gtk_inspector_misc_info_set_object (GtkInspectorMiscInfo *sl,
|
||||
g_object_weak_ref (G_OBJECT (sl), disconnect_each_other, object);
|
||||
g_object_weak_ref (object, disconnect_each_other, sl);
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
|
||||
|
||||
if (GTK_IS_WIDGET (object))
|
||||
{
|
||||
gtk_widget_show (sl->priv->refcount_row);
|
||||
@@ -540,7 +545,7 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
|
||||
widget_class->unmap = unmap;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_OBJECT_TREE,
|
||||
g_param_spec_object ("object-tree", "Object Tree", "Obect tree",
|
||||
g_param_spec_object ("object-tree", "Object Tree", "Object tree",
|
||||
GTK_TYPE_WIDGET, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/misc-info.ui");
|
||||
@@ -578,6 +583,7 @@ gtk_inspector_misc_info_class_init (GtkInspectorMiscInfoClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, is_toplevel);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible_row);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, child_visible);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorMiscInfo, object_title);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, show_default_widget);
|
||||
gtk_widget_class_bind_template_callback (widget_class, show_focus_widget);
|
||||
|
||||
@@ -5,8 +5,19 @@
|
||||
<object class="GtkBox">
|
||||
<property name="visible">true</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="margin">60</property>
|
||||
<property name="margin-start">60</property>
|
||||
<property name="margin-end">60</property>
|
||||
<property name="margin-bottom">60</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">30</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "gtktreeselection.h"
|
||||
#include "gtktreestore.h"
|
||||
#include "gtktreeview.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
|
||||
enum
|
||||
@@ -39,6 +40,7 @@ struct _GtkInspectorObjectHierarchyPrivate
|
||||
{
|
||||
GtkTreeStore *model;
|
||||
GtkTreeView *tree;
|
||||
GtkWidget *object_title;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
|
||||
@@ -58,6 +60,7 @@ gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *kla
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/object-hierarchy.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, object_title);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -72,6 +75,7 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
|
||||
GHashTableIter hit;
|
||||
GType *ifaces;
|
||||
gint i;
|
||||
const gchar *title;
|
||||
|
||||
gtk_tree_store_clear (oh->priv->model);
|
||||
|
||||
@@ -80,7 +84,10 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
|
||||
|
||||
interfaces = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
type = ((GTypeInstance*)object)->g_class->g_type;
|
||||
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
|
||||
|
||||
do
|
||||
{
|
||||
class_name = g_type_name (type);
|
||||
|
||||
@@ -6,7 +6,16 @@
|
||||
</columns>
|
||||
</object>
|
||||
<template class="GtkInspectorObjectHierarchy" parent="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -407,6 +407,14 @@ previous_match (GtkButton *button,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
stop_search (GtkWidget *entry,
|
||||
GtkInspectorObjectTree *wt)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (wt->priv->search_entry), "");
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (wt->priv->search_bar), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_inspector_object_tree_init (GtkInspectorObjectTree *wt)
|
||||
{
|
||||
@@ -492,6 +500,7 @@ gtk_inspector_object_tree_class_init (GtkInspectorObjectTreeClass *klass)
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_search_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, next_match);
|
||||
gtk_widget_class_bind_template_callback (widget_class, previous_match);
|
||||
gtk_widget_class_bind_template_callback (widget_class, stop_search);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@@ -615,6 +624,17 @@ gtk_inspector_object_tree_append_object (GtkInspectorObjectTree *wt,
|
||||
SENSITIVE, mapped,
|
||||
-1);
|
||||
|
||||
if (name && *name)
|
||||
{
|
||||
gchar *title;
|
||||
title = g_strconcat (class_name, " — ", name, NULL);
|
||||
g_object_set_data_full (object, "gtk-inspector-object-title", title, g_free);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_object_set_data (object, "gtk-inspector-object-title", (gpointer)class_name);
|
||||
}
|
||||
|
||||
g_free (classes);
|
||||
|
||||
od = g_new0 (ObjectData, 1);
|
||||
@@ -790,6 +810,19 @@ gtk_inspector_object_tree_append_object (GtkInspectorObjectTree *wt,
|
||||
gtk_inspector_object_tree_append_object (wt, clock, &iter, "frame-clock");
|
||||
}
|
||||
}
|
||||
|
||||
if (GTK_IS_APPLICATION (object))
|
||||
{
|
||||
GObject *menu;
|
||||
|
||||
menu = (GObject *)gtk_application_get_app_menu (GTK_APPLICATION (object));
|
||||
if (menu)
|
||||
gtk_inspector_object_tree_append_object (wt, menu, &iter, "app-menu");
|
||||
|
||||
menu = (GObject *)gtk_application_get_menubar (GTK_APPLICATION (object));
|
||||
if (menu)
|
||||
gtk_inspector_object_tree_append_object (wt, menu, &iter, "menubar");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<signal name="search-changed" handler="on_search_changed"/>
|
||||
<signal name="next-match" handler="next_match"/>
|
||||
<signal name="previous-match" handler="previous_match"/>
|
||||
<signal name="stop-search" handler="stop_search"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
#include "gtktreeview.h"
|
||||
#include "gtktreeselection.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtksearchbar.h"
|
||||
#include "gtksearchentry.h"
|
||||
#include "gtklabel.h"
|
||||
#include "gtkstack.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -64,46 +66,34 @@ struct _GtkInspectorPropListPrivate
|
||||
GtkTreeViewColumn *attribute_column;
|
||||
GtkWidget *tree;
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *search_bar;
|
||||
GtkWidget *search_stack;
|
||||
GtkWidget *object_title;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorPropList, gtk_inspector_prop_list, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
search_close_clicked (GtkWidget *button,
|
||||
GtkInspectorPropList *pl)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (pl->priv->search_entry), "");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
key_press_event (GtkWidget *window,
|
||||
GdkEvent *event,
|
||||
GtkInspectorPropList *pl)
|
||||
{
|
||||
if (gtk_widget_get_mapped (GTK_WIDGET (pl)))
|
||||
{
|
||||
if (event->key.keyval == GDK_KEY_Return ||
|
||||
event->key.keyval == GDK_KEY_ISO_Enter ||
|
||||
event->key.keyval == GDK_KEY_KP_Enter)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pl->priv->tree));
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
{
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
gtk_tree_view_row_activated (GTK_TREE_VIEW (pl->priv->tree),
|
||||
path,
|
||||
pl->priv->name_column);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
else
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (pl->priv->search_bar), event);
|
||||
}
|
||||
else
|
||||
if (!gtk_widget_get_mapped (GTK_WIDGET (pl)))
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
|
||||
if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (pl->priv->search_entry), event))
|
||||
{
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "search");
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -130,8 +120,6 @@ gtk_inspector_prop_list_init (GtkInspectorPropList *pl)
|
||||
g_str_equal,
|
||||
NULL,
|
||||
(GDestroyNotify) gtk_tree_iter_free);
|
||||
|
||||
g_signal_connect (pl, "hierarchy-changed", G_CALLBACK (hierarchy_changed), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -283,8 +271,11 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, attribute_column);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, tree);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, search_entry);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, search_bar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, search_stack);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorPropList, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, row_activated);
|
||||
gtk_widget_class_bind_template_callback (widget_class, search_close_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, hierarchy_changed);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -392,6 +383,7 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
||||
GParamSpec **props;
|
||||
guint num_properties;
|
||||
guint i;
|
||||
const gchar *title;
|
||||
|
||||
if (!object)
|
||||
return FALSE;
|
||||
@@ -407,6 +399,12 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (pl->priv->object_title), title);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (pl->priv->search_entry), "");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
||||
|
||||
if (pl->priv->child_properties)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
@@ -12,15 +12,60 @@
|
||||
</object>
|
||||
<template class="GtkInspectorPropList" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<signal name="hierarchy-changed" handler="hierarchy_changed"/>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="search_bar">
|
||||
<object class="GtkStack" id="search_stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<property name="hhomogeneous">True</property>
|
||||
<property name="vhomogeneous">True</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<object class="GtkBox" id="search_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin">6</property>
|
||||
<child type="center">
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<signal name="stop-search" handler="search_close_clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="search_close_button">
|
||||
<property name="visible">True</property>
|
||||
<signal name="clicked" handler="search_close_clicked"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">search</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">title</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "gtktreestore.h"
|
||||
#include "gtktreeview.h"
|
||||
#include "gtkwidgetpath.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
|
||||
enum
|
||||
@@ -35,6 +36,7 @@ struct _GtkInspectorSelectorPrivate
|
||||
{
|
||||
GtkTreeStore *model;
|
||||
GtkTreeView *tree;
|
||||
GtkWidget *object_title;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorSelector, gtk_inspector_selector, GTK_TYPE_BOX)
|
||||
@@ -54,6 +56,7 @@ gtk_inspector_selector_class_init (GtkInspectorSelectorClass *klass)
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/selector.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, tree);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, object_title);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -64,6 +67,7 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
|
||||
gint i;
|
||||
GtkWidget *widget;
|
||||
gchar *path, **words;
|
||||
const gchar *title;
|
||||
|
||||
gtk_tree_store_clear (oh->priv->model);
|
||||
|
||||
@@ -73,6 +77,9 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
|
||||
return;
|
||||
}
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
|
||||
|
||||
widget = GTK_WIDGET (object);
|
||||
|
||||
path = gtk_widget_path_to_string (gtk_widget_get_path (widget));
|
||||
|
||||
@@ -6,7 +6,16 @@
|
||||
</columns>
|
||||
</object>
|
||||
<template class="GtkInspectorSelector" parent="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin-top">12</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
#include "gtkcellrenderer.h"
|
||||
#include "gtkliststore.h"
|
||||
#include "gtktextbuffer.h"
|
||||
#include "gtktoggletoolbutton.h"
|
||||
#include "gtktogglebutton.h"
|
||||
#include "gtktreeviewcolumn.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -45,6 +46,7 @@ struct _GtkInspectorSignalsListPrivate
|
||||
GtkWidget *log_win;
|
||||
GtkWidget *trace_button;
|
||||
GtkWidget *clear_button;
|
||||
GtkWidget *object_title;
|
||||
GtkTreeViewColumn *count_column;
|
||||
GtkCellRenderer *count_renderer;
|
||||
GObject *object;
|
||||
@@ -148,7 +150,14 @@ gtk_inspector_signals_list_set_object (GtkInspectorSignalsList *sl,
|
||||
sl->priv->object = object;
|
||||
|
||||
if (object)
|
||||
read_signals_from_object (sl, object);
|
||||
{
|
||||
const gchar *title;
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (sl->priv->object_title), title);
|
||||
|
||||
read_signals_from_object (sl, object);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -185,8 +194,6 @@ gtk_inspector_signals_list_init (GtkInspectorSignalsList *sl)
|
||||
sl->priv = gtk_inspector_signals_list_get_instance_private (sl);
|
||||
gtk_widget_init_template (GTK_WIDGET (sl));
|
||||
|
||||
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (sl->priv->clear_button), "edit-clear-symbolic");
|
||||
|
||||
gtk_tree_view_column_set_cell_data_func (sl->priv->count_column,
|
||||
sl->priv->count_renderer,
|
||||
render_count,
|
||||
@@ -295,18 +302,18 @@ stop_tracing (GtkInspectorSignalsList *sl)
|
||||
{
|
||||
sl->priv->tracing = FALSE;
|
||||
gtk_tree_model_foreach (GTK_TREE_MODEL (sl->priv->model), stop_tracing_cb, sl);
|
||||
gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (sl->priv->trace_button), FALSE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sl->priv->trace_button), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
toggle_tracing (GtkToggleToolButton *button, GtkInspectorSignalsList *sl)
|
||||
toggle_tracing (GtkToggleButton *button, GtkInspectorSignalsList *sl)
|
||||
{
|
||||
if (gtk_toggle_tool_button_get_active (button) == sl->priv->tracing)
|
||||
if (gtk_toggle_button_get_active (button) == sl->priv->tracing)
|
||||
return;
|
||||
|
||||
//gtk_widget_show (sl->priv->log_win);
|
||||
|
||||
if (gtk_toggle_tool_button_get_active (button))
|
||||
if (gtk_toggle_button_get_active (button))
|
||||
start_tracing (sl);
|
||||
else
|
||||
stop_tracing (sl);
|
||||
@@ -323,7 +330,7 @@ clear_log_cb (GtkTreeModel *model,
|
||||
}
|
||||
|
||||
static void
|
||||
clear_log (GtkToolButton *button, GtkInspectorSignalsList *sl)
|
||||
clear_log (GtkButton *button, GtkInspectorSignalsList *sl)
|
||||
{
|
||||
gtk_text_buffer_set_text (sl->priv->text, "", -1);
|
||||
|
||||
@@ -344,6 +351,7 @@ gtk_inspector_signals_list_class_init (GtkInspectorSignalsListClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, count_renderer);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, trace_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, clear_button);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSignalsList, object_title);
|
||||
gtk_widget_class_bind_template_callback (widget_class, toggle_tracing);
|
||||
gtk_widget_class_bind_template_callback (widget_class, clear_log);
|
||||
}
|
||||
|
||||
@@ -20,22 +20,56 @@
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkToolbar" id="toolbar">
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-size">small-toolbar</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin">6</property>
|
||||
<child>
|
||||
<object class="GtkToggleToolButton" id="trace_button">
|
||||
<object class="GtkToggleButton" id="trace_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">media-record-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Trace signal emissions on this object</property>
|
||||
<signal name="toggled" handler="toggle_tracing"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">media-record-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="clear_button">
|
||||
<object class="GtkButton" id="clear_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="tooltip-text" translatable="yes">Clear log</property>
|
||||
<signal name="clicked" handler="clear_log"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-clear-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -215,6 +215,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sl), frame);
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_VIEW);
|
||||
gtk_container_add (GTK_CONTAINER (frame), box);
|
||||
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
@@ -273,6 +274,8 @@ gtk_inspector_size_groups_set_object (GtkInspectorSizeGroups *sl,
|
||||
GObject *object)
|
||||
{
|
||||
GSList *groups, *l;
|
||||
const gchar *title;
|
||||
GtkWidget *label;
|
||||
|
||||
clear_view (sl);
|
||||
|
||||
@@ -282,6 +285,16 @@ gtk_inspector_size_groups_set_object (GtkInspectorSizeGroups *sl,
|
||||
return;
|
||||
}
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
label = gtk_label_new (title);
|
||||
|
||||
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_margin_top (label, 12);
|
||||
gtk_widget_set_margin_bottom (label, 30);
|
||||
gtk_widget_show (label);
|
||||
gtk_container_add (GTK_CONTAINER (sl), label);
|
||||
|
||||
groups = _gtk_widget_get_sizegroups (GTK_WIDGET (object));
|
||||
if (groups)
|
||||
gtk_widget_show (GTK_WIDGET (sl));
|
||||
@@ -297,8 +310,10 @@ gtk_inspector_size_groups_init (GtkInspectorSizeGroups *sl)
|
||||
{
|
||||
g_object_set (sl,
|
||||
"orientation", GTK_ORIENTATION_VERTICAL,
|
||||
"margin", 40,
|
||||
"spacing", 20,
|
||||
"margin-start", 60,
|
||||
"margin-end", 60,
|
||||
"margin-bottom", 60,
|
||||
"spacing", 10,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
#include "gtksettings.h"
|
||||
#include "gtktreeview.h"
|
||||
#include "gtktreeselection.h"
|
||||
#include "gtksearchbar.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtksearchentry.h"
|
||||
#include "gtklabel.h"
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -48,49 +50,37 @@ struct _GtkInspectorStylePropListPrivate
|
||||
GtkListStore *model;
|
||||
GtkWidget *widget;
|
||||
GtkWidget *tree;
|
||||
GtkWidget *search_bar;
|
||||
GtkWidget *search_entry;
|
||||
GtkWidget *search_stack;
|
||||
GtkWidget *object_title;
|
||||
GHashTable *prop_iters;
|
||||
GtkTreeViewColumn *name_column;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorStylePropList, gtk_inspector_style_prop_list, GTK_TYPE_BOX)
|
||||
|
||||
static void
|
||||
search_close_clicked (GtkWidget *button,
|
||||
GtkInspectorStylePropList *pl)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (pl->priv->search_entry), "");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "title");
|
||||
}
|
||||
|
||||
static gboolean
|
||||
key_press_event (GtkWidget *window,
|
||||
GdkEvent *event,
|
||||
GtkInspectorStylePropList *pl)
|
||||
{
|
||||
if (gtk_widget_get_mapped (GTK_WIDGET (pl)))
|
||||
{
|
||||
if (event->key.keyval == GDK_KEY_Return ||
|
||||
event->key.keyval == GDK_KEY_ISO_Enter ||
|
||||
event->key.keyval == GDK_KEY_KP_Enter)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath *path;
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pl->priv->tree));
|
||||
if (gtk_tree_selection_get_selected (selection, &model, &iter))
|
||||
{
|
||||
path = gtk_tree_model_get_path (model, &iter);
|
||||
gtk_tree_view_row_activated (GTK_TREE_VIEW (pl->priv->tree),
|
||||
path,
|
||||
pl->priv->name_column);
|
||||
gtk_tree_path_free (path);
|
||||
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
else
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (pl->priv->search_bar), event);
|
||||
}
|
||||
else
|
||||
if (!gtk_widget_get_mapped (GTK_WIDGET (pl)))
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
|
||||
if (gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (pl->priv->search_entry), event))
|
||||
{
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (pl->priv->search_stack), "search");
|
||||
return GDK_EVENT_STOP;
|
||||
}
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -123,8 +113,6 @@ gtk_inspector_style_prop_list_init (GtkInspectorStylePropList *pl)
|
||||
NULL,
|
||||
(GDestroyNotify) gtk_tree_iter_free);
|
||||
|
||||
g_signal_connect (pl, "hierarchy-changed", G_CALLBACK (hierarchy_changed), NULL);
|
||||
|
||||
for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
|
||||
{
|
||||
GtkCssStyleProperty *prop;
|
||||
@@ -192,9 +180,12 @@ gtk_inspector_style_prop_list_class_init (GtkInspectorStylePropListClass *klass)
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/style-prop-list.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, model);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, tree);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, search_bar);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, search_stack);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, search_entry);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, object_title);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorStylePropList, name_column);
|
||||
gtk_widget_class_bind_template_callback (widget_class, search_close_clicked);
|
||||
gtk_widget_class_bind_template_callback (widget_class, hierarchy_changed);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
@@ -369,6 +360,8 @@ void
|
||||
gtk_inspector_style_prop_list_set_object (GtkInspectorStylePropList *self,
|
||||
GObject *object)
|
||||
{
|
||||
const gchar *title;
|
||||
|
||||
if (self->priv->widget == (GtkWidget *)object)
|
||||
{
|
||||
gtk_widget_hide (GTK_WIDGET (self));
|
||||
@@ -388,6 +381,12 @@ gtk_inspector_style_prop_list_set_object (GtkInspectorStylePropList *self,
|
||||
return;
|
||||
}
|
||||
|
||||
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
|
||||
gtk_label_set_label (GTK_LABEL (self->priv->object_title), title);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (self->priv->search_entry), "");
|
||||
gtk_stack_set_visible_child_name (GTK_STACK (self->priv->search_stack), "title");
|
||||
|
||||
self->priv->widget = (GtkWidget *)object;
|
||||
g_object_weak_ref (G_OBJECT (self), disconnect_each_other, object);
|
||||
g_object_weak_ref (G_OBJECT (object), disconnect_each_other, self);
|
||||
|
||||
@@ -11,15 +11,60 @@
|
||||
</object>
|
||||
<template class="GtkInspectorStylePropList" parent="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<signal name="hierarchy-changed" handler="hierarchy_changed"/>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="search_bar">
|
||||
<object class="GtkStack" id="search_stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-close-button">True</property>
|
||||
<property name="hhomogeneous">True</property>
|
||||
<property name="vhomogeneous">True</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<object class="GtkBox" id="search_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="margin">6</property>
|
||||
<child type="center">
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="max-width-chars">40</property>
|
||||
<signal name="stop-search" handler="search_close_clicked"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="search_close_button">
|
||||
<property name="visible">True</property>
|
||||
<signal name="clicked" handler="search_close_clicked"/>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">search</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="object_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">10</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="name">title</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -17,7 +17,7 @@ window1
|
||||
alpha: 1
|
||||
button1
|
||||
"push button"
|
||||
parent: center_box
|
||||
parent: box
|
||||
index: 0
|
||||
name: Start 1
|
||||
state: enabled focusable sensitive showing visible
|
||||
@@ -33,7 +33,7 @@ window1
|
||||
action 0 description: Clicks the button
|
||||
button2
|
||||
"push button"
|
||||
parent: center_box
|
||||
parent: box
|
||||
index: 1
|
||||
name: Start 2
|
||||
state: enabled focusable sensitive showing visible
|
||||
@@ -49,7 +49,7 @@ window1
|
||||
action 0 description: Clicks the button
|
||||
button5
|
||||
"push button"
|
||||
parent: center_box
|
||||
parent: box
|
||||
index: 2
|
||||
name: Center
|
||||
state: enabled focusable sensitive showing visible
|
||||
@@ -65,7 +65,7 @@ window1
|
||||
action 0 description: Clicks the button
|
||||
button4
|
||||
"push button"
|
||||
parent: center_box
|
||||
parent: box
|
||||
index: 3
|
||||
name: End 2
|
||||
state: enabled focusable sensitive showing visible
|
||||
@@ -81,7 +81,7 @@ window1
|
||||
action 0 description: Clicks the button
|
||||
button3
|
||||
"push button"
|
||||
parent: center_box
|
||||
parent: box
|
||||
index: 4
|
||||
name: End 1
|
||||
state: enabled focusable sensitive showing visible
|
||||
|
||||
@@ -602,6 +602,10 @@ test_type (gconstpointer data)
|
||||
g_str_equal (pspec->name, "visible-child-name"))
|
||||
continue;
|
||||
|
||||
if (pspec->owner_type == GTK_TYPE_POPOVER_MENU &&
|
||||
g_str_equal (pspec->name, "visible-submenu"))
|
||||
continue;
|
||||
|
||||
if (pspec->owner_type == GTK_TYPE_TEXT_VIEW &&
|
||||
g_str_equal (pspec->name, "im-module"))
|
||||
continue;
|
||||
@@ -627,6 +631,10 @@ test_type (gconstpointer data)
|
||||
g_str_equal (pspec->name, "use-header-bar"))
|
||||
continue;
|
||||
|
||||
if (type == GTK_TYPE_MODEL_BUTTON &&
|
||||
pspec->owner_type == GTK_TYPE_BUTTON)
|
||||
continue;
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_print ("Property %s.%s\n", g_type_name (pspec->owner_type), pspec->name);
|
||||
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif
|
||||
|
||||
static gboolean interactive = FALSE;
|
||||
|
||||
static gboolean
|
||||
@@ -336,6 +341,73 @@ test_show_hide3 (void)
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_map_event (GtkWidget *window)
|
||||
{
|
||||
gtk_main_quit ();
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
test_hide_titlebar_when_maximized (void)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
g_test_bug ("740287");
|
||||
|
||||
/* test that hide-titlebar-when-maximized gets set appropriately
|
||||
* on the window, if it's set before the window is realized.
|
||||
*/
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
g_signal_connect (window,
|
||||
"map-event",
|
||||
G_CALLBACK (on_map_event),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
g_timeout_add (100, stop_main, NULL);
|
||||
gtk_main ();
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
{
|
||||
Atom type;
|
||||
gint format;
|
||||
gulong nitems;
|
||||
gulong bytes_after;
|
||||
gulong *hide = NULL;
|
||||
|
||||
XGetWindowProperty (gdk_x11_get_default_xdisplay (),
|
||||
GDK_WINDOW_XID (gtk_widget_get_window (window)),
|
||||
gdk_x11_get_xatom_by_name ("_GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED"),
|
||||
0,
|
||||
G_MAXLONG,
|
||||
False,
|
||||
XA_CARDINAL,
|
||||
&type,
|
||||
&format,
|
||||
&nitems,
|
||||
&bytes_after,
|
||||
(guchar **) &hide);
|
||||
|
||||
g_assert_cmpint (type, !=, None);
|
||||
g_assert_cmpint (type, ==, XA_CARDINAL);
|
||||
g_assert_cmpint (format, ==, 32);
|
||||
g_assert_cmpint (nitems, ==, 1);
|
||||
g_assert_cmpint (hide[0], ==, 1);
|
||||
|
||||
XFree (hide);
|
||||
}
|
||||
#endif
|
||||
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -356,6 +428,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/window/show-hide", test_show_hide);
|
||||
g_test_add_func ("/window/show-hide2", test_show_hide2);
|
||||
g_test_add_func ("/window/show-hide3", test_show_hide3);
|
||||
g_test_add_func ("/window/hide-titlebar-when-maximized", test_hide_titlebar_when_maximized);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user