aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2023-05-05 05:19:44 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2023-05-07 20:52:12 +0200
commit0718f264357a13b1a55cadcb7eb6a5774b7dd7eb (patch)
tree9c44342564d431dfaf24cd8f61d5d63c44171eed
parentc9b2de2b43d1575a85b5d0344c4a0bd1eb9f93fa (diff)
downloadarctica-greeter-0718f264357a13b1a55cadcb7eb6a5774b7dd7eb.tar.gz
arctica-greeter-0718f264357a13b1a55cadcb7eb6a5774b7dd7eb.tar.bz2
arctica-greeter-0718f264357a13b1a55cadcb7eb6a5774b7dd7eb.zip
Fix casting issues
-rw-r--r--src/arctica-greeter.vala20
-rw-r--r--src/idle-monitor.vala7
-rw-r--r--src/list-stack.vala7
-rw-r--r--src/menubar.vala7
-rw-r--r--src/shutdown-dialog.vala18
-rw-r--r--src/user-list.vala4
6 files changed, 45 insertions, 18 deletions
diff --git a/src/arctica-greeter.vala b/src/arctica-greeter.vala
index 82d679e..9911f87 100644
--- a/src/arctica-greeter.vala
+++ b/src/arctica-greeter.vala
@@ -592,7 +592,10 @@ public class ArcticaGreeter : Object
/* Check to see if this window is our onboard window, since we don't want to focus it. */
X.Window keyboard_xid = 0;
if (main_window.menubar.keyboard_window != null)
- keyboard_xid = (main_window.menubar.keyboard_window.get_window () as Gdk.X11.Window).get_xid ();
+ {
+ Gdk.X11.Window pWindow = (Gdk.X11.Window) main_window.menubar.keyboard_window.get_window ();
+ keyboard_xid = pWindow.get_xid ();
+ }
if (xwin != keyboard_xid && win.get_type_hint() != Gdk.WindowTypeHint.NOTIFICATION)
{
@@ -650,20 +653,22 @@ public class ArcticaGreeter : Object
private static Cairo.XlibSurface? create_root_surface (Gdk.Screen screen)
{
var visual = screen.get_system_visual ();
-
- unowned X.Display display = (screen.get_display () as Gdk.X11.Display).get_xdisplay ();
- unowned X.Screen xscreen = (screen as Gdk.X11.Screen).get_xscreen ();
+ Gdk.X11.Display pDisplay = (Gdk.X11.Display) screen.get_display ();
+ unowned X.Display display = pDisplay.get_xdisplay ();
+ Gdk.X11.Screen pScreen = (Gdk.X11.Screen) screen;
+ unowned X.Screen xscreen = pScreen.get_xscreen ();
var pixmap = X.CreatePixmap (display,
- (screen.get_root_window () as Gdk.X11.Window).get_xid (),
+ ((Gdk.X11.Window) (screen.get_root_window ())).get_xid (),
xscreen.width_of_screen (),
xscreen.height_of_screen (),
visual.get_depth ());
/* Convert into a Cairo surface */
+ Gdk.X11.Visual pVisual = (Gdk.X11.Visual) visual;
var surface = new Cairo.XlibSurface (display,
pixmap,
- (visual as Gdk.X11.Visual).get_xvisual (),
+ pVisual.get_xvisual (),
xscreen.width_of_screen (), xscreen.height_of_screen ());
return surface;
@@ -1223,7 +1228,8 @@ public class ArcticaGreeter : Object
}
var screen = Gdk.Screen.get_default ();
- unowned X.Display xdisplay = (screen.get_display () as Gdk.X11.Display).get_xdisplay ();
+ Gdk.X11.Display pDisplay = (Gdk.X11.Display) screen.get_display ();
+ unowned X.Display xdisplay = pDisplay.get_xdisplay ();
var window = xdisplay.default_root_window();
var atom = xdisplay.intern_atom ("AT_SPI_BUS", true);
diff --git a/src/idle-monitor.vala b/src/idle-monitor.vala
index 374e924..b8e8963 100644
--- a/src/idle-monitor.vala
+++ b/src/idle-monitor.vala
@@ -2,6 +2,7 @@
*
* Copyright (C) 2014 Canonical Ltd
* Copyright (C) 2017 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ * Copyright (C) 2023 Robert Tari <robert@tari.in>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -79,7 +80,11 @@ public class IdleMonitor
warning ("Only support idle monitor under X");
return;
}
- display = (d as Gdk.X11.Display).get_xdisplay ();
+
+ if (d is Gdk.X11.Display)
+ {
+ display = d.get_xdisplay ();
+ }
int sync_error_base;
var res = X.Sync.QueryExtension (display, out sync_event_base, out sync_error_base);
diff --git a/src/list-stack.vala b/src/list-stack.vala
index 8f6e371..63bde28 100644
--- a/src/list-stack.vala
+++ b/src/list-stack.vala
@@ -1,6 +1,7 @@
/* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*-
*
* Copyright (C) 2011,2012 Canonical Ltd
+ * Copyright (C) 2023 Robert Tari
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
@@ -16,6 +17,7 @@
*
* Authors: Michael Terry <michael.terry@canonical.com>
* Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
+ * Robert Tari <robert@tari.in>
*/
public class ListStack : Gtk.Fixed
@@ -75,7 +77,10 @@ public class ListStack : Gtk.Fixed
unowned List<weak Gtk.Widget> prev = children.last ().prev;
if (prev != null)
- (prev.data as GreeterList).greeter_box.pop ();
+ {
+ GreeterList pList = (GreeterList) prev.data;
+ pList.greeter_box.pop ();
+ }
}
public override void size_allocate (Gtk.Allocation allocation)
diff --git a/src/menubar.vala b/src/menubar.vala
index 00fc862..5e8b2ef 100644
--- a/src/menubar.vala
+++ b/src/menubar.vala
@@ -655,8 +655,11 @@ public class MenuBar : Gtk.MenuBar
// why we do both. Ideally this would be fixed in orca itself.
var greeter = new ArcticaGreeter ();
greeter.orca_needs_kick = true;
- Timeout.add_seconds (1, () => {
- Signal.emit_by_name ((get_toplevel () as Gtk.Window).get_focus ().get_accessible (), "focus-event", true);
+ Timeout.add_seconds (1, () =>
+ {
+ Gtk.Window pWindow = (Gtk.Window) get_toplevel ();
+ Signal.emit_by_name (pWindow.get_focus ().get_accessible (), "focus-event", true);
+
return false;
});
}
diff --git a/src/shutdown-dialog.vala b/src/shutdown-dialog.vala
index c30ea0e..9c5be6e 100644
--- a/src/shutdown-dialog.vala
+++ b/src/shutdown-dialog.vala
@@ -363,19 +363,26 @@ public class ShutdownDialog : Gtk.Fixed
public void focus_next ()
{
- (get_toplevel () as Gtk.Window).move_focus (Gtk.DirectionType.TAB_FORWARD);
+ Gtk.Window pWindow = (Gtk.Window) get_toplevel ();
+ pWindow.move_focus (Gtk.DirectionType.TAB_FORWARD);
}
public void focus_prev ()
{
- (get_toplevel () as Gtk.Window).move_focus (Gtk.DirectionType.TAB_BACKWARD);
+ Gtk.Window pWindow = (Gtk.Window) get_toplevel ();
+ pWindow.move_focus (Gtk.DirectionType.TAB_BACKWARD);
}
public void cancel ()
{
- var widget = (get_toplevel () as Gtk.Window).get_focus ();
+ Gtk.Window pWindow = (Gtk.Window) get_toplevel ();
+ var widget = pWindow.get_focus ();
+
if (widget is DialogButton)
- (get_toplevel () as Gtk.Window).set_focus (null);
+ {
+ pWindow = (Gtk.Window) get_toplevel ();
+ pWindow.set_focus (null);
+ }
else
close ();
}
@@ -628,7 +635,8 @@ private class DialogButton : Gtk.Button
public override bool leave_notify_event (Gdk.EventCrossing event)
{
- (get_toplevel () as Gtk.Window).set_focus (null);
+ Gtk.Window pWindow = (Gtk.Window) get_toplevel ();
+ pWindow.set_focus (null);
return base.leave_notify_event (event);
}
diff --git a/src/user-list.vala b/src/user-list.vala
index 9affbb9..e410b19 100644
--- a/src/user-list.vala
+++ b/src/user-list.vala
@@ -639,7 +639,7 @@ public class UserList : GreeterList
if (agsettings.high_contrast || !AGSettings.get_boolean (AGSettings.KEY_DRAW_USER_BACKGROUNDS))
new_background_file = null;
else if (selected_entry is UserPromptBox)
- new_background_file = (selected_entry as UserPromptBox).background;
+ new_background_file = ((UserPromptBox) selected_entry).background;
background.current_background = new_background_file;
@@ -687,7 +687,7 @@ public class UserList : GreeterList
var greeter = new ArcticaGreeter ();
greeter.set_state ("last-user", username);
if (selected_entry is UserPromptBox)
- session = (selected_entry as UserPromptBox).session;
+ session = ((UserPromptBox) selected_entry).session;
else
session = null;
selected_entry.clear ();