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
This commit is contained in:
Carsten Haitzler 2001-10-08 07:32:54 +00:00
parent 94b8a4d832
commit 226325673c
6 changed files with 56 additions and 2 deletions

View File

@ -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 \

View File

@ -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)

View File

@ -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;

33
src/match.c Normal file
View File

@ -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
}

10
src/match.h Normal file
View File

@ -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

View File

@ -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);