Stop using deprecated get_allocated_width/height
This commit is contained in:
parent
be01a9349d
commit
c48c73834b
2 changed files with 6 additions and 6 deletions
|
@ -118,7 +118,7 @@ public class ChessView : Gtk.DrawingArea
|
|||
{
|
||||
load_theme (c);
|
||||
|
||||
c.translate (get_allocated_width () / 2, get_allocated_height () / 2);
|
||||
c.translate (get_width () / 2, get_height () / 2);
|
||||
c.rotate (Math.PI * scene.board_angle / 180.0);
|
||||
|
||||
int board_size = (int) Math.ceil (square_size * 4 + border_size);
|
||||
|
@ -292,8 +292,8 @@ public class ChessView : Gtk.DrawingArea
|
|||
if (scene.game.result != ChessResult.IN_PROGRESS)
|
||||
return;
|
||||
|
||||
int file = (int) Math.floor ((event_x - 0.5 * get_allocated_width () + square_size * 4) / square_size);
|
||||
int rank = 7 - (int) Math.floor ((event_y - 0.5 * get_allocated_height () + square_size * 4) / square_size);
|
||||
int file = (int) Math.floor ((event_x - 0.5 * get_width () + square_size * 4) / square_size);
|
||||
int rank = 7 - (int) Math.floor ((event_y - 0.5 * get_height () + square_size * 4) / square_size);
|
||||
|
||||
// FIXME: Use proper Cairo rotation matrix
|
||||
if (scene.board_angle == 180.0)
|
||||
|
@ -321,7 +321,7 @@ public class ChessView : Gtk.DrawingArea
|
|||
c.paint ();
|
||||
|
||||
c.select_font_face ("Sans", Cairo.FontSlant.NORMAL, Cairo.FontWeight.BOLD);
|
||||
c.set_font_size (get_allocated_width () * 0.125);
|
||||
c.set_font_size (get_width () * 0.125);
|
||||
|
||||
var text = _("Paused");
|
||||
Cairo.TextExtents extents;
|
||||
|
|
|
@ -263,8 +263,8 @@ public class ChessWindow : Adw.ApplicationWindow
|
|||
layout.get_size (out layout_width, out layout_height);
|
||||
layout_width /= Pango.SCALE;
|
||||
layout_height /= Pango.SCALE;
|
||||
c.move_to ((widget.get_allocated_width () - layout_width) / 2,
|
||||
(widget.get_allocated_height () - layout_height) / 2);
|
||||
c.move_to ((widget.get_width () - layout_width) / 2,
|
||||
(widget.get_height () - layout_height) / 2);
|
||||
c.set_source_rgba (fg[0], fg[1], fg[2], alpha);
|
||||
Pango.cairo_show_layout (c, layout);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue