From 226325673cdbfedc25a670a7247de6e31e3cc9d3 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 8 Oct 2001 07:32:54 +0000 Subject: [PATCH] added match hooks. #if 0'd out right now. need to think how exactly i planon matching.. keepign ti simple yet useful. imho i think just matching on name and/or class woudl be enough as the majority fo apps provide this properly :) now how to store the match rules and load them is next.. and probably handle launching apps to "restart on login" too :) SVN revision: 5439 --- src/Makefile.am | 1 + src/border.c | 11 +++++++++-- src/border.h | 2 ++ src/match.c | 33 +++++++++++++++++++++++++++++++++ src/match.h | 10 ++++++++++ src/place.c | 1 + 6 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/match.c create mode 100644 src/match.h diff --git a/src/Makefile.am b/src/Makefile.am index f8aca2c68..009e101bc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,6 +37,7 @@ enlightenment_SOURCES = \ ipc.h ipc.c \ keys.h keys.c \ main.c \ + match.c match.h \ menu.h menu.c \ menubuild.h menubuild.c \ pack.c \ diff --git a/src/border.c b/src/border.c index 2130924eb..e347613f7 100644 --- a/src/border.c +++ b/src/border.c @@ -8,6 +8,7 @@ #include "icccm.h" #include "util.h" #include "place.h" +#include "match.h" /* Window border rendering, querying, setting & modification code */ @@ -1040,11 +1041,12 @@ void e_border_apply_border(E_Border *b) { int pl, pr, pt, pb; - char *borders, buf[4096], border[4096], *style = NULL; + char *borders, buf[4096], border[4096], *style = NULL, *match_style; int prop_selected = 0, prop_sticky = 0, prop_shaded = 0; style = "default"; if ((!b->client.titlebar) && (!b->client.border)) style = "borderless"; + if (b->border_style) style = b->border_style; if (b->current.selected) prop_selected = 1; if (b->current.shaded == b->client.h) prop_shaded = 1; @@ -1216,6 +1218,7 @@ e_border_adopt(Window win, int use_client_pos) } /* reparent the window finally */ e_window_reparent(win, b->win.container, 0, 0); + e_match_set_props(b); /* figure what border to use */ e_border_apply_border(b); { @@ -1497,8 +1500,12 @@ e_border_free(E_Border *b) IF_FREE(b->client.title); IF_FREE(b->client.name); IF_FREE(b->client.class); + IF_FREE(b->client.command); + IF_FREE(b->client.machine); + IF_FREE(b->client.icon_name); + IF_FREE(b->border_style); IF_FREE(b->border_file); - + if (b->grabs) { for (l = b->grabs; l; l = l->next) diff --git a/src/border.h b/src/border.h index c8989675f..9d035cabb 100644 --- a/src/border.h +++ b/src/border.h @@ -93,6 +93,7 @@ struct _E_Border int initial_state; int is_desktop; int w, h; + int no_place; struct { int requested; int x, y; @@ -120,6 +121,7 @@ struct _E_Border Evas_List grabs; E_Desktop *desk; + char *border_style; char *border_file; int first_expose; diff --git a/src/match.c b/src/match.c new file mode 100644 index 000000000..8b7aabfe4 --- /dev/null +++ b/src/match.c @@ -0,0 +1,33 @@ +#include "match.h" + +void +e_match_set_props(E_Border *b) +{ +#if 0 + /* if we have a match that says to ignore prog coords: */ + b->client.pos.requested = 0; + /* if we have a match that applies a specifi border: */ + IF_FREE(b->border_style); + e_strdup(b->border_style, match_style); + /* if we have a match that specifies a location */ + b->client.pos.requested = 1; + b->client.pos.gravity = NorthWestGravity; + b->client.pos.x = match_x; + b->client.pos.y = match_y; + b->client.no_place = 1; + /* if we have a match specifying desk area (only valid with loc match */ + b->client.pos.x += (match_area_x - b->desk->desk.area.x) * b->desk->real.w; + b->client.pos.y += (match_area_y - b->desk->desk.area.y) * b->desk->real.h; + /* if we have a match specifying a size */ + b->current.requested.w = match_w; + b->current.requested.h = match_h; + e_window_resize(b->win.client, match_w, match_h); + /* if we have a match specifying a desktop */ + b->client.desk = match_desk; + e_border_raise(b); + if (b->client.desk != b->desk->desk.desk) b->current.requested.visible = 0; + b->client.no_place = 1; + /* if we have a match specifying stickyness */ + b->client.sticky = match_sticky; +#endif +} diff --git a/src/match.h b/src/match.h new file mode 100644 index 000000000..b9e814632 --- /dev/null +++ b/src/match.h @@ -0,0 +1,10 @@ +#ifndef E_MATCH_H +#define E_MATCH_H + +#include "e.h" +#include "border.h" + +void e_match_set_props(E_Border *b); + +#endif + diff --git a/src/place.c b/src/place.c index 6a07fd452..7b3f9af74 100644 --- a/src/place.c +++ b/src/place.c @@ -463,6 +463,7 @@ e_place_random(E_Border *b, E_Desktop *desk, int *x, int *y) int e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode) { + if (b->client.no_place) return 1; if (mode == E_PLACE_MANUAL) return e_place_manual (b, desk, x, y); if (mode == E_PLACE_SMART) return e_place_smart (b, desk, x, y); if (mode == E_PLACE_MIDDLE) return e_place_middle (b, desk, x, y);