[gimp/gtk3-port: 304/386] libgimp: undeprecate all GimpFooSelectButton classes
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 304/386] libgimp: undeprecate all GimpFooSelectButton classes
- Date: Wed, 9 May 2018 09:47:52 +0000 (UTC)
commit 0b089f6d99cdde43af86332d34d79916a7b56d56
Author: Michael Natterer <mitch gimp org>
Date: Wed May 2 21:23:33 2018 +0200
libgimp: undeprecate all GimpFooSelectButton classes
libgimp/gimpbrushselectbutton.c | 25 +++++++++----------------
libgimp/gimpfontselectbutton.c | 4 ----
libgimp/gimpgradientselectbutton.c | 4 ----
libgimp/gimppaletteselectbutton.c | 4 ----
libgimp/gimppatternselectbutton.c | 25 +++++++++----------------
5 files changed, 18 insertions(+), 44 deletions(-)
---
diff --git a/libgimp/gimpbrushselectbutton.c b/libgimp/gimpbrushselectbutton.c
index b98e02c..1628ccb 100644
--- a/libgimp/gimpbrushselectbutton.c
+++ b/libgimp/gimpbrushselectbutton.c
@@ -776,11 +776,10 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
GimpBrushSelectButtonPrivate *priv;
GtkWidget *frame;
GtkWidget *preview;
- GdkScreen *screen;
+ GdkMonitor *monitor;
+ GdkRectangle workarea;
gint x_org;
gint y_org;
- gint scr_w;
- gint scr_h;
priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (button);
@@ -790,11 +789,10 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
if (priv->width <= CELL_SIZE && priv->height <= CELL_SIZE)
return;
- screen = gtk_widget_get_screen (GTK_WIDGET (button));
-
priv->popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (priv->popup), GDK_WINDOW_TYPE_HINT_DND);
- gtk_window_set_screen (GTK_WINDOW (priv->popup), screen);
+ gtk_window_set_screen (GTK_WINDOW (priv->popup),
+ gtk_widget_get_screen (GTK_WIDGET (button)));
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
@@ -810,15 +808,14 @@ gimp_brush_select_button_open_popup (GimpBrushSelectButton *button,
gdk_window_get_origin (gtk_widget_get_window (priv->preview),
&x_org, &y_org);
- scr_w = gdk_screen_get_width (screen);
- scr_h = gdk_screen_get_height (screen);
+ monitor = gimp_widget_get_monitor (GTK_WIDGET (button));
+ gdk_monitor_get_workarea (monitor, &workarea);
x = x_org + x - (priv->width / 2);
y = y_org + y - (priv->height / 2);
- x = (x < 0) ? 0 : x;
- y = (y < 0) ? 0 : y;
- x = (x + priv->width > scr_w) ? scr_w - priv->width : x;
- y = (y + priv->height > scr_h) ? scr_h - priv->height : y;
+
+ x = CLAMP (x, workarea.x, workarea.x + workarea.width - priv->width);
+ y = CLAMP (y, workarea.y, workarea.y + workarea.height - priv->height);
gtk_window_move (GTK_WINDOW (priv->popup), x, y);
@@ -893,8 +890,6 @@ gimp_brush_select_button_create_inside (GimpBrushSelectButton *brush_button)
priv = GIMP_BRUSH_SELECT_BUTTON_GET_PRIVATE (brush_button);
- gtk_widget_push_composite_child ();
-
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
frame = gtk_frame_new (NULL);
@@ -934,7 +929,5 @@ gimp_brush_select_button_create_inside (GimpBrushSelectButton *brush_button)
gtk_widget_show_all (hbox);
- gtk_widget_pop_composite_child ();
-
return hbox;
}
diff --git a/libgimp/gimpfontselectbutton.c b/libgimp/gimpfontselectbutton.c
index d2b90f4..2bb79f3 100644
--- a/libgimp/gimpfontselectbutton.c
+++ b/libgimp/gimpfontselectbutton.c
@@ -440,8 +440,6 @@ gimp_font_select_button_create_inside (GimpFontSelectButton *font_button)
priv = GIMP_FONT_SELECT_BUTTON_GET_PRIVATE (font_button);
- gtk_widget_push_composite_child ();
-
button = gtk_button_new ();
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
@@ -471,7 +469,5 @@ gimp_font_select_button_create_inside (GimpFontSelectButton *font_button)
G_CALLBACK (gimp_font_select_drag_data_received),
font_button);
- gtk_widget_pop_composite_child ();
-
return button;
}
diff --git a/libgimp/gimpgradientselectbutton.c b/libgimp/gimpgradientselectbutton.c
index b96d224..b00dad7 100644
--- a/libgimp/gimpgradientselectbutton.c
+++ b/libgimp/gimpgradientselectbutton.c
@@ -588,8 +588,6 @@ gimp_gradient_select_button_create_inside (GimpGradientSelectButton *gradient_bu
priv = GIMP_GRADIENT_SELECT_BUTTON_GET_PRIVATE (gradient_button);
- gtk_widget_push_composite_child ();
-
button = gtk_button_new ();
priv->preview = gtk_drawing_area_new ();
@@ -621,7 +619,5 @@ gimp_gradient_select_button_create_inside (GimpGradientSelectButton *gradient_bu
G_CALLBACK (gimp_gradient_select_drag_data_received),
gradient_button);
- gtk_widget_pop_composite_child ();
-
return button;
}
diff --git a/libgimp/gimppaletteselectbutton.c b/libgimp/gimppaletteselectbutton.c
index e1b6fb8..31fa90b 100644
--- a/libgimp/gimppaletteselectbutton.c
+++ b/libgimp/gimppaletteselectbutton.c
@@ -457,8 +457,6 @@ gimp_palette_select_button_create_inside (GimpPaletteSelectButton *palette_butto
priv = GIMP_PALETTE_SELECT_BUTTON_GET_PRIVATE (palette_button);
- gtk_widget_push_composite_child ();
-
button = gtk_button_new ();
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
@@ -488,7 +486,5 @@ gimp_palette_select_button_create_inside (GimpPaletteSelectButton *palette_butto
G_CALLBACK (gimp_palette_select_drag_data_received),
palette_button);
- gtk_widget_pop_composite_child ();
-
return button;
}
diff --git a/libgimp/gimppatternselectbutton.c b/libgimp/gimppatternselectbutton.c
index 86f433c..f65221a 100644
--- a/libgimp/gimppatternselectbutton.c
+++ b/libgimp/gimppatternselectbutton.c
@@ -572,11 +572,10 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
GimpPatternSelectButtonPrivate *priv;
GtkWidget *frame;
GtkWidget *preview;
- GdkScreen *screen;
+ GdkMonitor *monitor;
+ GdkRectangle workarea;
gint x_org;
gint y_org;
- gint scr_w;
- gint scr_h;
priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (button);
@@ -586,11 +585,10 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
if (priv->width <= CELL_SIZE && priv->height <= CELL_SIZE)
return;
- screen = gtk_widget_get_screen (GTK_WIDGET (button));
-
priv->popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (priv->popup), GDK_WINDOW_TYPE_HINT_DND);
- gtk_window_set_screen (GTK_WINDOW (priv->popup), screen);
+ gtk_window_set_screen (GTK_WINDOW (priv->popup),
+ gtk_widget_get_screen (GTK_WIDGET (button)));
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
@@ -606,15 +604,14 @@ gimp_pattern_select_button_open_popup (GimpPatternSelectButton *button,
gdk_window_get_origin (gtk_widget_get_window (priv->preview),
&x_org, &y_org);
- scr_w = gdk_screen_get_width (screen);
- scr_h = gdk_screen_get_height (screen);
+ monitor = gimp_widget_get_monitor (GTK_WIDGET (button));
+ gdk_monitor_get_workarea (monitor, &workarea);
x = x_org + x - (priv->width / 2);
y = y_org + y - (priv->height / 2);
- x = (x < 0) ? 0 : x;
- y = (y < 0) ? 0 : y;
- x = (x + priv->width > scr_w) ? scr_w - priv->width : x;
- y = (y + priv->height > scr_h) ? scr_h - priv->height : y;
+
+ x = CLAMP (x, workarea.x, workarea.x + workarea.width - priv->width);
+ y = CLAMP (y, workarea.y, workarea.y + workarea.height - priv->height);
gtk_window_move (GTK_WINDOW (priv->popup), x, y);
@@ -691,8 +688,6 @@ gimp_pattern_select_button_create_inside (GimpPatternSelectButton *pattern_butto
priv = GIMP_PATTERN_SELECT_BUTTON_GET_PRIVATE (pattern_button);
- gtk_widget_push_composite_child ();
-
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
frame = gtk_frame_new (NULL);
@@ -732,7 +727,5 @@ gimp_pattern_select_button_create_inside (GimpPatternSelectButton *pattern_butto
gtk_widget_show_all (hbox);
- gtk_widget_pop_composite_child ();
-
return hbox;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]