[shotwell/wip/phako/misc-fixes: 8/9] faces: Remove deprecated calls
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/phako/misc-fixes: 8/9] faces: Remove deprecated calls
- Date: Wed, 12 Sep 2018 11:55:41 +0000 (UTC)
commit 74f59f827d2659ef9ed4f4d69a8d2ea8e13660cf
Author: Jens Georg <mail jensge org>
Date: Sat Sep 8 17:11:52 2018 +0200
faces: Remove deprecated calls
src/PhotoPage.vala | 2 +-
src/editing_tools/EditingTools.vala | 27 ++++++++++-----------------
src/faces/FaceShape.vala | 9 ++++-----
src/faces/FacesTool.vala | 6 +++---
src/util/ui.vala | 9 ++++-----
5 files changed, 22 insertions(+), 31 deletions(-)
---
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index af1d50cf..f09ba189 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -3178,7 +3178,7 @@ public class LibraryPhotoPage : EditingHostPage {
}
protected override void insert_faces_button(Gtk.Toolbar toolbar) {
- faces_button = new Gtk.ToggleToolButton.from_stock(Resources.FACES_TOOL);
+ faces_button = new Gtk.ToggleToolButton();
faces_button.set_icon_name(Resources.ICON_FACES);
faces_button.set_label(Resources.FACES_LABEL);
faces_button.set_tooltip_text(Resources.FACES_TOOLTIP);
diff --git a/src/editing_tools/EditingTools.vala b/src/editing_tools/EditingTools.vala
index f92b4a26..ab2d2ffe 100644
--- a/src/editing_tools/EditingTools.vala
+++ b/src/editing_tools/EditingTools.vala
@@ -433,6 +433,12 @@ public abstract class PhotoCanvas {
drawing_window.invalidate_rect(rect, false);
}
+ public void set_cursor(Gdk.CursorType cursor_type) {
+ var display = get_drawing_window().get_display();
+ var cursor = new Gdk.Cursor.for_display (display, cursor_type);
+ get_drawing_window().set_cursor(cursor);
+ }
+
private Cairo.Surface pixbuf_to_surface(Cairo.Context default_ctx, Gdk.Pixbuf pixbuf,
Gdk.Rectangle pos) {
Cairo.Surface surface = new Cairo.Surface.similar(default_ctx.get_target(),
@@ -1220,11 +1226,7 @@ public class CropTool : EditingTool {
// make sure the cursor isn't set to a modify indicator
if (canvas != null) {
- var drawing_window = canvas.get_drawing_window ();
- var display = drawing_window.get_display ();
- var cursor = new Gdk.Cursor.for_display (display,
- Gdk.CursorType.LEFT_PTR);
- drawing_window.set_cursor (cursor);
+ canvas.set_cursor (Gdk.CursorType.LEFT_PTR);
}
crop_surface = null;
@@ -1419,10 +1421,7 @@ public class CropTool : EditingTool {
}
if (cursor_type != current_cursor_type) {
- var drawing_window = canvas.get_drawing_window ();
- var display = drawing_window.get_display ();
- var cursor = new Gdk.Cursor.for_display (display, cursor_type);
- drawing_window.set_cursor (cursor);
+ canvas.set_cursor(cursor_type);
current_cursor_type = cursor_type;
}
}
@@ -1893,8 +1892,6 @@ public class RedeyeTool : EditingTool {
private bool is_reticle_move_in_progress = false;
private Gdk.Point reticle_move_mouse_start_point;
private Gdk.Point reticle_move_anchor;
- private Gdk.Cursor cached_arrow_cursor;
- private Gdk.Cursor cached_grab_cursor;
private Gdk.Rectangle old_scaled_pixbuf_position;
private Gdk.Pixbuf current_pixbuf = null;
@@ -2044,10 +2041,6 @@ public class RedeyeTool : EditingTool {
bind_window_handlers();
- var display = canvas.get_drawing_window().get_display();
- cached_arrow_cursor = new Gdk.Cursor.for_display(display, Gdk.CursorType.LEFT_PTR);
- cached_grab_cursor = new Gdk.Cursor.for_display(display, Gdk.CursorType.FLEUR);
-
DataCollection? owner = canvas.get_photo().get_membership();
if (owner != null)
owner.items_altered.connect(on_photos_altered);
@@ -2165,9 +2158,9 @@ public class RedeyeTool : EditingTool {
RedeyeInstance.to_bounds_rect(user_interaction_instance);
if (coord_in_rectangle(x, y, bounds)) {
- canvas.get_drawing_window().set_cursor(cached_grab_cursor);
+ canvas.set_cursor(Gdk.CursorType.FLEUR);
} else {
- canvas.get_drawing_window().set_cursor(cached_arrow_cursor);
+ canvas.set_cursor(Gdk.CursorType.LEFT_PTR);
}
}
}
diff --git a/src/faces/FaceShape.vala b/src/faces/FaceShape.vala
index c14b43b3..089c051a 100644
--- a/src/faces/FaceShape.vala
+++ b/src/faces/FaceShape.vala
@@ -39,7 +39,7 @@ public abstract class FaceShape : Object {
face_window.show_all();
face_window.hide();
- this.canvas.get_drawing_window().set_cursor(new Gdk.Cursor(current_cursor_type));
+ this.canvas.set_cursor(current_cursor_type);
}
~FaceShape() {
@@ -51,7 +51,7 @@ public abstract class FaceShape : Object {
canvas.new_surface.disconnect(prepare_ctx);
// make sure the cursor isn't set to a modify indicator
- canvas.get_drawing_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
+ canvas.set_cursor(Gdk.CursorType.LEFT_PTR);
}
public static FaceShape from_serialized(EditingTools.PhotoCanvas canvas, string serialized)
@@ -109,7 +109,7 @@ public abstract class FaceShape : Object {
face_window.hide();
// make sure the cursor isn't set to a modify indicator
- canvas.get_drawing_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
+ canvas.set_cursor(Gdk.CursorType.LEFT_PTR);
}
public void show() {
@@ -700,8 +700,7 @@ public class FaceRectangle : FaceShape {
}
if (cursor_type != current_cursor_type) {
- Gdk.Cursor cursor = new Gdk.Cursor(cursor_type);
- canvas.get_drawing_window().set_cursor(cursor);
+ canvas.set_cursor(cursor_type);
current_cursor_type = cursor_type;
}
}
diff --git a/src/faces/FacesTool.vala b/src/faces/FacesTool.vala
index cf53736d..050ac85a 100644
--- a/src/faces/FacesTool.vala
+++ b/src/faces/FacesTool.vala
@@ -120,7 +120,7 @@ public class FacesTool : EditingTools.EditingTool {
private EditingPhase editing_phase = EditingPhase.NOT_EDITING;
private Gtk.Box help_layout = null;
private Gtk.Box response_layout = null;
- private Gtk.HSeparator buttons_text_separator = null;
+ private Gtk.Separator buttons_text_separator = null;
private Gtk.Label help_text = null;
private Gtk.Box face_widgets_layout = null;
private Gtk.Box layout = null;
@@ -162,7 +162,7 @@ public class FacesTool : EditingTools.EditingTool {
layout = new Gtk.Box(Gtk.Orientation.VERTICAL, CONTROL_SPACING);
layout.pack_start(face_widgets_layout, false);
layout.pack_start(help_layout, false);
- layout.pack_start(new Gtk.HSeparator(), false);
+ layout.pack_start(new Gtk.Separator(Gtk.Orientation.HORIZONTAL), false);
layout.pack_start(response_layout, false);
add(layout);
@@ -253,7 +253,7 @@ public class FacesTool : EditingTools.EditingTool {
face_widgets_layout.pack_start(event_box, false);
if (buttons_text_separator == null) {
- buttons_text_separator = new Gtk.HSeparator();
+ buttons_text_separator = new Gtk.Separator(Gtk.Orientation.HORIZONTAL);
face_widgets_layout.pack_end(buttons_text_separator, false);
}
diff --git a/src/util/ui.vala b/src/util/ui.vala
index 7e7348fd..8568c6bc 100644
--- a/src/util/ui.vala
+++ b/src/util/ui.vala
@@ -88,16 +88,15 @@ public bool has_only_key_modifier(Gdk.ModifierType field, Gdk.ModifierType mask)
#if ENABLE_FACES
bool is_pointer_over(Gdk.Window window) {
- Gdk.DeviceManager? devmgr = window.get_display().get_device_manager();
- if (devmgr == null) {
- debug("No device for display");
+ var seat = window.get_display().get_default_seat();
+ if (seat == null) {
+ debug("No seat for display");
return false;
}
int x, y;
- devmgr.get_client_pointer().get_position(null, out x, out y);
- //gdk_device_get_position(devmgr.get_client_pointer(), null, out x, out y);
+ seat.get_pointer().get_position(null, out x, out y);
return x >= 0 && y >= 0 && x < window.get_width() && y < window.get_height();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]