diff options
author | Thomas Thurman <tthurman@gnome.org> | 2009-07-10 07:48:56 -0400 |
---|---|---|
committer | Thomas Thurman <tthurman@gnome.org> | 2009-07-10 07:48:56 -0400 |
commit | f218f30232dbe8a79c44e67fc9d89e9f3eb6b53c (patch) | |
tree | 2fe2b0e83f254ddc8cf5837558e52723d4154e6e | |
parent | 21415b6cfdde7770419740a26f1a685939995d7a (diff) | |
download | metacity-f218f30232dbe8a79c44e67fc9d89e9f3eb6b53c.tar.gz |
zeroth draft
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/core/matching.c | 56 | ||||
-rw-r--r-- | src/core/matching.h | 18 | ||||
-rw-r--r-- | src/core/window.c | 12 |
4 files changed, 82 insertions, 8 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index b0735db6..fb43927e 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 16dca745..f63e56ba 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 7eb2437a..2b5b2969 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 6de86ee3..5bdaad6d 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); |