[metacity/matching] zeroth draft
- From: Thomas James Alexander Thurman <tthurman src gnome org>
- To: svn-commits-list gnome org
- Subject: [metacity/matching] zeroth draft
- Date: Fri, 10 Jul 2009 11:49:21 +0000 (UTC)
commit f218f30232dbe8a79c44e67fc9d89e9f3eb6b53c
Author: Thomas Thurman <tthurman gnome org>
Date: Fri Jul 10 07:48:56 2009 -0400
zeroth draft
src/Makefile.am | 4 +-
src/core/matching.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++----
src/core/matching.h | 18 +++++++++++++++-
src/core/window.c | 12 +++++++++++
4 files changed, 82 insertions(+), 8 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index b0735db..fb43927 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,8 +98,8 @@ metacity_SOURCES= \
ui/themewidget.h \
ui/ui.c \
include/all-keybindings.h \
- ui/matching.c \
- ui/matching.h
+ core/matching.c \
+ core/matching.h
# by setting libmetacity_private_la_CFLAGS, the files shared with
# metacity proper will be compiled with different names.
diff --git a/src/core/matching.c b/src/core/matching.c
index 16dca74..f63e56b 100644
--- a/src/core/matching.c
+++ b/src/core/matching.c
@@ -23,20 +23,66 @@
#include "matching.h"
-MetaMatching* meta_matching_load_from_role (gchar *role)
+/**
+ * We currently keep this information in a GKeyFile.
+ * This is just for an example and may change.
+ */
+GKeyFile *matching_keyfile = NULL;
+
+static void
+load_matching_data (void)
{
+ if (matching_keyfile)
+ return;
+
+ /* load it, or... (stub) */
+ matching_keyfile = g_key_file_new ();
+ /* FIXME: would be helpful to add a leading comment */
+}
+
+MetaMatching*
+meta_matching_load_from_role (gchar *role)
+{
+ load_matching_data ();
+
/* stub */
return NULL;
}
-void meta_matching_save_to_role (gchar *role, MetaMatching *matching)
+void
+meta_matching_save_to_role (gchar *role, MetaMatching *matching)
{
- /* stub */
+ g_assert (matching);
+
+ 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_matching_save_all ();
}
-void meta_matching_save_all (void)
+void
+meta_matching_save_all (void)
{
- /* stub */
+ char *data = NULL;
+
+ load_matching_data ();
+
+ data = g_key_file_to_data (matching_keyfile, NULL, NULL);
+
+ g_file_set_contents ("/tmp/metacity-matching.conf",
+ data,
+ -1,
+ NULL);
+
+ g_free (data);
}
/* eof matching.c */
diff --git a/src/core/matching.h b/src/core/matching.h
index 7eb2437..2b5b296 100644
--- a/src/core/matching.h
+++ b/src/core/matching.h
@@ -35,7 +35,23 @@ typedef struct
gint y;
guint width;
guint height;
- guint desktop;
+ guint workspace;
+ /* XXX should we store gravity? */
+ /* FIXME: also:
+
+ guint on_all_workspaces : 1;
+ guint minimized : 1;
+ guint maximized : 1;
+
+ guint stack_position_set : 1;
+ guint geometry_set : 1;
+ guint on_all_workspaces_set : 1;
+ guint minimized_set : 1;
+ guint maximized_set : 1;
+ guint saved_rect_set : 1;
+ */
+
+
} MetaMatching;
MetaMatching* meta_matching_load_from_role (gchar *role);
diff --git a/src/core/window.c b/src/core/window.c
index 6de86ee..5bdaad6 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -45,6 +45,7 @@
#include "constraints.h"
#include "compositor.h"
#include "effects.h"
+#include "matching.h"
#include <X11/Xatom.h>
#include <string.h>
@@ -970,9 +971,20 @@ 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);
+
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]