we support... xrandr... :) feelfree to change resolution on the fly in e17...

it all works. :)


SVN revision: 12587
This commit is contained in:
Carsten Haitzler 2004-12-25 15:33:48 +00:00
parent e33a63c1b1
commit 59f94e10a8
9 changed files with 123 additions and 6 deletions

4
TODO
View File

@ -53,7 +53,9 @@ These are in no particular order:
* support text and color classes
* add tooltips
* add fullscreen support (xvidmode style)
* add xrandr support
* add screen rotation info to managers
* make xrandr support get rotation
* add rotation to containers
* fix multihead support
* xinerama support
* maybe add systray module/support?

View File

@ -16,11 +16,16 @@ static void _e_container_cb_bg_ecore_evas_resize(Ecore_Evas *ee);
static void _e_container_shape_del(E_Container_Shape *es);
static void _e_container_shape_free(E_Container_Shape *es);
static void _e_container_shape_change_call(E_Container_Shape *es, E_Container_Shape_Change ch);
static void _e_container_resize_handle(E_Container *con);
static void _e_container_event_container_resize_free(void *data, void *ev);
int E_EVENT_CONTAINER_RESIZE = 0;
/* externally accessible functions */
int
e_container_init(void)
{
E_EVENT_CONTAINER_RESIZE = ecore_event_type_new();
return 1;
}
@ -132,7 +137,7 @@ e_container_resize(E_Container *con, int w, int h)
con->h = h;
ecore_x_window_resize(con->win, con->w, con->h);
ecore_evas_resize(con->bg_ecore_evas, con->w, con->h);
}
}
void
e_container_move_resize(E_Container *con, int x, int y, int w, int h)
@ -396,6 +401,7 @@ _e_container_cb_bg_ecore_evas_resize(Ecore_Evas *ee)
con = evas_object_data_get(o, "e_container");
evas_object_resize(con->bg_object, w, h);
evas_object_resize(con->bg_event_object, w, h);
_e_container_resize_handle(con);
}
static void
@ -432,3 +438,33 @@ _e_container_shape_change_call(E_Container_Shape *es, E_Container_Shape_Change c
cb->func(cb->data, es, ch);
}
}
static void
_e_container_resize_handle(E_Container *con)
{
E_Event_Container_Resize *ev;
Evas_List *l;
ev = calloc(1, sizeof(E_Event_Container_Resize));
ev->container = con;
e_object_ref(E_OBJECT(con));
ecore_event_add(E_EVENT_CONTAINER_RESIZE, ev, _e_container_event_container_resize_free, NULL);
for (l = con->clients; l; l = l->next)
{
E_Border *b;
b = l->data;
if ((b->x + b->w) > con->w) e_border_move(b, con->w - b->w, b->y);
if ((b->y + b->h) > con->h) e_border_move(b, b->x, con->h - b->h);
}
}
static void
_e_container_event_container_resize_free(void *data, void *ev)
{
E_Event_Container_Resize *e;
e = ev;
e_object_unref(E_OBJECT(e->container));
free(e);
}

View File

