forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Adwaita: visible focus outline for color swatches See merge request GNOME/gtk!1678
This commit is contained in:
commit
1dfd514f7f
@ -104,6 +104,10 @@
|
||||
<file>gtkfishbowl.c</file>
|
||||
<file>gtkfishbowl.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/gears">
|
||||
<file>gtkgears.c</file>
|
||||
<file>gtkgears.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/iconscroll">
|
||||
<file>iconscroll.ui</file>
|
||||
</gresource>
|
||||
@ -176,6 +180,7 @@
|
||||
<file>font_features.c</file>
|
||||
<file>fontplane.c</file>
|
||||
<file>fontrendering.c</file>
|
||||
<file>gears.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>headerbar.c</file>
|
||||
|
137
demos/gtk-demo/gears.c
Normal file
137
demos/gtk-demo/gears.c
Normal file
@ -0,0 +1,137 @@
|
||||
/* OpenGL/Gears
|
||||
*
|
||||
* This is a classic OpenGL demo, running in a GtkGLArea.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkgears.h"
|
||||
|
||||
/************************************************************************
|
||||
* DEMO CODE *
|
||||
************************************************************************/
|
||||
|
||||
static void
|
||||
on_axis_value_change (GtkAdjustment *adjustment,
|
||||
gpointer data)
|
||||
{
|
||||
GtkGears *gears = GTK_GEARS (data);
|
||||
int axis = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (adjustment), "axis"));
|
||||
|
||||
gtk_gears_set_axis (gears, axis, gtk_adjustment_get_value (adjustment));
|
||||
}
|
||||
|
||||
|
||||
static GtkWidget *
|
||||
create_axis_slider (GtkGears *gears,
|
||||
int axis)
|
||||
{
|
||||
GtkWidget *box, *label, *slider;
|
||||
GtkAdjustment *adj;
|
||||
const char *text;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
|
||||
switch (axis)
|
||||
{
|
||||
case GTK_GEARS_X_AXIS:
|
||||
text = "X";
|
||||
break;
|
||||
|
||||
case GTK_GEARS_Y_AXIS:
|
||||
text = "Y";
|
||||
break;
|
||||
|
||||
case GTK_GEARS_Z_AXIS:
|
||||
text = "Z";
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
label = gtk_label_new (text);
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
|
||||
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
|
||||
g_signal_connect (adj, "value-changed",
|
||||
G_CALLBACK (on_axis_value_change),
|
||||
gears);
|
||||
slider = gtk_scale_new (GTK_ORIENTATION_VERTICAL, adj);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (box), slider);
|
||||
gtk_widget_set_vexpand (slider, TRUE);
|
||||
gtk_widget_show (slider);
|
||||
|
||||
gtk_widget_show (box);
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_gears (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
GtkWidget *box, *hbox, *fps_label, *gears, *overlay, *frame;
|
||||
int i;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Gears");
|
||||
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 640, 640);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
overlay = gtk_overlay_new ();
|
||||
gtk_widget_set_margin_start (overlay, 12);
|
||||
gtk_widget_set_margin_end (overlay, 12);
|
||||
gtk_widget_set_margin_top (overlay, 12);
|
||||
gtk_widget_set_margin_bottom (overlay, 12);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), overlay);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_widget_set_halign (frame, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (frame, GTK_ALIGN_START);
|
||||
gtk_widget_add_css_class (frame, "app-notification");
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), frame);
|
||||
|
||||
fps_label = gtk_label_new ("");
|
||||
gtk_widget_set_halign (fps_label, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (frame), fps_label);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (overlay), box);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (box), 6);
|
||||
gtk_container_add (GTK_CONTAINER (box), hbox);
|
||||
|
||||
gears = gtk_gears_new ();
|
||||
gtk_widget_set_hexpand (gears, TRUE);
|
||||
gtk_widget_set_vexpand (gears, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), gears);
|
||||
|
||||
for (i = 0; i < GTK_GEARS_N_AXIS; i++)
|
||||
gtk_container_add (GTK_CONTAINER (hbox), create_axis_slider (GTK_GEARS (gears), i));
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE);
|
||||
gtk_box_set_spacing (GTK_BOX (hbox), 6);
|
||||
gtk_container_add (GTK_CONTAINER (box), hbox);
|
||||
|
||||
gtk_gears_set_fps_label (GTK_GEARS (gears), GTK_LABEL (fps_label));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/* OpenGL Area
|
||||
/* OpenGL/OpenGL Area
|
||||
*
|
||||
* GtkGLArea is a widget that allows custom drawing using OpenGL calls.
|
||||
*/
|
||||
|
@ -28,6 +28,7 @@ demos = files([
|
||||
'fishbowl.c',
|
||||
'fixed.c',
|
||||
'fontrendering.c',
|
||||
'gears.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
'headerbar.c',
|
||||
|
@ -7915,7 +7915,7 @@ update_cursor (GtkWindow *toplevel,
|
||||
|
||||
surface = gtk_native_get_surface (gtk_widget_get_native (target));
|
||||
|
||||
if (grab_widget && !gtk_widget_is_ancestor (target, grab_widget))
|
||||
if (grab_widget && !gtk_widget_is_ancestor (target, grab_widget) && target != grab_widget)
|
||||
{
|
||||
/* Outside the grab widget, cursor stays to whatever the grab
|
||||
* widget says.
|
||||
@ -7932,9 +7932,6 @@ update_cursor (GtkWindow *toplevel,
|
||||
*/
|
||||
while (target)
|
||||
{
|
||||
if (grab_widget && target == grab_widget)
|
||||
break;
|
||||
|
||||
/* Don't inherit cursors across surfaces */
|
||||
if (surface != gtk_native_get_surface (gtk_widget_get_native (target)))
|
||||
break;
|
||||
@ -7947,6 +7944,9 @@ update_cursor (GtkWindow *toplevel,
|
||||
if (cursor)
|
||||
break;
|
||||
|
||||
if (grab_widget && target == grab_widget)
|
||||
break;
|
||||
|
||||
target = _gtk_widget_get_parent (target);
|
||||
}
|
||||
}
|
||||
|
@ -3978,6 +3978,12 @@ colorswatch {
|
||||
}
|
||||
}
|
||||
|
||||
&:focus(visible) {
|
||||
outline-offset: -2px;
|
||||
outline-width: 2px;
|
||||
outline-style: solid;
|
||||
}
|
||||
|
||||
&:drop(active) {
|
||||
box-shadow: none;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user