[metacity/matching] pass in a window



commit 4a95bf05416f7045d840ab043329a052b1ff26ca
Author: Thomas Thurman <tthurman gnome org>
Date:   Fri Jul 10 07:56:09 2009 -0400

    pass in a window

 src/core/matching.c |   18 ++++++++++--------
 src/core/matching.h |    6 ++++--
 src/core/window.c   |   11 +----------
 3 files changed, 15 insertions(+), 20 deletions(-)
---
diff --git a/src/core/matching.c b/src/core/matching.c
index f63e56b..56eaec8 100644
--- a/src/core/matching.c
+++ b/src/core/matching.c
@@ -22,6 +22,7 @@
  */
 
 #include "matching.h"
+#include "window-private.h"
 
 /**
  * We currently keep this information in a GKeyFile.
@@ -41,7 +42,7 @@ load_matching_data (void)
 }
 
 MetaMatching*
-meta_matching_load_from_role (gchar *role)
+meta_matching_load_from_role (MetaWindow *window, gchar *role)
 {
   load_matching_data ();
 
@@ -50,20 +51,21 @@ meta_matching_load_from_role (gchar *role)
 }
 
 void
-meta_matching_save_to_role (gchar *role, MetaMatching *matching)
+meta_matching_save_to_role (MetaWindow *window, gchar *role)
 {
-  g_assert (matching);
+  gint x, y, w, h;
 
   if (!role)
     return;
 
   load_matching_data ();
 
-  g_key_file_set_integer (matching_keyfile, role, "x", matching->x);
-  g_key_file_set_integer (matching_keyfile, role, "y", matching->y);
-  g_key_file_set_integer (matching_keyfile, role, "w", matching->width);
-  g_key_file_set_integer (matching_keyfile, role, "h", matching->height);
-  g_key_file_set_integer (matching_keyfile, role, "d", matching->workspace);
+  meta_window_get_geometry (window, &x, &y, &w, &h);
+
+  g_key_file_set_integer (matching_keyfile, role, "x", x);
+  g_key_file_set_integer (matching_keyfile, role, "y", y);
+  g_key_file_set_integer (matching_keyfile, role, "w", w);
+  g_key_file_set_integer (matching_keyfile, role, "h", h);
 
   meta_matching_save_all ();
 }
diff --git a/src/core/matching.h b/src/core/matching.h
index 2b5b296..730c4b1 100644
--- a/src/core/matching.h
+++ b/src/core/matching.h
@@ -25,6 +25,7 @@
 #define META_MATCHING_H
 
 #include "common.h"
+#include "window.h"
 
 /**
  * Represents the position of a given window on a display.
@@ -54,9 +55,10 @@ typedef struct
 
 } MetaMatching;
 
-MetaMatching* meta_matching_load_from_role (gchar *role);
+/* XXX rename to meta_window_... now the first param is a window */
+MetaMatching* meta_matching_load_from_role (MetaWindow *window, gchar *role);
 
-void meta_matching_save_to_role (gchar *role, MetaMatching *matching);
+void meta_matching_save_to_role (MetaWindow *window, gchar *role);
 
 void meta_matching_save_all (void);
 
diff --git a/src/core/window.c b/src/core/window.c
index 5bdaad6..198085f 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -971,19 +971,10 @@ meta_window_free (MetaWindow  *window,
                   guint32      timestamp)
 {
   GList *tmp;
-  MetaMatching matching;
-  int x, y, w, h;
   
   meta_verbose ("Unmanaging 0x%lx\n", window->xwindow);
 
-  /* XXX would be better to pass in a window! */
-  meta_window_get_geometry (window, &x, &y, &w, &h);
-  matching.x = x;
-  matching.y = y;
-  matching.width = w;
-  matching.height = h;
-  matching.workspace = 177; /* dummy for now */
-  meta_matching_save_to_role ("dummy", &matching);
+  meta_matching_save_to_role (window, "dummy2");
 
   if (window->display->compositor)
     meta_compositor_free_window (window->display->compositor, window);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]