@ -15,6 +15,7 @@ typedef enum _E_Container_Shape_Change
typedef struct _E_Container E_Container;
typedef struct _E_Container_Shape E_Container_Shape;
typedef struct _E_Container_Shape_Callback E_Container_Shape_Callback;
typedef struct _E_Event_Container_Resize E_Event_Container_Resize;
struct _E_Container
{
@ -53,6 +54,11 @@ struct _E_Container_Shape_Callback
void *data;
};
struct _E_Event_Container_Resize
{
E_Container *container;
};
EAPI int e_container_init(void);
EAPI int e_container_shutdown(void);
@ -80,4 +86,6 @@ EAPI void e_container_shape_change_callback_add(E_Container *con,
EAPI void e_container_shape_change_callback_del(E_Container *con, void (*func) (void *data, E_Container_Shape *es, E_Container_Shape_Change ch), void *data);
EAPI Evas_List *e_container_shape_rects_get(E_Container_Shape *es);
extern EAPI int E_EVENT_CONTAINER_RESIZE;
#endif

View File

@ -460,6 +460,7 @@ _e_main_screens_init(void)
int num, i;
if (!e_manager_init()) return 0;
if (!e_container_init()) return 0;
num = 0;
roots = ecore_x_window_root_list(&num);
@ -526,6 +527,7 @@ _e_main_screens_init(void)
static int
_e_main_screens_shutdown(void)
{
e_container_shutdown();
e_manager_shutdown();
return 1;
}

View File

@ -4,13 +4,13 @@
static void _e_manager_free(E_Manager *man);
static int _e_manager_cb_window_show_request(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_configure(void *data, int ev_type, void *ev);
#if 0 /* use later - maybe */
static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_reparent(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_create(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_configure_request(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_configure(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_gravity(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_stack(void *data, int ev_type, void *ev);
static int _e_manager_cb_window_stack_request(void *data, int ev_type, void *ev);
@ -60,6 +60,8 @@ e_manager_new(Ecore_X_Window root)
ecore_x_icccm_title_set(man->win, "Enlightenment Manager");
h = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, _e_manager_cb_window_show_request, man);
if (h) man->handlers = evas_list_append(man->handlers, h);
h = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _e_manager_cb_window_configure, man);
if (h) man->handlers = evas_list_append(man->handlers, h);
return man;
}
@ -96,16 +98,28 @@ e_manager_move(E_Manager *man, int x, int y)
void
e_manager_resize(E_Manager *man, int w, int h)
{
Evas_List *l;
E_OBJECT_CHECK(man);
if ((w == man->w) && (h == man->h)) return;
man->w = w;
man->h = h;
ecore_x_window_resize(man->win, man->w, man->h);
for (l = man->containers; l; l = l->next)
{
E_Container *con;
con = l->data;
e_container_resize(con, man->w, man->h);
}
}
void
e_manager_move_resize(E_Manager *man, int x, int y, int w, int h)
{
Evas_List *l;
E_OBJECT_CHECK(man);
if ((x == man->x) && (y == man->y) && (w == man->w) && (h == man->h)) return;
man->x = x;
@ -113,6 +127,14 @@ e_manager_move_resize(E_Manager *man, int x, int y, int w, int h)
man->w = w;
man->h = h;
ecore_x_window_move_resize(man->win, man->x, man->y, man->w, man->h);
for (l = man->containers; l; l = l->next)
{
E_Container *con;
con = l->data;
e_container_resize(con, man->w, man->h);
}
}
void
@ -178,6 +200,19 @@ _e_manager_cb_window_show_request(void *data, int ev_type, void *ev)
return 1;
}
static int
_e_manager_cb_window_configure(void *data, int ev_type, void *ev)
{
E_Manager *man;
Ecore_X_Event_Window_Configure *e;
man = data;
e = ev;
if (e->win != man->root) return 1;
e_manager_resize(man, e->w, e->h);
return 1;
}
#if 0 /* use later - maybe */
static int _e_manager_cb_window_destroy(void *data, int ev_type, void *ev){return 1;}
static int _e_manager_cb_window_hide(void *data, int ev_type, void *ev){return 1;}

View File

@ -18,6 +18,7 @@ static void _clock_face_reconfigure(Clock_Face *ef);
static void _clock_cb_face_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _clock_cb_face_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _clock_cb_face_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static int _clock_cb_event_container_resize(void *data, int type, void *event);
/* public module routines. all modules must have these */
void *
@ -191,6 +192,10 @@ _clock_face_init(Clock_Face *ef)
Evas_Coord ww, hh, bw, bh;
Evas_Object *o;
ef->ev_handler_container_resize =
ecore_event_handler_add(E_EVENT_CONTAINER_RESIZE,
_clock_cb_event_container_resize,
ef);
evas_output_viewport_get(ef->evas, NULL, NULL, &ww, &hh);
ef->fx = ef->clock->conf->x * (ww - ef->clock->conf->width);
ef->fy = ef->clock->conf->y * (hh - ef->clock->conf->width);
@ -228,6 +233,7 @@ _clock_face_init(Clock_Face *ef)
static void
_clock_face_free(Clock_Face *ef)
{
ecore_event_handler_del(ef->ev_handler_container_resize);
evas_object_del(ef->clock_object);
evas_object_del(ef->event_object);
free(ef);
@ -321,7 +327,7 @@ _clock_cb_face_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
evas_object_move(ef->event_object, ef->fx, ef->fy);
}
else if (ef->resize)
{
{
Evas_Coord d;
d = cx - ef->xx;
@ -337,3 +343,12 @@ _clock_cb_face_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
ef->yy = ev->cur.canvas.y;
}
static int
_clock_cb_event_container_resize(void *data, int type, void *event)
{
Clock_Face *ef;
ef = data;
_clock_face_reconfigure(ef);
return 1;
}

View File

@ -35,6 +35,8 @@ struct _Clock_Face
unsigned char resize : 1;
Evas_Coord xx, yy;
Evas_Coord fx, fy, fw;
Ecore_Event_Handler *ev_handler_container_resize;
};
EAPI void *init (E_Module *m);

View File

@ -68,6 +68,7 @@ static void _ibar_cb_bar_resize1_stop(void *data, Evas_Object *obj, const cha
static void _ibar_cb_bar_resize2_start(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _ibar_cb_bar_resize2_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _ibar_cb_bar_move_go(void *data, Evas_Object *obj, const char *emission, const char *source);
static int _ibar_cb_event_container_resize(void *data, int type, void *event);
/* public module routines. all modules must have these */
void *
@ -675,7 +676,6 @@ _ibar_bar_frame_resize(IBar_Bar *ibb)
e_box_freeze(ibb->box_object);
evas_output_viewport_get(ibb->evas, NULL, NULL, &ww, &hh);
o = ibb->bar_object;
if (ibb->ibar->conf->width < 0)
{
@ -803,7 +803,11 @@ _ibar_bar_init(IBar_Bar *ibb)
Evas_List *l;
Evas_Coord bw, bh;
Evas_Object *o;
ibb->ev_handler_container_resize =
ecore_event_handler_add(E_EVENT_CONTAINER_RESIZE,
_ibar_cb_event_container_resize,
ibb);
evas_event_freeze(ibb->evas);
o = edje_object_add(ibb->evas);
ibb->bar_object = o;
@ -892,6 +896,7 @@ _ibar_bar_init(IBar_Bar *ibb)
static void
_ibar_bar_free(IBar_Bar *ibb)
{
ecore_event_handler_del(ibb->ev_handler_container_resize);
while (ibb->icons)
{
IBar_Icon *ic;
@ -1623,3 +1628,13 @@ _ibar_cb_bar_move_go(void *data, Evas_Object *obj, const char *emission, const c
return;
}
}
static int
_ibar_cb_event_container_resize(void *data, int type, void *event)
{
IBar_Bar *ibb;
ibb = data;
_ibar_bar_frame_resize(ibb);
return 1;
}

View File

@ -56,6 +56,8 @@ struct _IBar_Bar
unsigned char resize2 : 1;
Evas_Coord start_x, start_y;
Evas_Coord start_bx, start_by, start_bw, start_bh;
Ecore_Event_Handler *ev_handler_container_resize;
};
struct _IBar_Icon