formatting

SVN revision: 71577
This commit is contained in:
Mike Blumenkrantz 2012-05-31 10:12:03 +00:00
parent df6ccc8374
commit 89da028fe0
3 changed files with 182 additions and 175 deletions

View File

@ -2,7 +2,7 @@
static void _e_xinerama_clean(void);
static void _e_xinerama_update(void);
static int _e_xinerama_cb_screen_sort(const void *data1, const void *data2);
static int _e_xinerama_cb_screen_sort(const void *data1, const void *data2);
static Eina_List *all_screens = NULL;
static Eina_List *chosen_screens = NULL;
@ -78,111 +78,111 @@ _e_xinerama_update(void)
roots = ecore_x_window_root_list(&n);
if (roots)
{
int i;
int rw, rh;
Ecore_X_Window root;
int i;
int rw, rh;
Ecore_X_Window root;
/* more than 1 root window - xinerama wont be active */
if (n > 1)
{
free(roots);
return;
}
/* first (and only) root window */
root = roots[0];
free(roots);
/* get root size */
ecore_x_window_size_get(root, &rw, &rh);
/* get number of xinerama screens */
n = ecore_x_xinerama_screen_count_get();
if (n < 1)
{
E_Screen *screen;
/* more than 1 root window - xinerama wont be active */
if (n > 1)
{
free(roots);
return;
}
/* first (and only) root window */
root = roots[0];
free(roots);
/* get root size */
ecore_x_window_size_get(root, &rw, &rh);
/* get number of xinerama screens */
n = ecore_x_xinerama_screen_count_get();
if (n < 1)
{
E_Screen *screen;
screen = E_NEW(E_Screen, 1);
screen->screen = 0;
screen = E_NEW(E_Screen, 1);
screen->screen = 0;
screen->escreen = screen->screen;
screen->x = 0;
screen->y = 0;
screen->w = rw;
screen->h = rh;
all_screens = eina_list_append(all_screens, screen);
}
else
{
for (i = 0; i < n; i++)
{
int x, y, w, h;
screen->x = 0;
screen->y = 0;
screen->w = rw;
screen->h = rh;
all_screens = eina_list_append(all_screens, screen);
}
else
{
for (i = 0; i < n; i++)
{
int x, y, w, h;
/* get each xinerama screen geometry */
if (ecore_x_xinerama_screen_geometry_get(i, &x, &y, &w, &h))
{
E_Screen *screen;
/* get each xinerama screen geometry */
if (ecore_x_xinerama_screen_geometry_get(i, &x, &y, &w, &h))
{
E_Screen *screen;
printf("E17 INIT: XINERAMA SCREEN: [%i][%i], %ix%i+%i+%i\n",
i, i, w, h, x, y);
/* add it to our list */
screen = E_NEW(E_Screen, 1);
screen->screen = i;
screen->escreen = screen->screen;
screen->x = x;
screen->y = y;
screen->w = w;
screen->h = h;
all_screens = eina_list_append(all_screens, screen);
}
}
}
printf("E17 INIT: XINERAMA SCREEN: [%i][%i], %ix%i+%i+%i\n",
i, i, w, h, x, y);
/* add it to our list */
screen = E_NEW(E_Screen, 1);
screen->screen = i;
screen->escreen = screen->screen;
screen->x = x;
screen->y = y;
screen->w = w;
screen->h = h;
all_screens = eina_list_append(all_screens, screen);
}
}
}
}
/* now go through all_screens... and build a list of chosen screens */
EINA_LIST_FOREACH(all_screens, l, scr)
EINA_LIST_FOREACH (all_screens, l, scr)
{
Eina_List *ll;
E_Screen *scr2;
int add = 1;
Eina_List *removes;
Eina_List *ll;
E_Screen *scr2;
int add = 1;
Eina_List *removes;
removes = NULL;
/* does this screen intersect with any we have chosen? */
EINA_LIST_FOREACH(chosen_screens, ll, scr2)
{
/* if they intersect */
if (E_INTERSECTS(scr->x, scr->y, scr->w, scr->h,
scr2->x, scr2->y, scr2->w, scr2->h))
{
int sz, sz2;
removes = NULL;
/* does this screen intersect with any we have chosen? */
EINA_LIST_FOREACH(chosen_screens, ll, scr2)
{
/* if they intersect */
if (E_INTERSECTS(scr->x, scr->y, scr->w, scr->h,
scr2->x, scr2->y, scr2->w, scr2->h))
{
int sz, sz2;
/* calculate pixel area */
sz = scr->w * scr->h;
sz2 = scr2->w * scr2->h;
/* if the one we already have is bigger, DONT add the new */
if (sz > sz2)
removes = eina_list_append(removes, scr2);
/* add the old to a list to remove */
else
add = 0;
}
}
/* if there are screens to remove - remove them */
EINA_LIST_FREE(removes, scr2)
{
chosen_screens = eina_list_remove(chosen_screens, scr2);
}
/* if this screen is to be added, add it */
if (add)
chosen_screens = eina_list_append(chosen_screens, scr);
/* calculate pixel area */
sz = scr->w * scr->h;
sz2 = scr2->w * scr2->h;
/* if the one we already have is bigger, DONT add the new */
if (sz > sz2)
removes = eina_list_append(removes, scr2);
/* add the old to a list to remove */
else
add = 0;
}
}
/* if there are screens to remove - remove them */
EINA_LIST_FREE(removes, scr2)
{
chosen_screens = eina_list_remove(chosen_screens, scr2);
}
/* if this screen is to be added, add it */
if (add)
chosen_screens = eina_list_append(chosen_screens, scr);
}
chosen_screens = eina_list_sort(chosen_screens,
eina_list_count(chosen_screens),
_e_xinerama_cb_screen_sort);
eina_list_count(chosen_screens),
_e_xinerama_cb_screen_sort);
printf("======================= screens:\n");
n = 0;
EINA_LIST_FOREACH(chosen_screens, l, scr)
{
scr->escreen = n;
printf("E17 INIT: XINERAMA CHOSEN: [%i][%i], %ix%i+%i+%i\n",
scr->screen, scr->escreen, scr->w, scr->h, scr->x, scr->y);
n++;
scr->escreen = n;
printf("E17 INIT: XINERAMA CHOSEN: [%i][%i], %ix%i+%i+%i\n",
scr->screen, scr->escreen, scr->w, scr->h, scr->x, scr->y);
n++;
}
}
@ -200,8 +200,9 @@ _e_xinerama_cb_screen_sort(const void *data1, const void *data2)
return scr->y - scr2->y;
else
{
dif = (scr2->w * scr2->h) - (scr->w * scr->h);
if (dif == 0) return scr->screen - scr2->screen;
dif = (scr2->w * scr2->h) - (scr->w * scr->h);
if (dif == 0) return scr->screen - scr2->screen;
}
return dif;
}

