Commit 97358b67 authored by Jens Georg's avatar Jens Georg

faces: Remove deprecated calls

parent 5e056712
......@@ -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);
......
......@@ -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);
}
}
}
......
......@@ -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;
}
}
......
......@@ -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);
}
......
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment