From c00a7e7e97fc4a3b8ebddd4b9f5b1fa32f0a3e8f Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Tue, 5 Jun 2012 19:17:07 +0200 Subject: [PATCH] libmutter.vapi: yet another bindings clean up followed by source adaption --- src/Main.vala | 3 +- src/Widgets/WindowSwitcher.vala | 11 ++----- src/Widgets/WorkspaceView.vala | 26 +++++----------- vapi/libmutter.vapi | 54 ++++++++++++++++----------------- 4 files changed, 39 insertions(+), 55 deletions(-) diff --git a/src/Main.vala b/src/Main.vala index 71c911e6..60aa205b 100644 --- a/src/Main.vala +++ b/src/Main.vala @@ -281,8 +281,7 @@ namespace Gala { var screen = get_screen (); - unowned Rectangle rect; //some useful infos - actor.get_meta_window ().get_outer_rect (out rect); + var rect = actor.get_meta_window ().get_outer_rect (); int width, height; screen.get_size (out width, out height); diff --git a/src/Widgets/WindowSwitcher.vala b/src/Widgets/WindowSwitcher.vala index 77d7bf15..c6210b22 100644 --- a/src/Widgets/WindowSwitcher.vala +++ b/src/Widgets/WindowSwitcher.vala @@ -211,18 +211,13 @@ namespace Gala plugin.begin_modal (); - int width, height; - unowned Meta.Rectangle area; - - screen.get_monitor_geometry (screen.get_primary_monitor (), out area); - width = area.width; - height = area.height; + var area = screen.get_monitor_geometry (screen.get_primary_monitor ()); bool backward = (binding.get_name () == "switch-windows-backward"); list_windows (display, screen, binding, backward); - x = width / 2 - this.width / 2; - y = height / 2 - this.height / 2; + x = area.width / 2 - width / 2; + y = area.height / 2 - height / 2; grab_key_focus (); animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, opacity : 255); } diff --git a/src/Widgets/WorkspaceView.vala b/src/Widgets/WorkspaceView.vala index 7bad88f6..370ee5fc 100644 --- a/src/Widgets/WorkspaceView.vala +++ b/src/Widgets/WorkspaceView.vala @@ -131,10 +131,7 @@ namespace Gala windows.prepend (screen.get_display ().get_focus_window ()); } - unowned Rectangle area; - - screen.get_monitor_geometry (screen.get_primary_monitor (), out area); - + var area = screen.get_monitor_geometry (screen.get_primary_monitor ()); var n_wins = windows.length (); var index = 0; @@ -191,9 +188,7 @@ namespace Gala }); int width, height; - unowned Rectangle area; - - plugin.get_screen ().get_monitor_geometry (plugin.get_screen ().get_primary_monitor (), out area); + var area = plugin.get_screen ().get_monitor_geometry (plugin.get_screen ().get_primary_monitor ()); width = area.width; height = area.height; @@ -329,18 +324,13 @@ namespace Gala animating = true; - int width, height; - unowned Rectangle area; + var area = screen.get_monitor_geometry (screen.get_primary_monitor ()); - screen.get_monitor_geometry (screen.get_primary_monitor (), out area); - width = area.width; - height = area.height; - - tile.x = width - 80; + tile.x = area.width - 80; tile.y = 120; - y = height; - this.width = width; + y = area.height; + width = area.width; /*get the workspaces together*/ workspaces.remove_all_children (); @@ -401,7 +391,7 @@ namespace Gala workspaces.add_child (group); } - workspaces.x = this.width / 2 - workspaces.width / 2; + workspaces.x = width / 2 - workspaces.width / 2; workspaces.y = 25; workspace = screen.get_active_workspace ().index (); @@ -411,7 +401,7 @@ namespace Gala visible = true; grab_key_focus (); Timeout.add (50, () => animating = false ); //catch hot corner hiding problem - animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : height-this.height, opacity : 255) + animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250, y : area.height - height, opacity : 255) .completed.connect (() => { }); } diff --git a/vapi/libmutter.vapi b/vapi/libmutter.vapi index 46ee9aac..8275ccab 100644 --- a/vapi/libmutter.vapi +++ b/vapi/libmutter.vapi @@ -219,7 +219,7 @@ namespace Meta { public void show_window (Meta.Window window, Meta.CompEffect effect); public void switch_workspace (Meta.Screen screen, Meta.Workspace from, Meta.Workspace to, Meta.MotionDirection direction); public void sync_screen_size (Meta.Screen screen, uint width, uint height); - public void sync_stack (Meta.Screen screen, GLib.List stack); + public void sync_stack (Meta.Screen screen, GLib.List stack); public void sync_window_geometry (Meta.Window window); public void unmanage_screen (Meta.Screen screen); public void unmaximize_window (Meta.Window window, Meta.Rectangle old_rect, Meta.Rectangle new_rect); @@ -343,24 +343,6 @@ namespace Meta { [NoAccessorMethod] public ulong features { get; } } - [CCode (cheader_filename = "meta/boxes.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "meta_rectangle_get_type ()")] - public struct Rectangle { - public int height; - public int width; - public int x; - public int y; - public int area (); - public bool contains_rect (Meta.Rectangle inner_rect); - public Meta.Rectangle copy (); - public bool could_fit_rect (Meta.Rectangle inner_rect); - public bool equal (Meta.Rectangle src2); - public void free (); - public bool horiz_overlap (Meta.Rectangle rect2); - public bool intersect (Meta.Rectangle src2, out unowned Meta.Rectangle dest); - public bool overlap (Meta.Rectangle rect2); - public void union (Meta.Rectangle rect2, out unowned Meta.Rectangle dest); - public bool vert_overlap (Meta.Rectangle rect2); - } [CCode (cheader_filename = "meta/main.h")] [Compact] public class ResizePopup { @@ -374,7 +356,7 @@ namespace Meta { public unowned Meta.Workspace get_active_workspace (); public int get_active_workspace_index (); public unowned Meta.Display get_display (); - public void get_monitor_geometry (int monitor, out unowned Meta.Rectangle geometry); + public Meta.Rectangle get_monitor_geometry (int monitor); public int get_n_monitors (); public int get_n_workspaces (); public int get_primary_monitor (); @@ -466,14 +448,14 @@ namespace Meta { public unowned string get_gtk_unique_bus_name (); public unowned string get_gtk_window_object_path (); public bool get_icon_geometry (Meta.Rectangle rect); - public void get_input_rect (out unowned Meta.Rectangle rect); + public Meta.Rectangle get_input_rect (); public Meta.StackLayer get_layer (); public Meta.MaximizeFlags get_maximized (); public int get_monitor (); public unowned string get_mutter_hints (); - public void get_outer_rect (out unowned Meta.Rectangle rect); + public Meta.Rectangle get_outer_rect (); public int get_pid (); - public unowned Meta.Rectangle get_rect (); + public Meta.Rectangle get_rect (); public unowned string get_role (); public unowned Meta.Screen get_screen (); public uint get_stable_sequence (); @@ -590,7 +572,7 @@ namespace Meta { public void activate (uint32 timestamp); public void activate_with_focus (Meta.Window focus_this, uint32 timestamp); public unowned Meta.Screen get_screen (); - public void get_work_area_all_monitors (out unowned Meta.Rectangle area); + public Meta.Rectangle get_work_area_all_monitors (); public int index (); public GLib.List list_windows (); public void set_builtin_struts (GLib.SList struts); @@ -613,7 +595,7 @@ namespace Meta { } [CCode (cheader_filename = "meta/boxes.h", has_type_id = false)] public struct Edge { - public weak Meta.Rectangle rect; + public Meta.Rectangle rect; public Meta.Side side_type; public Meta.EdgeType edge_type; } @@ -635,7 +617,7 @@ namespace Meta { public weak string name; public weak GLib.Settings settings; public Meta.KeyBindingAction action; - public weak GLib.SList bindings; + public weak GLib.SList bindings; public bool add_shift; public bool per_window; public bool builtin; @@ -655,6 +637,24 @@ namespace Meta { public uint version_micro; public uint version_api; } + [CCode (cheader_filename = "meta/boxes.h", type_id = "meta_rectangle_get_type ()")] + public struct Rectangle { + public int x; + public int y; + public int width; + public int height; + public int area (); + public bool contains_rect (Meta.Rectangle inner_rect); + public Meta.Rectangle copy (); + public bool could_fit_rect (Meta.Rectangle inner_rect); + public bool equal (Meta.Rectangle src2); + public void free (); + public bool horiz_overlap (Meta.Rectangle rect2); + public bool intersect (Meta.Rectangle src2, out Meta.Rectangle dest); + public bool overlap (Meta.Rectangle rect2); + public Meta.Rectangle union (Meta.Rectangle rect2); + public bool vert_overlap (Meta.Rectangle rect2); + } [CCode (cheader_filename = "meta/meta-shadow-factory.h", has_type_id = false)] public struct ShadowParams { public int radius; @@ -665,7 +665,7 @@ namespace Meta { } [CCode (cheader_filename = "meta/boxes.h", has_type_id = false)] public struct Strut { - public weak Meta.Rectangle rect; + public Meta.Rectangle rect; public Meta.Side side; } [CCode (cheader_filename = "meta/display.h", cprefix = "META_ATOM_")]