View File

@ -12,12 +12,12 @@ struct _E_Screen
int x, y, w, h;
};
EINTERN int e_xinerama_init(void);
EINTERN int e_xinerama_shutdown(void);
EINTERN int e_xinerama_init(void);
EINTERN int e_xinerama_shutdown(void);
EAPI void e_xinerama_update(void);
EAPI const Eina_List *e_xinerama_screens_get(void);
EAPI const Eina_List *e_xinerama_screens_all_get(void);
EAPI void e_xinerama_fake_screen_add(int x, int y, int w, int h);
#endif
#endif

View File

@ -13,72 +13,76 @@ typedef enum _E_Zone_Edge
E_ZONE_EDGE_BOTTOM_LEFT
} E_Zone_Edge;
typedef struct _E_Zone E_Zone;
typedef struct _E_Zone E_Zone;
typedef struct _E_Event_Zone_Desk_Count_Set E_Event_Zone_Desk_Count_Set;
typedef struct _E_Event_Zone_Move_Resize E_Event_Zone_Move_Resize;
typedef struct _E_Event_Zone_Add E_Event_Zone_Add;
typedef struct _E_Event_Zone_Del E_Event_Zone_Del;
typedef struct _E_Event_Zone_Desk_Count_Set E_Event_Zone_Desk_Count_Set;
typedef struct _E_Event_Zone_Move_Resize E_Event_Zone_Move_Resize;
typedef struct _E_Event_Zone_Add E_Event_Zone_Add;
typedef struct _E_Event_Zone_Del E_Event_Zone_Del;
/* TODO: Move this to a general place? */
typedef struct _E_Event_Pointer_Warp E_Event_Pointer_Warp;
typedef struct _E_Event_Zone_Edge E_Event_Zone_Edge;
typedef struct _E_Event_Pointer_Warp E_Event_Pointer_Warp;
typedef struct _E_Event_Zone_Edge E_Event_Zone_Edge;
#else
#ifndef E_ZONE_H
#define E_ZONE_H
#define E_ZONE_TYPE (int) 0xE0b0100d
#define E_ZONE_TYPE (int)0xE0b0100d
struct _E_Zone
{
E_Object e_obj_inherit;
E_Object e_obj_inherit;
int x, y, w, h;
const char *name;
int x, y, w, h;
const char *name;
/* num matches the id of the xinerama screen
* this zone belongs to. */
unsigned int num;
E_Container *container;
int fullscreen;
unsigned int num;
E_Container *container;
int fullscreen;
Evas_Object *bg_object;
Evas_Object *bg_event_object;
Evas_Object *bg_clip_object;
Evas_Object *prev_bg_object;
Evas_Object *transition_object;
int desk_x_count, desk_y_count;
int desk_x_current, desk_y_current;
E_Desk **desks;
Evas_Object *bg_object;
Evas_Object *bg_event_object;
Evas_Object *bg_clip_object;
Evas_Object *prev_bg_object;
Evas_Object *transition_object;
Eina_List *handlers;
int desk_x_count, desk_y_count;
int desk_x_current, desk_y_current;
E_Desk **desks;
struct {
unsigned char switching : 1;
E_Shelf *es;
E_Event_Zone_Edge *ev;
E_Binding_Edge *bind;
Eina_List *handlers;
struct
{
unsigned char switching : 1;
E_Shelf *es;
E_Event_Zone_Edge *ev;
E_Binding_Edge *bind;
} flip;
struct {
Ecore_X_Window top, right, bottom, left;
struct
{
Ecore_X_Window top, right, bottom, left;
} edge;
struct {
Ecore_X_Window left_top, top_left, top_right, right_top,
right_bottom, bottom_right, bottom_left, left_bottom;
struct
{
Ecore_X_Window left_top, top_left, top_right, right_top,
right_bottom, bottom_right, bottom_left, left_bottom;
} corner;
E_Action *cur_mouse_action;
Eina_List *popups;
Ecore_Evas *black_ecore_evas;
Evas *black_evas;
Ecore_X_Window black_win;
int black_need;
int id;
E_Action *cur_mouse_action;
Eina_List *popups;
struct {
int x, y, w, h;
Ecore_Evas *black_ecore_evas;
Evas *black_evas;
Ecore_X_Window black_win;
int black_need;
int id;
struct
{
int x, y, w, h;
Eina_Bool dirty : 1;
} useful_geometry;
};
@ -88,7 +92,7 @@ struct _E_Event_Zone_Desk_Count_Set
E_Zone *zone;
};
struct _E_Event_Zone_Move_Resize
struct _E_Event_Zone_Move_Resize
{
E_Zone *zone;
};
@ -105,50 +109,52 @@ struct _E_Event_Zone_Del
struct _E_Event_Pointer_Warp
{
struct {
int x, y;
struct
{
int x, y;
} prev;
struct {
int x, y;
struct
{
int x, y;
} curr;
};
struct _E_Event_Zone_Edge
{
E_Zone *zone;
E_Zone_Edge edge;
int x, y;
int modifiers;
E_Zone *zone;
E_Zone_Edge edge;
int x, y;
int modifiers;
};
EINTERN int e_zone_init(void);
EINTERN int e_zone_shutdown(void);
EAPI E_Zone *e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h);
EAPI void e_zone_name_set(E_Zone *zone, const char *name);
EAPI void e_zone_move(E_Zone *zone, int x, int y);
EAPI void e_zone_resize(E_Zone *zone, int w, int h);
EAPI void e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h);
EAPI void e_zone_fullscreen_set(E_Zone *zone, int on);
EAPI E_Zone *e_zone_current_get(E_Container *con);
EAPI void e_zone_bg_reconfigure(E_Zone *zone);
EAPI void e_zone_flip_coords_handle(E_Zone *zone, int x, int y);
EAPI void e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count);
EAPI void e_zone_desk_count_get(E_Zone *zone, int *x_count, int *y_count);
EAPI void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy);
EAPI void e_zone_desk_flip_to(E_Zone *zone, int x, int y);
EAPI void e_zone_desk_linear_flip_by(E_Zone *zone, int dx);
EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x);
EAPI void e_zone_edge_flip_eval(E_Zone *zone);
EAPI void e_zone_edge_new(E_Zone_Edge edge);
EAPI void e_zone_edge_free(E_Zone_Edge edge);
EAPI void e_zone_edge_enable(void);
EAPI void e_zone_edge_disable(void);
EAPI void e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b);
EAPI Eina_Bool e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge);
EAPI void e_zone_edge_win_layer_set(E_Zone *zone, int layer);
EINTERN int e_zone_init(void);
EINTERN int e_zone_shutdown(void);
EAPI E_Zone *e_zone_new(E_Container *con, int num, int id, int x, int y, int w, int h);
EAPI void e_zone_name_set(E_Zone *zone, const char *name);
EAPI void e_zone_move(E_Zone *zone, int x, int y);
EAPI void e_zone_resize(E_Zone *zone, int w, int h);
EAPI void e_zone_move_resize(E_Zone *zone, int x, int y, int w, int h);
EAPI void e_zone_fullscreen_set(E_Zone *zone, int on);
EAPI E_Zone *e_zone_current_get(E_Container *con);
EAPI void e_zone_bg_reconfigure(E_Zone *zone);
EAPI void e_zone_flip_coords_handle(E_Zone *zone, int x, int y);
EAPI void e_zone_desk_count_set(E_Zone *zone, int x_count, int y_count);
EAPI void e_zone_desk_count_get(E_Zone *zone, int *x_count, int *y_count);
EAPI void e_zone_desk_flip_by(E_Zone *zone, int dx, int dy);
EAPI void e_zone_desk_flip_to(E_Zone *zone, int x, int y);
EAPI void e_zone_desk_linear_flip_by(E_Zone *zone, int dx);
EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x);
EAPI void e_zone_edge_flip_eval(E_Zone *zone);
EAPI void e_zone_edge_new(E_Zone_Edge edge);
EAPI void e_zone_edge_free(E_Zone_Edge edge);
EAPI void e_zone_edge_enable(void);
EAPI void e_zone_edge_disable(void);
EAPI void e_zone_edges_desk_flip_capable(E_Zone *zone, Eina_Bool l, Eina_Bool r, Eina_Bool t, Eina_Bool b);
EAPI Eina_Bool e_zone_exists_direction(E_Zone *zone, E_Zone_Edge edge);
EAPI void e_zone_edge_win_layer_set(E_Zone *zone, int layer);
EAPI void e_zone_useful_geometry_dirty(E_Zone *zone);
EAPI void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h);
EAPI void e_zone_useful_geometry_dirty(E_Zone *zone);
EAPI void e_zone_useful_geometry_get(E_Zone *zone, int *x, int *y, int *w, int *h);
extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET;
extern EAPI int E_EVENT_ZONE_MOVE_RESIZE;