Introduced typedefs for the most common enums that were #defines, and

added e_border_set_gravity which really needn't be a macro.


SVN revision: 5406
devs/princeamd/enlightenment-0.17-elive
cpk 22 years ago committed by cpk
parent 499279afa1
commit 9449e40c1d
  1. 73
      src/actions.c
  2. 35
      src/actions.h
  3. 28
      src/border.c
  4. 1
      src/border.h
  5. 12
      src/config.h
  6. 3
      src/cursors.c
  7. 4
      src/desktops.c
  8. 9
      src/guides.c
  9. 24
      src/guides.h
  10. 4
      src/main.c
  11. 1
      src/menubuild.c
  12. 12
      src/place.c
  13. 16
      src/place.h
  14. 5
      src/view.c

@ -13,8 +13,8 @@ static Evas_List action_protos = NULL;
static Evas_List current_actions = NULL;
static Evas_List current_timers = NULL;
static void _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o);
static void _e_action_free(E_Action *a);
static void e_action_find(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods, void *o);
static void e_action_free(E_Action *a);
static void e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_move_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
@ -67,16 +67,8 @@ static void e_act_zoom_start (void *o, E_Action *a, void *data, int x, int y, in
static void e_act_desk_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
static void e_act_raise_next_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry);
#define SET_BORDER_GRAVITY(_b, _grav) \
e_window_gravity_set(_b->win.container, _grav); \
e_window_gravity_set(_b->win.input, _grav); \
e_window_gravity_set(_b->win.l, _grav); \
e_window_gravity_set(_b->win.r, _grav); \
e_window_gravity_set(_b->win.t, _grav); \
e_window_gravity_set(_b->win.b, _grav);
static void
_e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o)
e_action_find(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods, void *o)
{
char *actions_db;
E_DB_File *db;
@ -100,7 +92,7 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
for (l = actions; l; l = l->next)
{
a = l->data;
if (a) _e_action_free(a);
if (a) e_action_free(a);
}
actions = evas_list_free(actions);
}
@ -131,7 +123,7 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
a = NEW(E_Action, 1);
ZERO(a, E_Action, 1);
OBJ_INIT(a, _e_action_free);
OBJ_INIT(a, e_action_free);
a->name = a_name;
a->action = a_action;
@ -192,7 +184,7 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
aa = NEW(E_Action, 1);
ZERO(aa, E_Action, 1);
OBJ_INIT(aa, _e_action_free);
OBJ_INIT(aa, e_action_free);
e_strdup(aa->name, a->name);
e_strdup(aa->action, a->action);
@ -212,7 +204,7 @@ _e_action_find(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
}
static void
_e_action_free(E_Action *a)
e_action_free(E_Action *a)
{
/* it's a key? lets ungrab it! */
if ((a->key) && (strlen(a->key) > 0) && (a->grabbed))
@ -230,11 +222,11 @@ _e_action_free(E_Action *a)
}
void
e_action_start(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry)
e_action_start(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry)
{
Evas_List l;
_e_action_find(action, act, button, key, mods, o);
e_action_find(action, act, button, key, mods, o);
again:
for (l = current_actions; l; l = l->next)
{
@ -268,7 +260,7 @@ e_action_start(char *action, int act, int button, char *key, Ev_Key_Modifiers mo
}
void
e_action_stop(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry)
e_action_stop(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry)
{
Evas_List l;
@ -335,7 +327,7 @@ e_action_stop(char *action, int act, int button, char *key, Ev_Key_Modifiers mod
}
void
e_action_go(char *action, int act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry, int dx, int dy)
e_action_go(char *action, E_Action_Type act, int button, char *key, Ev_Key_Modifiers mods, void *o, void *data, int x, int y, int rx, int ry, int dx, int dy)
{
Evas_List l;
@ -392,7 +384,6 @@ e_action_stop_by_type(char *action)
{
Evas_List l;
again:
for (l = current_actions; l; l = l->next)
{
E_Action *a;
@ -539,10 +530,10 @@ static void
e_act_move_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
{
E_Border *b;
int move_mode = E_GUIDES_BOX;
E_Guides_Mode move_mode = E_GUIDES_BOX;
double align_x = 0.5;
double align_y = 0.5;
int display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_CFG_INT(cfg_window_move_mode, "settings", "/window/move/mode", E_GUIDES_BOX);
E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
@ -652,10 +643,10 @@ static void
e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
{
E_Border *b;
int resize_mode = E_GUIDES_BOX;
E_Guides_Mode resize_mode = E_GUIDES_BOX;
double align_x = 0.5;
double align_y = 0.5;
int display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_CFG_INT(cfg_window_resize_mode, "settings", "/window/resize/mode", E_GUIDES_BOX);
E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
@ -686,14 +677,14 @@ e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int
if (y > (b->current.h / 2))
{
b->mode.resize = 4;
/* SET_BORDER_GRAVITY(b, NorthWestGravity);*/
/* e_window_gravity_set(b->win.container, SouthEastGravity);*/
/* e_border_set_gravity(b, NorthWestGravity); */
/* e_window_gravity_set(b->win.container, SouthEastGravity);*/
}
else
{
b->mode.resize = 2;
/* SET_BORDER_GRAVITY(b, SouthWestGravity);*/
/* e_window_gravity_set(b->win.container, NorthEastGravity);*/
/* e_border_set_gravity(b, SouthWestGravity);*/
/* e_window_gravity_set(b->win.container, NorthEastGravity);*/
}
}
else
@ -701,13 +692,13 @@ e_act_resize_start (void *o, E_Action *a, void *data, int x, int y, int rx, int
if (y > (b->current.h / 2))
{
b->mode.resize = 3;
/* SET_BORDER_GRAVITY(b, NorthEastGravity);*/
/* e_border_set_gravity(b, NorthEastGravity);*/
/* e_window_gravity_set(b->win.container, SouthWestGravity);*/
}
else
{
b->mode.resize = 1;
/* SET_BORDER_GRAVITY(b, SouthEastGravity);*/
/* e_border_set_gravity(b, SouthEastGravity);*/
/* e_window_gravity_set(b->win.container, NorthWestGravity); */
}
}
@ -750,7 +741,7 @@ e_act_resize_stop (void *o, E_Action *a, void *data, int x, int y, int rx, int
b->changed = 1;
e_border_adjust_limits(b);
e_window_gravity_set(b->win.client, NorthWestGravity);
SET_BORDER_GRAVITY(b, NorthWestGravity);
e_border_set_gravity(b, NorthWestGravity);
e_guides_hide();
return;
UN(a);
@ -818,10 +809,10 @@ static void
e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
{
E_Border *b;
int resize_mode = E_GUIDES_BOX;
E_Guides_Mode resize_mode = E_GUIDES_BOX;
double align_x = 0.5;
double align_y = 0.5;
int display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_CFG_INT(cfg_window_resize_mode, "settings", "/window/resize/mode", E_GUIDES_BOX);
E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
@ -848,12 +839,12 @@ e_act_resize_h_start (void *o, E_Action *a, void *data, int x, int y, int rx, in
if (x > (b->current.w / 2))
{
b->mode.resize = 6;
/* SET_BORDER_GRAVITY(b, NorthWestGravity);*/
/* e_border_set_gravity(b, NorthWestGravity);*/
}
else
{
b->mode.resize = 5;
/* SET_BORDER_GRAVITY(b, NorthEastGravity);*/
/* e_border_set_gravity(b, NorthEastGravity);*/
}
{
char buf[4096];
@ -895,7 +886,7 @@ e_act_resize_h_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in
b->changed = 1;
e_border_adjust_limits(b);
e_window_gravity_set(b->win.client, NorthWestGravity);
SET_BORDER_GRAVITY(b, NorthWestGravity);
e_border_set_gravity(b, NorthWestGravity);
e_guides_hide();
return;
UN(a);
@ -949,10 +940,10 @@ static void
e_act_resize_v_start (void *o, E_Action *a, void *data, int x, int y, int rx, int ry)
{
E_Border *b;
int resize_mode = E_GUIDES_BOX;
E_Guides_Mode resize_mode = E_GUIDES_BOX;
double align_x = 0.5;
double align_y = 0.5;
int display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_Guides_Location display_loc = E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE;
E_CFG_INT(cfg_window_resize_mode, "settings", "/window/resize/mode", E_GUIDES_BOX);
E_CFG_FLOAT(cfg_guides_display_x, "settings", "/guides/display/x", 0.5);
E_CFG_FLOAT(cfg_guides_display_y, "settings", "/guides/display/y", 0.5);
@ -981,12 +972,12 @@ e_act_resize_v_start (void *o, E_Action *a, void *data, int x, int y, int rx, in
if (y > (b->current.h / 2))
{
b->mode.resize = 8;
/* SET_BORDER_GRAVITY(b, NorthWestGravity);*/
/* e_border_set_gravity(b, NorthWestGravity);*/
}
else
{
b->mode.resize = 7;
/* SET_BORDER_GRAVITY(b, SouthWestGravity);*/
/* e_border_set_gravity(b, SouthWestGravity);*/
}
{
char buf[4096];
@ -1027,7 +1018,7 @@ e_act_resize_v_stop (void *o, E_Action *a, void *data, int x, int y, int rx, in
b->mode.resize = 0;
e_border_adjust_limits(b);
e_window_gravity_set(b->win.client, NorthWestGravity);
SET_BORDER_GRAVITY(b, NorthWestGravity);
e_border_set_gravity(b, NorthWestGravity);
b->changed = 1;
e_guides_hide();
return;

@ -7,6 +7,21 @@ typedef struct _E_Action E_Action;
typedef struct _E_Action_Proto E_Action_Proto;
typedef struct _E_Active_Action_Timer E_Active_Action_Timer;
typedef enum e_action_type
{
ACT_MOUSE_IN,
ACT_MOUSE_OUT,
ACT_MOUSE_CLICK,
ACT_MOUSE_DOUBLE,
ACT_MOUSE_TRIPLE,
ACT_MOUSE_UP,
ACT_MOUSE_CLICKED,
ACT_MOUSE_MOVE,
ACT_KEY_DOWN,
ACT_KEY_UP
}
E_Action_Type;
struct _E_Active_Action_Timer
{
void *object;
@ -20,7 +35,7 @@ struct _E_Action
char *name;
char *action;
char *params;
int event;
E_Action_Type event;
int button;
char *key;
int modifiers;
@ -41,25 +56,13 @@ struct _E_Action_Proto
};
/* action type macros */
#define ACT_MOUSE_IN 0
#define ACT_MOUSE_OUT 1
#define ACT_MOUSE_CLICK 2
#define ACT_MOUSE_DOUBLE 3
#define ACT_MOUSE_TRIPLE 4
#define ACT_MOUSE_UP 5
#define ACT_MOUSE_CLICKED 6
#define ACT_MOUSE_MOVE 7
#define ACT_KEY_DOWN 8
#define ACT_KEY_UP 9
void e_action_start(char *action, int act, int button, char *key,
void e_action_start(char *action, E_Action_Type act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry);
void e_action_stop(char *action, int act, int button, char *key,
void e_action_stop(char *action, E_Action_Type act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry);
void e_action_go(char *action, int act, int button, char *key,
void e_action_go(char *action, E_Action_Type act, int button, char *key,
Ev_Key_Modifiers mods, void *o, void *data,
int x, int y, int rx, int ry, int dx, int dy);
void e_action_stop_by_object(void *o, void *data, int x, int y, int rx, int ry);

@ -1,3 +1,4 @@
#include "cursors.h"
#include "border.h"
#include "config.h"
#include "actions.h"
@ -797,7 +798,7 @@ e_cb_mouse_down(void *data, Ebits_Object o, char *class, int bt, int x, int y, i
border_mouse_buttons = mouse_buttons;
if (!current_ev) return;
{
int act;
E_Action_Type act;
Ev_Key_Modifiers mods;
mods = ((Ev_Mouse_Down *)(current_ev->event))->mods;
@ -826,7 +827,7 @@ e_cb_mouse_up(void *data, Ebits_Object o, char *class, int bt, int x, int y, int
border_mouse_buttons = mouse_buttons;
if (!current_ev) return;
{
int act;
E_Action_Type act;
Ev_Key_Modifiers mods;
mods = ((Ev_Mouse_Up *)(current_ev->event))->mods;
@ -947,7 +948,7 @@ e_cb_border_mouse_down(E_Border *b, Eevent *e)
}
}
{
int act;
E_Action_Type act;
Ev_Key_Modifiers mods;
mods = ((Ev_Mouse_Down *)(current_ev->event))->mods;
@ -978,7 +979,7 @@ e_cb_border_mouse_up(E_Border *b, Eevent *e)
y = ((Ev_Mouse_Up *)(e->event))->y;
bt = ((Ev_Mouse_Up *)(e->event))->button;
{
int act;
E_Action_Type act;
Ev_Key_Modifiers mods;
mods = ((Ev_Mouse_Up *)(current_ev->event))->mods;
@ -2148,6 +2149,9 @@ e_border_raise_delayed(int val, void *b)
E_CONFIG_INT_GET(cfg_auto_raise, auto_raise);
if (auto_raise)
e_border_raise((E_Border *)b);
return;
UN(val);
}
void
@ -2440,3 +2444,19 @@ e_border_print_size(char *buf, E_Border *b)
b->client.h);
}
}
void
e_border_set_gravity(E_Border *b, int gravity)
{
if (!b)
return;
e_window_gravity_set(b->win.container, gravity);
e_window_gravity_set(b->win.input, gravity);
e_window_gravity_set(b->win.l, gravity);
e_window_gravity_set(b->win.r, gravity);
e_window_gravity_set(b->win.t, gravity);
e_window_gravity_set(b->win.b, gravity);
}

@ -150,5 +150,6 @@ void e_border_send_pointer(E_Border *b);
int e_border_viewable(E_Border *b);
void e_border_print_pos(char *buf, E_Border *b);
void e_border_print_size(char *buf, E_Border *b);
void e_border_set_gravity(E_Border *b, int gravity);
#endif

@ -46,10 +46,14 @@ _var.last_fetch = __time;
} \
}
#define E_CFG_INT_T 123
#define E_CFG_FLOAT_T 1234
#define E_CFG_STR_T 12345
#define E_CFG_DATA_T 123456
typedef enum e_config_type
{
E_CFG_INT_T,
E_CFG_FLOAT_T,
E_CFG_STR_T,
E_CFG_DATA_T,
}
E_Config_Type;
#define E_CFG_INT(_var, _src, _key, _default) \
static E_Config_Element _var = { _src, _key, 0.0, E_CFG_INT_T, \

@ -38,6 +38,9 @@ e_cursors_idle(void *data)
IF_FREE(cur_cursor);
cur_cursor = NULL;
cursor_change = 0;
return;
UN(data);
}
static void

@ -190,8 +190,8 @@ e_desktops_init_file_display(E_Desktop *desk)
/* fixme: later */
/* uncomment this and comment out the next line for some tress testing */
/* desk->view->dir = strdup("/dev"); */
e_strdup(desk->view->dir, e_file_home());
/* e_strdup(desk->view->dir, "/dev"); */
e_strdup(desk->view->dir, e_file_home());
e_view_realize(desk->view);
if (desk->view->options.back_pixmap)

@ -12,7 +12,7 @@ static struct
{
struct
{
int loc;
E_Guides_Location loc;
struct
{
double x, y;
@ -22,7 +22,7 @@ static struct
} display;
int x, y, w, h;
int visible;
int mode;
E_Guides_Mode mode;
} current, prev;
struct {
@ -55,7 +55,6 @@ e_guides_idle(void *data)
static void
e_guides_update(void)
{
int max_colors = 216;
int font_cache = 1024 * 1024;
int image_cache = 8192 * 1024;
char *font_dir;
@ -538,7 +537,7 @@ e_guides_display_icon(char *icon)
}
void
e_guides_set_display_location(int loc)
e_guides_set_display_location(E_Guides_Location loc)
{
if (guides.current.display.loc == loc) return;
guides.changed = 1;
@ -556,7 +555,7 @@ e_guides_set_display_alignment(double x, double y)
}
void
e_guides_set_mode(int mode)
e_guides_set_mode(E_Guides_Mode mode)
{
if (guides.current.mode == mode) return;
guides.changed = 1;

@ -3,13 +3,21 @@
#include "e.h"
#define E_GUIDES_OPAQUE 0 /* configure window border & client */
#define E_GUIDES_BORDER 1 /* unmap client and configure window border */
#define E_GUIDES_BOX 2 /* box outline */
#define E_GUIDES_TECHNICAL 3 /* lots of lines & info */
typedef enum e_guides_mode
{
E_GUIDES_OPAQUE, /* configure window border & client */
E_GUIDES_BORDER, /* unmap client and configure window border */
E_GUIDES_BOX, /* box outline */
E_GUIDES_TECHNICAL /* lots of lines & info */
}
E_Guides_Mode;
#define E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE 0
#define E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE 1
typedef enum e_guides_location
{
E_GUIDES_DISPLAY_LOCATION_WINDOW_MIDDLE,
E_GUIDES_DISPLAY_LOCATION_SCREEN_MIDDLE
}
E_Guides_Location;
void e_guides_show(void);
void e_guides_hide(void);
@ -17,9 +25,9 @@ void e_guides_move(int x, int y);
void e_guides_resize(int w, int h);
void e_guides_display_text(char *text);
void e_guides_display_icon(char *icon);
void e_guides_set_display_location(int loc);
void e_guides_set_display_location(E_Guides_Location loc);
void e_guides_set_display_alignment(double x, double y);
void e_guides_set_mode(int mode);
void e_guides_set_mode(E_Guides_Mode mode);
void e_guides_init(void);
#endif

@ -1,4 +1,6 @@
#include "actions.h"
#include "guides.h"
#include "cursors.h"
#include "border.h"
#include "config.h"
#include "desktops.h"
@ -9,11 +11,13 @@
#include "ipc.h"
#include "menu.h"
#include "view.h"
#include "place.h"
#ifdef USE_FERITE
# include "e_ferite.h"
#endif
#include <time.h>
#include <X11/Xproto.h>
#ifdef E_PROF

@ -48,6 +48,7 @@ e_build_menu_cb_script(E_Menu *m, E_Menu_Item *mi, void *data)
UN(m);
UN(mi);
UN(script);
UN(data);
}
static void

@ -461,13 +461,13 @@ 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, int method)
e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode)
{
if (method == E_PLACE_MANUAL) return e_place_manual (b, desk, x, y);
if (method == E_PLACE_SMART) return e_place_smart (b, desk, x, y);
if (method == E_PLACE_MIDDLE) return e_place_middle (b, desk, x, y);
if (method == E_PLACE_CASCADE) return e_place_cascade(b, desk, x, y);
if (method == E_PLACE_RANDOM) return e_place_random (b, desk, x, y);
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);
if (mode == E_PLACE_CASCADE) return e_place_cascade(b, desk, x, y);
if (mode == E_PLACE_RANDOM) return e_place_random (b, desk, x, y);
return 1;
}

@ -5,13 +5,17 @@
#include "border.h"
#include "desktops.h"
#define E_PLACE_MANUAL 0
#define E_PLACE_SMART 1
#define E_PLACE_MIDDLE 2
#define E_PLACE_CASCADE 3
#define E_PLACE_RANDOM 4
typedef enum e_placement_mode
{
E_PLACE_MANUAL,
E_PLACE_SMART,
E_PLACE_MIDDLE,
E_PLACE_CASCADE,
E_PLACE_RANDOM
}
E_Placement_Mode;
int e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, int method);
int e_place_border(E_Border *b, E_Desktop *desk, int *x, int *y, E_Placement_Mode mode);
void e_place_init(void);
#endif

@ -1,6 +1,7 @@
#include <libefsd.h>
#include "view.h"
#include "cursors.h"
#include "background.h"
#include "desktops.h"
#include "config.h"
@ -1788,14 +1789,14 @@ e_view_icon_apply_xy(E_Icon *ic)
sprintf(buf, "%s/%s", ic->view->dir, ic->file);
printf("write meta xy for icon for file %s\n", ic->file);
/*
efsd_set_metadata_int(e_fs_get_connection(),
"/pos/x", buf,
ic->geom.x);
efsd_set_metadata_int(e_fs_get_connection(),
"/pos/y", buf,
ic->geom.y);
*/ }
}
if (ic->geom.x != ic->prev_geom.x) ic->view->extents.valid = 0;
else if (ic->geom.y != ic->prev_geom.y) ic->view->extents.valid = 0;
else if (ic->geom.w != ic->prev_geom.w) ic->view->extents.valid = 0;

Loading…
Cancel
Save