Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(182) |
Nov
(302) |
Dec
(141) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(142) |
Feb
(214) |
Mar
(291) |
Apr
(355) |
May
(185) |
Jun
(167) |
Jul
(281) |
Aug
(462) |
Sep
(227) |
Oct
(371) |
Nov
(303) |
Dec
(103) |
2002 |
Jan
(173) |
Feb
(204) |
Mar
(345) |
Apr
(427) |
May
(330) |
Jun
(296) |
Jul
(233) |
Aug
(163) |
Sep
(104) |
Oct
(162) |
Nov
(188) |
Dec
(197) |
2003 |
Jan
(328) |
Feb
(333) |
Mar
(169) |
Apr
(177) |
May
(150) |
Jun
(262) |
Jul
(316) |
Aug
(249) |
Sep
(218) |
Oct
(492) |
Nov
(399) |
Dec
(404) |
2004 |
Jan
(766) |
Feb
(779) |
Mar
(632) |
Apr
(690) |
May
(690) |
Jun
(418) |
Jul
(867) |
Aug
(653) |
Sep
(414) |
Oct
(661) |
Nov
(521) |
Dec
(633) |
2005 |
Jan
(818) |
Feb
(576) |
Mar
(932) |
Apr
(792) |
May
(790) |
Jun
(727) |
Jul
(648) |
Aug
(794) |
Sep
(1165) |
Oct
(1618) |
Nov
(777) |
Dec
(1140) |
2006 |
Jan
(1370) |
Feb
(1036) |
Mar
(1357) |
Apr
(1342) |
May
(968) |
Jun
(1010) |
Jul
(1320) |
Aug
(1506) |
Sep
(1396) |
Oct
(1108) |
Nov
(605) |
Dec
(650) |
2007 |
Jan
(727) |
Feb
(532) |
Mar
(1309) |
Apr
(719) |
May
(546) |
Jun
(651) |
Jul
(1299) |
Aug
(1042) |
Sep
(525) |
Oct
(701) |
Nov
(1750) |
Dec
(751) |
2008 |
Jan
(547) |
Feb
(529) |
Mar
(586) |
Apr
(571) |
May
(633) |
Jun
(453) |
Jul
(519) |
Aug
(365) |
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(112) |
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(2) |
2
(4) |
3
(18) |
4
(21) |
5
(8) |
6
(7) |
7
(2) |
8
(19) |
9
(8) |
10
(5) |
11
(9) |
12
(4) |
13
(13) |
14
(19) |
15
(3) |
16
|
17
(22) |
18
(20) |
19
(34) |
20
(27) |
21
(10) |
22
|
23
(3) |
24
|
25
(8) |
26
(9) |
27
(14) |
28
(5) |
29
|
30
(2) |
|
|
|
|
|
|
From: <enlightenment-cvs@li...> - 2002-06-03 21:33:55
|
Enlightenment CVS committal Author : rbdpngn Project : e17 Module : libs/ewl Dir : e17/libs/ewl/src Modified Files: ewl_check.c ewl_checkbutton.c Log Message: Couple more updates to the checkbutton code. =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_check.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ewl_check.c 25 May 2002 05:46:40 -0000 1.1 +++ ewl_check.c 3 Jun 2002 21:33:54 -0000 1.2 @@ -126,7 +126,7 @@ cb = EWL_CHECK(w); if (cb->checked) - ewl_widget_update_appearance(w, "clicked"); + ewl_widget_update_appearance(w, "checked"); else ewl_widget_update_appearance(w, "normal"); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/ewl_checkbutton.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ewl_checkbutton.c 25 May 2002 05:46:40 -0000 1.27 +++ ewl_checkbutton.c 3 Jun 2002 21:33:54 -0000 1.28 @@ -47,6 +47,7 @@ ewl_button_init(b, label); ewl_widget_set_appearance(w, "/appearance/button/check"); + RECURSIVE(b) = FALSE; ewl_object_set_fill_policy(EWL_OBJECT(w), EWL_FILL_POLICY_NONE); |
From: <enlightenment-cvs@li...> - 2002-06-03 08:31:15
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/canvas Modified Files: Tag: SPLIT evas_render.c Log Message: pants on =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/canvas/Attic/evas_render.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -3 -r1.1.2.7 -r1.1.2.8 --- evas_render.c 3 Jun 2002 07:29:59 -0000 1.1.2.7 +++ evas_render.c 3 Jun 2002 08:30:45 -0000 1.1.2.8 @@ -19,10 +19,15 @@ void evas_obscured_rectangle_add(Evas *e, int x, int y, int w, int h) { + Evas_Rectangle *r; + MAGIC_CHECK(e, Evas, MAGIC_EVAS); return; MAGIC_CHECK_END(); - /* FIXME: implement later */ + r = malloc(sizeof(Evas_Rectangle)); + if (!r) return; + r->x = x; r->y = y; r->w = w; r->h = h; + e->obscures = evas_list_append(e->obscures, r); } void @@ -31,7 +36,14 @@ MAGIC_CHECK(e, Evas, MAGIC_EVAS); return; MAGIC_CHECK_END(); - /* FIXME: implement later */ + while (e->obscures) + { + Evas_Rectangle *r; + + r = (Evas_Rectangle *)e->obscures->data; + e->obscures = evas_list_remove(e->obscures, r); + free(r); + } } Evas_List * @@ -67,8 +79,13 @@ /* build active object list */ if (evas_object_is_active(obj)) active_objects = evas_list_append(active_objects, obj); + /* something changed... maybe... */ if (obj->changed) obj->engine.func.render_pre(obj); + /* nothng changed at all */ + else + e->engine.func.output_redraws_rect_del(e->engine.data.output, + obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, obj->cur.cache.geometry.h); } } /* phase 2. add exposes */ @@ -83,7 +100,14 @@ free(r); } /* phase 3. add obscures */ - /* FIXME: not done yet */ + for (ll = e->obscures; ll; ll = ll->next) + { + Evas_Rectangle *r; + + r = ll->data; + e->engine.func.output_redraws_rect_del(e->engine.data.output, + r->x, r->y, r->w, r->h); + } /* build obscure objects list of active objects that obscure */ for (ll = active_objects; ll; ll = ll->next) { @@ -130,36 +154,35 @@ Evas_List *l3; obj = (Evas_Object *)(ll->data); - if ((obscuring_objects) && (obscuring_objects->data == obj)) - obscuring_objects = evas_list_remove(obscuring_objects, obj); - /* FIXME: need to check forintersect */ - e->engine.func.context_clip_set(e->engine.data.output, - e->engine.data.context, - cx, cy, cw, ch); - /* FIXME: add cutouts.. shoud this be done here? */ - /* does it actualyl speed things up? */ - /* should we do a pre-calc as to if we shoudl use these */ - /* in the first place? (if object count too big this will */ - /* be slow) */ -#if 0 - for (l3 = obscuring_objects; l3; l3 = l3->next) + if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh)) { - Evas_Object *obj2; - - obj2 = (Evas_Object *)l3->data; - e->engine.func.context_cutout_add(e->engine.data.output, - e->engine.data.context, - obj2->cur.cache.geometry.x, - obj2->cur.cache.geometry.y, - obj2->cur.cache.geometry.w, - obj2->cur.cache.geometry.h); - } + if ((obscuring_objects) && (obscuring_objects->data == obj)) + obscuring_objects = evas_list_remove(obscuring_objects, obj); + e->engine.func.context_clip_set(e->engine.data.output, + e->engine.data.context, + cx, cy, cw, ch); + /* FIXME: add cutouts.. shoud this be done here? */ + /* does it actually speed things up? */ +#if 0 /* FIXME: this can slow things down... figure out optimum... */ + for (l3 = obscuring_objects; l3; l3 = l3->next) + { + Evas_Object *obj2; + + obj2 = (Evas_Object *)l3->data; + e->engine.func.context_cutout_add(e->engine.data.output, + e->engine.data.context, + obj2->cur.cache.geometry.x, + obj2->cur.cache.geometry.y, + obj2->cur.cache.geometry.w, + obj2->cur.cache.geometry.h); + } #endif - obj->engine.func.render(obj, surface, - e->engine.data.context, - off_x, off_y); - e->engine.func.context_cutout_clear(e->engine.data.output, - e->engine.data.context); + obj->engine.func.render(obj, surface, + e->engine.data.context, + off_x, off_y); + e->engine.func.context_cutout_clear(e->engine.data.output, + e->engine.data.context); + } } /* punch rect out */ e->engine.func.output_redraws_next_update_push(e->engine.data.output, |
From: <enlightenment-cvs@li...> - 2002-06-03 08:30:46
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/include Modified Files: Tag: SPLIT evas_private.h Log Message: pants on =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/include/Attic/evas_private.h,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -3 -r1.1.2.7 -r1.1.2.8 --- evas_private.h 3 Jun 2002 07:29:59 -0000 1.1.2.7 +++ evas_private.h 3 Jun 2002 08:30:45 -0000 1.1.2.8 @@ -56,6 +56,7 @@ int output_validity; Evas_List *damages; + Evas_List *obscures; Evas_Layer *layers; |
From: <enlightenment-cvs@li...> - 2002-06-03 07:52:28
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/engines/common Modified Files: Tag: SPLIT evas_tiler.c Log Message: and a update deleteer from the tiler engine more speed! WOOP! =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/engines/common/Attic/evas_tiler.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -3 -r1.1.2.3 -r1.1.2.4 --- evas_tiler.c 28 May 2002 07:19:36 -0000 1.1.2.3 +++ evas_tiler.c 3 Jun 2002 07:51:58 -0000 1.1.2.4 @@ -162,6 +162,37 @@ } int +tilebuf_del_redraw(Tilebuf *tb, int x, int y, int w, int h) +{ + int tx1, tx2, ty1, ty2, tfx1, tfx2, tfy1, tfy2, xx, yy; + int num; + + num = 0; + /* wipes out any motion vectors in tiles it touches into redraws */ + if (tilebuf_x_intersect(tb, x, w, &tx1, &tx2, &tfx1, &tfx2) && + tilebuf_y_intersect(tb, y, h, &ty1, &ty2, &tfy1, &tfy2)) + { + if (tfx1) tx1++; + if (tfx2) tx2--; + if (tfy1) ty1++; + if (tfy2) ty2--; + for (yy = ty1; yy <= ty2; yy++) + { + Tilebuf_Tile *tbt; + + tbt = &(TILE(tb, tx1, yy)); + for (xx = tx1; xx <= tx2; xx++) + { + tbt->redraw = 0; + num++; + tbt++; + } + } + } + return num; +} + +int tilebuf_add_motion_vector(Tilebuf *tb, int x, int y, int w, int h, int dx, int dy, int alpha) { /* FIXME: need to actually impliment motion vectors. for now it just */ |
From: <enlightenment-cvs@li...> - 2002-06-03 07:52:28
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/engines/software_x11 Modified Files: Tag: SPLIT evas_engine.c Log Message: and a update deleteer from the tiler engine more speed! WOOP! =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/engines/software_x11/Attic/evas_engine.c,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -3 -r1.1.2.11 -r1.1.2.12 --- evas_engine.c 3 Jun 2002 07:29:59 -0000 1.1.2.11 +++ evas_engine.c 3 Jun 2002 07:51:58 -0000 1.1.2.12 @@ -81,7 +81,7 @@ outbuf_init(); /* get any stored performance metrics from device (xserver) */ perf = outbuf_perf_restore_x(disp, draw, vis, cmap, depth); - re->ob = outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp, draw, vis, cmap, depth, perf); + re->ob = outbuf_setup_x(w, h, rot, OUTBUF_DEPTH_INHERIT, disp, draw, vis, cmap, depth, perf); re->tb = tilebuf_new(); /* no backbuf! */ outbuf_set_have_backbuf(re->ob, 0); @@ -139,7 +139,7 @@ Render_Engine *re; re = (Render_Engine *)data; - /* FIXME: impliment */ + tilebuf_del_redraw(re->tb, x, y, w, h); } void |
From: <enlightenment-cvs@li...> - 2002-06-03 07:51:58
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/include Modified Files: Tag: SPLIT evas_common.h Log Message: and a update deleteer from the tiler engine more speed! WOOP! =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/include/Attic/evas_common.h,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -3 -r1.1.2.6 -r1.1.2.7 --- evas_common.h 31 May 2002 09:10:29 -0000 1.1.2.6 +++ evas_common.h 3 Jun 2002 07:51:58 -0000 1.1.2.7 @@ -814,6 +814,7 @@ void tilebuf_set_tile_size (Tilebuf *tb, int tw, int th); void tilebuf_get_tile_size (Tilebuf *tb, int *tw, int *th); int tilebuf_add_redraw (Tilebuf *tb, int x, int y, int w, int h); +int tilebuf_del_redraw (Tilebuf *tb, int x, int y, int w, int h); int tilebuf_add_motion_vector (Tilebuf *tb, int x, int y, int w, int h, int dx, int dy, int alpha); void tilebuf_clear (Tilebuf *tb); Tilebuf_Rect *tilebuf_get_render_rects (Tilebuf *tb); |
From: <enlightenment-cvs@li...> - 2002-06-03 07:30:31
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/bin Modified Files: Tag: SPLIT main.c Log Message: hella-cool! 2100+ fps in 32bpp on this athalon 1.2 ghz box here. also some more clean code... now i can beat this by a bit i think.... some more code to do... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/bin/Attic/main.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -3 -r1.1.2.10 -r1.1.2.11 --- main.c 31 May 2002 09:10:28 -0000 1.1.2.10 +++ main.c 3 Jun 2002 07:29:59 -0000 1.1.2.11 @@ -104,6 +104,7 @@ szhints.min_height = win_h; XSetWMNormalHints(disp, win, &szhints); XMapWindow(disp, win); + XSync(disp, False); evas = evas_new(); evas_output_method_set(evas, evas_render_method_lookup("software_x11")); |
From: <enlightenment-cvs@li...> - 2002-06-03 07:30:31
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/engines/common Modified Files: Tag: SPLIT evas_outbuf.c Log Message: hella-cool! 2100+ fps in 32bpp on this athalon 1.2 ghz box here. also some more clean code... now i can beat this by a bit i think.... some more code to do... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/engines/common/Attic/evas_outbuf.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -3 -r1.1.2.6 -r1.1.2.7 --- evas_outbuf.c 31 May 2002 00:44:10 -0000 1.1.2.6 +++ evas_outbuf.c 3 Jun 2002 07:29:59 -0000 1.1.2.7 @@ -313,6 +313,8 @@ } } + buf->perf = perf; + return buf; #else return NULL; |
From: <enlightenment-cvs@li...> - 2002-06-03 07:30:31
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/canvas Modified Files: Tag: SPLIT evas_main.c evas_object_main.c evas_object_rectangle.c evas_render.c Log Message: hella-cool! 2100+ fps in 32bpp on this athalon 1.2 ghz box here. also some more clean code... now i can beat this by a bit i think.... some more code to do... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/canvas/Attic/evas_main.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -3 -r1.1.2.6 -r1.1.2.7 --- evas_main.c 31 May 2002 09:10:28 -0000 1.1.2.6 +++ evas_main.c 3 Jun 2002 07:29:59 -0000 1.1.2.7 @@ -77,6 +77,7 @@ e->output.w = w; e->output.h = h; e->output.changed = 1; + e->output_validity++; e->changed = 1; } @@ -107,6 +108,7 @@ e->viewport.w = w; e->viewport.h = h; e->viewport.changed = 1; + e->output_validity++; e->changed = 1; } @@ -128,6 +130,18 @@ } int +evas_coord_world_x_to_screen(Evas *e, double x) +{ + return (int)(((x - e->viewport.x) * (double)e->output.w) / e->viewport.w); +} + +int +evas_coord_world_y_to_screen(Evas *e, double y) +{ + return (int)(((y - e->viewport.y) * (double)e->output.h) / e->viewport.h); +} + +int evas_render_method_lookup(const char *name) { if (!name) return RENDER_METHOD_INVALID; @@ -169,6 +183,7 @@ e->engine.func.output_resize = evas_engine_software_x11_output_resize; e->engine.func.output_tile_size_set = evas_engine_software_x11_output_tile_size_set; e->engine.func.output_redraws_rect_add = evas_engine_software_x11_output_redraws_rect_add; + e->engine.func.output_redraws_rect_del = evas_engine_software_x11_output_redraws_rect_del; e->engine.func.output_redraws_clear = evas_engine_software_x11_output_redraws_clear; e->engine.func.output_redraws_next_update_get = evas_engine_software_x11_output_redraws_next_update_get; e->engine.func.output_redraws_next_update_push = evas_engine_software_x11_output_redraws_next_update_push; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/canvas/Attic/evas_object_main.c,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -3 -r1.1.2.3 -r1.1.2.4 --- evas_object_main.c 27 May 2002 07:05:38 -0000 1.1.2.3 +++ evas_object_main.c 3 Jun 2002 07:29:59 -0000 1.1.2.4 @@ -147,6 +147,7 @@ (obj->cur.geometry.y == y)) return; obj->cur.geometry.x = x; obj->cur.geometry.y = y; + obj->cur.cache.geometry.validity = 0; evas_object_change(obj); } @@ -160,6 +161,7 @@ (obj->cur.geometry.h == h)) return; obj->cur.geometry.w = w; obj->cur.geometry.h = h; + obj->cur.cache.geometry.validity = 0; evas_object_change(obj); } @@ -202,4 +204,107 @@ obj->cur.color.b = b; obj->cur.color.a = a; evas_object_change(obj); +} + +void +evas_object_coords_recalc(Evas_Object *obj) +{ + if (obj->cur.cache.geometry.validity == obj->layer->evas->output_validity) + return; + obj->cur.cache.geometry.x = + evas_coord_world_x_to_screen(obj->layer->evas, obj->cur.geometry.x); + obj->cur.cache.geometry.y = + evas_coord_world_y_to_screen(obj->layer->evas, obj->cur.geometry.y); + obj->cur.cache.geometry.w = + evas_coord_world_x_to_screen(obj->layer->evas, obj->cur.geometry.w); + obj->cur.cache.geometry.h = + evas_coord_world_y_to_screen(obj->layer->evas, obj->cur.geometry.h); + obj->cur.cache.geometry.validity = obj->layer->evas->output_validity; +} + +int +evas_object_is_active(Evas_Object *obj) +{ + if (evas_object_is_in_output_rect(obj, 0, 0, + obj->layer->evas->output.w, + obj->layer->evas->output.h) || + evas_object_was_in_output_rect(obj, 0, 0, + obj->layer->evas->output.w, + obj->layer->evas->output.h) || + evas_object_is_visible(obj) || + evas_object_was_visible(obj)) + return 1; + return 0; +} + +int +evas_object_is_in_output_rect(Evas_Object *obj, int x, int y, int w, int h) +{ + if ((RECTS_INTERSECT(x, y, w, h, + obj->cur.cache.geometry.x, + obj->cur.cache.geometry.y, + obj->cur.cache.geometry.w, + obj->cur.cache.geometry.h))) + return 1; + return 0; +} + +int +evas_object_was_in_output_rect(Evas_Object *obj, int x, int y, int w, int h) +{ + if ((RECTS_INTERSECT(x, y, w, h, + obj->prev.cache.geometry.x, + obj->prev.cache.geometry.y, + obj->prev.cache.geometry.w, + obj->prev.cache.geometry.h))) + return 1; + return 0; +} + +int +evas_object_is_visible(Evas_Object *obj) +{ + if ((obj->cur.visible) && + (obj->cur.color.a > 0)) + { + /* FIXME: call objects is_visible method */ + /* if (obj->is_visible(obj)) */ + return 1; + } +} + +int +evas_object_was_visible(Evas_Object *obj) +{ + if ((obj->prev.visible) && + (obj->prev.color.a > 0)) + { + /* FIXME: call objects is_visible method */ + /* if (obj->is_visible(obj)) */ + return 1; + } +} + +int +evas_object_is_opaque(Evas_Object *obj) +{ + if (obj->cur.color.a == 255) + { + /* FIXME: call objects is_opaque method */ + /* if (obj->is_opaque(obj)) */ + return 1; + } + return 0; +} + +int +evas_object_was_opaque(Evas_Object *obj) +{ + if (obj->prev.color.a == 255) + { + /* FIXME: call objects is_opaque method */ + /* if (obj->is_opaque(obj)) */ + return 1; + } + return 0; } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/canvas/Attic/evas_object_rectangle.c,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -3 -r1.1.2.5 -r1.1.2.6 --- evas_object_rectangle.c 31 May 2002 09:10:28 -0000 1.1.2.5 +++ evas_object_rectangle.c 3 Jun 2002 07:29:59 -0000 1.1.2.6 @@ -80,22 +80,13 @@ obj->cur.color.g, obj->cur.color.b, obj->cur.color.a); - /* FIXME: for now ONLY use software engine */ - /* x and y are the update rect offsets - so add them */ - { - int ox, oy, ow, oh; - - ox = obj->cur.geometry.x; - oy = obj->cur.geometry.y; - ow = obj->cur.geometry.w; - oh = obj->cur.geometry.h; - /* FIXME: this needs to be an engine func */ - obj->layer->evas->engine.func.draw_rectangle(obj->layer->evas->engine.data.output, - obj->layer->evas->engine.data.context, - surface, - ox + x, oy + y, ow, oh); - cpu_end_opt(); - } + obj->layer->evas->engine.func.draw_rectangle(obj->layer->evas->engine.data.output, + obj->layer->evas->engine.data.context, + surface, + obj->cur.cache.geometry.x + x, + obj->cur.cache.geometry.y + y, + obj->cur.cache.geometry.w, + obj->cur.cache.geometry.h); } static void @@ -131,32 +122,154 @@ evas_object_rectangle_render_pre(Evas_Object *obj) { Evas_Object_Rectangle *o; + int is_v, was_v; o = (Evas_Object_Rectangle *)(obj->object_data); MAGIC_CHECK(o, Evas_Object_Rectangle, MAGIC_OBJ_RECTANGLE); return; MAGIC_CHECK_END(); - + + /* if it just became visible or invisible */ + is_v = evas_object_is_visible(obj); + was_v = evas_object_was_visible(obj); + if (is_v != was_v) + { + if (is_v) + obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, + obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, obj->cur.cache.geometry.h); + else + obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, + obj->prev.cache.geometry.x, obj->prev.cache.geometry.y, obj->prev.cache.geometry.w, obj->prev.cache.geometry.h); + return; + } + /* its not visible - we accounted for it appearing or not so just abort */ + if (!is_v) return; + /* if it changed color */ + if ((obj->cur.color.r != obj->prev.color.r) || + (obj->cur.color.g != obj->prev.color.g) || + (obj->cur.color.b != obj->prev.color.b) || + (obj->cur.color.a != obj->prev.color.a)) { - int x, y, w, h; - - /* FIXME: need to make world->screen and screen->world */ - x = obj->prev.geometry.x; - y = obj->prev.geometry.y; - w = obj->prev.geometry.w; - h = obj->prev.geometry.h; obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, - x, y, w, h); - x = obj->cur.geometry.x; - y = obj->cur.geometry.y; - w = obj->cur.geometry.w; - h = obj->cur.geometry.h; + obj->prev.cache.geometry.x, obj->prev.cache.geometry.y, obj->prev.cache.geometry.w, obj->prev.cache.geometry.h); obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, - x, y, w, h); + obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, obj->cur.cache.geometry.h); + return; } - /* it's a rectangle. there are no internal properites. add a redraw rect */ - /* add (post viewport) transformed rects to output list */ -/* obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, x, y, w, h); */ + /* if it changed geometry - and obviously not visibility or color */ + if ((obj->cur.geometry.x != obj->prev.geometry.x) || + (obj->cur.geometry.y != obj->prev.geometry.y) || + (obj->cur.geometry.w != obj->prev.geometry.w) || + (obj->cur.geometry.h != obj->prev.geometry.h)) + { + /* if the new and old rects dont intersect - just put both updates */ + /* on the list */ + if (!(RECTS_INTERSECT(obj->prev.cache.geometry.x, obj->prev.cache.geometry.y, obj->prev.cache.geometry.w, obj->prev.cache.geometry.h, + obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, obj->cur.cache.geometry.h))) + { + obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, + obj->prev.cache.geometry.x, obj->prev.cache.geometry.y, obj->prev.cache.geometry.w, obj->prev.cache.geometry.h); + obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, + obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, obj->cur.cache.geometry.h); + } + /* the intersect.. only add the delta regions */ + else + { + int x, y, w, h, xx, yy, ww, hh; + int x1[4], y1[4], i, j; + Evas_List *rl, *rll; + + x = obj->prev.cache.geometry.x; + y = obj->prev.cache.geometry.y; + w = obj->prev.cache.geometry.w; + h = obj->prev.cache.geometry.h; + xx = obj->cur.cache.geometry.x; + yy = obj->cur.cache.geometry.y; + ww = obj->cur.cache.geometry.w; + hh = obj->cur.cache.geometry.h; + + if (x < xx) + { + x1[0] = x; + x1[1] = xx; + } + else + { + x1[0] = xx; + x1[1] = x; + } + if ((x + w) < (xx + ww)) + { + x1[2] = x + w; + x1[3] = xx + ww; + } + else + { + x1[2] = xx + ww; + x1[3] = x + w; + } + if (y < yy) + { + y1[0] = y; + y1[1] = yy; + } + else + { + y1[0] = yy; + y1[1] = y; + } + if ((y + h) < (yy + hh)) + { + y1[2] = y + h; + y1[3] = yy + hh; + } + else + { + y1[2] = yy + hh; + y1[3] = y + h; + } + rl = NULL; + for (j = 0; j < 3; j++) + { + for (i = 0; i < 3; i++) + { + Evas_Rectangle *r; + + r = malloc(sizeof(Evas_Rectangle)); + rl = evas_list_append(rl, r); + r->x = x1[i]; + r->y = y1[j]; + r->w = x1[i + 1] - x1[i]; + r->h = y1[j + 1] - y1[j]; + } + } + if (rl) + { + for (rll = rl; rll; rll = rll->next) + { + Evas_Rectangle *r; + + r = rll->data; + if ((r->w > 0) && (r->h > 0)) + { + int intsec1, intsec2; + + intsec1 = (RECTS_INTERSECT(r->x, r->y, r->w, r->h, x, y, w, h)); + intsec2 = (RECTS_INTERSECT(r->x, r->y, r->w, r->h, xx, yy, ww, hh)); + if (intsec1 ^ intsec2) + obj->layer->evas->engine.func.output_redraws_rect_add(obj->layer->evas->engine.data.output, + r->x, r->y, r->w, r->h); + } + free(r); + } + rl = evas_list_free(rl); + } + } + return; + } + /* it obviously didn't change - add a NO obscure */ + obj->layer->evas->engine.func.output_redraws_rect_del(obj->layer->evas->engine.data.output, + obj->cur.cache.geometry.x, obj->cur.cache.geometry.y, obj->cur.cache.geometry.w, obj->cur.cache.geometry.h); } static void =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/canvas/Attic/evas_render.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -3 -r1.1.2.6 -r1.1.2.7 --- evas_render.c 31 May 2002 09:10:28 -0000 1.1.2.6 +++ evas_render.c 3 Jun 2002 07:29:59 -0000 1.1.2.7 @@ -5,10 +5,15 @@ void evas_damage_rectangle_add(Evas *e, int x, int y, int w, int h) { + Evas_Rectangle *r; + MAGIC_CHECK(e, Evas, MAGIC_EVAS); return; MAGIC_CHECK_END(); - e->engine.func.output_redraws_rect_add(e->engine.data.output, x, y, w, h); + r = malloc(sizeof(Evas_Rectangle)); + if (!r) return; + r->x = x; r->y = y; r->w = w; r->h = h; + e->damages = evas_list_append(e->damages, r); } void @@ -34,6 +39,9 @@ { Evas_List *updates = NULL; Evas_List *obscuring_objects = NULL; + Evas_List *obscuring_objects_orig = NULL; + Evas_List *active_objects = NULL; + Evas_List *ll; Evas_Object_List *l; void *surface; int ux, uy, uw, uh; @@ -55,14 +63,44 @@ Evas_Object *obj; obj = (Evas_Object *)l2; + evas_object_coords_recalc(obj); + /* build active object list */ + if (evas_object_is_active(obj)) + active_objects = evas_list_append(active_objects, obj); if (obj->changed) obj->engine.func.render_pre(obj); } } - /* phase 2. go thu each update rect */ - while ((surface = e->engine.func.output_redraws_next_update_get(e->engine.data.output, - &ux, &uy, &uw, &uh, - &cx, &cy, &cw, &ch))) + /* phase 2. add exposes */ + while (e->damages) + { + Evas_Rectangle *r; + + r = e->damages->data; + e->damages = evas_list_remove(e->damages, r); + e->engine.func.output_redraws_rect_add(e->engine.data.output, + r->x, r->y, r->w, r->h); + free(r); + } + /* phase 3. add obscures */ + /* FIXME: not done yet */ + /* build obscure objects list of active objects that obscure */ + for (ll = active_objects; ll; ll = ll->next) + { + Evas_Object *obj; + + obj = (Evas_Object *)(ll->data); + if (evas_object_is_opaque(obj) && evas_object_is_visible(obj)) + obscuring_objects = evas_list_append(obscuring_objects, obj); + } + /* save this list */ + obscuring_objects_orig = obscuring_objects; + obscuring_objects = NULL; + /* phase 4. go thu each update rect and render objects in it*/ + while ((surface = + e->engine.func.output_redraws_next_update_get(e->engine.data.output, + &ux, &uy, &uw, &uh, + &cx, &cy, &cw, &ch))) { Evas_Rectangle *rect; void *context = NULL; @@ -77,79 +115,58 @@ off_x = cx - ux; off_y = cy - uy; /* build obscuring objects list (in order from bottom to top) */ - /* FIXME: build this once only and copy it per update rect */ - for (l = (Evas_Object_List *)e->layers; l; l = l->next) + for (ll = obscuring_objects_orig; ll; ll = ll->next) { - Evas_Object_List *l2; - Evas_Layer *lay; + Evas_Object *obj; - lay = (Evas_Layer *)l; - for (l2 = (Evas_Object_List *)lay->objects; l2; l2 = l2->next) - { - Evas_Object *obj; - - obj = (Evas_Object *)l2; - /* FIXME: need func to determine opacity */ - /* FIXME: only add objects that intersect with update */ - if (obj->cur.color.a == 255) - obscuring_objects = evas_list_append(obscuring_objects, obj); - } + obj = (Evas_Object *)(ll->data); + if (evas_object_is_in_output_rect(obj, ux, uy, uw, uh)) + obscuring_objects = evas_list_append(obscuring_objects, obj); } /* render all object that intersect with rect */ - for (l = (Evas_Object_List *)e->layers; l; l = l->next) + for (ll = active_objects; ll; ll = ll->next) { - Evas_Object_List *l2; - Evas_Layer *lay; + Evas_Object *obj; + Evas_List *l3; - lay = (Evas_Layer *)l; - for (l2 = (Evas_Object_List *)lay->objects; l2; l2 = l2->next) + obj = (Evas_Object *)(ll->data); + if ((obscuring_objects) && (obscuring_objects->data == obj)) + obscuring_objects = evas_list_remove(obscuring_objects, obj); + /* FIXME: need to check forintersect */ + e->engine.func.context_clip_set(e->engine.data.output, + e->engine.data.context, + cx, cy, cw, ch); + /* FIXME: add cutouts.. shoud this be done here? */ + /* does it actualyl speed things up? */ + /* should we do a pre-calc as to if we shoudl use these */ + /* in the first place? (if object count too big this will */ + /* be slow) */ +#if 0 + for (l3 = obscuring_objects; l3; l3 = l3->next) { - Evas_Object *obj; + Evas_Object *obj2; - obj = (Evas_Object *)l2; - if ((obscuring_objects) && (obscuring_objects->data == obj)) - obscuring_objects = evas_list_remove(obscuring_objects, obj); - /* FIXME: need to check forintersect */ - e->engine.func.context_clip_set(e->engine.data.output, - e->engine.data.context, - cx, cy, cw, ch); - /* FIXME: add cutouts.. shoud this be done here? */ - /* does it actualyl speed things up? */ - /* should we do a pre-calc as to if we shoudl use these */ - /* in the first place? (if object count too big this will */ - /* be slow) */ - if (obscuring_objects) - { - Evas_List *l3; - - for (l3 = obscuring_objects; l3; l3 = l3->next) - { - Evas_Object *obj2; - int x, y, w, h; - - obj2 = l3->data; - x = obj2->cur.geometry.x; - y = obj2->cur.geometry.y; - w = obj2->cur.geometry.w; - h = obj2->cur.geometry.h; - e->engine.func.context_cutout_add(e->engine.data.output, - e->engine.data.context, - x + off_x, y + off_y, w, h); - } - } - obj->engine.func.render(obj, surface, - e->engine.data.context, - off_x, off_y); - e->engine.func.context_cutout_clear(e->engine.data.output, - e->engine.data.context); + obj2 = (Evas_Object *)l3->data; + e->engine.func.context_cutout_add(e->engine.data.output, + e->engine.data.context, + obj2->cur.cache.geometry.x, + obj2->cur.cache.geometry.y, + obj2->cur.cache.geometry.w, + obj2->cur.cache.geometry.h); } +#endif + obj->engine.func.render(obj, surface, + e->engine.data.context, + off_x, off_y); + e->engine.func.context_cutout_clear(e->engine.data.output, + e->engine.data.context); } /* punch rect out */ e->engine.func.output_redraws_next_update_push(e->engine.data.output, surface, ux, uy, uw, uh); /* free obscuring objects list */ - obscuring_objects = evas_list_free(obscuring_objects); + obscuring_objects = evas_list_free(obscuring_objects); } /* clear redraws */ e->engine.func.output_redraws_clear(e->engine.data.output); @@ -172,6 +189,10 @@ } } } + /* free our obscuring object list */ + obscuring_objects_orig = evas_list_free(obscuring_objects_orig); + /* free our active object list */ + active_objects = evas_list_free(active_objects); return updates; } |
From: <enlightenment-cvs@li...> - 2002-06-03 07:30:31
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/engines/software_x11 Modified Files: Tag: SPLIT evas_engine.c Log Message: hella-cool! 2100+ fps in 32bpp on this athalon 1.2 ghz box here. also some more clean code... now i can beat this by a bit i think.... some more code to do... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/engines/software_x11/Attic/evas_engine.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -3 -r1.1.2.10 -r1.1.2.11 --- evas_engine.c 31 May 2002 09:10:28 -0000 1.1.2.10 +++ evas_engine.c 3 Jun 2002 07:29:59 -0000 1.1.2.11 @@ -134,6 +134,15 @@ } void +evas_engine_software_x11_output_redraws_rect_del(void *data, int x, int y, int w, int h) +{ + Render_Engine *re; + + re = (Render_Engine *)data; + /* FIXME: impliment */ +} + +void evas_engine_software_x11_output_redraws_clear(void *data) { Render_Engine *re; |
From: <enlightenment-cvs@li...> - 2002-06-03 07:30:31
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib Modified Files: Tag: SPLIT Evas.h Log Message: hella-cool! 2100+ fps in 32bpp on this athalon 1.2 ghz box here. also some more clean code... now i can beat this by a bit i think.... some more code to do... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/Attic/Evas.h,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -u -3 -r1.1.2.5 -r1.1.2.6 --- Evas.h 30 May 2002 05:44:59 -0000 1.1.2.5 +++ Evas.h 3 Jun 2002 07:29:59 -0000 1.1.2.6 @@ -52,6 +52,10 @@ void evas_output_viewport_get(Evas *e, double *x, double *y, double *w, double *h); int + evas_coord_world_x_to_screen(Evas *e, double x); + int + evas_coord_world_y_to_screen(Evas *e, double y); + int evas_render_method_lookup(const char *name); Evas_List * evas_render_method_list(void); |
From: <enlightenment-cvs@li...> - 2002-06-03 07:30:01
|
Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas2 Dir : e17/libs/evas2/src/lib/include Modified Files: Tag: SPLIT evas_engine_software_x11.h evas_private.h Log Message: hella-cool! 2100+ fps in 32bpp on this athalon 1.2 ghz box here. also some more clean code... now i can beat this by a bit i think.... some more code to do... =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/include/Attic/evas_engine_software_x11.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -3 -r1.1.2.2 -r1.1.2.3 --- evas_engine_software_x11.h 31 May 2002 09:10:29 -0000 1.1.2.2 +++ evas_engine_software_x11.h 3 Jun 2002 07:29:59 -0000 1.1.2.3 @@ -12,6 +12,8 @@ void evas_engine_software_x11_output_redraws_rect_add(void *data, int x, int y, int w, int h); void +evas_engine_software_x11_output_redraws_rect_del(void *data, int x, int y, int w, int h); +void evas_engine_software_x11_output_redraws_clear(void *data); void * evas_engine_software_x11_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas2/src/lib/include/Attic/evas_private.h,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -3 -r1.1.2.6 -r1.1.2.7 --- evas_private.h 31 May 2002 09:10:29 -0000 1.1.2.6 +++ evas_private.h 3 Jun 2002 07:29:59 -0000 1.1.2.7 @@ -53,6 +53,10 @@ int changed : 1; } output; + int output_validity; + + Evas_List *damages; + Evas_Layer *layers; int changed : 1; @@ -63,6 +67,7 @@ void (*output_resize) (void *data, int w, int h); void (*output_tile_size_set) (void *data, int w, int h); void (*output_redraws_rect_add) (void *data, int x, int y, int w, int h); + void (*output_redraws_rect_del) (void *data, int x, int y, int w, int h); void (*output_redraws_clear) (void *data); void *(*output_redraws_next_update_get) (void *data, int *x, int *y, int *w, int *h, int *cx, int *cy, int *cw, int *ch); void (*output_redraws_next_update_push) (void *data, void *surface, int x, int y, int w, int h); @@ -114,6 +119,12 @@ Evas_Layer *layer; struct { + struct { + struct { + int x, y, w, h; + int validity; + } geometry; + } cache; struct { double x, y, w, h; } geometry; |
From: <enlightenment-cvs@li...> - 2002-06-03 00:26:46
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm Modified Files: ChangeLog Log Message: Sun Jun 2 20:25:55 2002 Michael Jennings (mej) Oops, missed these. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/ChangeLog,v retrieving revision 1.292 retrieving revision 1.293 diff -u -3 -r1.292 -r1.293 --- ChangeLog 3 Jun 2002 00:24:21 -0000 1.292 +++ ChangeLog 3 Jun 2002 00:26:15 -0000 1.293 @@ -4683,3 +4683,7 @@ Latest Escreen patch along with twin support from Azundris. ---------------------------------------------------------------------- +Sun Jun 2 20:25:55 2002 Michael Jennings (mej) + +Oops, missed these. +---------------------------------------------------------------------- |
From: <enlightenment-cvs@li...> - 2002-06-03 00:26:16
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm/doc Modified Files: README.Escreen escreen.cfg Log Message: Sun Jun 2 20:25:55 2002 Michael Jennings (mej) Oops, missed these. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/doc/README.Escreen,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- README.Escreen 22 May 2002 15:38:34 -0000 1.1 +++ README.Escreen 3 Jun 2002 00:26:15 -0000 1.2 @@ -1,100 +1,197 @@ -ESCREEN -1 - What is it? + _____ _ ___ _____ +| ___/ \ / _ \ _ _ | ____|___ ___ _ __ ___ ___ _ __ +| |_ / _ \| | | | (_|_) | _| / __|/ __| '__/ _ \/ _ \ '_ \ +| _/ ___ \ |_| | _ _ | |___\__ \ (__| | | __/ __/ | | | +|_|/_/ \_\__\_\ (_|_) |_____|___/\___|_| \___|\___|_| |_| + +Frequently Asked Questions about the Eterm "Escreen" extension -Eterm now offers you to compile in experimental support for the -"screen" program. "screen" is a terminal multiplexer (one window, -several shells). Yes, it's like konsole or multi-gnome-terminal, -only that your shells won't die just because X or the Window Manager -do. Oh, and you can pick up your home session from work, and vice -versa. And several people can connect to the same session at once, -and... -You get this picture -- if you're a power-user, this is for you. -Also, if you're not a power-user, this is *not* for you. It's alpha. -It's experimental. Reported bugs will get fixed where possible, but -there can be no newbie support at this time. +------------------------------------------------------------------------------ -2 - How do I get it? + BEFORE INSTALLING IT -You already have it. ./configure --enable-escreen && make && make install -Oh, and you also need the screen program. In our tests, we used -Screen version 3.09.11 (FAU) 14-Feb-02. +Q What is it? -3 - How do I start it? +A Eterm now offers you to compile in experimental support for the + "screen" program. "screen" is a terminal multiplexer (one window, + several shells). Yes, it's like konsole or multi-gnome-terminal, + only that your shells won't die just because X or the Window Manager + do. Oh, and you can pick up your home session from work, and vice + versa. And several people can connect to the same session at once, + and... -If you call it an Eterm, it will behave like one. Same for an Escreen. -(you'd have to symlink from Escreen to Eterm first, of course). -Additionally, when called with a command-line (-e "/some/program"), the -suite will *always* behave like an Eterm, even if invoked as Escreen. -Likewise, when called with an URL (-U "screen://user@.../";), -it will behave like an Escreen, even if invoked under another name. + You get this picture -- if you're a power-user, this is for you. + Also, if you're not a power-user, this is *not* for you. It's alpha. + It's experimental. Reported bugs will get fixed where possible, but + there can be no newbie support at this time. -4 - What should I expect from it? (subject to change) -An Eterm should open with a screen (without a status-line) running -inside of it. There should be a button-bar in the Eterm enumerating -the multiplexed terminal (you usually start with one), and button with -a menu of screen-related actions. If you normally don't use a button-bar, -Escreen will create one for you. Otherwise, it will add buttons to your -existing bar. +Q How do I get it? -* .screenrc, $SCREENRC, [/usr/local]/etc/screenrc and $SYSSCREENRC are - supported. +A You already have it. -* Eterm-buttons are supported (left click on display-name to activate - the display, middle to close it, right to rename it). + ./configure --enable-escreen && make && make install -* Sending statements to screen (^A: in the default setup) with - tab-completion + Oh, and you also need the screen program. In our tests, we used + Screen version 3.09.11 (FAU) 14-Feb-02. -* support for screen command-line options: - Eterm -U screen://localhost/-xRR+-c~/.screenrc.testing -* menu for "screen"-functions (if you add your own, use ^A as the - escape-character in the ECHO action; Escreen will remap it to - whatever is actually used in the session) -* alert boxes for messages from screen +Q What should I expect from it? (subject to change) -* support for SSH-tunneling through firewalls +A An Eterm should open with a screen (without a status-line) running + inside of it. There should be a button-bar in the Eterm enumerating + the multiplexed terminal (you usually start with one), and button with + a menu of screen-related actions. If you normally don't use a button-bar, + Escreen will create one for you. Otherwise, it will add buttons to your + existing bar. +* .screenrc, $SCREENRC, [/usr/local]/etc/screenrc and $SYSSCREENRC are + supported. To a point. If something doesn't work, try things without + the screenrc. If it works then, find the offending line in the screenrc + and send it to me if you'd like a fix. Thankyou. +* Eterm-buttons are supported (left click on display-name to activate + the display, middle to close it, right to rename it). -5 - What's new? +* Sending statements to screen (^A: in the default setup) with + tab-completion -* Entering and exiting copy mode no longer produces a dialog box. - Just too bloody annoying, that. +* support for screen command-line options: + Eterm -U screen://localhost/-xRR+-c~/.screenrc.testing -* SCREENRC, SYSSCREENRC, .../etc/screenrc support (thanks mej) +* menu for "screen"-functions (if you add your own, use ^A as the + escape-character in the ECHO action; Escreen will remap it to + whatever is actually used in the session) -* Easy-to-remember key-layout (optional, see below) +* alert boxes for messages from screen -* Comes up much faster +* support for SSH-tunneling through firewalls -* You can pass arbitrary paramters to screen/scream now +* Easy-to-remember key-layout (optional, see below) +* You can pass arbitrary paramters to screen/scream -6 - What should I expect in the future? (TODO) -* Limited support for scrolling. screen doesn't give us all the info - we'd need to make this really sexy. There will likely be limited - support for screen (we need to keep this, it will be what we'll find - on remote machine), and possibly support for enhanced screen-clones - (like the perchance forthcoming "scream"). +Q What's new? +* Dialog boxes now longer block the entire GUI (only Eterm's). + +* Display-closing has a dialog-box now. + +* Code clean-up. It's actually understandable now. + (You can also compile libscream w/o support for screen now. : ) + +* Logs debug info through libast now if it available + +* Fix for scrollbar (reported by mej). + +* Fix for remote sessions with no corresponding local user + (reported by tfing). + +* Tear-off tabs. You can select the button-representation of a + display and drag-and-drop it + + - to another button: + + The display is moved to that position; the dragged-to display + and all displays following it each move one slot to the right. + (Yes, a swap may occur rather than an insert, cause that's what + screen does. We'll provide a work-around with the next version.) + + - to the desktop: + + This opens another Escreen window (selecting the dragged session + where possible). This is very alpha and not intended for productive + use (yet). + + + +Q What should I expect in the future? (TODO) + +* Limited support for scrolling. screen doesn't give us all the info + we'd need to make this really sexy. + +* Possibly support for enhanced screen-clones (like the perchance + forthcoming "scream"). + + + +------------------------------------------------------------------------------ + + + + AFTER INSTALLING IT + + + +Q How do I start it? + +A If you call it an Eterm, it will behave like one. Same for an Escreen. + (you'd have to symlink from Escreen to Eterm first, of course). + Additionally, when called with a command-line (-e "/some/program"), the + suite will *always* behave like an Eterm, even if invoked as Escreen. + Likewise, when called with an URL (-U "screen://user@.../";), + it will behave like an Escreen, even if invoked under another name. + + + +Q Something is amiss! Moan, moan, complain, complain! + +A Before you complain: + +* Take a deep breath, remember you didn't pay for this. + +* Check whether you are using the latest version. Support for each + version stops with the release of a new one! + +* Read all of the FAQ, your question may be answered in there. + Remember that the FAQ grows with almost each release, so re-reading + it with each release is a good idea. Gives you something to do while + compiling, too. Also see the manual page for Eterm, and that for screen. + +* Check whether the problem only occurs when using your screenrc + (see below). + +* If remote sessions break, check whether terminfo isn't broken on the + remote machine. + +* Send a detailed bug-report. Often, it will not be possible to reproduce + the bug on my set, so I'll need the info from yours. This includes your + screenrc. Sometimes tracing the problem will only be possible if you send + me Escreen's debug output. To get it, #define NS_DEBUG in screamcfg.h + and recompile. + +* If you send a usable bug-report, you will normally receive a free fix, + or at least an explanation why there will be no fix. If on the other + hand you asked something that's explained in this FAQ, we will laugh + at you and THEN be rude. Sorry, but you already got free code, a free + FAQ, and, in many cases, free support. Wasting my time with questions + I already answered is not a welcome response to this generosity. + + + +Q Creating a new screen takes forever!? (While connecting to an + existing one doesn't?) + +A It's the price of making things compatible with stupid screen. To + disable compatibility mode for local connections, pass -z 0 to Eterm + on the command line. (This has no effect on remote sessions!) + Depending on your setup, -z 0 will either make creating new screens + much faster, or not work at all for you. Good luck. -9 - FAQ Q ^A does funny things! @@ -108,6 +205,8 @@ statements like "escape ^Uu"; trying things out will be easier that way. yes, it will be ^U: afterwards. ; ) + + Q I typed ^A and it *doesn't do* funny things! A You probably already have changed the magic escape key to something @@ -115,12 +214,16 @@ Er, you *did* hold Control, then press A, rather then typing a ^ and an A, right? + + Q But I don't like all this control-whatever stuff, can I have easier - to remember bindings? + to remember key-bindings? A Sure. Eterm is The Configurable Terminal, after all. A pret-a-porter - example that you can simply add to your theme.cfg file (or %include - from it) lives in escreen.cfg -- enjoy. + example that you can simply add to the action context of your theme.cfg + file (or %include from it) lives in escreen.cfg -- enjoy. + + Q Escreen changes the escape on the remote box to the same thing as on the local box, does it have to? @@ -131,30 +234,91 @@ Where ^X is the escape and y the literal (man screen). -Q I don't see any buttons when I connect to a remote screen! -A Some Debian-users reported this before, and it is presumed to be a - problem with the terminfo-data. Call up Eterm (or xterm, or whatnot). - *Then* call up "screen" from inside that terminal. Is the last line - inverted? If it isn't, something is seriously weird with your setup, - and it's not a problem in Escreen. Sorry. : ( - 2002/05/13 rewritten code should handle most of these cases - 2002/05/18 rewritten code should handle even more of these cases : ) - -Q Escreen opens, then closes again. - -A Escreen cannot run "screen". If you do have "screen", and it is in - the search path, screen apparently terminates right away. Normally - this means that your screen-sessions are messed up; "screen -ls" will - give you a list of them; "screen -wipe" will do the cleaning up. - If this happens with a remote session, the remote end might just find - your terminal type confusing. The "--term-name" option with something - vanilla (--term-name vt100) should remedy this. + +Q Escreen only creates a new session when there is none; otherwise, + it connects to the existing one! + +A It's not a bug, it's a feature. : ) The default parameters for + the screen Escreen starts are "-xRR". You can override those by + putting your own parameters in the URL + + Eterm -U "protocol://user@...:port/screen_parameters"; + + like so: + + Eterm -U "screen://foo@.../-r"; + + or, for a local screen with no parameters: + + Eterm -U "localhost/ " # which is the same as + Eterm -U "/ " # which is the same as + Eterm -U /+ + + + +Q Escreen complains about stuff in my .screenrc! + +A If it works aside from that, ignore the machine. If it doesn't, try + things without the screenrc. If it works then, find the offending + line in the screenrc and send it to me if you'd like a fix. Thankyou. + + + +Q When Escreen connects to an existing session, things don't work. + They do otherwise. + +A In all likelihood you're not using the same .screenrc when picking + up the session that you used when creating it. If it's just a matter + of the escapes being different, you can tell the front-end which ones + the backend uses either by providing the right screenrc, or by setting + them on the command-line: + + Eterm -U "/-e^Xy" + + Where ^X is the escape-character, and y the literal. Replace as needed. + See "man screen" for more info on escapes. + + + +Q I don't see any buttons when I run Escreen (Eterm -U "")! + +A Escreen could not set up screen in a decent way. Don't use -z 0. + Try it without the screenrc interfering. If this only happens when + picking up a session, see above. + + + +Q Escreen opens, then closes again (with a local session). + +A Escreen cannot run "screen". If you do have "screen", and it is in the + search path, screen apparently terminates right away. Normally + this is a session-problem: there are several sessions, and Escreen + doesn't know which one to pick up, or all sessions are "dead" + (unreachable). + + screen -ls will give you a list of the sessions; + screen -wipe will remove dead sessions; + Eterm -U "/-r session_name" will pick up the session named session_name. + + + +Q Escreen opens, then closes again (with a remote session). + + If it's not one of the problems described above, the remote end might + just find your terminal type confusing. The "--term-name" option with + something vanilla (--term-name vt100) should remedy this. + + Q Escreen works, except when I use -Z to tunnel through a firewall? A Try to manually ssh to the firewall, see how long that takes. Then, - tune the -Z option accordingly (cf man Eterm). + tune the delay in the -Z option accordingly (cf man Eterm): + + Eterm -U ... -Z "localport:firewall:remoteport,delay" + + Q I'd like for the button labels to be in a different colour. @@ -162,21 +326,15 @@ You will be able to define colours for (foreground|background|active|bell) windows' labels in later releases. + + Q "screen" support rocks! Can we have it in konsole/multi-gnome-terminal? A I will not attempt anything like that before I am happy with Escreen. The code, however, is LGPL'd, and its use is documented by example of Eterm (grep for ESCREEN). If you can work with that, do. -Q What's with the licence changing? -A I wrongly assumed that Eterm was GPL'd rather than BSD'd, so I stuck - a GPL on the first alpha. To correct this mistake, the licence was - changed. In an attempt to honour both the convictions of the authors - of Eterm (BSD licence) and those of screen (GPL) which Escreen tries - to bring together, it appears that the licensing of Escreen should - land somewhere in the middle; therefore, I nominally chose LGPL. - This may be softened to BSD at a later date. Q Who's responsible for this? @@ -186,5 +344,11 @@ in (or by trying to use the alpha-functionality). By using this, you agree that anything happening while or because of using it is your fault, and your fault only. + Unfortunately, screen is poorly coded, and a bummer to support. + + Someone (perhaps this kitty) may at some point provide a better + backend, but since we cannot expect that backend on our every + client's machine, we'll still need to support GNU screen, much + as we may hate its protocol (or lack thereof, really). --- Azundris 2002/05/13 <scream@...> http://www.azundris.com/ +-- Azundris 2002/05/23 <scream@...> http://www.azundris.com/ =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/doc/escreen.cfg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- escreen.cfg 22 May 2002 15:38:34 -0000 1.1 +++ escreen.cfg 3 Jun 2002 00:26:15 -0000 1.2 @@ -8,7 +8,7 @@ # See "man Eterm" for more information. # 2002/05/19 Azundris <scream@...> - # CONTROL VARIETY ######################################################### + # CONTROL VARIETY ############################################################ # ctrl-left -> previous display, ctrl-right -> next display bind ctrl Left to echo ^Ap @@ -35,7 +35,7 @@ bind ctrl 0x39 to echo ^A8 bind ctrl 0x30 to echo ^A9 - # ALT VARIETY ############################################################# + # ALT VARIETY ################################################################ # alt-left -> previous display, alt-right -> next display bind alt Left to echo ^Ap @@ -63,7 +63,7 @@ bind alt 0x39 to echo ^A8 bind alt 0x30 to echo ^A9 - # FUNCTION KEYS ########################################################### + # FUNCTION KEYS ############################################################## # F1..F10 -> display_0..display_9 bind F1 to echo ^A0 @@ -80,7 +80,7 @@ # alt F4 -> close display bind alt F4 to echo ^Ak - # MISC STUFF ############################################################## + # MISC STUFF ################################################################# # DISPLAY @@ -129,4 +129,4 @@ - # ENDS #################################################################### + # ENDS ####################################################################### |
From: <enlightenment-cvs@li...> - 2002-06-03 00:24:54
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm/src Modified Files: actions.c buttons.c buttons.h command.c command.h defaultfont.c draw.c e.c eterm_debug.h events.c font.c grkelot.c libscream.c menus.c netdisp.c options.c pixmap.c scream.h screamcfg.h screen.c screen.h scrollbar.c startup.c system.c term.c timer.c utmp.c windows.c Log Message: Sun Jun 2 20:23:07 2002 Michael Jennings (mej) Latest Escreen patch along with twin support from Azundris. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/actions.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- actions.c 22 May 2002 15:38:34 -0000 1.24 +++ actions.c 3 Jun 2002 00:24:21 -0000 1.25 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: actions.c,v 1.24 2002/05/22 15:38:34 mej Exp $"; +static const char cvs_ident[] = "$Id: actions.c,v 1.25 2002/06/03 00:24:21 mej Exp $"; #include "config.h" #include "feature.h" @@ -42,6 +42,9 @@ #include "scrollbar.h" #include "term.h" #include "windows.h" +#ifdef ESCREEN +# include "screamcfg.h" +#endif action_t *action_list = NULL; @@ -60,9 +63,12 @@ USE_VAR(ev); REQUIRE_RVAL(action->param.string != NULL, 0); #ifdef ESCREEN - if (TermWin.screen_mode && TermWin.screen) /* translate escapes */ + if (TermWin.screen && TermWin.screen->backend) { +# ifdef NS_HAVE_SCREEN + /* translate escapes */ ns_parse_screen_interactive(TermWin.screen, action->param.string); - else +# endif + } else #endif tt_write((unsigned char *) action->param.string, strlen(action->param.string)); return 1; @@ -140,8 +146,7 @@ /* When we do have to check the modifiers, we do so in this order to eliminate the most popular choices first. If any test fails, we return FALSE. */ - D_ACTIONS(("Checking modifier set 0x%08x (" MOD_FMT ") vs. X modifier set 0x%08x (" MOD_FMT ")\n", - mod, SHOW_MODS(mod), x_mod, SHOW_X_MODS(x_mod))); + D_ACTIONS(("Checking modifier set 0x%08x (" MOD_FMT ") vs. X modifier set 0x%08x (" MOD_FMT ")\n", mod, SHOW_MODS(mod), x_mod, SHOW_X_MODS(x_mod))); if (mod != MOD_ANY) { /* LOGICAL_XOR() returns true if either the first parameter or the second parameter is true, but not both...just like XOR. If the mask we're looking for is set in @@ -197,8 +202,7 @@ ASSERT_RVAL(ev != NULL, 0); ASSERT_RVAL(ev->xany.type == ButtonPress || ev->xany.type == KeyPress, 0); - D_ACTIONS(("Event %8p: Button %d, Keysym 0x%08x, Key State 0x%08x (modifiers " MOD_FMT ")\n", - ev, ev->xbutton.button, keysym, ev->xkey.state, SHOW_X_MODS(ev->xkey.state))); + D_ACTIONS(("Event %8p: Button %d, Keysym 0x%08x, Key State 0x%08x (modifiers " MOD_FMT ")\n", ev, ev->xbutton.button, keysym, ev->xkey.state, SHOW_X_MODS(ev->xkey.state))); for (action = action_list; action; action = action->next) { /* The very first thing we do is match the event type to the type of the current action. This means that we'll only run through =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/buttons.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- buttons.c 23 May 2002 18:14:39 -0000 1.29 +++ buttons.c 3 Jun 2002 00:24:21 -0000 1.30 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: buttons.c,v 1.29 2002/05/23 18:14:39 mej Exp $"; +static const char cvs_ident[] = "$Id: buttons.c,v 1.30 2002/06/03 00:24:21 mej Exp $"; #include "config.h" #include "feature.h" @@ -50,6 +50,10 @@ static inline void draw_string(buttonbar_t *, Drawable, GC, int, int, char *, size_t); buttonbar_t *buttonbar = NULL; + +#ifdef ESCREEN +button_t *drag = NULL; +#endif long bbar_total_h = -1; static inline void @@ -70,8 +74,7 @@ return; } -buttonbar_t * -bbar_create(void) +buttonbar_t *bbar_create(void) { buttonbar_t *bbar; Cursor cursor; @@ -188,8 +191,7 @@ return 0; } bbar_draw(bbar, IMAGE_STATE_SELECTED, 0); - XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), - &unused_mask); + XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y); if (b) { bbar_select_button(bbar, b); @@ -231,6 +233,9 @@ if (bbar->current) { bbar_click_button(bbar, bbar->current); button_check_action(bbar, bbar->current, ev->xbutton.button, ev->xbutton.time); +#ifdef ESCREEN + drag = bbar->current; +#endif } return 1; } @@ -244,6 +249,10 @@ int unused_root_x, unused_root_y; unsigned int unused_mask; +#ifdef ESCREEN + drag = NULL; +#endif + D_EVENTS(("bbar_handle_button_release(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &buttonbar->event_data), 0); @@ -252,8 +261,7 @@ return 0; } - XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), - &unused_mask); + XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y); if (b) { @@ -285,8 +293,7 @@ return 0; } while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, MotionNotify, ev)); - XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), - &mask); + XQueryPointer(Xdisplay, bbar->win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &mask); D_BBAR((" -> Pointer is at %d, %d with mask 0x%08x\n", ev->xbutton.x, ev->xbutton.y, mask)); b = find_button_by_coords(bbar, ev->xbutton.x, ev->xbutton.y); @@ -315,8 +322,7 @@ return (0); } -buttonbar_t * -find_bbar_by_window(Window win) +buttonbar_t *find_bbar_by_window(Window win) { buttonbar_t *bbar; @@ -500,8 +506,7 @@ D_BBAR((" -> Final icon dimensions are %hux%hu\n", button->icon_w, button->icon_h)); } #endif - D_BBAR((" -> Set button to %dx%d at %d, %d and icon to %dx%d\n", button->w, button->h, button->x, button->y, button->icon_w, - button->icon_h)); + D_BBAR((" -> Set button to %dx%d at %d, %d and icon to %dx%d\n", button->w, button->h, button->x, button->y, button->icon_w, button->icon_h)); } void @@ -577,8 +582,7 @@ ASSERT_RVAL(fontname != NULL, 0); - D_BBAR(("bbar_set_font(%8p, \"%s\"): Current font is %8p, dimensions %d/%d/%d\n", bbar, fontname, bbar->font, bbar->fwidth, - bbar->fheight, bbar->h)); + D_BBAR(("bbar_set_font(%8p, \"%s\"): Current font is %8p, dimensions %d/%d/%d\n", bbar, fontname, bbar->font, bbar->fwidth, bbar->fheight, bbar->h)); if (bbar->font) { free_font(bbar->font); } @@ -603,8 +607,7 @@ return 1; } -button_t * -find_button_by_text(buttonbar_t *bbar, char *text) +button_t *find_button_by_text(buttonbar_t *bbar, char *text) { register button_t *b; @@ -623,8 +626,7 @@ return NULL; } -button_t * -find_button_by_index(buttonbar_t *bbar, long idx) +button_t *find_button_by_index(buttonbar_t *bbar, long idx) { register button_t *b; long i; @@ -639,8 +641,7 @@ return ((i == idx) ? (b) : (NULL)); } -button_t * -find_button_by_coords(buttonbar_t *bbar, int x, int y) +button_t *find_button_by_coords(buttonbar_t *bbar, int x, int y) { register button_t *b; @@ -659,8 +660,7 @@ return NULL; } -button_t * -button_create(char *text) +button_t *button_create(char *text) { button_t *button; @@ -791,8 +791,7 @@ if (image_mode_is(image_button, MODE_MASK)) { paste_simage(images[image_button].clicked, image_button, bbar->win, bbar->win, button->x, button->y, button->w, button->h); } else { - draw_shadow_from_colors(bbar->win, PixColors[menuBottomShadowColor], PixColors[menuTopShadowColor], button->x, button->y, button->w, - button->h, 2); + draw_shadow_from_colors(bbar->win, PixColors[menuBottomShadowColor], PixColors[menuTopShadowColor], button->x, button->y, button->w, button->h, 2); } if (image_mode_is(image_button, MODE_AUTO)) { enl_ipc_sync(); @@ -826,38 +825,48 @@ case ACTION_ECHO: if (!press) { #ifdef ESCREEN - if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */ + if (TermWin.screen && TermWin.screen->backend) { /* translate escapes */ + button_t *b = bbar->buttons; + _ns_disp *d2 = TermWin.screen->dsps; + int n = (button->action.string)[1] - '0'; + if (prvs != 1) { - button_t *b = bbar->buttons; - _ns_disp *d2 = TermWin.screen->dsps; - int n = (button->action.string)[1] - '0'; - - while (b && !(b->flags & NS_SCREAM_CURR)) /* find active disp */ - b = b->next; /* when trying to change name of non- */ - if (b && b != button) { /* active display, make that disp active */ + /* find active disp */ + for (; b && !(b->flags & NS_SCREAM_CURR); b = b->next); + + if (b && b != button) { + /* when trying to change name of non- */ + /* active display, make that disp active */ button->flags |= NS_SCREAM_CURR; b->flags &= ~NS_SCREAM_CURR; bbar_draw(bbar, IMAGE_STATE_CURRENT, MODE_MASK); button->flags &= ~NS_SCREAM_CURR; b->flags |= NS_SCREAM_CURR; - while (d2 && d2->index != n) - d2 = d2->next; - if (d2) - TermWin.screen->curr = d2; /* pre-adjust curr ptr */ - else + for (; d2 && d2->index != n; d2 = d2->next); + if (d2) { + /* pre-adjust curr ptr */ + TermWin.screen->curr = d2; + } else { D_ESCREEN(("no display %d in this session : (\n", n)); - (void) ns_screen_command(TermWin.screen, button->action.string); + } + ns_go2_disp(TermWin.screen, n); } - if (prvs == 2) /* middle button -- kill */ - (void) ns_parse_screen_key(TermWin.screen, NS_SCREEN_KILL); - else /* right button -- rename */ - (void) ns_parse_screen_key(TermWin.screen, NS_SCREEN_RENAME); - } else /* left button -- select */ - (void) ns_screen_command(TermWin.screen, button->action.string); - } else /* not in screen-mode, use normal facilities */ + if (prvs == 2) { + /* middle button -- kill */ + (void) ns_rem_disp(TermWin.screen, n); + } else { + /* right button -- rename */ + (void) ns_ren_disp(TermWin.screen, n, NULL); + } + } else { + /* left button -- select */ + ns_go2_disp(TermWin.screen, n); + } + } else #endif + /* not in screen-mode, use normal facilities */ tt_write((unsigned char *) button->action.string, strlen(button->action.string)); } break; @@ -1138,6 +1147,7 @@ } else { int c = 0; button_t *b = bbar->rbuttons; + do { c++; } while ((b = b->next)); @@ -1154,11 +1164,12 @@ } } } else { /* add to buttons */ - if (!bbar->buttons || after < 0) { /* first button */ + if (!bbar->buttons || after < 0) { /* first button */ button->next = bbar->buttons; bbar->buttons = button; } else { button_t *b = bbar->buttons; + while (after-- > 0 && b->next) b = b->next; button->next = b->next; @@ -1173,6 +1184,7 @@ if (!state) { if (buttonbar) { buttonbar_t *bar = buttonbar; + while (bar->next) bar = bar->next; bar->next = bbar; =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/buttons.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- buttons.h 23 May 2002 18:14:39 -0000 1.12 +++ buttons.h 3 Jun 2002 00:24:21 -0000 1.13 @@ -96,6 +96,9 @@ /************ Variables ************/ extern buttonbar_t *buttonbar; extern long bbar_total_h; +#ifdef ESCREEN +extern button_t *drag; +#endif /************ Function Prototypes ************/ _XFUNCPROTOBEGIN =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/command.c,v retrieving revision 1.75 retrieving revision 1.76 diff -u -3 -r1.75 -r1.76 --- command.c 23 May 2002 18:14:40 -0000 1.75 +++ command.c 3 Jun 2002 00:24:21 -0000 1.76 @@ -34,7 +34,7 @@ * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ -static const char cvs_ident[] = "$Id: command.c,v 1.75 2002/05/23 18:14:40 mej Exp $"; +static const char cvs_ident[] = "$Id: command.c,v 1.76 2002/06/03 00:24:21 mej Exp $"; /* includes: */ #include "config.h" @@ -141,7 +141,7 @@ /* local variables */ int my_ruid, my_euid, my_rgid, my_egid; char initial_dir[PATH_MAX + 1]; -static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */ +static char *ptydev = NULL, *ttydev = NULL; /* pty/tty name */ int cmd_fd = -1; /* file descriptor connected to the command */ int pipe_fd = -1; pid_t cmd_pid = -1; /* process id if child */ @@ -150,6 +150,7 @@ struct stat ttyfd_stat; /* original status of the tty we will use */ int refresh_count = 0, refresh_limit = 1, refresh_type = FAST_REFRESH; unsigned char cmdbuf_base[CMD_BUF_SIZE], *cmdbuf_ptr, *cmdbuf_endp; + /* Addresses pasting large amounts of data * code pinched from xterm */ @@ -157,10 +158,12 @@ static char *v_bufstr = NULL; /* beginning of area to write */ static char *v_bufptr; /* end of area to write */ static char *v_bufend; /* end of physical buffer */ + #ifdef USE_XIM XIM xim_input_method = NULL; XIC xim_input_context = NULL; /* input context */ static XIMStyle xim_input_style = 0; + # ifndef XSetIMValues extern char *XSetIMValues(XIM im, ...); # endif @@ -952,10 +955,10 @@ get_ctrl_char_name(char c) { const char *lookup[] = { - "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */ - "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */ - "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */ - "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */ + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */ + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */ + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */ + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */ }; return ((c < ' ') ? (lookup[(int) c]) : ("")); @@ -1416,7 +1419,7 @@ privileges(INVOKE); # ifndef __CYGWIN32__ - fchown(fd, my_ruid, gid); /* fail silently */ + fchown(fd, my_ruid, gid); /* fail silently */ fchmod(fd, mode); # endif privileges(REVERT); @@ -1673,28 +1676,28 @@ /* get parameters -- gtty */ if (ioctl(0, TIOCGETP, &(tio->sg)) < 0) { - tio->sg.sg_erase = CERASE; /* ^H */ - tio->sg.sg_kill = CKILL; /* ^U */ + tio->sg.sg_erase = CERASE; /* ^H */ + tio->sg.sg_kill = CKILL; /* ^U */ } tio->sg.sg_flags = (CRMOD | ECHO | EVENP | ODDP); /* get special characters */ if (ioctl(0, TIOCGETC, &(tio->tc)) < 0) { - tio->tc.t_intrc = CINTR; /* ^C */ - tio->tc.t_quitc = CQUIT; /* ^\ */ - tio->tc.t_startc = CSTART; /* ^Q */ - tio->tc.t_stopc = CSTOP; /* ^S */ + tio->tc.t_intrc = CINTR; /* ^C */ + tio->tc.t_quitc = CQUIT; /* ^\ */ + tio->tc.t_startc = CSTART; /* ^Q */ + tio->tc.t_stopc = CSTOP; /* ^S */ tio->tc.t_eofc = CEOF; /* ^D */ tio->tc.t_brkc = -1; } /* get local special chars */ if (ioctl(0, TIOCGLTC, &(tio->lc)) < 0) { - tio->lc.t_suspc = CSUSP; /* ^Z */ - tio->lc.t_dsuspc = CDSUSP; /* ^Y */ - tio->lc.t_rprntc = CRPRNT; /* ^R */ - tio->lc.t_flushc = CFLUSH; /* ^O */ - tio->lc.t_werasc = CWERASE; /* ^W */ - tio->lc.t_lnextc = CLNEXT; /* ^V */ + tio->lc.t_suspc = CSUSP; /* ^Z */ + tio->lc.t_dsuspc = CDSUSP; /* ^Y */ + tio->lc.t_rprntc = CRPRNT; /* ^R */ + tio->lc.t_flushc = CFLUSH; /* ^O */ + tio->lc.t_werasc = CWERASE; /* ^W */ + tio->lc.t_lnextc = CLNEXT; /* ^V */ } /* get line discipline */ ioctl(0, TIOCGETD, &(tio->line)); @@ -1760,6 +1763,7 @@ #ifdef USE_XIM static int xim_real_init(void); + # ifdef USE_X11R6_XIM static void xim_destroy_cb(XIM xim, XPointer client_data, XPointer call_data); static void xim_instantiate_cb(Display * display, XPointer client_data, XPointer call_data); @@ -1843,8 +1847,7 @@ preedit_rect->x = needed_rect->width + (scrollbar_is_visible() && !(Options & Opt_scrollbar_right) ? (scrollbar_trough_width()) : 0); preedit_rect->y = Height2Pixel(TermWin.nrow - 1); - preedit_rect->width = - Width2Pixel(TermWin.ncol + 1) - needed_rect->width + (!(Options & Opt_scrollbar_right) ? (scrollbar_trough_width()) : 0); + preedit_rect->width = Width2Pixel(TermWin.ncol + 1) - needed_rect->width + (!(Options & Opt_scrollbar_right) ? (scrollbar_trough_width()) : 0); preedit_rect->height = Height2Pixel(1); status_rect->x = (scrollbar_is_visible() && !(Options & Opt_scrollbar_right)) ? (scrollbar_trough_width()) : 0; @@ -1995,9 +1998,7 @@ xim_set_size(&rect); xim_get_position(&spot); xim_set_color(&fg, &bg); - preedit_attr = - XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, - NULL); + preedit_attr = XVaCreateNestedList(0, XNArea, &rect, XNSpotLocation, &spot, XNForeground, fg, XNBackground, bg, XNFontSet, TermWin.fontset, NULL); } else if (xim_input_style & XIMPreeditArea) { xim_set_color(&fg, &bg); /* The necessary width of preedit area is unknown until create input context. */ @@ -2270,12 +2271,14 @@ return (ptyfd); } + +#ifdef ESCREEN + /***************************************************************************/ /* Escreen: callbacks */ /***********************/ -#ifdef ESCREEN -int +static int set_scroll_x(void *xd, int x) { USE_VAR(xd); @@ -2283,7 +2286,7 @@ return NS_FAIL; } -int +static int set_scroll_y(void *xd, int y) { USE_VAR(xd); @@ -2291,7 +2294,7 @@ return NS_FAIL; } -int +static int set_scroll_w(void *xd, int w) { USE_VAR(xd); @@ -2299,7 +2302,7 @@ return NS_FAIL; } -int +static int set_scroll_h(void *xd, int h) { USE_VAR(xd); @@ -2307,7 +2310,7 @@ return NS_FAIL; } -int +static int redraw(void *xd) { USE_VAR(xd); @@ -2315,7 +2318,7 @@ return NS_FAIL; } -int +static int redraw_xywh(void *xd, int x, int y, int w, int h) { USE_VAR(xd); @@ -2323,8 +2326,7 @@ return NS_FAIL; } -static button_t * -screen_button_create(char *text, char code) +static button_t *screen_button_create(char *text, char code) { button_t *b; char p[3]; @@ -2344,9 +2346,12 @@ /* add a new screen display to button bar. if our user's configured a bbar, we'll add to that, - otherwise, we'll create one. */ -int -ins_disp(void *xd, int after, char *name) + otherwise, we'll create one. + xd address of the pointer to the buttonbar in question + after insert after which display? + name the display's name */ +static int +ins_disp(void *xd, int after, int as, char *name) { buttonbar_t *bbar; button_t *button; @@ -2357,12 +2362,10 @@ bbar = *((buttonbar_t **) xd); - if (!(button = screen_button_create(name, '0' + after + 1))) { + if (!(button = screen_button_create(name, '0' + as))) { return NS_FAIL; } - D_ESCREEN(("%s after %d...\n", name, after)); - if ((bbar = bbar_insert_button(bbar, button, after, FALSE))) { *((buttonbar_t **) xd) = bbar; return NS_SUCC; @@ -2372,7 +2375,8 @@ return NS_FAIL; } -# if 0 +#if 0 + /* add supa-dupa right buttons for screen-features. if our user's configured a bbar, we'll add to that, otherwise, we'll create one. */ @@ -2388,9 +2392,9 @@ bbar = *xd; - if (!(button = screen_button_create(name, key))) { + if (!(button = screen_button_create(name, key))) return NS_FAIL; - } + if ((bbar = bbar_insert_button(bbar, button, -1, TRUE))) { *xd = bbar; return NS_SUCC; @@ -2399,11 +2403,12 @@ button_free(button); return NS_FAIL; } -# endif +#endif /* delete n'th button - n index of the button (not screen, not data -- the button) */ -int + xd address of the pointer to the buttonbar in question + n index of the button (not screen, not data -- the button) */ +static int del_disp(void *xd, int n) { buttonbar_t *bbar = *((buttonbar_t **) xd); @@ -2413,16 +2418,6 @@ REQUIRE_RVAL(bbar, NS_FAIL); REQUIRE_RVAL(bbar->buttons, NS_FAIL); -#if DEBUG >= DEBUG_ESCREEN - if (DEBUG_LEVEL >= DEBUG_ESCREEN) { - int c; - - for (c = 0, b2 = bbar->buttons; b2; c++, b2 = b2->next) { - D_ESCREEN(("%02d: \"%s\"\n", c, b2->text)); - } - } -#endif - b2 = button = bbar->buttons; if (n == 0) { bbar->buttons = bbar->buttons->next; @@ -2443,8 +2438,6 @@ } } - D_ESCREEN(("deleting button %d (%s)...\n", bi, button->text)); - button->next = NULL; button_free(button); @@ -2454,12 +2447,12 @@ } /* update the button-representation of a screen-display. - xd + xd address of the pointer to the buttonbar in question n the button's index (in the list of buttons) flags the new flags for the display (or -1 to ignore) name the new name for the display (or NULL) <- error code */ -int +static int upd_disp(void *xd, int n, int flags, char *name) { buttonbar_t *bbar = *((buttonbar_t **) xd); @@ -2484,20 +2477,49 @@ return NS_SUCC; } +/* expire all buttons + xd address of the pointer to the buttonbar in question + n how many buttons do we want to throw out (normally all of them)? + <- error code */ +static int +expire_buttons(void *xd, int n) +{ + buttonbar_t *bbar = *((buttonbar_t **) xd); + button_t *b, *p; + + REQUIRE_RVAL(bbar, NS_FAIL); + if (n < 1) { + return NS_FAIL; + } + + if ((b = bbar->buttons)) { + for (; n; n--) { + p = b; + b = b->next; + } + p->next = NULL; + button_free(bbar->buttons); + bbar->buttons = b; + } + + return NS_SUCC; +} + /* display a status line the screen program sent us */ -int +static int err_msg(void *xd, int err, char *msg) { - char *sc[] = { "Copy mode", "Bell in" }; + char *sc[] = { "Copy mode", "Bell in", "Wuff, Wuff!!" }; int n, nsc = sizeof(sc) / sizeof(char *); - USE_VAR(xd); - USE_VAR(err); - /* there are certain things that would make sense if we were displaying a status-line; they do not, however, warrant an alert-box, so we drop them here. */ - if (msg && *msg) { + + USE_VAR(xd); + USE_VAR(err); + + if (strlen(msg)) { for (n = 0; n < nsc; n++) { if (!strncmp(msg, sc[n], strlen(sc[n]))) { break; @@ -2511,7 +2533,7 @@ } /* send text to the application (normally "screen") in the terminal */ -int +static int inp_text(void *xd, int id, char *txt) { USE_VAR(xd); @@ -2522,7 +2544,7 @@ } /* open a dialog */ -int +static int input_dialog(void *xd, char *prompt, int maxlen, char **retstr, int (*inp_tab) (void *, char *, size_t, size_t)) { switch (menu_dialog(xd, prompt, maxlen, retstr, inp_tab)) { @@ -2536,19 +2558,21 @@ } /* run a program (normally "screen") inside the terminal */ -int +static int exe_prg(void *xd, char **argv) { USE_VAR(xd); return run_command(argv); } -/********************* Azundris' toys ***************************/ + +/****** Azundris' playthings :-) ******/ #define DIRECT_MASK (~(RS_Cursor|RS_Select|RS_fontMask)) #define COLOUR_MASK (RS_fgMask|RS_bgMask) #define DIRECT_SET_SCREEN(x,y,fg,bg) (screen.text[ys+y])[x]=fg; (screen.rend[ys+y])[x]=bg&DIRECT_MASK; #define CLEAR (1<<16) + static void direct_write_screen(int x, int y, char *fg, rend_t bg) { @@ -2569,10 +2593,12 @@ { int x, y; int ys = TermWin.saveLines - TermWin.view_start; + for (; n != 0; n--) { for (y = 0; y < TermWin.nrow; y++) { text_t *t = screen.text[ys + y]; rend_t *r = screen.rend[ys + y]; + for (x = 0; x < TermWin.ncol; x++) { t[x] = random() & 0xff; r[x] = random() & COLOUR_MASK; @@ -2588,10 +2614,12 @@ int x, y; int ys = TermWin.saveLines - TermWin.view_start; rend_t bg; + do { bg = CLEAR; for (y = 0; (bg == CLEAR) && y < TermWin.nrow; y++) { rend_t *r = screen.rend[ys + y]; + for (x = 0; (bg == CLEAR) && x < TermWin.ncol; x++) { if (r[x] != CLEAR) { bg = r[x]; @@ -2602,6 +2630,7 @@ for (y = 0; y < TermWin.nrow; y++) { text_t *t = screen.text[ys + y]; rend_t *r = screen.rend[ys + y]; + for (x = 0; x < TermWin.ncol; x++) { if (r[x] == bg) { r[x] = CLEAR; @@ -2613,12 +2642,11 @@ } } while (bg != CLEAR); } + #undef DIRECT_MASK #undef COLOUR_MASK #undef DIRECT_SET_SCREEN -#define MATRIX_HI CLEAR -#define MATRIX_LO ((4<<8)|CLEAR) static void matrix(int n) { @@ -2634,8 +2662,10 @@ } MEMSET(s, 0, TermWin.ncol); +#define MATRIX_HI CLEAR +#define MATRIX_LO ((4<<8)|CLEAR) - for (; n != 0; n--) { + while (n--) { for (x = 0; x < TermWin.ncol; x++) { if (!(random() & 3)) { if ((y = s[x])) { @@ -2684,7 +2714,8 @@ } break; - default: t[x] = random() & 0xff; /* hold */ + default: + t[x] = random() & 0xff; /* hold */ } } } @@ -2692,6 +2723,7 @@ } FREE(s); } + #undef MATRIX_HI #undef MATRIX_LO @@ -2701,11 +2733,9 @@ { int y = 1; time_t dur = (time_t) (ms / 1000); -#if 0 - time_t fin = dur + time(NULL); -#endif USE_VAR(xd); + if (!(random() & 7)) { if (!(random() & 3)) { matrix(31); @@ -2725,8 +2755,10 @@ scr_refresh(FAST_REFRESH); sleep(dur); + return 0; } + #undef CLEAR /* Set everything up for escreen mode */ @@ -2745,6 +2777,7 @@ ns_register_red(efuns, redraw); ns_register_rda(efuns, redraw_xywh); + ns_register_exb(efuns, expire_buttons); ns_register_ins(efuns, ins_disp); ns_register_del(efuns, del_disp); @@ -2767,7 +2800,7 @@ menuitem_t *i; if (rs_delay >= 0) { - TermWin.screen->delay = rs_delay; /* more flexible ways later */ + TermWin.screen->delay = rs_delay; /* more flexible ways later */ } if ((m = menu_create(NS_MENU_TITLE))) { char *sc[] = { @@ -2793,11 +2826,8 @@ int n, nsc = sizeof(sc) / sizeof(char *); if (menu_list) { - for (n = 0; n < menu_list->nummenus; n++) { /* blend in w/ l&f */ + for (n = 0; n < menu_list->nummenus; n++) { /* blend in w/ l&f */ if (menu_list->menus[n]->font) { -#ifdef NS_DEBUG - D_ESCREEN(("%d: %p\n", n, menu_list->menus[n]->font)); -#endif m->font = menu_list->menus[n]->font; m->fwidth = menu_list->menus[n]->fwidth; m->fheight = menu_list->menus[n]->fheight; @@ -2810,22 +2840,16 @@ } for (n = 0; n < (nsc - 1); n += 2) { - if (!strcmp(sc[n], "-")) { /* separator */ + if (!strcmp(sc[n], "-")) { + /* separator */ if ((i = menuitem_create(NULL))) { menu_add_item(m, i); menuitem_set_action(i, MENUITEM_SEP, NULL); } - } /* menu entry */ - else if ((i = menuitem_create(sc[n]))) { + } else if ((i = menuitem_create(sc[n]))) { + /* menu entry */ menuitem_set_action(i, n && strcmp(sc[n + 1], NS_SCREEN_INIT) && strcmp(sc[n + 1], NS_SCREEN_PRVS_REG) ? MENUITEM_ECHO : MENUITEM_LITERAL, sc[n + 1]); -# ifdef NS_DEBUG - { - char buf[64]; - sprintf(buf, NS_PREFIX "escreen_menu: registered %s as", sc[n]); - ns_desc_string(i->action.string, buf); - } -# endif menu_add_item(m, i); } } @@ -2846,32 +2870,31 @@ button_free(button); } else { int j, k = menu_list ? menu_list->nummenus : 0; + menu_list = menulist_add_menu(menu_list, m); - for (j = k; j < menu_list->nummenus; j++) + for (j = k; j < menu_list->nummenus; j++) { event_data_add_mywin(&menu_event_data, menu_list->menus[j]->win); + } if (!k) menu_init(); button_set_action(button, ACTION_MENU, NS_MENU_TITLE); } } } -/* add_screen_ctl_button(&buttonbar,"New",'c'); */ - cmd_fd = TermWin.screen->fd; - } else { - return -1; + /* add_screen_ctl_button(&buttonbar,"New",'c'); */ + return TermWin.screen->fd; } -# undef ETERM_PREFIX -# undef ESCREEN_PREFIX - return cmd_fd; + return -1; } - #endif + + /* init_command() */ void init_command(char **argv) { - int (*command_func)(char **); + int (*command_func) (char **); /* Use init function appropriate for how we were compiled. */ #ifdef ESCREEN @@ -2953,13 +2976,13 @@ /* try and get more space from the end */ unsigned char *src, *dst; - dst = (cmdbuf_base + sizeof(cmdbuf_base) - 1); /* max pointer */ + dst = (cmdbuf_base + sizeof(cmdbuf_base) - 1); /* max pointer */ if ((cmdbuf_ptr + n) > dst) - n = (dst - cmdbuf_ptr); /* max # chars to insert */ + n = (dst - cmdbuf_ptr); /* max # chars to insert */ if ((cmdbuf_endp + n) > dst) - cmdbuf_endp = (dst - n); /* truncate end if needed */ + cmdbuf_endp = (dst - n); /* truncate end if needed */ /* equiv: memmove ((cmdbuf_ptr+n), cmdbuf_ptr, n); */ src = cmdbuf_endp; @@ -3064,8 +3087,26 @@ #endif } #ifdef ESCREEN - if (TermWin.screen_mode) - parse_screen_status_if_necessary(); + if (TermWin.screen) { + switch (TermWin.screen->backend) { + case NS_MODE_NONE: + break; + case NS_MODE_NEGOTIATE: +# ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + parse_screen_status_if_necessary(); + break; +# endif +# ifdef NS_HAVE_SCREAM + case NS_MODE_SCREAM: + break; +# endif + default: + D_ESCREEN(("mode %d not supported...\n", TermWin.screen->backend)); + TermWin.screen->backend = NS_MODE_NONE; + TermWin.screen_mode = NS_MODE_NONE; + } + } #endif /* characters already read in */ @@ -3075,7 +3116,7 @@ for (;;) { v_doPending(); - while (XPending(Xdisplay)) { /* process pending X events */ + while (XPending(Xdisplay)) { /* process pending X events */ XEvent ev; @@ -3282,7 +3323,7 @@ #endif do { - while ((ch = cmd_getc()) == 0); /* wait for something */ + while ((ch = cmd_getc()) == 0); /* wait for something */ if (ch >= ' ' || ch == '\t' || ch == '\n' || ch == '\r') { /* Read a text string from the input buffer */ int nlines = 0; @@ -3321,8 +3362,7 @@ break; } } - D_SCREEN(("Adding %d lines (%d chars); str == %8p, cmdbuf_ptr == %8p, cmdbuf_endp == %8p\n", - nlines, cmdbuf_ptr - str, str, cmdbuf_ptr, cmdbuf_endp)); + D_SCREEN(("Adding %d lines (%d chars); str == %8p, cmdbuf_ptr == %8p, cmdbuf_endp == %8p\n", nlines, cmdbuf_ptr - str, str, cmdbuf_ptr, cmdbuf_endp)); scr_add_lines(str, nlines, (cmdbuf_ptr - str)); } else { switch (ch) { @@ -3397,7 +3437,7 @@ */ if (len > 0) { - if (v_bufend < v_bufptr + len) { /* we've run out of room */ + if (v_bufend < v_bufptr + len) { /* we've run out of room */ if (v_bufstr != v_buffer) { /* there is unused space, move everything down */ /* possibly overlapping bcopy here */ @@ -3410,7 +3450,7 @@ if (v_bufend < v_bufptr + len) { /* still won't fit: get more space */ /* Don't use XtRealloc because an error is not fatal. */ - int size = v_bufptr - v_buffer; /* save across realloc */ + int size = v_bufptr - v_buffer; /* save across realloc */ v_buffer = REALLOC(v_buffer, size + len); if (v_buffer) { @@ -3420,13 +3460,13 @@ } else { /* no memory: ignore entire write request */ print_error("cannot allocate buffer space\n"); - v_buffer = v_bufstr; /* restore clobbered pointer */ + v_buffer = v_bufstr; /* restore clobbered pointer */ c = 0; } } } - if (v_bufend >= v_bufptr + len) { /* new stuff will fit */ - memcpy(v_bufptr, d, len); /* bcopy(d, v_bufptr, len); */ + if (v_bufend >= v_bufptr + len) { /* new stuff will fit */ + memcpy(v_bufptr, d, len); /* bcopy(d, v_bufptr, len); */ v_bufptr += len; } } @@ -3452,13 +3492,13 @@ } D_TTY(("Wrote %d characters\n", written)); v_bufstr += written; - if (v_bufstr >= v_bufptr) /* we wrote it all */ + if (v_bufstr >= v_bufptr) /* we wrote it all */ v_bufstr = v_bufptr = v_buffer; } /* * If we have lots of unused memory allocated, return it */ - if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */ + if (v_bufend - v_bufptr > 1024) { /* arbitrary hysteresis */ /* save pointers across realloc */ int start = v_bufstr - v_buffer; int size = v_bufptr - v_buffer; @@ -3471,7 +3511,7 @@ v_bufend = v_buffer + allocsize; } else { /* should we print a warning if couldn't return memory? */ - v_buffer = v_bufstr - start; /* restore clobbered pointer */ + v_buffer = v_bufstr - start; /* restore clobbered pointer */ } } } =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/command.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- command.h 24 Jul 2001 01:00:37 -0000 1.18 +++ command.h 3 Jun 2002 00:24:21 -0000 1.19 @@ -238,6 +238,7 @@ #endif #define VT100_ANS "\033[?1;2c" /* vt100 answerback */ +#define LINUX_ANS "\033[?6;5c" /* linux answerback */ #ifndef ESCZ_ANSWER # define ESCZ_ANSWER VT100_ANS /* obsolete ANSI ESC[c */ #endif @@ -359,6 +360,7 @@ #else # define init_locale() ((void)0) #endif +extern int escreen_init(char **); extern int run_command(char **); extern void init_command(char **); extern void tt_winsize(int); =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/defaultfont.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- defaultfont.c 4 May 2002 14:25:27 -0000 1.4 +++ defaultfont.c 3 Jun 2002 00:24:21 -0000 1.5 @@ -182,7 +182,7 @@ if ((locale = getenv("LC_ALL")) == NULL) if ((locale = getenv("LC_CTYPE")) == NULL) if ((locale = getenv("LANG")) == NULL) - locale = "C"; /* failsafe */ + locale = "C"; /* failsafe */ /* Obtain a "normalized" name of current encoding. * The current encoding is available via nl_langinfo(). =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/draw.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- draw.c 4 May 2002 14:25:27 -0000 1.11 +++ draw.c 3 Jun 2002 00:24:22 -0000 1.12 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: draw.c,v 1.11 2002/05/04 14:25:27 mej Exp $"; +static const char cvs_ident[] = "$Id: draw.c,v 1.12 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -144,7 +144,7 @@ unsigned int r, g, b; int real_depth = 0, depth_factor; register int br, bg, bb; /* Bitshifts */ - register unsigned int mr, mg, mb; /* Bitmasks */ + register unsigned int mr, mg, mb; /* Bitmasks */ GC gc; if (!bord) =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/e.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- e.c 4 May 2002 14:25:27 -0000 1.21 +++ e.c 3 Jun 2002 00:24:22 -0000 1.22 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: e.c,v 1.21 2002/05/04 14:25:27 mej Exp $"; +static const char cvs_ident[] = "$Id: e.c,v 1.22 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -144,7 +144,7 @@ } } len = strlen(str); - for (; XCheckTypedWindowEvent(Xdisplay, my_ipc_win, ClientMessage, &ev);); /* Discard any out-of-sync messages */ + for (; XCheckTypedWindowEvent(Xdisplay, my_ipc_win, ClientMessage, &ev);); /* Discard any out-of-sync messages */ ev.xclient.type = ClientMessage; ev.xclient.serial = 0; ev.xclient.send_event = True; =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/eterm_debug.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- eterm_debug.h 23 May 2002 18:14:40 -0000 1.6 +++ eterm_debug.h 3 Jun 2002 00:24:22 -0000 1.7 @@ -72,7 +72,7 @@ # define DEBUG_ACTIONS 4 # define D_ACTIONS(x) DPRINTF4(x) # define DEBUG_ESCREEN 4 -# define D_ESCREEN(x) DPRINTF4(x) +# define D_ESCREEN(x) DPRINTF4(x) # define DEBUG_PROFILE 5 # define D_PROFILE(x) DPRINTF5(x) =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/events.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -3 -r1.52 -r1.53 --- events.c 4 May 2002 14:25:27 -0000 1.52 +++ events.c 3 Jun 2002 00:24:22 -0000 1.53 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: events.c,v 1.52 2002/05/04 14:25:27 mej Exp $"; +static const char cvs_ident[] = "$Id: events.c,v 1.53 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -46,6 +46,9 @@ #include "scrollbar.h" #include "term.h" #include "windows.h" +#ifdef ESCREEN +# include "screamcfg.h" +#endif unsigned char paused = 0; event_master_t event_master; @@ -70,8 +73,7 @@ /* Add a secondary event dispatcher */ event_master.num_dispatchers++; - event_master.dispatchers = - (event_dispatcher_t *) REALLOC(event_master.dispatchers, sizeof(event_dispatcher_t) * event_master.num_dispatchers); + event_master.dispatchers = (event_dispatcher_t *) REALLOC(event_master.dispatchers, sizeof(event_dispatcher_t) * event_master.num_dispatchers); event_master.dispatchers[event_master.num_dispatchers - 1] = (event_dispatcher_t) func; (init) (); /* Initialize the dispatcher's data */ } @@ -226,8 +228,7 @@ if ((ev->xany.window == TermWin.parent) || (ev->xany.window == Xroot)) { D_EVENTS(("On %s. prop (_WIN_WORKSPACE) == 0x%08x, ev->xproperty.atom == 0x%08x\n", - ((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), - (int) props[PROP_DESKTOP], (int) ev->xproperty.atom)); + ((ev->xany.window == Xroot) ? "the root window" : "TermWin.parent"), (int) props[PROP_DESKTOP], (int) ev->xproperty.atom)); if (ev->xproperty.atom == props[PROP_DESKTOP]) { win = get_desktop_window(); if (win == (Window) 1) { @@ -267,8 +268,7 @@ } #endif if ((ev->xany.window == Xroot) && (image_mode_any(MODE_AUTO))) { - D_EVENTS(("On the root window. prop (ENLIGHTENMENT_COMMS) == %d, ev->xproperty.atom == %d\n", (int) props[PROP_ENL_COMMS], - (int) ev->xproperty.atom)); + D_EVENTS(("On the root window. prop (ENLIGHTENMENT_COMMS) == %d, ev->xproperty.atom == %d\n", (int) props[PROP_ENL_COMMS], (int) ev->xproperty.atom)); if ((props[PROP_ENL_COMMS] != None) && (ev->xproperty.atom == props[PROP_ENL_COMMS])) { if ((enl_ipc_get_win()) != None) { #ifdef PIXMAP_SUPPORT @@ -333,8 +333,7 @@ unsigned char *data; unsigned long Size, RemainingBytes; - XGetWindowProperty(Xdisplay, Xroot, props[PROP_DND_SELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, - &Size, &RemainingBytes, &data); + XGetWindowProperty(Xdisplay, Xroot, props[PROP_DND_SELECTION], 0L, 1000000L, False, AnyPropertyType, &ActualType, &ActualFormat, &Size, &RemainingBytes, &data); if (data != NULL) { XChangeProperty(Xdisplay, Xroot, XA_CUT_BUFFER0, XA_STRING, 8, PropModeReplace, data, strlen(data)); selection_paste(Xroot, XA_CUT_BUFFER0, True); @@ -453,8 +452,7 @@ unsigned int unused_mask; TermWin.focus = 1; - XQueryPointer(Xdisplay, TermWin.parent, &unused_root, &child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), - &unused_mask); + XQueryPointer(Xdisplay, TermWin.parent, &unused_root, &child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); if (child == TermWin.vt) { if (images[image_bg].current != images[image_bg].selected) { images[image_bg].current = images[image_bg].selected; @@ -517,8 +515,7 @@ REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0); while (XCheckTypedWindowEvent(Xdisplay, ev->xany.window, ConfigureNotify, ev)) { - D_EVENTS(("New event: Window 0x%08x, %dx%d at %d, %d\n", ev->xany.window, ev->xconfigure.width, - ev->xconfigure.height, ev->xconfigure.x, ev->xconfigure.y)); + D_EVENTS(("New event: Window 0x%08x, %dx%d at %d, %d\n", ev->xany.window, ev->xconfigure.width, ev->xconfigure.height, ev->xconfigure.x, ev->xconfigure.y)); } if (ev->xany.window == TermWin.parent) { int x = ev->xconfigure.x, y = ev->xconfigure.y; @@ -740,6 +737,62 @@ D_EVENTS(("handle_button_release(ev [%8p] on window 0x%08x)\n", ev, ev->xany.window)); +#ifdef ESCREEN + if (!XEVENT_IS_MYWIN(ev, &primary_data) && drag && TermWin.screen && TermWin.screen->backend && TermWin.screen->userdef) { + buttonbar_t *bbar = *((buttonbar_t **) (TermWin.screen->userdef)); + button_t *b; + int fm = 0, to = 0; + + if (!bbar || !(b = bbar->buttons)) { + return 0; + } + + while (b && (b != drag)) { + b = b->next; + fm++; + } + if (!b) { + /* dragged button is not on the bar with our displays on */ + return 0; + } + + if (bbar->current) { + b = bbar->buttons; + while (b && (b != bbar->current)) { + b = b->next; + to++; + } + if (!b) { + /* dragged-to button is not on the bar with our displays */ + return 0; + } + } + + if (!bbar->current) { + /* tab torn off */ + char *u = ns_get_url(TermWin.screen, fm); + + if (u) { + char *c; + size_t l = strlen(orig_argv0) + strlen(u) + 7; + + if ((c = MALLOC(l))) { + snprintf(c, l, "%s%s -U %s", ((orig_argv0[0] == '/') || ((orig_argv0[0] == '.') && (orig_argv0[1] == '/'))) ? "" : "./", orig_argv0, u); + D_ESCREEN(("(experimental) creating other frame using \"%s\"\n", c)); + (void) ns_run(TermWin.screen->efuns, c); + FREE(c); + } + FREE(u); + } + return 1; + } else if (buttonbar->current != drag) { + /* tab "moved" */ + ns_mov_disp(TermWin.screen, fm, to); + return 1; + } + } +#endif + if (button_state.ignore_release == 1) { button_state.ignore_release = 0; return 0; @@ -802,8 +855,11 @@ COUNT_EVENT(motion_cnt); REQUIRE_RVAL(XEVENT_IS_MYWIN(ev, &primary_data), 0); - if ((PrivateModes & PrivMode_mouse_report) && !(button_state.bypass_keystate)) + + if ((PrivateModes & PrivMode_mouse_report) && !(button_state.bypass_keystate)) { + mouse_drag_report(&(ev->xbutton)); return 1; + } if (ev->xany.window == TermWin.vt) { if (ev->xbutton.state & (Button1Mask | Button3Mask)) { @@ -812,8 +868,7 @@ unsigned int unused_mask; while (XCheckTypedWindowEvent(Xdisplay, TermWin.vt, MotionNotify, ev)); - XQueryPointer(Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), - &(ev->xbutton.y), &unused_mask); + XQueryPointer(Xdisplay, TermWin.vt, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); #ifdef MOUSE_THRESHOLD /* deal with a `jumpy' mouse */ if ((ev->xmotion.time - button_state.button_press) > MOUSE_THRESHOLD) =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/font.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -3 -r1.32 -r1.33 --- font.c 4 May 2002 14:25:27 -0000 1.32 +++ font.c 3 Jun 2002 00:24:22 -0000 1.33 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: font.c,v 1.32 2002/05/04 14:25:27 mej Exp $"; +static const char cvs_ident[] = "$Id: font.c,v 1.33 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -44,6 +44,7 @@ unsigned char font_idx = DEF_FONT_IDX, font_cnt = 0; int def_font_idx = DEF_FONT_IDX; char *rs_font[NFONTS]; + #ifdef MULTI_CHARSET char *rs_mfont[NFONTS]; char **etmfonts = NULL; @@ -229,15 +230,14 @@ update the "next" pointer of the font prior to the one we're actually deleting. */ for (current = font_cache; current->next; current = current->next) { if (((current->next->type == FONT_TYPE_X) && (current->next->fontinfo.xfontinfo == (XFontStruct *) info))) { - D_FONT((" -> Match found at current->next (%8p, current == %8p). Font name is \"%s\"\n", current->next, current, - NONULL(current->next->name))); + D_FONT((" -> Match found at current->next (%8p, current == %8p). Font name is \"%s\"\n", current->next, current, NONULL(current->next->name))); if (--(current->next->ref_cnt) == 0) { D_FONT((" -> Reference count is now 0. Deleting from cache.\n")); tmp = current->next; current->next = current->next->next; XFreeFont(Xdisplay, (XFontStruct *) info); if (cur_font == tmp) { - cur_font = current; /* If we're nuking the last entry in the cache, point cur_font to the *new* last entry. */ + cur_font = current; /* If we're nuking the last entry in the cache, point cur_font to the *new* last entry. */ } FREE(tmp->name); FREE(tmp); @@ -455,8 +455,7 @@ short idx = 0, old_idx = font_idx; int fh, fw = 0; - D_FONT(("change_font(%d, \"%s\"): def_font_idx == %u, font_idx == %u\n", init, NONULL(fontname), (unsigned int) def_font_idx, - (unsigned int) font_idx)); + D_FONT(("change_font(%d, \"%s\"): def_font_idx == %u, font_idx == %u\n", init, NONULL(fontname), (unsigned int) def_font_idx, (unsigned int) font_idx)); if (init) { font_idx = def_font_idx; @@ -585,8 +584,7 @@ TermWin.fprop = 1; /* Proportional font */ /* For proportional fonts with large size variations, do some math-fu to try and help the appearance */ - if (TermWin.fprop && (Options & Opt_proportional) && TermWin.font->per_char - && (TermWin.font->max_bounds.width - TermWin.font->min_bounds.width >= 3)) { + if (TermWin.fprop && (Options & Opt_proportional) && TermWin.font->per_char && (TermWin.font->max_bounds.width - TermWin.font->min_bounds.width >= 3)) { int cw, n = 0, sum = 0, sumsq = 0, min_w, max_w; unsigned int i; double dev; @@ -634,7 +632,7 @@ fw = boldFont->min_bounds.width; fh = boldFont->ascent + boldFont->descent + rs_line_space; - if (TermWin.fprop == 0) { /* bold font must also be monospaced */ + if (TermWin.fprop == 0) { /* bold font must also be monospaced */ if (fw != boldFont->max_bounds.width) fw = -1; } else { @@ -651,8 +649,7 @@ TermWin.width = TermWin.ncol * TermWin.fwidth; TermWin.height = TermWin.nrow * TermWin.fheight; - D_FONT((" -> New font width/height = %ldx%ld, making the terminal size %ldx%ld\n", TermWin.fwidth, TermWin.fheight, TermWin.width, - TermWin.height)); + D_FONT((" -> New font width/height = %ldx%ld, making the terminal size %ldx%ld\n", TermWin.fwidth, TermWin.fheight, TermWin.width, TermWin.height)); /* If we're initializing, *we* do the size hints. If not, resize the parent window. */ if (init) { =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/grkelot.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- grkelot.c 4 May 2002 14:25:27 -0000 1.4 +++ grkelot.c 3 Jun 2002 00:24:22 -0000 1.5 @@ -42,7 +42,7 @@ * TODO: make it more dynamic (linked lists is an idea but slower) */ -static const char cvs_ident[] = "$Id: grkelot.c,v 1.4 2002/05/04 14:25:27 mej Exp $"; +static const char cvs_ident[] = "$Id: grkelot.c,v 1.5 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -53,9 +53,9 @@ # include <string.h> /* --- Macros, Types --------- */ -# define MAX_STATES 4 /* max # states for the FSM */ -# define MAX_SWITCHER 2U /* per state */ -# define MAX_VAL 256 /* for temp allocation */ +# define MAX_STATES 4 /* max # states for the FSM */ +# define MAX_SWITCHER 2U /* per state */ +# define MAX_VAL 256 /* for temp allocation */ typedef unsigned char u_char; typedef unsigned int u_int; @@ -77,7 +77,7 @@ u_int num_xlat; /* number of translations */ K_XLAT *xlat; /* State translations ((dynamic - realloc'ed) */ u_int num_switcher; /* number of switcher keys */ - K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */ + K_SWITCH switcher[MAX_SWITCHER]; /* switcher keys to other states */ u_char life; /* 0 = until switched by key */ u_char prev_state; /* filled when jumped to a new state */ } K_STATE; @@ -109,10 +109,9 @@ "65-122:193,194,216,196,197,214,195,199,201,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,213,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,233,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,245,230"; /* c and s give copyright and section sign */ -static char elot_xlat_acc[] = - "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226," +static char elot_xlat_acc[] = "65-122:182,194,216,196,184,214,195,185,186,206,202,203,204,205,188,208,81,209,211,212,200,191,87,215,190,198,91,92,93,94,95,96,220,226," /*248 */ "169,228,221,246,227,222,223,238,234,235,236,237,252,240,113,241," /*243 */ "167,244,232,254,242,247,253,230"; -static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */ +static char elot_xlat_acc_xtra[] = "46-62:183,47,48,49,50,51,52,53,54,55,56,57,58,59,171,61,187"; /* anw teleia, quotes */ static char elot_xlat_uml[] = "65-122:193,194,216,196,197,214,195,199,218,206,202,203,204,205,207,208,81,209,211,212,200,217,87,215,219,198,91,92,93,94,95,96,225,226,248,228,229,246,227,231,250,238,234,235,236,237,239,240,113,241,243,244,232,249,242,247,251,230"; static char elot_xlat_umacc[] = @@ -123,7 +122,7 @@ "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,160,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,172,157"; static char i437_xlat_acc[] = "65-122:234,129,150,131,235,148,130,236,237,141,137,138,139,140,238,143,81,144,145,146,135,240,87,149,239,133,91,92,93,94,95,96,225,153,175,155,226,173,154,227,229,165,161,162,163,164,230,167,113,168,169,171,159,233,170,174,231,157"; -static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */ +static char i437_xlat_acc_xtra[] = "46-46:250"; /* anw teleia */ static char i437_xlat_uml[] = "65-122:128,129,150,131,132,148,130,134,136,141,137,138,139,140,142,143,81,144,145,146,135,151,87,149,147,133,91,92,93,94,95,96,152,153,175,155,156,173,154,158,228,165,161,162,163,164,166,167,113,168,169,171,159,224,170,174,232,157"; static char i437_xlat_umacc[] = @@ -196,7 +195,7 @@ kstate_setcurr(i); kstate_init(); } - if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */ + if (greek_mode < 0 || greek_mode >= NUM_XLAT_TYPES) /* avoid death */ greek_mode = GREEK_ELOT928; xlat_now = &xlat_type[greek_mode]; kstate_setcurr(0); @@ -310,7 +309,7 @@ /* check for ascii switcher */ for (i = 0; i < pStateNow->num_switcher; i++) - if (pStateNow->switcher[i].type == 'A' && /* only ascii here */ + if (pStateNow->switcher[i].type == 'A' && /* only ascii here */ c == pStateNow->switcher[i].code) { kstate_setcurr(pStateNow->switcher[i].nextstate); pStateNow->switcher[i].on = 1; =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/libscream.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- libscream.c 23 May 2002 18:14:40 -0000 1.7 +++ libscream.c 3 Jun 2002 00:24:22 -0000 1.8 @@ -1,23 +1,27 @@ /**************************************************************************** * scream::libscream.c Azundris <scream@...> * - * routines to connect to screen and or scream daemons. + * routines for terminal emulators to connect to screen and/or scream daemons. * libscream is a double-transparency layer -- it abstracts the backend * (screen or a replacement, locally or ssh-tunneled) to the front-end - * (a terminal-emulation such as Eterm) and vice versa. + * (a terminal-emulation such as Eterm, konsole, or multi-gnome-terminal) + * and vice versa. several sessions can be open at once. * * Lesser GNU Public Licence applies. * Thread-safe: untested + * * 2002/04/19 Azundris incept * 2002/05/04 Azundris support for esoteric screens, thanks to Till * 2002/05/12 Azundris edit display names, send statement, tab completion * 2002/05/13 Azundris ssh tunnel through firewall * 2002/05/17 Azundris supports systemwide screenrc (thanks mej) * 2002/05/18 Azundris remote handling improved (thanks tillsan, tfing) + * 2002/05/21 Azundris code restruction, basic tab tear-off ***************************************************************************/ -#include "config.h" -#include "src/feature.h" + + +#undef NS_DEBUG #include <stdio.h> /* stderr, fprintf, snprintf() */ #include <string.h> /* bzero() */ @@ -32,7 +36,21 @@ #include <ctype.h> /* isspace() */ #include <errno.h> /* errno */ -#include <libast.h> +#include "config.h" +#include "src/feature.h" + +/* use libast if we have it */ +#ifdef DEBUG_ESCREEN +# include <libast.h> +#else +# define MALLOC(a) malloc(a) +# define FREE(a) free(a) +# ifdef NS_DEBUG +# define D_ESCREEN(a) fprintf(stderr,a); +# else +# define D_ESCREEN(a) +# endif +#endif #include "scream.h" /* structs, defs, headers */ #include "screamcfg.h" /* user-tunables */ @@ -47,6 +65,53 @@ +/***************************************************************************/ +/* module-global vars */ +/**********************/ + + + +static long err_inhibit = 0; /* bits. avoid telling same error twice. */ +static _ns_sess *sa = NULL; /* anchor for session list */ +static _ns_hop *ha = NULL; /* anchor for hop list */ + + + +/***************************************************************************/ +/* forward declarations */ +/************************/ + + + +static void ns_desc_hop(_ns_hop *, char *); +static int ns_parse_screenrc(_ns_sess *, char *, int); +static int ns_mov_screen_disp(_ns_sess *, int, int); +static _ns_sess *ns_dst_sess(_ns_sess **); + + + +/**************************************************************************** + _ _ _ _ _ + _ __ ___ (_) __| | __| | | ___ | | __ _ _ _ ___ _ __ +| '_ ` _ \| |/ _` |/ _` | |/ _ \ | |/ _` | | | |/ _ \ '__| +| | | | | | | (_| | (_| | | __/ | | (_| | |_| | __/ | +|_| |_| |_|_|\__,_|\__,_|_|\___| |_|\__,_|\__, |\___|_| + |___/ + +central abstraction layer + + this abstracts the front-end (terminal emulator) against the back-end + (local or remote terminal server), and the back-end against the front-end: + + - front-end hands us an URL we attach to (without knowing about the backend) + - CAL receives messages from back-end and calls the external function (efun) + the front-end registered for this event + - CAL functions are called from the front-end and send data fitting the + session-type to the backend +*/ + + + /* test if we have a valid callback for function-type "e". !p a variable of the "_ns_efuns *" type. will contain a pointer to an efun struct containing a function pointer to the requested function @@ -57,31 +122,35 @@ !<- conditional execution of next (compound-) statement (which would normally be (p)->(e)(...), the call of the function e). */ -#define NS_EFUN_EXISTS(p,s,d,e) (((p) = ns_get_efuns((s),(d))) && ((p)->e)) +#define NS_EFUN_EXISTS(p,s,d,e) (((p)=ns_get_efuns((s),(d)))&&((p)->e)) /***************************************************************************/ -/* module-global vars */ -/**********************/ - - +/* constructors/destructors */ +/****************************/ -static long err_inhibit = 0; /* bits. avoid telling same error twice. */ -static _ns_sess *sa = NULL; /* anchor for session list */ -static _ns_hop *ha = NULL; /* anchor for hop list */ +/* ns_free + free a string (or whatever) */ -/***************************************************************************/ -/* constructors/destructors */ -/****************************/ +static void +* +ns_free(char **x) +{ + if (x && !*x) { + FREE(*x); + *x = NULL; + } + return NULL; +} /* ns_new_hop. create and initialize a hop struct. lp local port. if 0: if otherwise matching hop exists, reuse that. - otherwise, find the first free (as in, not used + otherwise, find the first FREE (as in, not used by us) port, starting with NS_MIN_PORT. fw firewall machine. numeric or symbolic. fp foreign port. if 0: default to SSH port. @@ -98,17 +167,16 @@ return NULL; if (!fp) - fp = get_ssh_port(); /* remote port defaults to SSH */ + fp = ns_get_ssh_port(); /* remote port defaults to SSH */ if (s) { /* see if we already have a matching hop. */ - while (h && !(((h->localport == lp) || (!lp)) && - (!strcmp(h->fw, fw)) && (h->fwport == fp) && (h->sess->port == s->port) && (!strcmp(h->sess->host, s->host)))) + while (h && !(((h->localport == lp) || (!lp)) && (!strcmp(h->fw, fw)) && (h->fwport == fp) && (h->sess->port == s->port) && (!strcmp(h->sess->host, s->host)))) h = h->next; if (h) { if (delay) - h->delay = delay; /* may change delay! */ + h->delay = delay; /* may change delay! */ h->refcount++; return h; } @@ -119,11 +187,13 @@ bzero(h, sizeof(_ns_hop)); if ((h->fw = strdup(fw))) { if (!lp) { - lp = NS_MIN_PORT; /* local port defaults to */ + lp = NS_MIN_PORT; /* local port defaults to */ if (ha) { /* NS_MIN_PORT. if that's */ - int f; /* taken, use next free port. */ - do { /* free as in, not used by us. */ + int f; /* taken, use next FREE port. */ + + do { /* FREE as in, not used by us. */ _ns_hop *i = ha; + f = 0; while (i) if (i->localport == lp) { @@ -155,7 +225,7 @@ /* ns_dst_hop. deref (and, where necessary, release) a hop struct. if sp is provided, additional integrity magic will take place. - ss hop to deref/free + ss hop to deref/FREE sp session that the hop used to belong to (NULL for none (as if)) <- NULL */ @@ -165,23 +235,19 @@ if (ss && *ss) { _ns_hop *s = *ss; -#ifdef NS_DEBUG_MEM if (s->refcount <= 0) { - D_ESCREEN(("leak alert -- trying to double-free hop...\n")); + D_ESCREEN(("ns_dst_hop: leak alert -- trying to double-FREE hop...\n")); return NULL; } -#endif - if (!--(s->refcount)) { /* was last ref to hop => free hop */ + if (!--(s->refcount)) { /* was last ref to hop => FREE hop */ if (s->fw) FREE(s->fw); -#ifdef NS_DEBUG_MEM - bzero(s, sizeof(_ns_hop)); -#endif if (ha == s) /* delist */ ha = s->next; else { _ns_hop *h = ha; + while (h && h->next != s) h = h->next; if (h) @@ -193,12 +259,11 @@ as it's probably about to die. fix the back ref to a session that's actually valid. */ _ns_sess *p = sa; + while (p && ((p == sp) || (p->port != sp->port) || (strcmp(p->host, sp->host)))) p = p->next; if (!p) - ns_desc_hop(s, - NS_PREFIX - "ns_dst_sess: Leak alert -- found a hop that is only\n referenced once, but has a refcount > 1. Hop data follow"); + ns_desc_hop(s, NS_PREFIX "ns_dst_sess: Leak alert -- found a hop that is only\n referenced once, but has a refcount > 1. Hop data follow"); else s->sess = p; } @@ -213,6 +278,7 @@ ns_new_efuns(void) { _ns_efuns *s = MALLOC(sizeof(_ns_efuns)); + if (s) { bzero(s, sizeof(_ns_efuns)); } @@ -234,11 +300,9 @@ { if (ss && *ss) { _ns_efuns *s = *ss; + *ss = NULL; if (!--(s->refcount)) { -#ifdef NS_DEBUG_MEM - bzero(s, sizeof(_ns_efuns)); -#endif FREE(s); } } @@ -251,29 +315,26 @@ ns_new_disp(void) { _ns_disp *s = MALLOC(sizeof(_ns_disp)); + if (s) { bzero(s, sizeof(_ns_disp)); } return s; } -_ns_sess *ns_dst_sess(_ns_sess **); /* forward, sorry */ - static _ns_disp * ns_dst_disp(_ns_disp ** ss) { if (ss && *ss) { _ns_disp *s = *ss; + if (s->name) FREE(s->name); if (s->efuns) ns_dst_efuns(&(s->efuns)); if (s->child) /* nested screen? */ - ns_dst_sess(&(s->child)); /* forward, sorry */ + ns_dst_sess(&(s->child)); *ss = NULL; -#ifdef NS_DEBUG_MEM - bzero(s, sizeof(_ns_disp)); -#endif FREE(s); } return NULL; @@ -284,6 +345,7 @@ { if (ss && *ss) { _ns_disp *s = *ss, *t; + *ss = NULL; do { t = s->next; @@ -300,14 +362,16 @@ ns_new_sess(void) { _ns_sess *s = MALLOC(sizeof(_ns_sess)); + if (s) { bzero(s, sizeof(_ns_sess)); - s->escape = NS_SCREEN_ESCAPE; /* default setup for the screen program */ - s->literal = NS_SCREEN_LITERAL; + s->escape = NS_SCREEN_ESCAPE; /* default setup for the screen program */ + s->literal = NS_SCREEN_LITERAL; /* set even ifndef NS_HAVE_SCREEN */ s->dsbb = NS_SCREEN_DEFSBB; s->delay = NS_INIT_DELAY; if (sa) { /* add to end of list */ _ns_sess *r = sa; + while (r->next) r = r->next; r->next = s; @@ -317,11 +381,12 @@ return s; } -_ns_sess * +static _ns_sess * ns_dst_sess(_ns_sess ** ss) { if (ss && *ss) { _ns_sess *s = *ss; + ns_dst_dsps(&(s->dsps)); if (s->hop) ns_dst_hop(&(s->hop), s); @@ -340,9 +405,6 @@ if (s->next) s->next->prvs = s->prvs; *ss = NULL; -#ifdef NS_DEBUG_MEM - bzero(s, sizeof(_ns_sess)); -#endif FREE(s); } return NULL; @@ -352,168 +414,136 @@ /***************************************************************************/ -/* send commands to screen */ -/***************************/ +/* display-list handling */ +/*************************/ -/* send a command string to a session, using the appropriate escape-char - sess the session - cmd the command string. escapes must be coded as NS_SCREEN_ESCAPE; - this routine will convert the string to use the escapes actually - used in the session - <- error code */ +/* we need a certain display struct (index n in session s). + give it to us if it exists. + s the session the display should be in + n the index of the display (>=0). displays in a session are sorted + by index, but may be sparse (0, 1, 3, 7) + <- the requested display */ -int -ns_screen_command(_ns_sess * sess, char *cmd) +static _ns_disp * +disp_fetch(_ns_sess * s, int n) { - _ns_efuns *efuns; - char *c; - int ret = NS_SUCC; - - if (!cmd || !*cmd) { - return NS_FAIL; - } - - if (NS_EFUN_EXISTS(efuns, sess, NULL, inp_text)) { - if ((c = strdup(cmd))) { - char *p; /* replace default escape-char with that */ + _ns_disp *e = NULL, *c; - for (p = c; *p; p++) { /* actually used in this session */ - if (*p == NS_SCREEN_ESCAPE) { - *p = sess->escape; - } - } -#ifdef NS_DEBUG - ns_desc_string(c, "ns_screen_command: xlated string"); -#endif - efuns->inp_text(NULL, sess->fd, c); - FREE(c); - } else { - /* out of memory */ - ret = NS_OOM; - } - } else { - ret = NS_EFUN_NOT_SET; - D_ESCREEN(("sess->efuns->inp_text not set!\n")); - } - return ret; + for (c = s->dsps; c && (c->index < n); c = c->next) + e = c; + if (c && (c->index == n)) /* found it */ + return c; + return NULL; } -/* send a single command string to screen, adding the equiv of ^A: - s the session - cmd the command string - <- error code */ +/* we need a certain display struct (index n in session s). + give it to us. if you can't find it, make one up and insert it into + the list. + s the session the display should be in + n the index of the display (>=0). displays in a session are sorted + by index, but may be sparse (0, 1, 3, 7) + <- the requested display */ -int -ns_screen_xcommand(_ns_sess * s, char prefix, char *cmd) +static _ns_disp * +disp_fetch_or_make(_ns_sess * s, int n) { - char *i; - int ret = NS_OOM; - if ((i = MALLOC(strlen(cmd) + 4))) { - size_t l = strlen(cmd) + 2; - strcpy(&i[2], cmd); - i[0] = s->escape; - i[1] = prefix; - i[l] = '\n'; - i[++l] = '\0'; - ret = ns_screen_command(s, i); - FREE(i); - } - return ret; -} + _ns_disp *d, *e = NULL, *c; + for (c = s->dsps; c && (c->index < n); c = c->next) + e = c; + if (c && (c->index == n)) /* found it */ + return c; -/* scroll horizontally to column x (dummy) */ -int -ns_scroll2x(_ns_sess * s, int x) -{ - return NS_FAIL; -} + if (!(d = ns_new_disp())) /* not there, create new */ + return NULL; /* can't create, fail */ -/* scroll vertically so line y of the scrollback buffer is the top line */ -int -ns_scroll2y(_ns_sess * s, int y) -{ - return NS_FAIL; -} + d->index = n; -/* go to display #d */ -int -ns_go2_disp(_ns_sess * s, int d) -{ - return NS_FAIL; -} + if ((d->next = c)) /* if not last element... */ + c->prvs = d; + if ((d->prvs = e)) /* if not first element */ + e->next = d; + else /* make first */ + s->dsps = d; -/* add a client display with the name "name" after display number #after */ -int -ns_add_disp(_ns_sess * s, int after, char *name) -{ - return NS_FAIL; -} + d->sess = s; /* note session on display */ -/* resize display #d to w*h */ -int -ns_rsz_disp(_ns_sess * s, int d, int w, int h) -{ - return NS_FAIL; -} + if (!d->sess->curr) /* note as current on session if first display */ + d->sess->curr = d; -/* remove display #d */ -int -ns_rem_disp(_ns_sess * s, int d) -{ - return NS_FAIL; + return d; } -/* rename display #d to "name" */ -int -ns_ren_disp(_ns_sess * s, int d, char *name) -{ - return NS_FAIL; -} -/* log activity in display #d to file "logfile" */ + +/* get element number from screen-index (latter is sparse, former ain't) + screen the session in question + n the index screen gave us (sparse) + <- the real index (element number in our list of displays) */ + int -ns_log_disp(_ns_sess * s, int d, char *logfile) +disp_get_real_by_screen(_ns_sess * screen, int n) { - return NS_FAIL; + _ns_disp *d2 = screen->dsps; + int r = 0; + + while (d2 && d2->index != n) { + d2 = d2->next; + r++; + } +#ifdef NS_PARANOID + if (!d2) + return -1; +#endif + return r; } -/* force an update of the status line */ + + +/* get screen-index from element number (former is sparse, latter ain't) + screen the session in question + n the real index (element number in our list of displays) + <- the index screen knows (sparse) */ + int -ns_upd_stat(_ns_sess * s) +disp_get_screen_by_real(_ns_sess * screen, int r) { - return ns_screen_command(s, NS_SCREEN_UPDATE); -} + _ns_disp *d2 = screen->dsps; + while (d2 && (r-- > 0)) + d2 = d2->next; +#ifdef NS_PARANOID + if (!d2) + return -1; +#endif + return d2->index; +} -/* ns_input_dialog - open a dialog - s the session - !retstr where we'll store a pointer to the result (the user's input) - prompt the prompt to appear in the dialog box - <- msg */ +/* remove a display from the internal list and release its struct and data + disp the display in question */ -int -ns_input_dialog(_ns_sess * s, char *prompt, int maxlen, char **retstr, int (*inp_tab) (void *, char *, size_t, size_t)) +static void +disp_kill(_ns_disp * d3) { - _ns_efuns *efuns; - char *c; - int ret = NS_SUCC; - - if (NS_EFUN_EXISTS(efuns, s, NULL, input_dialog)) { - (void) efuns->input_dialog((void *) s, prompt, maxlen, retstr, inp_tab); + if (d3->prvs) { + d3->prvs->next = d3->next; + if (d3->sess->curr == d3) + d3->sess->curr = d3->prvs; } else { - ret = NS_EFUN_NOT_SET; - D_ESCREEN(("sess->efuns->input_dialog not set!\n")); + d3->sess->dsps = d3->next; + if (d3->sess->curr == d3) + d3->sess->curr = d3->next; } - return ret; + if (d3->next) + d3->next->prvs = d3->prvs; + ns_dst_disp(&d3); } @@ -532,10 +562,12 @@ int ns_sess_init(_ns_sess * sess) { +#ifdef NS_HAVE_SCREEN if ((sess->backend == NS_MODE_NEGOTIATE) || (sess->backend == NS_MODE_SCREEN)) { (void) ns_parse_screenrc(sess, sess->sysrc, NS_ESC_SYSSCREENRC); return ns_parse_screenrc(sess, sess->home, NS_ESC_SCREENRC); } +#endif return NS_SUCC; } @@ -545,10 +577,11 @@ <- a port number -- 22 in all likelihood. */ int -get_ssh_port(void) +ns_get_ssh_port(void) { static int port = 0; struct servent *srv; + if (port) return port; /* (fixme) replace with getservbyname_r on systems that have it */ @@ -567,10 +600,10 @@ <- a hop struct, or NULL */ -_ns_hop * +static _ns_hop * ns_parse_hop(_ns_sess * s, char *h) { - char *p = h, *e, *fw = NULL; + char *p = h, *e; int f = 0, v, lp = 0, fp = 0, delay = 0; if (!h || !*h) @@ -619,31 +652,32 @@ doc context-info !stdout the string, in human-readable form */ -void +static void ns_desc_string(char *c, char *doc) { char *p = c; - if (doc) - D_ESCREEN((" ", doc)); + if (doc) { + D_ESCREEN(("%s: ", doc)); + } if (!c) { - fputs("NULL\n", stderr); + D_ESCREEN(("NULL\n")); return; } else if (!*c) { - fputs("empty\n", stderr); + D_ESCREEN(("empty\n")); return; } while (*p) { if (*p < ' ') - fprintf(stderr, "^%c", *p + 'A' - 1); + D_ESCREEN(("^%c", *p + 'A' - 1)); else - fputc(*p, stderr); + D_ESCREEN(("%c", *p)); p++; } - fputs("\n", stderr); + D_ESCREEN(("\n")); return; } @@ -656,20 +690,19 @@ doc: info about the context ! stderr: info about the hop */ -void +static void ns_desc_hop(_ns_hop * h, char *doc) { if (!h && doc) { - D_ESCREEN(("ns_desc_hop called with broken pointer!\n", doc)); + D_ESCREEN(("%s: ns_desc_hop called with broken pointer!\n", doc)); return; } if (doc) - D_ESCREEN(("\n", doc)); + D_ESCREEN(("%s:\n", doc)); - fprintf(stderr, NS_PREFIX "tunnel from localhost:%d to %s:%d to %s:%d is %s. (delay %d, %d ref%s)\n", - h->localport, h->fw, h->fwport, - h->sess->host, h->sess->port, h->established ? "up" : "down", h->delay, h->refcount, h->refcount == 1 ? "" : "s"); + D_ESCREEN(("tunnel from localhost:%d to %s:%d to %s:%d is %s. (delay %d, %d ref%s)\n", + h->localport, h->fw, h->fwport, h->sess->host, h->sess->port, h->established ? "up" : "down", h->delay, h->refcount, h->refcount == 1 ? "" : "s")); } @@ -680,31 +713,29 @@ doc: info about the context ! stderr: info about the session */ -void +static void ns_desc_sess(_ns_sess * sess, char *doc) { if (!sess) { - D_ESCREEN(("ns_desc_sess called with broken pointer!\n", doc)); - fflush(stderr); + D_ESCREEN(("%s: ns_desc_sess called with broken pointer!\n", doc)); return; } if (sess->where == NS_LCL) - D_ESCREEN(("(efuns@%p)\t (user %s) local %s", doc, sess->efuns, sess->user, sess->proto)); + D_ESCREEN(("%s: (efuns@%p)\t (user %s) local %s", doc, sess->efuns, sess->user, sess->proto)); else { - fprintf(stderr, NS_PREFIX "%s: (efuns@%p)\t %s://%s%s%s@%s";, - doc, sess->efuns, sess->proto, sess->user, sess->pass ? ":" : "", sess->pass ? sess->pass : "", sess->host); + D_ESCREEN(("%s: (efuns@%p)\t %s://%s%s%s@%s";, + doc, sess->efuns, sess->proto ? sess->proto : "???", sess->user, sess->pass ? ":" : "", sess->pass ? sess->pass : "", sess->host)); if (sess->port != NS_DFLT_SSH_PORT) - fprintf(stderr, ":%s", sess->port); + D_ESCREEN((":%s", sess->port)); } - fprintf(stderr, "%c%s\n", sess->where == NS_LCL ? ' ' : '/', sess->rsrc); + D_ESCREEN(("%c%s\n", sess->where == NS_LCL ? ' ' : '/', sess->rsrc)); if (sess->hop) ns_desc_hop(sess->hop, NULL); if (sess->sysrc) - D_ESCREEN(("searching for sysrc in %s\n", sess->sysrc)); + D_ESCREEN(("%s: searching for sysrc in %s\n", doc, sess->sysrc)); if (sess->home) - D_ESCREEN(("searching for usrrc in %s\n", sess->home)); - D_ESCREEN(("escapes set to ^%c-%c\n", sess->escape + 'A' - 1, sess->literal)); - fflush(stderr); + D_ESCREEN(("%s: searching for usrrc in %s\n", doc, sess->home)); + D_ESCREEN(("%s: escapes set to ^%c-%c\n", doc, sess->escape + 'A' - 1, sess->literal)); } @@ -728,9 +759,7 @@ goto fail; if (cmd && *cmd) { /* count args (if any) */ -#ifdef NS_DEBUG - D_ESCREEN(("executing \"%s\"...\n", cmd)); -#endif + D_ESCREEN(("ns_run: executing \"%s\"...\n", cmd)); do { n++; while (*p && *p != ' ') { @@ -759,8 +788,8 @@ for (p = cmd, c = 0; c < n; c++) { args[c] = p; while (*p && *p != ' ') { - if (*p == '\"') { /* leave quoting stuff together as one arg */ - args[c] = &p[1]; /* but remove the quote signs */ + if (*p == '\"') { /* leave quoting stuff together as one arg */ + args[c] = &p[1]; /* but remove the quote signs */ do { p++; if (s) @@ -796,12 +825,12 @@ tmpl the template. should contain one %s dflt the default value opt the user-supplied value (or NULL) - <- a new malloc'd string (or NULL) */ + <- a new MALLOC'd string (or NULL) */ -char * +static char * ns_make_call_el(char *tmpl, char *dflt, char *opt) { - size_t l, r; + int l, r; char *p; if (tmpl && dflt && *tmpl && strstr(tmpl, "%s")) { @@ -819,7 +848,7 @@ -char * +static char * ns_make_call(_ns_sess * sess) { char *call, *tmp = NULL, *screen = NULL, *scream = NULL, *screem = NULL; @@ -827,24 +856,27 @@ /* unless decidedly in other mode... */ if (sess->backend != NS_MODE_SCREEN) tmp = scream = ns_make_call_el(NS_SCREAM_CALL, NS_SCREAM_OPTS, sess->rsrc); +#ifdef NS_HAVE_SCREEN if (sess->backend != NS_MODE_SCREAM) tmp = screen = ns_make_call_el(NS_SCREEN_CALL, NS_SCREEN_OPTS, sess->rsrc); +#endif if (sess->backend == NS_MODE_NEGOTIATE) { - size_t r, l = strlen(NS_SCREEM_CALL) + strlen(scream) + strlen(screen) - 3; + int r, l = strlen(NS_SCREEM_CALL) + (scream ? strlen(scream) : 0) + (screen ? strlen(screen) : 0) - 3; + if ((screem = MALLOC(l))) { - r = snprintf(screem, l, NS_SCREEM_CALL, scream, screen); + r = snprintf(screem, l, NS_SCREEM_CALL, scream ? scream : "", screen ? screen : ""); #ifdef NS_PARANOID if ((r < 0) || (r > l)) { - FREE(screem); + ns_free(&screem); } #endif } tmp = screem; } call = ns_make_call_el(NS_WRAP_CALL, tmp, NULL); - FREE(screen); - FREE(scream); - FREE(screem); + ns_free(&screen); + ns_free(&scream); + ns_free(&screem); return call; } @@ -854,7 +886,7 @@ sp the session <- NS_FAIL, or the result of ns_run() */ -int +static int ns_attach_lcl(_ns_sess ** sp) { _ns_sess *sess; @@ -866,12 +898,13 @@ sess = *sp; - if (call = ns_make_call(sess)) { + if ((call = ns_make_call(sess))) { char *c2 = ns_make_call_el("/bin/sh -c \"%s\"", call, NULL); - FREE(call); + + ns_free(&call); if (c2) { ret = ns_run(sess->efuns, c2); - FREE(c2); + ns_free(&c2); } } return ret; @@ -883,7 +916,7 @@ sp the session <- -1, or the result of ns_run() */ -int +static int ns_attach_ssh(_ns_sess ** sp) { _ns_sess *sess; @@ -899,10 +932,9 @@ call = ns_make_call(sess); if (sess->hop) { - if (sess->hop->established == NS_HOP_DOWN) { /* the nightmare foe */ + if (sess->hop->established == NS_HOP_DOWN) { /* the nightmare foe */ ret = snprintf(cmd, NS_MAXCMD, "%s %s -p %d -L %d:%s:%d %s@%s", - NS_SSH_CALL, NS_SSH_TUNNEL_OPTS, - sess->hop->fwport, sess->hop->localport, sess->host, sess->port, sess->user, sess->hop->fw); + NS_SSH_CALL, NS_SSH_TUNNEL_OPTS, sess->hop->fwport, sess->hop->localport, sess->host, sess->port, sess->user, sess->hop->fw); if (ret < 0 || ret > NS_MAXCMD) return NS_FAIL; ns_run(sess->efuns, cmd); @@ -912,14 +944,10 @@ NS_SSH_CALL, NS_SSH_OPTS, sess->hop->localport, sess->user, call, sess->escape + 'A' - 1, sess->literal); } else { ret = - snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@%s \"%s -e^%c%c\"", NS_SSH_CALL, NS_SSH_OPTS, sess->port, sess->user, sess->host, call, - sess->escape + 'A' - 1, sess->literal); + snprintf(cmd, NS_MAXCMD, "%s %s -p %d %s@%s \"%s -e^%c%c\"", NS_SSH_CALL, NS_SSH_OPTS, sess->port, sess->user, sess->host, call, sess->escape + 'A' - 1, sess->literal); } - FREE(call); -#ifdef NS_DEBUG - fprintf(stderr, "\n\n>>%s\n>>%s\n\n", call, cmd); - fflush(stderr); -#endif + ns_free(&call); + return (ret < 0 || ret > NS_MAXCMD) ? NS_FAIL : ns_run(sess->efuns, cmd); } @@ -938,7 +966,6 @@ { _ns_sess *sess; int err_dummy; - char *p; if (!err) err = &err_dummy; @@ -948,9 +975,7 @@ return NULL; sess = *sp; -#ifdef NS_DEBUG ns_desc_sess(sess, "ns_attach_by_sess()"); -#endif (void) ns_sess_init(sess); @@ -962,6 +987,9 @@ /* local session, but for a different uid. */ /* FALL-THROUGH */ case NS_SSH: + if (!sess->delay) { + sess->delay = NS_INIT_DELAY ? NS_INIT_DELAY : 1; + } sess->fd = ns_attach_ssh(&sess); break; default: @@ -969,9 +997,7 @@ goto fail; } -#ifdef NS_DEBUG - D_ESCREEN(("screen session-fd is %d, ^%c-%c\n", sess->fd, sess->escape + 'A' - 1, sess->literal)); -#endif + D_ESCREEN(("ns_attach_by_sess: screen session-fd is %d, ^%c-%c\n", sess->fd, sess->escape + 'A' - 1, sess->literal)); return sess; @@ -1022,7 +1048,7 @@ if (!(d = strdup(url))) goto fail; - if ((q = strstr(d, "://"))) { /* protocol, if any */ + if ((q = strstr(d, "://"))) { /* protocol, if any */ *q = '\0'; if (!(sess->proto = strdup(d))) goto fail; @@ -1030,13 +1056,14 @@ } else q = d; - if ((p = strchr(q, '@'))) { /* user, if any */ + if ((p = strchr(q, '@'))) { /* user, if any */ char *r; + if (p != q) { /* ignore empty user */ *p = '\0'; - if ((r = strchr(q, ':'))) { /* password, if any */ + if ((r = strchr(q, ':'))) { /* password, if any */ *(r++) = '\0'; - if (!(sess->pass = strdup(r))) /* password may be empty string! */ + if (!(sess->pass = strdup(r))) /* password may be empty string! */ goto fail; } sess->user = strdup(q); @@ -1049,6 +1076,7 @@ if (strlen(p)) { char *r = p; int f; + while (*r) { if (*r == '+') *(r++) = ' '; @@ -1056,6 +1084,7 @@ long v; char *e; char b[3]; + b[0] = r[1]; b[1] = r[2]; b[2] = '\0'; @@ -1070,32 +1099,33 @@ r = p; f = 0; while (*r) { - if (*r == ' ') { /* Padding between arguments */ + if (*r == ' ') { /* Padding between arguments */ while (*r == ' ') r++; } else { if (*r == '-') { - if (*(++r) == 'e') { /* set escape */ +# ifdef NS_HAVE_SCREEN + if (*(++r) == 'e') { /* set escape */ char x = 0, y = 0; + while (*(++r) == ' '); if ((x = ns_parse_esc(&r)) && (y = ns_parse_esc(&r))) { sess->escape = x; sess->literal = y; sess->escdef = NS_ESC_CMDLINE; } - } else if (*r == 'c') { /* alt screenrc */ + } else if (*r == 'c') { /* alt screenrc */ char *rc, *rx; + while (*(++r) == ' '); if ((rx = strchr(r, ' '))) *rx = '\0'; if (*r != '/') - D_ESCREEN(("path for screen's option -c should be absolute (%s)\n", r)); + D_ESCREEN(("URL: path for screen's option -c should be absolute (%s)\n", r)); if ((rc = strdup(r))) { - if (sess->home) /* this should never happen */ + if (sess->home) /* this should never happen */ FREE(sess->home); -#ifdef NS_DEBUG - D_ESCREEN(("searching for rc in %s\n", rc)); -#endif + D_ESCREEN(("URL: searching for rc in %s\n", rc)); sess->home = rc; } if (rx) { @@ -1103,13 +1133,14 @@ *rx = ' '; } } +# endif while (*r && (f || *r != ' ')) { if (*r == '\"') f = 1 - f; r++; } } - while (*r && *r != ' ') /* proceed to space */ + while (*r && *r != ' ') /* proceed to space */ r++; } } @@ -1119,7 +1150,7 @@ } } - if ((p = strchr(q, ':'))) { /* port, if any */ + if ((p = strchr(q, ':'))) { /* port, if any */ *(p++) = '\0'; if (!*p || !(sess->port = atoi(p)) || sess->port > NS_MAX_PORT) { *err = NS_MALFORMED_URL; @@ -1127,7 +1158,7 @@ } } - if (strlen(q) && !(sess->host = strdup(q))) /* host, if any */ + if (strlen(q) && !(sess->host = strdup(q))) /* host, if any */ goto fail; FREE(d); @@ -1142,24 +1173,32 @@ } if (!(sess->user = strdup(pwe->pw_name))) goto fail; - } else if (pwe && strcmp(pwe->pw_name, sess->user)) { /* user!=current_user */ + } else if ((sess->host && strcmp(sess->host, "localhost") && strcmp(sess->host, "127.0.0.1")) || sess->port) { + pwe = NULL; + } else if (!pwe || strcmp(pwe->pw_name, sess->user)) { /* user!=current_user */ sess->where = NS_SU; - if (!(pwe = getpwnam(sess->user)) && !sess->host && !sess->port) { + if (!(pwe = getpwnam(sess->user))) { *err = NS_UNKNOWN_USER; goto fail; } + } else { + *err = NS_UNKNOWN_USER; + goto fail; } - if (getenv("SYSSCREENRC")) { /* $SYSSCREENRC */ + +#ifdef NS_HAVE_SCREEN + if (getenv("SYSSCREENRC")) { /* $SYSSCREENRC */ if (!(sess->sysrc = strdup(getenv("SCREENRC")))) goto fail; } else { - char *loc[] = { "/usr/local/etc/screenrc", /* official */ + char *loc[] = { "/usr/local/etc/screenrc", /* official */ "/etc/screenrc", /* actual (on SuSE) */ "/usr/etc/screenrc", "/opt/etc/screenrc" }; int n, nloc = sizeof(loc) / sizeof(char *); + for (n = 0; n < nloc; n++) if (!access(loc[n], R_OK)) { if (!(sess->sysrc = strdup(loc[n]))) @@ -1170,11 +1209,11 @@ if (getenv("SCREENRC")) { /* $SCREENRC */ sess->home = strdup(getenv("SCREENRC")); - } else if (pwe && !sess->home) { /* ~/.screenrc */ + } else if (pwe && !sess->home) { /* ~/.screenrc */ if ((sess->home = MALLOC(strlen(pwe->pw_dir) + strlen(NS_SCREEN_RC) + 2))) sprintf(sess->home, "%s/%s", pwe->pw_dir, NS_SCREEN_RC); - } else - goto fail; + } +#endif if (!sess->host) { /* no host */ if (!(sess->host = strdup("localhost"))) @@ -1182,23 +1221,25 @@ if (!sess->port) { /* no host/port */ sess->where = NS_LCL; } - } else if ((p = strchr(sess->host, '/'))) /* have host */ + } else if ((p = strchr(sess->host, '/'))) /* have host */ *p = '\0'; if (!sess->port) /* no port -> default port (SSH) */ - sess->port = get_ssh_port(); + sess->port = ns_get_ssh_port(); sess->backend = NS_MODE_NEGOTIATE; - if (!sess->proto) { - if (!(sess->proto = strdup("screXX"))) + if (sess->proto) { +#ifdef NS_HAVE_SCREEN + if (!strcmp(sess->proto, "screen")) { + sess->backend = NS_MODE_SCREEN; + } else +#endif + if (!strcmp(sess->proto, "scream")) { + sess->backend = NS_MODE_SCREAM; + } else { + *err = NS_UNKNOWN_PROTO; goto fail; - } else if (!strcmp(sess->proto, "screen")) - sess->backend = NS_MODE_SCREEN; - else if (!strcmp(sess->proto, "scream")) - sess->backend = NS_MODE_SCREAM; - else { - *err = NS_UNKNOWN_PROTO; - goto fail; + } } if (!sess->efuns && ef && *ef) { @@ -1210,7 +1251,7 @@ if (hop && strlen(hop)) { sess->hop = ns_parse_hop(sess, hop); if (sess->hop && (!strcmp(sess->host, sess->hop->fw) || !strcmp(sess->host, "localhost") || !strcmp(sess->host, "127.0.0.1"))) - D_ESCREEN(("routing in circles...\n")); + D_ESCREEN(("ns_attach_by_URL: routing in circles...\n")); } *err = NS_SUCC; @@ -1231,300 +1272,429 @@ int ns_detach(_ns_sess ** sess) { -#ifdef NS_DEBUG ns_desc_sess(*sess, "ns_detach"); -#endif (void) ns_dst_sess(sess); return NS_SUCC; } -/***************************************************************************/ -/* messages to the client */ -/* (register callbacks) */ -/**************************/ +/**************************************************************************** + ____ _ _ +| __ ) __ _ ___| | __ ___ _ __ __| | +| _ \ / _` |/ __| |/ /____ / _ \ '_ \ / _` | +| |_) | (_| | (__| <_____| __/ | | | (_| | +|____/ \__,_|\___|_|\_\ \___|_| |_|\__,_| + +backend abstraction (utils) + this abstracts the backend against the frontend; the terminal-emulator + calls these functions without knowing what the backend is. */ -/* function that moves horizontal scrollbar to x/1000 % of width */ -void -ns_register_ssx(_ns_efuns * efuns, int (*set_scroll_x) (void *, int)) -{ - efuns->set_scroll_x = set_scroll_x; -} -/* function that moves vertical scrollbar to y/1000 % of height */ -void -ns_register_ssy(_ns_efuns * efuns, int (*set_scroll_y) (void *, int)) -{ - efuns->set_scroll_y = set_scroll_y; -} - -/* function that sets horizontal scrollbar to w/1000 % of width */ -void -ns_register_ssw(_ns_efuns * efuns, int (*set_scroll_w) (void *, int)) -{ - efuns->set_scroll_w = set_scroll_w; -} -/* function that sets vertical scrollbar to h/1000 % of height */ -void -ns_register_ssh(_ns_efuns * efuns, int (*set_scroll_h) (void *, int)) +/* scroll horizontally to column x (dummy) */ +int +ns_scroll2x(_ns_sess * s, int x) { - efuns->set_scroll_h = set_scroll_h; + return NS_FAIL; } -/* function that redraws the terminal */ -void -ns_register_red(_ns_efuns * efuns, int (*redraw) (void *)) +/* scroll vertically so line y of the scrollback buffer is the top line */ +int +ns_scroll2y(_ns_sess * s, int y) { - efuns->redraw = redraw; + return NS_FAIL; } -/* function that redraw part of the terminal */ -void -ns_register_rda(_ns_efuns * efuns, int (*redraw_xywh) (void *, int, int, int, int)) +/* go to display #d */ +int +ns_go2_disp(_ns_sess * s, int d) { - efuns->redraw_xywh = redraw_xywh; -} + char b[] = "\x01_"; -/* function to call when a new client was added ("add tab"). - after denotes the index of the button after which this one should - be inserted (0..n, 0 denoting "make it the first button") */ -void -ns_register_ins(_ns_efuns * efuns, int (*ins_disp) (void *, int, char *)) -{ - efuns->ins_disp = ins_disp; + switch (s->backend) { +#ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + b[1] = '0' + d; + return ns_screen_command(s, b); +#endif + default: + return NS_FAIL; + } } -/* function to call when a client was closed ("remove tab") */ -void -ns_register_del(_ns_efuns * efuns, int (*del_disp) (void *, int)) +/* add a client display with the name "name" after display number #after */ +int +ns_add_disp(_ns_sess * s, int after, char *name) { - efuns->del_disp = del_disp; + switch (s->backend) { + default: + return NS_FAIL; + } } -/* function to call when a client's title was changed ("update tab") */ -void -ns_register_upd(_ns_efuns * efuns, int (*upd_disp) (void *, int, int, char *)) -{ - efuns->upd_disp = upd_disp; -} -/* function to pass status lines to */ -void -ns_register_err(_ns_efuns * efuns, int (*err_msg) (void *, int, char *)) +/* move client display #fm to display slot #to */ +int +ns_mov_disp(_ns_sess * s, int fm, int to) { - efuns->err_msg = err_msg; -} + _ns_efuns *efuns; + _ns_disp *d; + int n = 0; -/* function that will execute client programs (in pseudo-terminal et al) */ -void -ns_register_exe(_ns_efuns * efuns, int (*execute) (void *, char **)) -{ - efuns->execute = execute; -} + if (fm == to) + return NS_SUCC; -/* function that will hand text as input to the client */ -void -ns_register_txt(_ns_efuns * efuns, int (*inp_text) (void *, int, char *)) -{ - efuns->inp_text = inp_text; -} + if (!(d = s->dsps)) /* this should never happen */ + return NS_FAIL; + while (d) { + n++; + d = d->next; + } + d = s->dsps; -/* function that will open a dialog */ -void -ns_register_inp(_ns_efuns * efuns, int (*input_dialog) (void *, char *, int, char **, int (*)(void *, char *, size_t, size_t))) -{ - efuns->input_dialog = input_dialog; -} + if ((fm < 0) || (to < 0)) + return NS_FAIL; + fm = disp_get_screen_by_real(s, fm); + to = disp_get_screen_by_real(s, to); + while (d->next) /* find last display */ + d = d->next; -/* function that will handle tab-completion in a dialog */ -void -ns_register_tab(_ns_efuns * efuns, int (*inp_tab) (void *, char *[], int, char *, size_t, size_t)) -{ - efuns->inp_tab = inp_tab; -} + switch (s->backend) { +#ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + D_ESCREEN(("ns_mov_disp: move #%d to #%d\n", fm, to)); + +#if 0 + while (d && (d->index >= to)) { + ns_mov_screen_disp(s, d->index, d->index + 1); + d = d->prvs; + } + ns_mov_screen_disp(s, fm + (to < fm) ? 1 : 0, to); + /* done. now unsparse. */ + if (to > fm) { /* moved right */ + d = s->dsps; + while (d->index != fm) + d = d->next; + while (d) { + ns_mov_screen_disp(s, d->index, d->index - 1); + d = d->next; + } + } +#else + ns_mov_screen_disp(s, fm, to); +#endif + if (NS_EFUN_EXISTS(efuns, s, NULL, expire_buttons)) { + efuns->expire_buttons(s->userdef, n); + } + break; +#endif + } + return NS_FAIL; +} -/* function that will do whatever while waiting */ -void -ns_register_fun(_ns_efuns * efuns, int (*inp_fun) (void *, int)) +/* resize display #d to w*h */ +int +ns_rsz_disp(_ns_sess * s, int d, int w, int h) { - efuns->waitstate = inp_fun; + switch (s->backend) { + default: + return NS_FAIL; + } } +/* remove display #d */ +int +ns_rem_disp(_ns_sess * s, int d) +{ + char *b = "\x01_\x01ky\r"; + switch (s->backend) { +#ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: +# if 0 + b[1] = '0' + d; + return ns_screen_command(s, b); +# endif + return ns_parse_screen_key(s, NS_SCREEN_KILL); +#endif + default: + return NS_FAIL; + } +} -/* get callbacks. at least one of session and display must be non-NULL. - s session, or NULL. if NULL, will be initialized from d->sess - d display, or NULL. if NULL, will be initialized from s->curr. - if set, will override session callbacks; - note that NULL pointers in d->efuns *will* - override (disable) non-NULL pointers in s->efuns! - <- callback-struct */ +/* rename display #d to "name" */ +int +ns_ren_disp(_ns_sess * s, int d, char *name) +{ + switch (s->backend) { +#ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + if (!name || !*name) + return ns_parse_screen_key(s, NS_SCREEN_RENAME); +#endif + } + return NS_FAIL; +} -_ns_efuns * -ns_get_efuns(_ns_sess * s, _ns_disp * d) +/* log activity in display #d to file "logfile" */ +int +ns_log_disp(_ns_sess * s, int d, char *logfile) { - if (!s) { - if (!d || !d->sess) - return NULL; - else - s = d->sess; + switch (s->backend) { + default: + return NS_FAIL; } - if (!d) - d = s->curr; - if (d && d->efuns) - return d->efuns; - else - return s->efuns; } +/* force an update of the status line */ +int +ns_upd_stat(_ns_sess * s) +{ + switch (s->backend) { +#ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + return ns_screen_command(s, NS_SCREEN_UPDATE); +#endif + default: + return NS_FAIL; + } +} -/***************************************************************************/ -/* display-handling */ -/********************/ +char * +ns_get_url(_ns_sess * s, int d) +{ + int r, l; + char *u; + char esc[] = "^_\0"; + char lit[] = "^_\0"; + if (!s) { + return NULL; + } -/* we need a certain display struct (index n in session s). - give it to us if it exists. - s the session the display should be in - n the index of the display (>=0). displays in a session are sorted - by index, but may be sparse (0, 1, 3, 7) - <- the requested display */ + l = ((s->proto) ? strlen(s->proto) + 3 : 0) + strlen(s->user) + 1 + strlen(s->host) + 1 + 5 + 1 + ((s->rsrc) ? strlen(s->rsrc) : 0) + + 7 + (s->name ? strlen(s->name) + 4 : 0) + 1; -_ns_disp * -disp_fetch(_ns_sess * s, int n) -{ - _ns_disp *d, *e = NULL, *c; + if ((u = malloc(l + 1))) { + if (!s->escape) { + esc[0] = '\0'; + } else if (s->escape < ' ') { + esc[1] = s->escape + 'A' - 1; + } else { + esc[0] = s->escape; + esc[1] = '\0'; + } + if (!s->literal) { + lit[0] = '\0'; + } else if (s->literal < ' ') { + lit[1] = s->literal + 'A' - 1; + } else { + lit[0] = s->literal; + lit[1] = '\0'; + } + r = snprintf(u, l, "%s%s%s@%s:%d/%s%s%s%s%s%s", s->proto ? s->proto : "", s->proto ? "://" : "", s->user, s->host, s->port, + ((s->rsrc) ? s->rsrc : ""), ((s->escape) ? "+-e" : ""), esc, ((s->escape) ? lit : ""), ((s->name) ? "+-x+" : ""), ((s->name) ? s->name : "")); + D_ESCREEN(("ns_get_url: URL is %s\n", u)); + if ((r >= 0) && (r < l)) { + return u; + } + FREE(u); + } - for (c = s->dsps; c && (c->index < n); c = c->next) - e = c; - if (c && (c->index == n)) /* found it */ - return c; return NULL; } -/* we need a certain display struct (index n in session s). - give it to us. if you can't find it, make one up and insert it into - the list. - s the session the display should be in - n the index of the display (>=0). displays in a session are sorted - by index, but may be sparse (0, 1, 3, 7) - <- the requested display */ +/**************************************************************************** + _ __ _ + ___ ___ _ __ ___ ___ _ __ ___ _ __ ___ ___(_)/ _(_) ___ +/ __|/ __| '__/ _ \/ _ \ '_ \ _____/ __| '_ \ / _ \/ __| | |_| |/ __| +\__ \ (__| | | __/ __/ | | |_____\__ \ |_) | __/ (__| | _| | (__ +|___/\___|_| \___|\___|_| |_| |___/ .__/ \___|\___|_|_| |_|\___| + |_| +screen-specific routines -_ns_disp * -disp_fetch_or_make(_ns_sess * s, int n) -{ - _ns_disp *d, *e = NULL, *c; + these routines handle a specific backend, the GNU "screen" program. */ - for (c = s->dsps; c && (c->index < n); c = c->next) - e = c; - if (c && (c->index == n)) /* found it */ - return c; - if (!(d = ns_new_disp())) /* not there, create new */ - return NULL; /* can't create, fail */ +#ifdef NS_HAVE_SCREEN - d->index = n; +/* ns_mov_screen_disp - move a screen display to a new position + s session + fm from (old index) + to to (new index) + <- error code */ - if ((d->next = c)) /* if not last element... */ - c->prvs = d; - if ((d->prvs = e)) /* if not first element */ - e->next = d; - else /* make first */ - s->dsps = d; +static int +ns_mov_screen_disp(_ns_sess * s, int fm, int to) +{ + char *t1 = "\x01'%d\r"; + char *t2 = "\x01:number %d\r"; + char b[NS_MAXCMD + 1]; + int l; + _ns_disp *d, *d2; - d->sess = s; /* note session on display */ + if ((fm > 9999) || (to > 9999)) + return NS_FAIL; - if (!d->sess->curr) /* note as current on session if first display */ - d->sess->curr = d; + if (!s->curr || s->curr->index != fm) { + s->curr = disp_fetch(s, fm); - return d; -} + l = snprintf(b, NS_MAXCMD, t1, fm); + if ((l <= 0) || (l > NS_MAXCMD)) { + return NS_FAIL; + } + (void) ns_screen_command(s, b); + } + l = snprintf(b, NS_MAXCMD, t2, to); + if ((l <= 0) || (l > NS_MAXCMD)) { + return NS_FAIL; + } -/* get element number from screen-index (latter is sparse, former ain't) - screen the session in question - n the index screen gave us (sparse) - <- the real index (element number in our list of displays) */ + (void) ns_screen_command(s, b); -int -disp_get_real_by_screen(_ns_sess * screen, int n) -{ - _ns_disp *d2 = screen->dsps; - int r = 0; - while (d2 && d2->index != n) { - d2 = d2->next; - r++; +#if 0 + d = s->dsps; /* swap-o-matic */ + while (d) { + if (d->index == to) { + d->index = fm; + d = NULL; + } else { + d = d->next; + } } -#ifdef NS_DEBUG - if (!d2) - return -1; + + s->curr->index = to; + + do { /* sort displays */ + d = s->dsps; + while (d && d->next && (d->index < d->next->index)) /* find one in wrong pos */ + d = d->next; + + if (d) { /* found one */ + d2 = s->dsps; + if (d->prvs) { /* take out of list */ + d->prvs->next = d->next; + } /* wasn n'th el */ + else { + s->dsps = d->next; /* was first el */ + } + if (d->next) { + d->next->prvs = d->prvs; + } + + /* put in again at new correct position */ + if (d2->index > d->index) { /* new first el */ + d->prvs = NULL; + d->next = d2; + d2->prvs = d; + s->dsps = d; + } else { + while (d2->index < d->index) { + d2 = d2->next; + } + if (d2) { + d->next = d2; + if ((d->prvs = d2->prvs)) { + d->prvs->next = d; + } + d2->prvs = d; + } + } + } + } while (d); +#else + s->curr = NULL; + ns_dst_dsps(&(s->dsps)); #endif - return r; + + return NS_SUCC; } -/* get screen-index from element number (former is sparse, latter ain't) - screen the session in question - n the real index (element number in our list of displays) - <- the index screen knows (sparse) */ +/* send a command string to a session, using the appropriate escape-char + sess the session + cmd the command string. escapes must be coded as NS_SCREEN_ESCAPE; + this routine will convert the string to use the escapes actually + used in the session + <- error code */ int -disp_get_screen_by_real(_ns_sess * screen, int r) +ns_screen_command(_ns_sess * sess, char *cmd) { - _ns_disp *d2 = screen->dsps; - while (d2 && (r-- > 0)) - d2 = d2->next; -#ifdef NS_DEBUG - if (!d2) - return -1; -#endif - return d2->index; + _ns_efuns *efuns; + char *c; + int ret = NS_SUCC; + + if (!cmd || !*cmd) + return NS_FAIL; + + if (NS_EFUN_EXISTS(efuns, sess, NULL, inp_text)) { + if ((c = strdup(cmd))) { + { + char *p = c; /* replace default escape-char with that */ + + while (*p) { /* actually used in this session */ + if (*p == NS_SCREEN_ESCAPE) + *p = sess->escape; + p++; + } + } + ns_desc_string(c, "ns_screen_command: xlated string"); + efuns->inp_text(NULL, sess->fd, c); + FREE(c); + } else + ret = NS_OOM; + } /* out of memory */ + else { + ret = NS_EFUN_NOT_SET; + D_ESCREEN(("ns_screen_command: sess->efuns->inp_text not set!\n")); + } + return ret; } -/* remove a display from the internal list and release its struct and data - disp the display in question */ +/* send a single command string to screen, adding the equiv of ^A: + s the session + cmd the command string + <- error code */ -void -disp_kill(_ns_disp * d3) +int +ns_screen_xcommand(_ns_sess * s, char prefix, char *cmd) { - if (d3->prvs) { - d3->prvs->next = d3->next; - if (d3->sess->curr == d3) - d3->sess->curr = d3->prvs; - } else { - d3->sess->dsps = d3->next; - if (d3->sess->curr == d3) - d3->sess->curr = d3->next; - } - if (d3->next) - d3->next->prvs = d3->prvs; - ns_dst_disp(&d3); -} - + char *i; + int ret = NS_OOM; + if ((i = MALLOC(strlen(cmd) + 4))) { + size_t l = strlen(cmd) + 2; -/***************************************************************************/ -/* parse status lines of the "screen" program */ -/**********************************************/ + strcpy(&i[2], cmd); + i[0] = s->escape; + i[1] = prefix; + i[l] = '\n'; + i[++l] = '\0'; + ret = ns_screen_command(s, i); + FREE(i); + } + return ret; +} @@ -1534,7 +1704,7 @@ m maximum number of characters in entry (size of input buffer) <- error code */ -int +static int ns_inp_tab(void *xd, char *b, size_t l, size_t m) { char *sc[] = { "acladd", "addacl", "aclchg", "chacl", "acldel", "aclgrp", @@ -1576,11 +1746,10 @@ _ns_sess *s = (_ns_sess *) xd; int nsc = sizeof(sc) / sizeof(char *); - if (NS_EFUN_EXISTS(efuns, s, NULL, inp_tab)) { + if (NS_EFUN_EXISTS(efuns, s, NULL, inp_tab)) return efuns->inp_tab((void *) s, sc, nsc, b, l, m) < 0 ? NS_FAIL : NS_SUCC; - } - D_ESCREEN(("sess->efuns->inp_tab not set!\n")); + D_ESCREEN(("ns_screen_command: sess->efuns->inp_tab not set!\n")); return NS_EFUN_NOT_SET; } @@ -1600,12 +1769,12 @@ if (**x == '\\') { (*x)++; r = **x; - if (r >= '0' && r <= '7') { /* octal, otherwise literal */ + if (r >= '0' && r <= '7') { /* octal, otherwise literal */ char b[4] = "\0\0\0"; char *e = *x; - long v; size_t l = 0; - while ((*e >= '0' && *e <= '7') && (l < 3)) { /* can't use endptr here : ( */ + + while ((*e >= '0' && *e <= '7') && (l < 3)) { /* can't use endptr here : ( */ e++; l++; } @@ -1651,8 +1820,9 @@ if (!p || !*p) return NS_FAIL; - if ((p2 = strchr(p, ' '))) { /* first argument */ + if ((p2 = strchr(p, ' '))) { /* first argument */ char *e; + while (isspace(*p2)) p2++; v1 = strtol(p2, &e, 0); /* magic conversion mode */ @@ -1661,25 +1831,26 @@ } #define IS_CMD(b) (strncasecmp(p,b,strlen(b))==0) if (!p2) { - D_ESCREEN(("ignoring \"%s\" without an argument...\n", p)); + D_ESCREEN(("screenrc: ignoring \"%s\" without an argument...\n", p)); /* must return success so it's fowarded to screen in interactive mode. that way, the user can read the original reply instead of a fake one from us. */ return NS_SUCC; } else if (IS_CMD("defescape")) - D_ESCREEN(("ignoring \"defescape\", did you mean \"escape\"?\n")); + D_ESCREEN(("screenrc: ignoring \"defescape\", did you mean \"escape\"?\n")); else if (IS_CMD("defhstatus") || IS_CMD("hardstatus") || IS_CMD("echo") || IS_CMD("colon") || IS_CMD("wall") || #ifdef NS_PARANOID IS_CMD("nethack") || #endif IS_CMD("info") || IS_CMD("time") || IS_CMD("title") || IS_CMD("lastmsg") || IS_CMD("msgwait") || IS_CMD("msgminwait")) { - D_ESCREEN(("ignoring \"%s\", not applicable...\n", p)); + D_ESCREEN(("screenrc: ignoring \"%s\", not applicable...\n", p)); return NS_NOT_ALLOWED; } else if (IS_CMD("escape")) { char x = 0, y = 0; + if ((x = ns_parse_esc(&p2)) && (y = ns_parse_esc(&p2))) { if (s->escdef == NS_ESC_CMDLINE) { - D_ESCREEN(("ignoring \"escape\"; overridden on command-line...\n", x, y)); + D_ESCREEN(("screenrc: ignoring \"escape\"; overridden on command-line...\n", x, y)); return NS_NOT_ALLOWED; } else { s->escape = x; @@ -1688,30 +1859,28 @@ return NS_SUCC; } } else - D_ESCREEN(("ignoring \"escape\" because of invalid arguments %o %o...\n", x, y)); + D_ESCREEN(("screenrc: ignoring \"escape\" because of invalid arguments %o %o...\n", x, y)); } else if (IS_CMD("defscrollback")) { if (v1 < NS_SCREEN_DEFSBB) - D_ESCREEN(("ignoring \"%s\" for value < %d...\n", p, NS_SCREEN_DEFSBB)); + D_ESCREEN(("screenrc: ignoring \"%s\" for value < %d...\n", p, NS_SCREEN_DEFSBB)); else { s->dsbb = v1; return NS_SUCC; } } else if (IS_CMD("scrollback")) { if (v1 < NS_SCREEN_DEFSBB) - D_ESCREEN(("ignoring \"%s\" for value < %d...\n", p, NS_SCREEN_DEFSBB)); + D_ESCREEN(("screenrc: ignoring \"%s\" for value < %d...\n", p, NS_SCREEN_DEFSBB)); else { if (!s->curr) s->curr = s->dsps; if (!s->curr) - D_ESCREEN(("ignoring \"%s\", cannot determine current display!?...\n", p)); + D_ESCREEN(("screenrc: ignoring \"%s\", cannot determine current display!?...\n", p)); else s->curr->sbb = v1; return NS_SUCC; } } else { -#ifdef NS_DEBUG - D_ESCREEN(("bored now \"%s\"\n", p)); -#endif + D_ESCREEN(("screenrc: bored now \"%s\"\n", p)); return NS_SUCC; } return NS_FAIL; @@ -1739,21 +1908,19 @@ b[1] = c; b[2] = '\0'; -#ifdef NS_DEBUG if (c < 27) - D_ESCREEN(("^%c-^%c %d\n", s->escape + 'A' - 1, c + 'A' - 1, c)); + D_ESCREEN(("screen_key: ^%c-^%c %d\n", s->escape + 'A' - 1, c + 'A' - 1, c)); else - D_ESCREEN(("^%c-%c %d\n", s->escape + 'A' - 1, c, c)); -#endif + D_ESCREEN(("screen_key: ^%c-%c %d\n", s->escape + 'A' - 1, c, c)); switch (c) { case NS_SCREEN_CMD: /* send command (statement) to screen server */ - (void) ns_input_dialog((void *) s, "Enter a command to send to the \"screen\" program", 64, &i, ns_inp_tab); + (void) ns_inp_dial((void *) s, "Enter a command to send to the \"screen\" program", 64, &i, ns_inp_tab); if (i) { if ((ret = ns_parse_screen_cmd(s, i, NS_ESC_INTERACTIVE)) == NS_SUCC) { ret = ns_screen_xcommand(s, c, i); } else if (ret == NS_NOT_ALLOWED) { - menu_dialog(NULL, "Sorry, David, I cannot allow that.", 0, NULL, NULL); + ns_inp_dial(NULL, "Sorry, David, I cannot allow that.", 0, NULL, NULL); } FREE(i); } @@ -1761,9 +1928,10 @@ case NS_SCREEN_RENAME: /* rename current display */ i = s->curr->name; l = strlen(i); - (void) ns_input_dialog(s, "Enter a new name for the current display", 12, &i, NULL); + (void) ns_inp_dial(s, "Enter a new name for the current display", 12, &i, NULL); if (i && *i) { char *n; + if ((n = MALLOC(strlen(i) + l + 1))) { strcpy(&n[l], i); while (l) @@ -1774,6 +1942,18 @@ FREE(i); } break; + case NS_SCREEN_KILL: + i = NULL; + (void) ns_inp_dial(s, "Really close display?", 1, &i, NULL); + if (i) { + if ((*i == 'y') || (*i == 'Y')) { + char *b = "\x01ky\r"; + + ret = ns_screen_command(s, b); + } + FREE(i); + } + break; default: ret = ns_screen_command(s, b); } @@ -1837,12 +2017,11 @@ whence which screenrc are we in? <- error code */ -int +static int ns_parse_screenrc(_ns_sess * s, char *fn, int whence) { int fd = -1; char *rc = NULL; - char _e = '\0', _l = '\0', *esc = NULL; if (fn) { struct stat st; @@ -1852,6 +2031,7 @@ if (!fstat(fd, &st)) { if ((rc = MALLOC(st.st_size + 1))) { char *p; + while (((rd = read(fd, rc, st.st_size)) < 0) && (errno == EINTR)); if (rd < 0) goto fail; @@ -1861,10 +2041,11 @@ while (*p) { char *p2 = p, *n; int f = 0; - while (*p2 && *p2 != '\n' && *p2 != '\r') /* find EOL */ + + while (*p2 && *p2 != '\n' && *p2 != '\r') /* find EOL */ p2++; n = p2; - while (*n == '\r' || *n == '\n') /* delete EOL */ + while (*n == '\r' || *n == '\n') /* delete EOL */ *(n++) = '\0'; while (isspace(*p)) p++; @@ -1873,19 +2054,19 @@ while (*p2) { if (*p2 == '\\') { p2++; - if (*p2) /* sanity check */ + if (*p2) /* sanity check */ p2++; } else { if (*p2 == '\"') f = 1 - f; - if (!f && *p2 == '#') /* comment, kill to EOL */ + if (!f && *p2 == '#') /* comment, kill to EOL */ *p2 = '\0'; else p2++; } } - if (strlen(p)) /* any commands in line? */ + if (strlen(p)) /* any commands in line? */ ns_parse_screen_cmd(s, p, whence); p = n; /* done, next line */ } @@ -1917,13 +2098,13 @@ p the offending message-line <- returns an error code. */ -int +static int ns_parse_screen_msg(_ns_sess * screen, char *p) { _ns_efuns *efuns; - _ns_disp *disp; - char *p2, *p3, *d; - int ma, mi, mu, n, ret = NS_SUCC, type; + char *p2; + char vdate[33], vtype[3], vrem[17]; + int ma, mi, mu, ret = NS_SUCC, type; if (!p) return NS_FAIL; @@ -1936,9 +2117,8 @@ type = (strlen(p) > 1) ? NS_SCREEN_STATUS : NS_SCREEN_ST_CLR; if (type == NS_SCREEN_ST_CLR) { - if (NS_EFUN_EXISTS(efuns, screen, NULL, err_msg)) { + if (NS_EFUN_EXISTS(efuns, screen, NULL, err_msg)) ret = efuns->err_msg(NULL, type, ""); - } } /* a screen display can disappear because the program in it dies, or because we explicitly ask screen to kill the display. in the latter @@ -1948,36 +2128,43 @@ from the struct-list). this way, we won't need to duplicate the delete-logic here. */ else if (!strncmp(p, "Window ", strlen("Window ")) && (p2 = strrchr(p, ' ')) && !strcmp(p2, " killed.")) { -#ifdef NS_DEBUG - D_ESCREEN(("window kill detected.\n")); -#endif ret = ns_upd_stat(screen); p = NULL; - } else if (!strcmp(p, "New screen...") || !strncmp(p, "msgwait", strlen("msgwait")) || !strncmp(p, "msgminwait", strlen("msgminwait"))) + } else if (!strncmp(p, NS_SCREEN_SESS_T, strlen(NS_SCREEN_SESS_T))) { + if (screen->name) { + FREE(screen->name); + } + if ((screen->name = strdup(&p[strlen(NS_SCREEN_SESS_T)]))) { + size_t lsn = strlen(screen->name); + + if (lsn) { + screen->name[--lsn] = '\0'; + } + D_ESCREEN(("ns_parse_screen_msg: session is \"%s\"\n", screen->name)); + } + p = NULL; + } else if (!strcmp(p, "New screen...") || + !strncmp(p, "msgwait", strlen("msgwait")) || + !strncmp(p, "msgminwait", strlen("msgminwait")) || + !strcmp(p, "Press ^@ to destroy or ^@ to resurrect window") || !strcmp(p, "Aborted because of window size change.")) p = NULL; -#ifndef NS_PARANOID - /* FIXME. */ - else if (sscanf(p, NS_SCREEN_VERSION, &p3, &ma, &mi, &mu, &p2, &d) == 6) { - if (!strcmp("en", p3)) + else if (sscanf(p, NS_SCREEN_VERSION_T, vtype, &ma, &mi, &mu, vrem, vdate) == 6) { + if (!strcmp("en", vtype)) screen->backend = NS_MODE_SCREEN; - else if (!strcmp("am", p3)) + else if (!strcmp("am", vtype)) screen->backend = NS_MODE_SCREAM; -# ifdef NS_DEBUG - D_ESCREEN(("scre%s %d.%2d.%2d %s a/o %s\n", p3, ma, mi, mu, p2, d)); -# endif - } -#endif - else if (!strcmp(p, NS_SCREEN_NO_DEBUG)) + p = NULL; + D_ESCREEN(("ns_parse_screen_msg: scre%s %d.%2d.%2d %s a/o %s -> mode %d\n", vtype, ma, mi, mu, vrem, vdate, screen->backend)); + } else if (!strcmp(p, NS_SCREEN_NO_DEBUG)) p = "debug info was not compiled into \"screen\"..."; - else if (!strncmp(p, NS_SCREEN_DK_CMD, strlen(NS_SCREEN_DK_CMD))) { + else if (!strncmp(p, NS_SCREEN_DK_CMD_T, strlen(NS_SCREEN_DK_CMD_T))) { p[strlen(p) - 1] = '\0'; - p2 = &p[strlen(NS_SCREEN_DK_CMD)]; + p2 = &p[strlen(NS_SCREEN_DK_CMD_T)]; p = "unknown screen statement ignored"; } if (p) { /* status. send to status-line or dialog or whatever */ - if (NS_EFUN_EXISTS(efuns, screen, NULL, err_msg)) { + if (NS_EFUN_EXISTS(efuns, screen, NULL, err_msg)) ret = efuns->err_msg(NULL, type, p); - } } return ret; } @@ -2000,7 +2187,7 @@ may be called from here. force the terminal wants us to update. if it doesn't, we may see fit to do so anyway in certain cases. - width the terminal's width in columns (== that of the status line) + width the terminal's width in columns (ie that of the status line) p the pointer to the status line. may point into the terminal's line buffer if that holds plain text data (not interleaved with colour- and boldness-data) @@ -2011,12 +2198,9 @@ { char *p4, *p3, *p2; /* pointers for parser magic */ static const char *p5 = NS_SCREEN_FLAGS; - static size_t l = sizeof(NS_SCREEN_FLAGS); -#if (NS_SCREEN_UPD_FREQ>0) - time_t t2 = time(NULL); -#endif - int ret = NS_SUCC, tmp, status_blanks = 0, /* status-bar overflow? */ - parsed, /* no of *visible* elements in status line */ + static int l = sizeof(NS_SCREEN_FLAGS); + size_t status_blanks = 0; /* status-bar overflow? */ + int ret = NS_SUCC, tmp, parsed, /* no of *visible* elements in status line */ n, /* screen's index (immutable, sparse) */ r; /* real index (r'th element) */ _ns_efuns *efuns; @@ -2028,37 +2212,54 @@ if (!force && screen->timestamp) return NS_SUCC; - if (p = strdup(p)) { + if ((p = strdup(p))) { _ns_parse pd[NS_MAX_DISPS]; + p2 = &p[width - 1]; while (p2 > p && *p2 == ' ') { status_blanks++; *(p2--) = '\0'; } /* p2 now points behind last item */ -#ifdef NS_DEBUG - D_ESCREEN(("screen sends ::%s::\n", p)); -#endif + D_ESCREEN(("parse_screen: screen sends ::%s::\n", p)); if (strlen(p) < 2) { /* special case: display 0 */ - disp = screen->dsps; /* might not get a status-line in d0! */ - if (disp && !(disp->flags & NS_SCREAM_CURR)) { /* flags need updating */ - disp->flags |= NS_SCREAM_CURR; /* set flag to avoid calling inp_text */ + disp = screen->dsps; /* might not get a status-line in d0! */ + if (disp && !(disp->flags & NS_SCREAM_CURR)) { /* flags need updating */ + disp->flags |= NS_SCREAM_CURR; /* set flag to avoid calling inp_text */ ret = ns_upd_stat(screen); } /* more than once */ else if (!screen->timestamp) { - screen->timestamp = time(NULL); + /* send init string the first time around, just to be on + the safe side. we could send it before entering this + function for the first time, but that would break if + escapes or screenrc were set from the + command-line. don't ask. */ + + D_ESCREEN(("parse_screen: preparing screen...\n")); + if (screen->delay > 0) { + screen->timestamp = time(NULL) + screen->delay; if (NS_EFUN_EXISTS(efuns, screen, NULL, waitstate)) { ret = efuns->waitstate(NULL, screen->delay * 1000); - } else { - sleep(screen->delay); } + (void) ns_upd_stat(screen); + } else { + (void) ns_screen_command(screen, NS_SCREEN_INIT); + screen->timestamp = 1; } + } else if ((screen->timestamp > 1) && (time(NULL) >= screen->timestamp)) { (void) ns_screen_command(screen, NS_SCREEN_INIT); + screen->timestamp = 1; + D_ESCREEN(("parse_screen: resetting screen...\n")); } FREE(p); return ret; + } else if (screen->backend == NS_MODE_NEGOTIATE) { + /* I can't believe we haven't decided on a backend yet! Ask! */ + (void) ns_screen_command(screen, NS_SCREEN_VERSION); + (void) ns_screen_command(screen, NS_SCREEN_SESSION); + screen->timestamp = time(NULL); } p3 = p; @@ -2073,10 +2274,10 @@ pd[parsed].screen = n; pd[parsed].real = r++; - while (isdigit(*p3)) /* skip index */ + while (isdigit(*p3)) /* skip index */ p3++; - pd[parsed].flags = 0; /* get and skip flags */ + pd[parsed].flags = 0; /* get and skip flags */ while (*p3 && *p3 != ' ') { for (n = 0; n < l; n++) { if (*p3 == p5[n]) { @@ -2087,7 +2288,7 @@ p3++; } - if (*p3 == ' ') { /* skip space, read name */ + if (*p3 == ' ') { /* skip space, read name */ *(p3++) = '\0'; p4 = p3; while (p3[0] && p3[1] && (p3[0] != ' ' || p3[1] != ' ')) @@ -2102,31 +2303,22 @@ p3 = &p3[strlen(p3)]; } /* out of mem => skip remainder */ else - p3 = &p3[strlen(p3)]; /* weirdness => skip remainder */ + p3 = &p3[strlen(p3)]; /* weirdness => skip remainder */ } while (*p3); -#ifdef NS_DEBUG_ - fputs(NS_PREFIX "parse_screen: found ", stderr); - for (r = 0; r < parsed; r++) - if (pd[r].name) - fprintf(stderr, "%d(%d/%d,%s) ", r, pd[r].screen, pd[r].real, pd[r].name); - fputs("\n\n", stderr); -#endif - for (r = 0; r < parsed; r++) { n = pd[r].screen; disp = disp_fetch(screen, n); if (!disp) { /* new display */ if (!(disp = disp_fetch_or_make(screen, n)) || !(disp->name = strdup(pd[r].name))) { - D_ESCREEN(("out of memory in new_display(%d)\n", n)); + D_ESCREEN(("parse_screen: out of memory in new_display(%d)\n", n)); ret = NS_FAIL; } else { - if (NS_EFUN_EXISTS(efuns, screen, NULL, ins_disp)) { - ret = efuns->ins_disp(screen->userdef, pd[r].real - 1, disp->name); - } + if (NS_EFUN_EXISTS(efuns, screen, NULL, ins_disp)) + ret = efuns->ins_disp(screen->userdef, pd[r].real - 1, pd[r].screen, disp->name); } - } else if ((tmp = strcmp(disp->name, pd[r].name)) || /* upd display */ + } else if ((tmp = strcmp(disp->name, pd[r].name)) || /* upd display */ (disp->flags != pd[r].flags)) { if (tmp) { FREE(disp->name); @@ -2138,23 +2330,20 @@ if (pd[r].flags & NS_SCREAM_CURR) disp->sess->curr = disp; disp->flags = pd[r].flags & NS_SCREAM_MASK; - if (NS_EFUN_EXISTS(efuns, screen, NULL, upd_disp)) { + if (NS_EFUN_EXISTS(efuns, screen, NULL, upd_disp)) ret = efuns->upd_disp(screen->userdef, r, disp->flags, disp->name); - } } /* remove any displays from list that have disappeared from the middle of the status-line */ - if (!d2 || d2->next != disp) { /* remove expired displays */ + if (!d2 || d2->next != disp) { /* remove expired displays */ _ns_disp *d3 = disp->prvs, *d4; + while (d3 && d3 != d2) { -#ifdef NS_DEBUG - D_ESCREEN(("remove expired middle %d \"%s\"...\n", d3->index, d3->name)); -#endif + D_ESCREEN(("parse_screen: remove expired middle %d \"%s\"...\n", d3->index, d3->name)); d4 = d3->prvs; - if (NS_EFUN_EXISTS(efuns, screen, NULL, del_disp)) { + if (NS_EFUN_EXISTS(efuns, screen, NULL, del_disp)) ret = efuns->del_disp(screen->userdef, disp_get_real_by_screen(screen, d3->index)); - } disp_kill(d3); d3 = d4; } @@ -2168,14 +2357,13 @@ if (!r) { if (!(err_inhibit & NS_ERR_WEIRDSCREEN)) { err_inhibit |= NS_ERR_WEIRDSCREEN; - fprintf(stderr, NS_PREFIX "parse_screen: !r\n" + fprintf(stderr, "parse_screen: !r\n" "This should never happen. It is assumed that you use a\n" "rather unusual configuration for \"screen\". Please\n" "send the result of 'screen --version' to <scream@...>\n" "(together with your ~/.screenrc and /etc/screenrc if present).\n" "If at all possible, please also run 'Eterm -e screen' and make\n" - "a screenshot of the offending window (and the window only, the\n" - "beauty of your desktop is not relevant to this investigation. : ).\n"); + "a screenshot of the offending window (and the window only, the\n" "beauty of your desktop is not relevant to this investigation. : ).\n"); } ret = ns_upd_stat(screen); FREE(p); @@ -2186,17 +2374,15 @@ (as it will if not all the disp names fit in the status-line) */ if (disp->next && status_blanks > (strlen(disp->next->name) + 6)) { _ns_disp *d3 = disp; + for (disp = disp->next; disp;) { -#ifdef NS_DEBUG - D_ESCREEN(("remove expired right %d \"%s\"...\n", disp->index, disp->name)); -#endif + D_ESCREEN(("parse_screen: remove expired right %d \"%s\"...\n", disp->index, disp->name)); d2 = disp; if (d2->sess->curr == d2) d2->sess->curr = d3; disp = disp->next; - if (NS_EFUN_EXISTS(efuns, screen, NULL, del_disp)) { + if (NS_EFUN_EXISTS(efuns, screen, NULL, del_disp)) ret = efuns->del_disp(screen->userdef, disp_get_real_by_screen(screen, d2->index)); - } disp_kill(d2); } d3->next = NULL; @@ -2209,17 +2395,199 @@ FREE(p); /* release our (modified) copy of the status-line */ } - /* send init string the first time around, just to be on the safe side. - we could send it before entering this function for the first time, - but that would break if escapes or screenrc were set from the - command-line. don't ask. */ -#if (NS_SCREEN_UPD_FREQ>0) - if ((t2 - screen->timestamp) > NS_SCREEN_UPD_FREQ) { - (void) ns_upd_stat(screen); - screen->timestamp = t2; - } + return ret; +} + #endif + + +/**************************************************************************** + _____ _ _ +| ___| __ ___ _ __ | |_ ___ _ __ __| | +| |_ | '__/ _ \| '_ \| __|____ / _ \ '_ \ / _` | +| _|| | | (_) | | | | ||_____| __/ | | | (_| | +|_| |_| \___/|_| |_|\__| \___|_| |_|\__,_| + + +frontend abstraction (callbacks for messages to the client) + + this abstracts the frontend against the backend; the abstraction-layer + (libscream) calls these in response to message from the backend (screen, + or whatever) without really knowing what terminal-emulator (Eterm, + konsole, multi-gnome-terminal, ...) the frontend is. */ + + + +/* function that moves horizontal scrollbar to x/1000 % of width */ +void +ns_register_ssx(_ns_efuns * efuns, int (*set_scroll_x) (void *, int)) +{ + efuns->set_scroll_x = set_scroll_x; +} + +/* function that moves vertical scrollbar to y/1000 % of height */ +void +ns_register_ssy(_ns_efuns * efuns, int (*set_scroll_y) (void *, int)) +{ + efuns->set_scroll_y = set_scroll_y; +} + +/* function that sets horizontal scrollbar to w/1000 % of width */ +void +ns_register_ssw(_ns_efuns * efuns, int (*set_scroll_w) (void *, int)) +{ + efuns->set_scroll_w = set_scroll_w; +} + +/* function that sets vertical scrollbar to h/1000 % of height */ +void +ns_register_ssh(_ns_efuns * efuns, int (*set_scroll_h) (void *, int)) +{ + efuns->set_scroll_h = set_scroll_h; +} + +/* function that redraws the terminal */ +void +ns_register_red(_ns_efuns * efuns, int (*redraw) (void *)) +{ + efuns->redraw = redraw; +} + +/* function that redraw part of the terminal */ +void +ns_register_rda(_ns_efuns * efuns, int (*redraw_xywh) (void *, int, int, int, int)) +{ + efuns->redraw_xywh = redraw_xywh; +} + +/* function that redraw part of the terminal */ +void +ns_register_exb(_ns_efuns * efuns, int (*expire_buttons) (void *, int)) +{ + efuns->expire_buttons = expire_buttons; +} + +/* function to call when a new client was added ("add tab"). + after denotes the index of the button after which this one should + be inserted (0..n, 0 denoting "make it the first button") */ +void +ns_register_ins(_ns_efuns * efuns, int (*ins_disp) (void *, int, int, char *)) +{ + efuns->ins_disp = ins_disp; +} + +/* function to call when a client was closed ("remove tab") */ +void +ns_register_del(_ns_efuns * efuns, int (*del_disp) (void *, int)) +{ + efuns->del_disp = del_disp; +} + +/* function to call when a client's title was changed ("update tab") */ +void +ns_register_upd(_ns_efuns * efuns, int (*upd_disp) (void *, int, int, char *)) +{ + efuns->upd_disp = upd_disp; +} + +/* function to pass status lines to */ +void +ns_register_err(_ns_efuns * efuns, int (*err_msg) (void *, int, char *)) +{ + efuns->err_msg = err_msg; +} + +/* function that will execute client programs (in pseudo-terminal et al) */ +void +ns_register_exe(_ns_efuns * efuns, int (*execute) (void *, char **)) +{ + efuns->execute = execute; +} + +/* function that will hand text as input to the client */ +void +ns_register_txt(_ns_efuns * efuns, int (*inp_text) (void *, int, char *)) +{ + efuns->inp_text = inp_text; +} + + + +/* function that will open a dialog */ +void +ns_register_inp(_ns_efuns * efuns, int (*inp_dial) (void *, char *, int, char **, int (*)(void *, char *, size_t, size_t))) +{ + efuns->inp_dial = inp_dial; +} + + + +/* function that will handle tab-completion in a dialog */ +void +ns_register_tab(_ns_efuns * efuns, int (*inp_tab) (void *, char *[], int, char *, size_t, size_t)) +{ + efuns->inp_tab = inp_tab; +} + + + +/* function that will do whatever while waiting */ +void +ns_register_fun(_ns_efuns * efuns, int (*inp_fun) (void *, int)) +{ + efuns->waitstate = inp_fun; +} + + + +/* get callbacks. at least one of session and display must be non-NULL. + s session, or NULL. if NULL, will be initialized from d->sess + d display, or NULL. if NULL, will be initialized from s->curr. + if set, will override session callbacks; + note that NULL pointers in d->efuns *will* + override (disable) non-NULL pointers in s->efuns! + <- callback-struct */ + +_ns_efuns * +ns_get_efuns(_ns_sess * s, _ns_disp * d) +{ + if (!s) { + if (!d || !d->sess) + return NULL; + else + s = d->sess; + } + if (!d) + d = s->curr; + if (d && d->efuns) + return d->efuns; + else + return s->efuns; +} + + + +/* ns_inp_dial + open a dialog (wrapp around efuns->inp_dial) + s the session + !retstr where we'll store a pointer to the result (the user's input) + prompt the prompt to appear in the dialog box + <- msg */ + + +int +ns_inp_dial(_ns_sess * s, char *prompt, int maxlen, char **retstr, int (*inp_tab) (void *, char *, size_t, size_t)) +{ + _ns_efuns *efuns; + int ret = NS_SUCC; + + if (NS_EFUN_EXISTS(efuns, s, NULL, inp_dial)) { + (void) efuns->inp_dial((void *) s, prompt, maxlen, retstr, inp_tab); + } else { + ret = NS_EFUN_NOT_SET; + D_ESCREEN(("ns_inp_dial: sess->efuns->inp_dial not set!\n")); + } return ret; } =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/menus.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -3 -r1.54 -r1.55 --- menus.c 23 May 2002 18:14:40 -0000 1.54 +++ menus.c 3 Jun 2002 00:24:22 -0000 1.55 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: menus.c,v 1.54 2002/05/23 18:14:40 mej Exp $"; +static const char cvs_ident[] = "$Id: menus.c,v 1.55 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -47,18 +47,16 @@ # include "screamcfg.h" #endif -menulist_t *menu_list = NULL; -#ifndef ESCREEN -static -#endif -event_dispatcher_data_t menu_event_data; static GC topShadowGC, botShadowGC; static Time button_press_time; static int button_press_x = 0, button_press_y = 0; + #ifndef ESCREEN static #endif menu_t *current_menu; +menulist_t *menu_list = NULL; +event_dispatcher_data_t menu_event_data; static inline void grab_pointer(Window win); static inline void ungrab_pointer(void); @@ -74,8 +72,7 @@ D_EVENTS(("Grabbing control of pointer for window 0x%08x.\n", win)); success = XGrabPointer(Xdisplay, win, False, EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask - | Button1MotionMask | Button2MotionMask | Button3MotionMask, - GrabModeAsync, GrabModeAsync, None, None, CurrentTime); + | Button1MotionMask | Button2MotionMask | Button3MotionMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime); if (success != GrabSuccess) { switch (success) { case GrabNotViewable: @@ -262,12 +259,10 @@ ungrab_pointer(); menu_reset_all(menu_list); current_menu = NULL; - XTranslateCoordinates(Xdisplay, ev->xany.window, Xroot, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y), - &unused_win); + XTranslateCoordinates(Xdisplay, ev->xany.window, Xroot, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_win); child_win = find_window_by_coords(Xroot, 0, 0, ev->xbutton.x, ev->xbutton.y); if (child_win != None) { - XTranslateCoordinates(Xdisplay, Xroot, child_win, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y), - &unused_win); + XTranslateCoordinates(Xdisplay, Xroot, child_win, ev->xbutton.x, ev->xbutton.y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_win); ev->xany.window = child_win; D_EVENTS(("Sending synthetic event on to window 0x%08x at %d, %d\n", child_win, ev->xbutton.x, ev->xbutton.y)); XSendEvent(Xdisplay, child_win, False, 0, ev); @@ -297,8 +292,7 @@ if (current_menu && (current_menu->state & MENU_STATE_IS_DRAGGING)) { /* Dragging-and-release mode */ - D_MENU(("Drag-and-release mode, detected release. Button press time is %lu, release time is %lu\n", button_press_time, - ev->xbutton.time)); + D_MENU(("Drag-and-release mode, detected release. Button press time is %lu, release time is %lu\n", button_press_time, ev->xbutton.time)); ungrab_pointer(); if (button_press_time && (ev->xbutton.time - button_press_time > MENU_CLICK_TIME)) { @@ -315,14 +309,13 @@ menu_reset_all(menu_list); current_menu = NULL; } else { - current_menu->state &= ~MENU_STATE_IS_DRAGGING; /* Click, brief drag, release == single click */ + current_menu->state &= ~MENU_STATE_IS_DRAGGING; /* Click, brief drag, release == single click */ } } else { /* Single-click mode */ - D_MENU(("Single click mode, detected click. Button press time is %lu, release time is %lu\n", button_press_time, - ev->xbutton.time)); + D_MENU(("Single click mode, detected click. Button press time is %lu, release time is %lu\n", button_press_time, ev->xbutton.time)); if (current_menu && (ev->xbutton.x >= 0) && (ev->xbutton.y >= 0) && (ev->xbutton.x < current_menu->w) && (ev->xbutton.y < current_menu->h)) { /* Click inside the menu window. Activate the current item. */ @@ -463,22 +456,18 @@ xattr.colormap = cmap; cursor = XCreateFontCursor(Xdisplay, XC_left_ptr); - mask = - PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | - Button3MotionMask; + mask = PointerMotionMask | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask; } menu = (menu_t *) MALLOC(sizeof(menu_t)); MEMSET(menu, 0, sizeof(menu_t)); menu->title = STRDUP(title ? title : ""); - menu->win = XCreateWindow(Xdisplay, Xroot, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent, - CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr); + menu->win = XCreateWindow(Xdisplay, Xroot, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr); XDefineCursor(Xdisplay, menu->win, cursor); XSelectInput(Xdisplay, menu->win, mask); XStoreName(Xdisplay, menu->win, menu->title); - menu->swin = XCreateWindow(Xdisplay, menu->win, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent, - CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr); + menu->swin = XCreateWindow(Xdisplay, menu->win, 0, 0, 1, 1, 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWBorderPixel | CWColormap, &xattr); menu->gc = LIBAST_X_CREATE_GC(0, NULL); menuitem_clear_current(menu); @@ -674,16 +663,14 @@ current = menuitem_get_current(current_menu); if (current != item) { - D_MENU(("Changing current item in menu \"%s\" from \"%s\" to \"%s\"\n", current_menu->title, (current ? current->text : "(NULL)"), - (item ? item->text : "(NULL)"))); + D_MENU(("Changing current item in menu \"%s\" from \"%s\" to \"%s\"\n", current_menu->title, (current ? current->text : "(NULL)"), (item ? item->text : "(NULL)"))); if (current) { /* Reset the current item */ menuitem_deselect(current_menu); /* If we're changing from one submenu to another and neither is a child of the other, or if we're changing from a submenu to no current item at all, reset the tree for the current submenu */ if (current->type == MENUITEM_SUBMENU && current->action.submenu != NULL) { - if ((item && item->type == MENUITEM_SUBMENU && item->action.submenu != NULL - && !menu_is_child(current->action.submenu, item->action.submenu) + if ((item && item->type == MENUITEM_SUBMENU && item->action.submenu != NULL && !menu_is_child(current->action.submenu, item->action.submenu) && !menu_is_child(item->action.submenu, current->action.submenu)) || (!item)) { menu_reset_tree(current->action.submenu); @@ -896,8 +883,7 @@ item = menuitem_get_current(menu); REQUIRE(item != NULL); - D_MENU(("Selecting new current item \"%s\" within menu \"%s\" (window 0x%08x, selection window 0x%08x)\n", item->text, menu->title, - menu->win, menu->swin)); + D_MENU(("Selecting new current item \"%s\" within menu \"%s\" (window 0x%08x, selection window 0x%08x)\n", item->text, menu->title, menu->win, menu->swin)); item->state |= MENU_STATE_IS_CURRENT; XMoveWindow(Xdisplay, menu->swin, item->x, item->y); XMapWindow(Xdisplay, menu->swin); @@ -907,8 +893,7 @@ enl_ipc_sync(); } else if (!image_mode_is(image_submenu, MODE_MASK)) { draw_shadow_from_colors(menu->swin, top, bottom, 0, 0, item->w - MENU_VGAP, item->h, 2); - draw_arrow_from_colors(menu->swin, top, bottom, item->w - 3 * MENU_HGAP, (item->h - MENU_VGAP) / 2, MENU_VGAP, 2, - DRAW_ARROW_RIGHT); + draw_arrow_from_colors(menu->swin, top, bottom, item->w - 3 * MENU_HGAP, (item->h - MENU_VGAP) / 2, MENU_VGAP, 2, DRAW_ARROW_RIGHT); } } else { if (image_mode_is(image_menu, MODE_MASK)) { @@ -923,8 +908,7 @@ XSetForeground(Xdisplay, menu->gc, images[image_menu].selected->fg); draw_string(menu->swin, menu->gc, MENU_HGAP, item->h - MENU_VGAP, item->text, item->len); if (item->rtext) { - draw_string(menu->swin, menu->gc, item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 2 * MENU_HGAP, item->h - MENU_VGAP, - item->rtext, item->rlen); + draw_string(menu->swin, menu->gc, item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 2 * MENU_HGAP, item->h - MENU_VGAP, item->rtext, item->rlen); } XSetForeground(Xdisplay, menu->gc, images[image_menu].norm->fg); } @@ -953,8 +937,7 @@ REQUIRE(item->action.submenu != NULL); submenu = item->action.submenu; - D_MENU(("Displaying submenu \"%s\" (window 0x%08x) of menu \"%s\" (window 0x%08x)\n", submenu->title, submenu->win, menu->title, - menu->win)); + D_MENU(("Displaying submenu \"%s\" (window 0x%08x) of menu \"%s\" (window 0x%08x)\n", submenu->title, submenu->win, menu->title, menu->win)); menu_invoke(item->x + item->w, item->y, menu->win, submenu, CurrentTime); /* Invoking the submenu makes it current. Undo that behavior. */ @@ -985,6 +968,7 @@ { register unsigned short i, len; unsigned long width, height; + #if 0 char *safeaction; #endif @@ -1113,10 +1097,8 @@ str_y = menu->fheight + MENU_VGAP; len = strlen(menu->title); XTextExtents(menu->font, menu->title, len, &direction, &ascent, &descent, &chars); - draw_string(menu->bg, menu->gc, center_coords(2 * MENU_HGAP, menu->w - 2 * MENU_HGAP) - (chars.width >> 1), - str_y - chars.descent - MENU_VGAP / 2, menu->title, len); - draw_shadow(menu->bg, topShadowGC, botShadowGC, str_x, str_y - chars.descent - MENU_VGAP / 2 + 1, menu->w - (4 * MENU_HGAP), MENU_VGAP, - 2); + draw_string(menu->bg, menu->gc, center_coords(2 * MENU_HGAP, menu->w - 2 * MENU_HGAP) - (chars.width >> 1), str_y - chars.descent - MENU_VGAP / 2, menu->title, len); + draw_shadow(menu->bg, topShadowGC, botShadowGC, str_x, str_y - chars.descent - MENU_VGAP / 2 + 1, menu->w - (4 * MENU_HGAP), MENU_VGAP, 2); str_y += MENU_VGAP; for (i = 0; i < menu->numitems; i++) { @@ -1130,11 +1112,9 @@ item->y = str_y - 2 * MENU_VGAP; item->w = menu->w - MENU_HGAP; item->h = 2 * MENU_VGAP; - D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w, - item->y + item->h, item->w, item->h)); + D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w, item->y + item->h, item->w, item->h)); } - draw_shadow(menu->bg, botShadowGC, topShadowGC, str_x, str_y - MENU_VGAP - MENU_VGAP / 2, menu->w - 4 * MENU_HGAP, MENU_VGAP, - 2); + draw_shadow(menu->bg, botShadowGC, topShadowGC, str_x, str_y - MENU_VGAP - MENU_VGAP / 2, menu->w - 4 * MENU_HGAP, MENU_VGAP, 2); } else { str_y += menu->fheight + MENU_VGAP; @@ -1143,18 +1123,15 @@ item->y = str_y - menu->fheight - MENU_VGAP / 2; item->w = menu->w - MENU_HGAP; item->h = menu->fheight + MENU_VGAP; - D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w, - item->y + item->h, item->w, item->h)); + D_MENU(("Hot Area at %hu, %hu to %hu, %hu (width %hu, height %hu)\n", item->x, item->y, item->x + item->w, item->y + item->h, item->w, item->h)); } switch (item->type) { case MENUITEM_SUBMENU: if (image_mode_is(image_submenu, MODE_MASK)) { - paste_simage(images[image_submenu].norm, image_submenu, menu->win, menu->bg, item->x, item->y, item->w - MENU_VGAP, - item->h); + paste_simage(images[image_submenu].norm, image_submenu, menu->win, menu->bg, item->x, item->y, item->w - MENU_VGAP, item->h); } else { draw_arrow_from_colors(menu->bg, PixColors[menuTopShadowColor], PixColors[menuBottomShadowColor], - item->x + item->w - 3 * MENU_HGAP, item->y + (item->h - MENU_VGAP) / 2, MENU_VGAP, 2, - DRAW_ARROW_RIGHT); + item->x + item->w - 3 * MENU_HGAP, item->y + (item->h - MENU_VGAP) / 2, MENU_VGAP, 2, DRAW_ARROW_RIGHT); } break; #if 0 @@ -1179,8 +1156,7 @@ } draw_string(menu->bg, menu->gc, str_x, str_y - MENU_VGAP / 2, item->text, item->len); if (item->rtext) { - draw_string(menu->bg, menu->gc, str_x + item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 3 * MENU_HGAP, - str_y - MENU_VGAP / 2, item->rtext, item->rlen); + draw_string(menu->bg, menu->gc, str_x + item->w - XTextWidth(menu->font, item->rtext, item->rlen) - 3 * MENU_HGAP, str_y - MENU_VGAP / 2, item->rtext, item->rlen); } } } @@ -1226,16 +1202,34 @@ break; case MENUITEM_ECHO: #ifdef ESCREEN - if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */ - ns_parse_screen_interactive(TermWin.screen, item->action.string); + if (TermWin.screen && TermWin.screen->backend) { + /* translate escapes */ + switch (TermWin.screen->backend) { +# ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + ns_parse_screen_interactive(TermWin.screen, item->action.string); + break; +# endif + default: + tt_write((unsigned char *) item->action.string, strlen(item->action.string)); + } } else #endif tt_write((unsigned char *) item->action.string, strlen(item->action.string)); break; case MENUITEM_LITERAL: #ifdef ESCREEN - if (TermWin.screen_mode && TermWin.screen) { /* translate escapes */ - (void) ns_screen_command(TermWin.screen, item->action.string); + if (TermWin.screen) { + /* translate escapes */ + switch (TermWin.screen->backend) { +# ifdef NS_HAVE_SCREEN + case NS_MODE_SCREEN: + (void) ns_screen_command(TermWin.screen, item->action.string); + break; +# endif + default: + tt_write((unsigned char *) item->action.string, strlen(item->action.string)); + } } else #endif tt_write((unsigned char *) item->action.string, strlen(item->action.string)); @@ -1310,7 +1304,7 @@ for (n = n2; n < nsc; n++) { if (!strncasecmp(b, sc[n], l)) { if (strcmp(b, sc[n])) { - if (strlen(sc[n]) >= m) /* buffer would overflow => fail */ + if (strlen(sc[n]) >= m) /* buffer would overflow => fail */ return -1; strcpy(b, sc[n]); return 0; @@ -1366,8 +1360,8 @@ } if ((m = menu_create(prompt))) { - for (l = 0; l < menu_list->nummenus; l++) { /* copycat font entry to */ - if (menu_list->menus[l]->font) { /* blend in with l&f */ + for (l = 0; l < menu_list->nummenus; l++) { /* copycat font entry to */ + if (menu_list->menus[l]->font) { /* blend in with l&f */ m->font = menu_list->menus[l]->font; m->fwidth = menu_list->menus[l]->fwidth; m->fheight = menu_list->menus[l]->fheight; @@ -1385,17 +1379,21 @@ if (m->font) { /* pre-calc width so we can center the dialog */ l = strlen(prompt); - if (i->len > l) + if (i->len > l) { l = XTextWidth(m->font, i->text, i->len); - else + } else { l = XTextWidth(m->font, prompt, l); - } else + } + } else { l = 200; + } menuitem_set_action(i, MENUITEM_STRING, "error"); menu_add_item(m, i); menu_invoke((int) ((TermWin_TotalWidth() - l) / 2), (int) (TermWin_TotalHeight() / 2) - 20, TermWin.parent, m, CurrentTime); + ungrab_pointer(); + do { do { while (!XPending(Xdisplay)); @@ -1413,18 +1411,26 @@ if (l < maxlen) { b[l + 1] = '\0'; b[l] = ch; + if (!l && (maxlen == 1)) { + /* special case: one char */ + /* answer auto-returns */ + f = 1; + } } - } else if ((ch == '\n') || (ch == '\r')) + } else if ((ch == '\n') || (ch == '\r')) { f = 1; - else if (ch == '\x08') { - if (maxlen && l) + } else if (ch == '\x08') { + if (maxlen && l) { b[--l] = '\0'; + } } else if ((ch == '\t') && inp_tab) { - if (!tab) + if (!tab) { tab = l; + } inp_tab(xd, b, tab, maxlen); - } else if (ch == '\x1b') + } else if (ch == '\x1b') { f = 2; + } i->len = strlen(b); menu_draw(m); } while (!f); @@ -1433,8 +1439,9 @@ i->len = strlen(old); /* we could just return b, but it might be longer than we need */ - if (retstr) + if (retstr) { *retstr = (!maxlen || (f == 2)) ? NULL : strdup(b); + } ret = (f == 2) ? -2 : 0; } m->font = NULL; =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/netdisp.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- netdisp.c 4 May 2002 14:25:28 -0000 1.5 +++ netdisp.c 3 Jun 2002 00:24:22 -0000 1.6 @@ -18,7 +18,7 @@ * he guarantee anything whatsoever. *----------------------------------------------------------------------*/ -static const char cvs_ident[] = "$Id: netdisp.c,v 1.5 2002/05/04 14:25:28 mej Exp $"; +static const char cvs_ident[] = "$Id: netdisp.c,v 1.6 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -78,7 +78,7 @@ if (display[0] != ':' && strncmp(display, "unix:", 5)) return display; /* nothing to do */ - ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */ + ifc.ifc_len = sizeof(buffer); /* Get names of all ifaces */ ifc.ifc_buf = buffer; if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { @@ -111,9 +111,7 @@ if (colon == NULL) colon = ":0.0"; - sprintf(ipaddress, "%d.%d.%d.%d%s", - (int) ((addr >> 030) & 0xFF), - (int) ((addr >> 020) & 0xFF), (int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon); + sprintf(ipaddress, "%d.%d.%d.%d%s", (int) ((addr >> 030) & 0xFF), (int) ((addr >> 020) & 0xFF), (int) ((addr >> 010) & 0xFF), (int) (addr & 0xFF), colon); rval = ipaddress; break; =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/options.c,v retrieving revision 1.107 retrieving revision 1.108 diff -u -3 -r1.107 -r1.108 --- options.c 22 May 2002 15:38:34 -0000 1.107 +++ options.c 3 Jun 2002 00:24:22 -0000 1.108 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: options.c,v 1.107 2002/05/22 15:38:34 mej Exp $"; +static const char cvs_ident[] = "$Id: options.c,v 1.108 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -75,12 +75,14 @@ static void *parse_multichar(char *, void *); static char *rs_pipe_name = NULL; + #ifdef PIXMAP_SUPPORT static int rs_shade = 0; static char *rs_tint = NULL; #endif static unsigned long rs_buttonbars = 1; static char *rs_font_effects = NULL; + #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) static char *rs_bigfont_key = NULL; static char *rs_smallfont_key = NULL; @@ -101,11 +103,13 @@ int rs_desktop = -1; char *rs_path = NULL; int rs_saveLines = SAVELINES; /* Lines in the scrollback buffer */ + #ifdef USE_XIM char *rs_input_method = NULL; char *rs_preedit_type = NULL; #endif char *rs_name = NULL; + #ifndef NO_BOLDFONT char *rs_boldFont = NULL; #endif @@ -119,6 +123,7 @@ char *rs_finished_title = NULL; char *rs_finished_text = NULL; char *rs_term_name = NULL; + #ifdef PIXMAP_SUPPORT char *rs_pixmapScale = NULL; char *rs_icon = NULL; @@ -127,6 +132,7 @@ char *rs_cmod_green = NULL; char *rs_cmod_blue = NULL; unsigned long rs_cache_size = (unsigned long) -1; + # ifdef BACKGROUND_CYCLING_SUPPORT char *rs_anim_pixmap_list = NULL; char **rs_anim_pixmaps = NULL; @@ -136,6 +142,7 @@ #endif char *rs_theme = NULL; char *rs_config_file = NULL; + #ifdef ESCREEN char *rs_url = NULL; char *rs_hop = NULL; @@ -143,6 +150,7 @@ #endif unsigned int rs_line_space = 0; unsigned int rs_meta_mod = 0, rs_alt_mod = 0, rs_numlock_mod = 0; + #ifdef KEYSYM_ATTRIBUTE unsigned char *KeySym_map[256]; /* probably mostly empty */ #endif @@ -164,8 +172,7 @@ } optList[] = { OPT_STR('t', "theme", "select a theme", &rs_theme), - OPT_STR('X', "config-file", "choose an alternate config file", &rs_config_file), - OPT_STR('d', "display", "X server to connect to", &display_name), + OPT_STR('X', "config-file", "choose an alternate config file", &rs_config_file), OPT_STR('d', "display", "X server to connect to", &display_name), #ifdef ESCREEN OPT_STR('U', "URL", "an URL pointing at a screen-session to pick up", &rs_url), OPT_STR('Z', "[lclport:]fw[:fwport]", "the destination machine -U can only be seen by the firewall fw. tunnel.", &rs_hop), @@ -185,8 +192,7 @@ OPT_ILONG("debug", "level of debugging information to show (0-5)", &DEBUG_LEVEL), #endif OPT_BLONG("install", "install a private colormap", &Options, Opt_install), - OPT_BOOL('h', "help", "display usage information", NULL, 0), - OPT_BLONG("version", "display version and configuration information", NULL, 0), + OPT_BOOL('h', "help", "display usage information", NULL, 0), OPT_BLONG("version", "display version and configuration information", NULL, 0), /* =======[ Color options ]======= */ OPT_BOOL('r', "reverse-video", "reverse video", &Options, Opt_reverse_video), OPT_STR('b', "background-color", "background color", &rs_color[bgColor]), @@ -196,8 +202,7 @@ OPT_LONG("color2", "color 2", &rs_color[minColor + 2]), OPT_LONG("color3", "color 3", &rs_color[minColor + 3]), OPT_LONG("color4", "color 4", &rs_color[minColor + 4]), - OPT_LONG("color5", "color 5", &rs_color[minColor + 5]), - OPT_LONG("color6", "color 6", &rs_color[minColor + 6]), OPT_LONG("color7", "color 7", &rs_color[minColor + 7]), + OPT_LONG("color5", "color 5", &rs_color[minColor + 5]), OPT_LONG("color6", "color 6", &rs_color[minColor + 6]), OPT_LONG("color7", "color 7", &rs_color[minColor + 7]), #ifndef NO_BRIGHTCOLOR OPT_LONG("color8", "color 8", &rs_color[minBright]), OPT_LONG("color9", "color 9", &rs_color[minBright + 1]), @@ -212,8 +217,7 @@ #endif /* NO_BOLDUNDERLINE */ OPT_LONG("pointer-color", "mouse pointer color", &rs_color[pointerColor]), #ifndef NO_CURSORCOLOR - OPT_STR('c', "cursor-color", "cursor color", &rs_color[cursorColor]), - OPT_LONG("cursor-text-color", "cursor text color", &rs_color[cursorColor2]), + OPT_STR('c', "cursor-color", "cursor color", &rs_color[cursorColor]), OPT_LONG("cursor-text-color", "cursor text color", &rs_color[cursorColor2]), #endif /* NO_CURSORCOLOR */ /* =======[ X11 options ]======= */ OPT_STR('g', "geometry", "WxH+X+Y = size and position", &rs_geometry), @@ -265,8 +269,7 @@ OPT_LONG("mfont1", "multichar font 1", &rs_mfont[1]), OPT_LONG("mfont2", "multichar font 2", &rs_mfont[2]), OPT_LONG("mfont3", "multichar font 3", &rs_mfont[3]), - OPT_LONG("mfont4", "multichar font 4", &rs_mfont[4]), - OPT_LONG("mencoding", "multichar encoding mode (eucj/sjis/euckr/big5/gb)", &rs_multichar_encoding), + OPT_LONG("mfont4", "multichar font 4", &rs_mfont[4]), OPT_LONG("mencoding", "multichar encoding mode (eucj/sjis/euckr/big5/gb)", &rs_multichar_encoding), #endif /* MULTI_CHARSET */ #ifdef USE_XIM OPT_LONG("input-method", "XIM input method", &rs_input_method), OPT_LONG("preedit-type", "XIM preedit type", &rs_preedit_type), @@ -302,20 +305,16 @@ OPT_BLONG("resize-gravity", "toggle gravitation to nearest corner on resize", &Options, Opt_resize_gravity), /* =======[ Keyboard options ]======= */ #if defined (HOTKEY_CTRL) || defined (HOTKEY_META) - OPT_LONG("big-font-key", "keysym for font size increase", &rs_bigfont_key), - OPT_LONG("small-font-key", "keysym for font size decrease", &rs_smallfont_key), + OPT_LONG("big-font-key", "keysym for font size increase", &rs_bigfont_key), OPT_LONG("small-font-key", "keysym for font size decrease", &rs_smallfont_key), #endif OPT_ILONG("meta-mod", "modifier to interpret as the Meta key", &rs_meta_mod), - OPT_ILONG("alt-mod", "modifier to interpret as the Alt key", &rs_alt_mod), - OPT_ILONG("numlock-mod", "modifier to interpret as the NumLock key", &rs_numlock_mod), + OPT_ILONG("alt-mod", "modifier to interpret as the Alt key", &rs_alt_mod), OPT_ILONG("numlock-mod", "modifier to interpret as the NumLock key", &rs_numlock_mod), #ifdef GREEK_SUPPORT OPT_LONG("greek-keyboard", "greek keyboard mapping (iso or ibm)", &rs_greek_keyboard), #endif - OPT_BLONG("app-keypad", "application keypad mode", &PrivateModes, PrivMode_aplKP), - OPT_BLONG("app-cursor", "application cursor key mode", &PrivateModes, PrivMode_aplCUR), + OPT_BLONG("app-keypad", "application keypad mode", &PrivateModes, PrivMode_aplKP), OPT_BLONG("app-cursor", "application cursor key mode", &PrivateModes, PrivMode_aplCUR), /* =======[ Misc options ]======= */ - OPT_INT('L', "save-lines", "lines to save in scrollback buffer", &rs_saveLines), - OPT_ILONG("min-anchor-size", "minimum size of the scrollbar anchor", &rs_min_anchor_size), + OPT_INT('L', "save-lines", "lines to save in scrollback buffer", &rs_saveLines), OPT_ILONG("min-anchor-size", "minimum size of the scrollbar anchor", &rs_min_anchor_size), #ifdef BORDER_WIDTH_OPTION OPT_INT('w', "border-width", "term window border width", &(TermWin.internalBorder)), #endif @@ -330,8 +329,7 @@ OPT_LONG("term-name", "value to use for setting $TERM", &rs_term_name), OPT_LONG("pipe-name", "filename of console pipe to emulate -C", &rs_pipe_name), OPT_STR('a', "attribute", "parse an attribute in the specified context", NULL), - OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console), - OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_exec_args) + OPT_BOOL('C', "console", "grab console messages", &Options, Opt_console), OPT_ARGS('e', "exec", "execute a command rather than a shell", &rs_exec_args) }; /* Print usage information */ @@ -402,8 +400,7 @@ " " PIXMAP_IDENT "\n" " " SCREEN_IDENT "\n" " " SCROLLBAR_IDENT "\n" - " " STARTUP_IDENT "\n" - " " SYSTEM_IDENT "\n" " " TERM_IDENT "\n" " " TIMER_IDENT "\n" " " UTMP_IDENT "\n" " " WINDOWS_IDENT "\n" "\n"); + " " STARTUP_IDENT "\n" " " SYSTEM_IDENT "\n" " " TERM_IDENT "\n" " " TIMER_IDENT "\n" " " UTMP_IDENT "\n" " " WINDOWS_IDENT "\n" "\n"); printf("Debugging configuration: "); #ifdef DEBUG @@ -894,7 +891,7 @@ } else if (!strcasecmp(opt, "attribute")) { conf_parse_line(NULL, val_ptr); } else { /* It's not --exec */ - if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */ + if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */ D_OPTIONS(("Boolean option detected\n")); if (val_ptr) { if (BOOL_OPT_ISTRUE(val_ptr)) { @@ -917,7 +914,7 @@ *(optList[j].maskvar) |= optList[j].mask; } } - } else if (optList[j].flag & OPT_INTEGER) { /* Integer value */ + } else if (optList[j].flag & OPT_INTEGER) { /* Integer value */ D_OPTIONS(("Integer option detected\n")); *((int *) optList[j].pval) = strtol(val_ptr, (char **) NULL, 0); } else { /* String value */ @@ -965,13 +962,13 @@ if ((val_ptr == NULL) || ((*val_ptr == '-') && (optList[j].short_opt != 'F') && (optList[j].short_opt != 'g'))) { print_error("option -%c requires a%s value\n", opt[pos], (optList[j].flag & OPT_INTEGER ? "n integer" : " string")); CHECK_BAD(); - if (val_ptr) { /* If the "arg" was actually an option, don't skip it */ + if (val_ptr) { /* If the "arg" was actually an option, don't skip it */ i--; } continue; } } - if (opt[pos] == 'e') { /* It's an exec */ + if (opt[pos] == 'e') { /* It's an exec */ register unsigned short k, len; @@ -1006,12 +1003,12 @@ } else if (opt[pos] == 'a') { conf_parse_line(NULL, val_ptr); } else { - if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */ + if (optList[j].flag & OPT_BOOLEAN) { /* Boolean value */ D_OPTIONS(("Boolean option detected\n")); if (optList[j].maskvar) { *(optList[j].maskvar) |= optList[j].mask; } - } else if (optList[j].flag & OPT_INTEGER) { /* Integer value */ + } else if (optList[j].flag & OPT_INTEGER) { /* Integer value */ D_OPTIONS(("Integer option detected\n")); *((int *) optList[j].pval) = strtol(val_ptr, (char **) NULL, 0); D_OPTIONS(("Got value %d\n", *((int *) optList[j].pval))); @@ -1140,7 +1137,7 @@ D_OPTIONS(("val_ptr == %s done == %d\n", val_ptr, done)); if ((val_ptr == NULL) || (*val_ptr == '-')) { print_error("option -%c requires a string value\n", opt[pos]); - if (val_ptr) { /* If the "arg" was actually an option, don't skip it */ + if (val_ptr) { /* If the "arg" was actually an option, don't skip it */ i--; } continue; @@ -1191,8 +1188,7 @@ if (!BEG_STRCASECMP(tmp, "reverse")) { Options |= Opt_reverse_video; } else if (BEG_STRCASECMP(tmp, "normal")) { - print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video\n", - file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid value \"%s\" for attribute video\n", file_peek_path(), file_peek_line(), tmp); } } else if (!BEG_STRCASECMP(buff, "color ")) { @@ -1201,8 +1197,7 @@ n = num_words(buff); if (n < 3) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" - "attribute color", file_peek_path(), file_peek_line(), NONULL(tmp)); + print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" "attribute color", file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } tmp = get_pword(2, buff); @@ -1234,15 +1229,13 @@ return NULL; } else { tmp = get_word(1, tmp); - print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", - file_peek_path(), file_peek_line(), NONULL(tmp)); + print_error("Parse error in file %s, line %lu: Invalid color index \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(tmp)); FREE(tmp); } } } if (n != 5) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" - "attribute color", file_peek_path(), file_peek_line(), NONULL(tmp)); + print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for \n" "attribute color", file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } g1 = get_pword(4, buff); @@ -1292,8 +1285,7 @@ FREE(tmp); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context color\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context color\n", file_peek_path(), file_peek_line(), buff); } return state; } @@ -1332,8 +1324,7 @@ if (!BEG_STRCASECMP(tmp, "fx ") || !BEG_STRCASECMP(tmp, "effect")) { if (parse_font_fx(get_pword(2, tmp)) != 1) { - print_error("Parse error in file %s, line %lu: Syntax error in font effects specification\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Syntax error in font effects specification\n", file_peek_path(), file_peek_line()); } } else if (!BEG_STRCASECMP(tmp, "prop")) { tmp = get_pword(2, tmp); @@ -1342,8 +1333,7 @@ } else if (BOOL_OPT_ISFALSE(tmp)) { Options &= ~(Opt_proportional); } else { - print_error("Parse error in file %s, line %lu: Invalid/missing boolean value for attribute proportional\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Invalid/missing boolean value for attribute proportional\n", file_peek_path(), file_peek_line()); } } else if (isdigit(*tmp)) { n = (unsigned char) strtoul(tmp, (char **) NULL, 0); @@ -1369,8 +1359,7 @@ } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context attributes\n", - file_peek_path(), file_peek_line(), (buff ? buff : "")); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context attributes\n", file_peek_path(), file_peek_line(), (buff ? buff : "")); } return state; } @@ -1393,8 +1382,7 @@ } else if (BOOL_OPT_ISFALSE(tmp)) { bool_val = 0; } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context toggles\n", - file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context toggles\n", file_peek_path(), file_peek_line(), tmp); return NULL; } @@ -1584,8 +1572,7 @@ Options &= ~(Opt_resize_gravity); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(), - file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context toggles\n", file_peek_path(), file_peek_line(), buff); } return state; } @@ -1624,8 +1611,7 @@ if (sym >= 0xff00) sym -= 0xff00; if (sym < 0 || sym > 0xff) { - print_error("Parse error in file %s, line %lu: Keysym 0x%x out of range 0xff00-0xffff\n", - file_peek_path(), file_peek_line(), sym + 0xff00); + print_error("Parse error in file %s, line %lu: Keysym 0x%x out of range 0xff00-0xffff\n", file_peek_path(), file_peek_line(), sym + 0xff00); return NULL; } s = get_word(3, buff); @@ -1653,8 +1639,7 @@ char *tmp = get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing modifier value for attribute meta_mod\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Missing modifier value for attribute meta_mod\n", file_peek_path(), file_peek_line()); return NULL; } rs_meta_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0); @@ -1663,8 +1648,7 @@ char *tmp = get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing modifier value for attribute alt_mod\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Missing modifier value for attribute alt_mod\n", file_peek_path(), file_peek_line()); return NULL; } rs_alt_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0); @@ -1673,8 +1657,7 @@ char *tmp = get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing modifier value for attribute numlock_mod\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Missing modifier value for attribute numlock_mod\n", file_peek_path(), file_peek_line()); return NULL; } rs_numlock_mod = (unsigned int) strtoul(tmp, (char **) NULL, 0); @@ -1685,8 +1668,7 @@ char *tmp = get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing boolean value for attribute greek\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Missing boolean value for attribute greek\n", file_peek_path(), file_peek_line()); return NULL; } if (BOOL_OPT_ISTRUE(tmp)) { @@ -1702,8 +1684,7 @@ } else if (BOOL_OPT_ISFALSE(tmp)) { /* This space intentionally left no longer blank =^) */ } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute %s\n", - file_peek_path(), file_peek_line(), tmp, buff); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute %s\n", file_peek_path(), file_peek_line(), tmp, buff); return NULL; } #else @@ -1715,8 +1696,7 @@ char *tmp = get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_keypad\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_keypad\n", file_peek_path(), file_peek_line()); return NULL; } if (BOOL_OPT_ISTRUE(tmp)) { @@ -1724,8 +1704,7 @@ } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplKP); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_keypad\n", - file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_keypad\n", file_peek_path(), file_peek_line(), tmp); return NULL; } @@ -1734,8 +1713,7 @@ char *tmp = get_pword(2, buff); if (!tmp) { - print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_cursor\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Missing boolean value for attribute app_cursor\n", file_peek_path(), file_peek_line()); return NULL; } if (BOOL_OPT_ISTRUE(tmp)) { @@ -1743,14 +1721,12 @@ } else if (BOOL_OPT_ISFALSE(tmp)) { PrivateModes &= ~(PrivMode_aplCUR); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_cursor\n", - file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" for attribute app_cursor\n", file_peek_path(), file_peek_line(), tmp); return NULL; } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context keyboard\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context keyboard\n", file_peek_path(), file_peek_line(), buff); } return state; } @@ -1818,8 +1794,7 @@ #endif } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context misc\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context misc\n", file_peek_path(), file_peek_line(), buff); } return state; } @@ -1855,16 +1830,14 @@ if (tmp) { rs_anim_pixmap_list = STRDUP(tmp); } else { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute anim\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute anim\n", file_peek_path(), file_peek_line()); } #else print_warning("Support for the anim attribute was not compiled in, ignoring\n"); #endif } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context imageclasses\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context imageclasses\n", file_peek_path(), file_peek_line(), buff); } return state; } @@ -1938,8 +1911,7 @@ char *allow_list = get_pword(4, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"mode\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"mode\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!mode) { @@ -1985,8 +1957,7 @@ return NULL; } if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"state\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"state\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!strcasecmp(state, "normal")) { @@ -2028,18 +1999,15 @@ char *fg = get_word(2, buff), *bg = get_word(3, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image state defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"color\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!fg || !bg) { - print_error("Parse error in file %s, line %lu: Foreground and background colors must be specified with \"color\"\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Foreground and background colors must be specified with \"color\"\n", file_peek_path(), file_peek_line()); return NULL; } if (!BEG_STRCASECMP(fg, "0x")) { @@ -2060,13 +2028,11 @@ char *filename = get_pword(2, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image state defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"file\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!filename) { @@ -2082,13 +2048,11 @@ char *geom = get_pword(2, buff); if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image state defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"geom\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!geom) { @@ -2104,13 +2068,11 @@ imlib_t *iml = images[idx].current->iml; if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered color modifier with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered color modifier with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (!color) { @@ -2176,21 +2138,18 @@ } update_cmod(iml->bmod); } else { - print_error("Parse error in file %s, line %lu: Color must be either \"image\", \"red\", \"green\", or \"blue\"\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Color must be either \"image\", \"red\", \"green\", or \"blue\"\n", file_peek_path(), file_peek_line()); return NULL; } #endif } else if (!BEG_STRCASECMP(buff, "border ")) { if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"border\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"border\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (num_words(buff + 7) < 4) { - print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"border\"\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"border\"\n", file_peek_path(), file_peek_line()); return NULL; } RESET_AND_ASSIGN(images[idx].current->iml->border, (Imlib_Border *) MALLOC(sizeof(Imlib_Border))); @@ -2203,22 +2162,19 @@ if ((images[idx].current->iml->border->left == 0) && (images[idx].current->iml->border->right == 0) && (images[idx].current->iml->border->top == 0) && (images[idx].current->iml->border->bottom == 0)) { FREE(images[idx].current->iml->border); - images[idx].current->iml->border = (Imlib_Border *) NULL; /* No sense in wasting CPU time and memory if there are no borders */ + images[idx].current->iml->border = (Imlib_Border *) NULL; /* No sense in wasting CPU time and memory if there are no borders */ } } else if (!BEG_STRCASECMP(buff, "bevel ")) { if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image state defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"bevel\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (num_words(buff + 6) < 5) { - print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"bevel\"\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"bevel\"\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current->iml->bevel != NULL) { @@ -2247,18 +2203,15 @@ } } else if (!BEG_STRCASECMP(buff, "padding ")) { if (!CHECK_VALID_INDEX(idx)) { - print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image type defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image type defined\n", file_peek_path(), file_peek_line()); return NULL; } if (images[idx].current == NULL) { - print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Encountered \"padding\" with no image state defined\n", file_peek_path(), file_peek_line()); return NULL; } if (num_words(buff + 8) < 4) { - print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"padding\"\n", file_peek_path(), - file_peek_line()); + print_error("Parse error in file %s, line %lu: Invalid parameter list for attribute \"padding\"\n", file_peek_path(), file_peek_line()); return NULL; } RESET_AND_ASSIGN(images[idx].current->iml->pad, (Imlib_Border *) MALLOC(sizeof(Imlib_Border))); @@ -2274,8 +2227,7 @@ images[idx].current->iml->pad = (Imlib_Border *) NULL; } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context image\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context image\n", file_peek_path(), file_peek_line(), buff); } return ((void *) state); } @@ -2364,8 +2316,7 @@ } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context action\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context action\n", file_peek_path(), file_peek_line(), buff); } return state; } @@ -2389,8 +2340,7 @@ sprintf(tmp, "Eterm_Menu_%u", menu_list->nummenus); menu_set_title(menu, tmp); - print_error("Parse error in file %s, line %lu: Menu context ended without giving a title. Defaulted to \"%s\".\n", - file_peek_path(), file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Menu context ended without giving a title. Defaulted to \"%s\".\n", file_peek_path(), file_peek_line(), tmp); } menu_list = menulist_add_menu(menu_list, menu); return NULL; @@ -2419,8 +2369,7 @@ menuitem_set_action(item, MENUITEM_SEP, (char *) NULL); } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), - file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff); } return ((void *) menu); } @@ -2441,8 +2390,7 @@ ASSERT_RVAL(menu != NULL, state); if (*buff == CONF_END_CHAR) { if (!(curitem->text)) { - print_error("Parse error in file %s, line %lu: Menuitem context ended with no text given. Discarding this entry.\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Menuitem context ended with no text given. Discarding this entry.\n", file_peek_path(), file_peek_line()); FREE(curitem); } else { menu_add_item(menu, curitem); @@ -2491,14 +2439,12 @@ menuitem_set_action(curitem, MENUITEM_SEP, action); } else { - print_error("Parse error in file %s, line %lu: Invalid menu item action \"%s\"\n", file_peek_path(), file_peek_line(), - NONULL(type)); + print_error("Parse error in file %s, line %lu: Invalid menu item action \"%s\"\n", file_peek_path(), file_peek_line(), NONULL(type)); } FREE(action); } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), - file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff); } return ((void *) curitem); } @@ -2531,13 +2477,12 @@ print_error("Parse error in file %s, line %lu: Attribute dock requires a parameter\n", file_peek_path(), file_peek_line()); } else if (!BEG_STRCASECMP(where, "top")) { bbar_set_docked(bbar, BBAR_DOCKED_TOP); - } else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */ + } else if (!BEG_STRCASECMP(where, "bot")) { /* "bot" or "bottom" */ bbar_set_docked(bbar, BBAR_DOCKED_BOTTOM); - } else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */ + } else if (!BEG_STRCASECMP(where, "no")) { /* "no" or "none" */ bbar_set_docked(bbar, BBAR_UNDOCKED); } else { - print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock\n", file_peek_path(), - file_peek_line(), where); + print_error("Parse error in file %s, line %lu: Invalid parameter \"%s\" to attribute dock\n", file_peek_path(), file_peek_line(), where); } } else if (!BEG_STRCASECMP(buff, "visible ")) { @@ -2548,8 +2493,7 @@ } else if (BOOL_OPT_ISFALSE(tmp)) { bbar_set_visible(bbar, 0); } else { - print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar\n", file_peek_path(), - file_peek_line(), tmp); + print_error("Parse error in file %s, line %lu: Invalid boolean value \"%s\" in context button_bar\n", file_peek_path(), file_peek_line(), tmp); } } else if (!BEG_STRCASECMP(buff, "button ") || !BEG_STRCASECMP(buff, "rbutton ")) { @@ -2611,8 +2555,7 @@ bbar_add_button(bbar, button); } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context menu\n", file_peek_path(), file_peek_line(), buff); } return ((void *) bbar); } @@ -2629,8 +2572,7 @@ } else if (!BEG_STRCASECMP(buff, "preedit_type ")) { RESET_AND_ASSIGN(rs_preedit_type, get_word(2, buff)); } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context xim\n", file_peek_path(), file_peek_line(), buff); } #else print_warning("XIM support was not compiled in, ignoring entire context\n"); @@ -2657,14 +2599,12 @@ && BEG_STRCASECMP(rs_multichar_encoding, "gb") && BEG_STRCASECMP(rs_multichar_encoding, "iso-10646") && BEG_STRCASECMP(rs_multichar_encoding, "none")) { - print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n", - file_peek_path(), file_peek_line(), rs_multichar_encoding); + print_error("Parse error in file %s, line %lu: Invalid multichar encoding mode \"%s\"\n", file_peek_path(), file_peek_line(), rs_multichar_encoding); FREE(rs_multichar_encoding); return NULL; } } else { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute encoding\n", - file_peek_path(), file_peek_line()); + print_error("Parse error in file %s, line %lu: Invalid parameter list \"\" for attribute encoding\n", file_peek_path(), file_peek_line()); } } else if (!BEG_STRCASECMP(buff, "font ")) { @@ -2672,8 +2612,7 @@ unsigned char n; if (num_words(buff) != 3) { - print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for attribute font\n", - file_peek_path(), file_peek_line(), NONULL(tmp)); + print_error("Parse error in file %s, line %lu: Invalid parameter list \"%s\" for attribute font\n", file_peek_path(), file_peek_line(), NONULL(tmp)); return NULL; } if (isdigit(*tmp)) { @@ -2690,8 +2629,7 @@ } } else { - print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context multichar\n", - file_peek_path(), file_peek_line(), buff); + print_error("Parse error in file %s, line %lu: Attribute \"%s\" is not valid within context multichar\n", file_peek_path(), file_peek_line(), buff); } #else if (*buff == CONF_BEGIN_CHAR) { @@ -2950,7 +2888,7 @@ if (rs_pixmaps[i]) { reset_simage(images[i].norm, RESET_ALL_SIMG); load_image(rs_pixmaps[i], images[i].norm); - FREE(rs_pixmaps[i]); /* These are created by STRDUP() */ + FREE(rs_pixmaps[i]); /* These are created by STRDUP() */ } #else /* Right now, solid mode is the only thing we can do without pixmap support. */ @@ -3123,8 +3061,7 @@ if (n > 2) { iml->mod->gamma = (int) strtol(get_pword(3, rs_cmod_image), (char **) NULL, 0); } - D_PIXMAP(("From image cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_image, - iml->mod->brightness, iml->mod->contrast, iml->mod->gamma)); + D_PIXMAP(("From image cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_image, iml->mod->brightness, iml->mod->contrast, iml->mod->gamma)); FREE(rs_cmod_image); } if (rs_cmod_red) { @@ -3142,8 +3079,7 @@ if (n > 2) { iml->rmod->gamma = (int) strtol(get_pword(3, rs_cmod_red), (char **) NULL, 0); } - D_PIXMAP(("From red cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_red, - iml->rmod->brightness, iml->rmod->contrast, iml->rmod->gamma)); + D_PIXMAP(("From red cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_red, iml->rmod->brightness, iml->rmod->contrast, iml->rmod->gamma)); FREE(rs_cmod_red); update_cmod(iml->rmod); } @@ -3162,8 +3098,7 @@ if (n > 2) { iml->gmod->gamma = (int) strtol(get_pword(3, rs_cmod_green), (char **) NULL, 0); } - D_PIXMAP(("From green cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_green, - iml->gmod->brightness, iml->gmod->contrast, iml->gmod->gamma)); + D_PIXMAP(("From green cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_green, iml->gmod->brightness, iml->gmod->contrast, iml->gmod->gamma)); FREE(rs_cmod_green); update_cmod(iml->gmod); } @@ -3182,8 +3117,7 @@ if (n > 2) { iml->bmod->gamma = (int) strtol(get_pword(3, rs_cmod_blue), (char **) NULL, 0); } - D_PIXMAP(("From blue cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_blue, - iml->bmod->brightness, iml->bmod->contrast, iml->bmod->gamma)); + D_PIXMAP(("From blue cmod string %s to brightness %d, contrast %d, and gamma %d\n", rs_cmod_blue, iml->bmod->brightness, iml->bmod->contrast, iml->bmod->gamma)); FREE(rs_cmod_blue); update_cmod(iml->bmod); } @@ -3234,11 +3168,11 @@ unsigned long w, h; int count; - count = num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */ + count = num_words(rs_anim_pixmap_list) - 1; /* -1 for the delay */ rs_anim_pixmaps = (char **) MALLOC(sizeof(char *) * (count + 1)); for (i = 0; i < count; i++) { - temp = get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */ + temp = get_word(i + 2, rs_anim_pixmap_list); /* +2 rather than +1 to account for the delay */ if (temp == NULL) break; if (num_words(temp) != 3) { @@ -3326,8 +3260,7 @@ *(--tmp) = '/'; } if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) { - print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm\n"), - path); + print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (theme_dir ? theme_dir : PKGDATADIR "/themes/Eterm\n"), path); return errno; } } @@ -3356,8 +3289,7 @@ *(--tmp) = '/'; } if (!mkdirhier(path) || (stat(path, &fst) && !CAN_WRITE(fst))) { - print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm\n"), - path); + print_error("I couldn't write to \"%s\" or \"%s\". I give up.", (user_dir ? user_dir : PKGDATADIR "/themes/Eterm\n"), path); return errno; } } @@ -3418,8 +3350,7 @@ fprintf(fp, " desktop %d\n", rs_desktop); } } - fprintf(fp, " scrollbar_type %s\n", - (scrollbar_get_type() == SCROLLBAR_XTERM ? "xterm" : (scrollbar_get_type() == SCROLLBAR_MOTIF ? "motif" : "next"))); + fprintf(fp, " scrollbar_type %s\n", (scrollbar_get_type() == SCROLLBAR_XTERM ? "xterm" : (scrollbar_get_type() == SCROLLBAR_MOTIF ? "motif" : "next"))); fprintf(fp, " scrollbar_width %d\n", scrollbar_anchor_width()); fprintf(fp, " font default %u\n", (unsigned int) font_idx); fprintf(fp, " font proportional %d\n", ((Options & Opt_proportional) ? 1 : 0)); @@ -3561,33 +3492,27 @@ } fprintf(fp, "\n"); if (simg->iml->mod) { - fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, - simg->iml->mod->gamma); + fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma); } if (simg->iml->rmod) { - fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, - simg->iml->rmod->gamma); + fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma); } if (simg->iml->gmod) { - fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, - simg->iml->gmod->gamma); + fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma); } if (simg->iml->bmod) { - fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, - simg->iml->bmod->gamma); + fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma); } #endif if (simg->iml->border) { - fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, - simg->iml->border->bottom); + fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom); } if (simg->iml->bevel) { fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom); } if (simg->iml->pad) { - fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, - simg->iml->pad->bottom); + fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom); } /* Selected state */ @@ -3622,33 +3547,27 @@ } fprintf(fp, "\n"); if (simg->iml->mod) { - fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, - simg->iml->mod->gamma); + fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma); } if (simg->iml->rmod) { - fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, - simg->iml->rmod->gamma); + fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma); } if (simg->iml->gmod) { - fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, - simg->iml->gmod->gamma); + fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma); } if (simg->iml->bmod) { - fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, - simg->iml->bmod->gamma); + fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma); } #endif if (simg->iml->border) { - fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, - simg->iml->border->bottom); + fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom); } if (simg->iml->bevel) { fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom); } if (simg->iml->pad) { - fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, - simg->iml->pad->bottom); + fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom); } } @@ -3684,33 +3603,27 @@ } fprintf(fp, "\n"); if (simg->iml->mod) { - fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, - simg->iml->mod->gamma); + fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma); } if (simg->iml->rmod) { - fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, - simg->iml->rmod->gamma); + fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma); } if (simg->iml->gmod) { - fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, - simg->iml->gmod->gamma); + fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma); } if (simg->iml->bmod) { - fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, - simg->iml->bmod->gamma); + fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma); } #endif if (simg->iml->border) { - fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, - simg->iml->border->bottom); + fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom); } if (simg->iml->bevel) { fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom); } if (simg->iml->pad) { - fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, - simg->iml->pad->bottom); + fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom); } } @@ -3746,33 +3659,27 @@ } fprintf(fp, "\n"); if (simg->iml->mod) { - fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, - simg->iml->mod->gamma); + fprintf(fp, " colormod image 0x%02x 0x%02x 0x%02x\n", simg->iml->mod->brightness, simg->iml->mod->contrast, simg->iml->mod->gamma); } if (simg->iml->rmod) { - fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, - simg->iml->rmod->gamma); + fprintf(fp, " colormod red 0x%02x 0x%02x 0x%02x\n", simg->iml->rmod->brightness, simg->iml->rmod->contrast, simg->iml->rmod->gamma); } if (simg->iml->gmod) { - fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, - simg->iml->gmod->gamma); + fprintf(fp, " colormod green 0x%02x 0x%02x 0x%02x\n", simg->iml->gmod->brightness, simg->iml->gmod->contrast, simg->iml->gmod->gamma); } if (simg->iml->bmod) { - fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, - simg->iml->bmod->gamma); + fprintf(fp, " colormod blue 0x%02x 0x%02x 0x%02x\n", simg->iml->bmod->brightness, simg->iml->bmod->contrast, simg->iml->bmod->gamma); } #endif if (simg->iml->border) { - fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, - simg->iml->border->bottom); + fprintf(fp, " border %hu %hu %hu %hu\n", simg->iml->border->left, simg->iml->border->right, simg->iml->border->top, simg->iml->border->bottom); } if (simg->iml->bevel) { fprintf(fp, " bevel %s %hu %hu %hu %hu\n", ((simg->iml->bevel->up) ? "up" : "down"), simg->iml->bevel->edges->left, simg->iml->bevel->edges->right, simg->iml->bevel->edges->top, simg->iml->bevel->edges->bottom); } if (simg->iml->pad) { - fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, - simg->iml->pad->bottom); + fprintf(fp, " padding %hu %hu %hu %hu\n", simg->iml->pad->left, simg->iml->pad->right, simg->iml->pad->top, simg->iml->pad->bottom); } } fprintf(fp, " end image\n"); @@ -4008,8 +3915,7 @@ } for (i = 0; i < 256; i++) { if (KeySym_map[i]) { - fprintf(fp, " keysym 0xff%02x \'%s\'\n", i, - safe_print_string((char *) (KeySym_map[i] + 1), (unsigned long) KeySym_map[i][0])); + fprintf(fp, " keysym 0xff%02x \'%s\'\n", i, safe_print_string((char *) (KeySym_map[i] + 1), (unsigned long) KeySym_map[i][0])); } } #ifdef GREEK_SUPPORT =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/pixmap.c,v retrieving revision 1.83 retrieving revision 1.84 diff -u -3 -r1.83 -r1.84 --- pixmap.c 22 May 2002 15:38:34 -0000 1.83 +++ pixmap.c 3 Jun 2002 00:24:22 -0000 1.84 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: pixmap.c,v 1.83 2002/05/22 15:38:34 mej Exp $"; +static const char cvs_ident[] = "$Id: pixmap.c,v 1.84 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -62,6 +62,7 @@ #endif Pixmap buffer_pixmap = None; + #ifdef PIXMAP_OFFSET Pixmap desktop_pixmap = None, viewport_pixmap = None; Window desktop_window = None; @@ -333,8 +334,7 @@ pmap->op = op; changed++; } - D_PIXMAP(("Returning %hu, *pmap == { op [%hu], w [%hd], h [%hd], x [%hd], y [%hd] }\n", changed, pmap->op, pmap->w, pmap->h, pmap->x, - pmap->y)); + D_PIXMAP(("Returning %hu, *pmap == { op [%hu], w [%hd], h [%hd], x [%hd], y [%hd] }\n", changed, pmap->op, pmap->w, pmap->h, pmap->x, pmap->y)); return changed; } @@ -628,8 +628,7 @@ } ); /* *INDENT-ON* */ - print_error("Looks like this version of Enlightenment doesn't support the IPC " - "commands I need. Disallowing \"auto\" mode for all images.\n"); + print_error("Looks like this version of Enlightenment doesn't support the IPC " "commands I need. Disallowing \"auto\" mode for all images.\n"); FREE(reply); checked = 2; return 0; @@ -678,8 +677,7 @@ XSetFillStyle(Xdisplay, gc, FillTiled); XFillRectangle(Xdisplay, p, gc, 0, 0, width, height); } else { - D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, - ph, desktop_pixmap)); + D_PIXMAP(("Copying %hux%hu rectangle at %d, %d from %ux%u desktop pixmap 0x%08x onto p.\n", width, height, x, y, pw, ph, desktop_pixmap)); XCopyArea(Xdisplay, desktop_pixmap, p, gc, x, y, width, height, 0, 0); } if ((which != image_bg || (image_toggles & IMOPT_ITRANS) || images[image_bg].current != images[image_bg].norm) @@ -706,6 +704,7 @@ Pixmap p = None, mask = None; GC gc; Screen *scr; + D_PIXMAP(("create_viewport_pixmap(%8p, 0x%08x, %d, %d, %hu, %hu) called.\n", simg, d, x, y, width, height)); scr = ScreenOfDisplay(Xdisplay, Xscreen); if (!scr) @@ -719,6 +718,7 @@ } if (viewport_pixmap == None) { imlib_t *tmp_iml = images[image_bg].current->iml; + imlib_context_set_image(tmp_iml->im); imlib_context_set_drawable(d); imlib_image_set_has_alpha(0); @@ -782,19 +782,19 @@ } void -paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsigned short x, unsigned short y, - unsigned short w, unsigned short h) +paste_simage(simage_t *simg, unsigned char which, Window win, Drawable d, unsigned short x, unsigned short y, unsigned short w, unsigned short h) { Pixmap pmap = None, mask = None; GC gc; + ASSERT(simg != NULL); REQUIRE(d != None); - D_PIXMAP(("paste_simage(%8p, %s, 0x%08x, 0x%08x, %hd, %hd, %hd, %hd) called.\n", simg, get_image_type(which), - (int) win, (int) d, x, y, w, h)); + D_PIXMAP(("paste_simage(%8p, %s, 0x%08x, 0x%08x, %hd, %hd, %hd, %hd) called.\n", simg, get_image_type(which), (int) win, (int) d, x, y, w, h)); if (which != image_max) { if (image_mode_is(which, MODE_AUTO) && image_mode_is(which, ALLOW_AUTO)) { char buff[255], *reply; const char *iclass, *state; + check_image_ipc(0); if (image_mode_is(which, MODE_AUTO)) { iclass = get_iclass_name(which); @@ -810,8 +810,7 @@ snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) d, state, w, h); reply = enl_send_and_wait(buff); if (strstr(reply, "Error")) { - print_error - ("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n"); + print_error("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n"); image_mode_fallback(which); FREE(reply); } else { @@ -829,8 +828,7 @@ LIBAST_X_FREE_GC(gc); return; } else { - print_error - ("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n"); + print_error("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n"); FREE(reply); image_mode_fallback(which); } @@ -839,6 +837,7 @@ } } else if (image_mode_is(which, MODE_TRANS) && image_mode_is(which, ALLOW_TRANS)) { Pixmap p; + gc = LIBAST_X_CREATE_GC(0, NULL); p = create_trans_pixmap(simg, which, win, x, y, w, h); if (p != None) { @@ -850,6 +849,7 @@ LIBAST_X_FREE_GC(gc); } else if (image_mode_is(which, MODE_VIEWPORT) && image_mode_is(which, ALLOW_VIEWPORT)) { Pixmap p; + gc = LIBAST_X_CREATE_GC(0, NULL); p = create_viewport_pixmap(simg, win, x, y, w, h); if (simg->iml->bevel != NULL) { @@ -950,6 +950,7 @@ { GC gc; XGCValues gcvalue; + ASSERT(buffer_pixmap == None); buffer_pixmap = LIBAST_X_CREATE_PIXMAP(width, height); gcvalue.foreground = (Pixel) fill; @@ -957,6 +958,7 @@ XSetGraphicsExposures(Xdisplay, gc, False); if (mode == MODE_SOLID) { simage_t *simg; + simg = images[image_bg].current; if (simg->pmap->pixmap) { LIBAST_X_FREE_PIXMAP(simg->pmap->pixmap); @@ -977,6 +979,7 @@ GC gc; Pixmap pixmap = None; Screen *scr; + #ifdef PIXMAP_SUPPORT short xsize, ysize; short xpos = 0, ypos = 0; @@ -990,8 +993,7 @@ ASSERT(simg->iml != NULL); ASSERT(simg->pmap != NULL); REQUIRE(win != None); - D_PIXMAP(("Rendering simg->iml->im %8p (%s) at %hux%hu onto window 0x%08x\n", simg->iml->im, get_image_type(which), - width, height, win)); + D_PIXMAP(("Rendering simg->iml->im %8p (%s) at %hux%hu onto window 0x%08x\n", simg->iml->im, get_image_type(which), width, height, win)); D_PIXMAP(("Image mode is 0x%02x\n", images[which].mode)); #ifdef PIXMAP_SUPPORT if ((which == image_bg) && image_mode_is(image_bg, MODE_VIEWPORT)) { @@ -1003,7 +1005,7 @@ return; gcvalue.foreground = gcvalue.background = PixColors[bgColor]; gc = LIBAST_X_CREATE_GC(GCForeground | GCBackground, &gcvalue); - pixmap = simg->pmap->pixmap; /* Save this for later */ + pixmap = simg->pmap->pixmap; /* Save this for later */ if ((which == image_bg) && (buffer_pixmap != None)) { LIBAST_X_FREE_PIXMAP(buffer_pixmap); buffer_pixmap = None; @@ -1012,6 +1014,7 @@ if ((images[which].mode & MODE_AUTO) && (images[which].mode & ALLOW_AUTO)) { char buff[255]; const char *iclass, *state; + check_image_ipc(0); if (image_mode_is(which, MODE_AUTO)) { iclass = get_iclass_name(which); @@ -1025,15 +1028,16 @@ if (iclass) { if (renderop & RENDER_FORCE_PIXMAP) { char *reply; + snprintf(buff, sizeof(buff), "imageclass %s apply_copy 0x%x %s %hd %hd", iclass, (int) win, state, width, height); reply = enl_send_and_wait(buff); if (strstr(reply, "Error")) { - print_error - ("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n"); + print_error("Enlightenment didn't seem to like something about my syntax. Disallowing \"auto\" mode for this image.\n"); image_mode_fallback(which); FREE(reply); } else { Pixmap pmap, mask; + pmap = (Pixmap) strtoul(reply, (char **) NULL, 0); mask = (Pixmap) strtoul(get_pword(2, reply), (char **) NULL, 0); FREE(reply); @@ -1057,8 +1061,7 @@ snprintf(buff, sizeof(buff), "imageclass %s free_pixmap 0x%08x", iclass, (int) pmap); enl_ipc_send(buff); } else { - print_error - ("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n"); + print_error("Enlightenment returned a null pixmap, which I can't use. Disallowing \"auto\" mode for this image.\n"); FREE(reply); image_mode_fallback(which); } @@ -1094,8 +1097,8 @@ } } else if (image_mode_is(which, MODE_VIEWPORT) && image_mode_is(which, ALLOW_VIEWPORT)) { Pixmap p; - D_PIXMAP(("Viewport mode enabled. viewport_pixmap == 0x%08x and simg->pmap->pixmap == 0x%08x\n", viewport_pixmap, - simg->pmap->pixmap)); + + D_PIXMAP(("Viewport mode enabled. viewport_pixmap == 0x%08x and simg->pmap->pixmap == 0x%08x\n", viewport_pixmap, simg->pmap->pixmap)); p = create_viewport_pixmap(simg, win, 0, 0, width, height); if (p && (p != simg->pmap->pixmap)) { if (simg->pmap->pixmap != None) { @@ -1126,6 +1129,7 @@ int h = simg->pmap->h; int x = simg->pmap->x; int y = simg->pmap->y; + imlib_context_set_image(simg->iml->im); imlib_context_set_drawable(win); imlib_context_set_anti_alias(1); @@ -1136,6 +1140,7 @@ D_PIXMAP(("w == %d, h == %d, x == %d, y == %d, xsize == %d, ysize == %d\n", w, h, x, y, xsize, ysize)); if ((simg->pmap->op & OP_PROPSCALE) && w && h) { double x_ratio, y_ratio; + x_ratio = ((double) width) / ((double) xsize); y_ratio = ((double) height) / ((double) ysize); if (x_ratio > 1) { @@ -1185,6 +1190,7 @@ } if (xscaled != width || yscaled != height || xpos != 0 || ypos != 0) { unsigned char single; + /* This tells us if we have a single, non-tiled image which does not entirely fill the window */ single = ((xscaled < width || yscaled < height) && !(simg->pmap->op & OP_TILE)) ? 1 : 0; pixmap = simg->pmap->pixmap; @@ -1275,6 +1281,7 @@ const char *path; int maxpath, len; struct stat fst; + if (!pathlist || !file) { /* If either one is NULL, there really isn't much point in going on.... */ return ((const char *) NULL); } @@ -1328,6 +1335,7 @@ } for (path = pathlist; path != NULL && *path != '\0'; path = p) { int n; + /* colon delimited */ if ((p = strchr(path, ':')) == NULL) p = strchr(path, '\0'); @@ -1339,6 +1347,7 @@ if (*path == '~') { unsigned int l; char *home_dir = getenv("HOME"); + if (home_dir && *home_dir) { l = strlen(home_dir); if (l + n < (unsigned) maxpath) { @@ -1382,6 +1391,7 @@ Imlib_Image *im; Imlib_Load_Error im_err; char *geom; + ASSERT_RVAL(file != NULL, 0); ASSERT_RVAL(simg != NULL, 0); D_PIXMAP(("load_image(%s, %8p)\n", file, simg)); @@ -1447,6 +1457,7 @@ { colormod_t *mod = iml->mod, *rmod = iml->rmod, *gmod = iml->gmod, *bmod = iml->bmod; DATA8 rt[256], gt[256], bt[256]; + REQUIRE(mod || rmod || gmod || bmod); /* When any changes is made to any individual color modifier for an image, this function must be called to update the overall Imlib2 color modifier. */ @@ -1510,12 +1521,14 @@ { unsigned char *ptr; int x, y; + ptr = (unsigned char *) data + (w * sizeof(DATA16)); if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { /* No saturation */ for (y = h; --y >= 0;) { for (x = -w; x < 0; x++) { int r, g, b; + b = ((DATA16 *) ptr)[x]; r = (b & 0x7c00) * rm; g = (b & 0x3e0) * gm; @@ -1530,6 +1543,7 @@ for (y = h; --y >= 0;) { for (x = -w; x < 0; x++) { int r, g, b; + b = ((DATA16 *) ptr)[x]; r = (b & 0x7c00) * rm; g = (b & 0x3e0) * gm; @@ -1552,12 +1566,14 @@ { unsigned char *ptr; int x, y; + ptr = (unsigned char *) data + (w * sizeof(DATA16)); if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { /* No saturation */ for (y = h; --y >= 0;) { for (x = -w; x < 0; x++) { int r, g, b; + b = ((DATA16 *) ptr)[x]; r = (b & 0xf800) * rm; g = (b & 0x7e0) * gm; @@ -1572,6 +1588,7 @@ for (y = h; --y >= 0;) { for (x = -w; x < 0; x++) { int r, g, b; + b = ((DATA16 *) ptr)[x]; r = (b & 0xf800) * rm; g = (b & 0x7e0) * gm; @@ -1594,12 +1611,14 @@ { unsigned char *ptr; int x, y; + ptr = (unsigned char *) data + (w * 4); if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { /* No saturation */ for (y = h; --y >= 0;) { for (x = -(w * 4); x < 0; x += 4) { int r, g, b; + # ifdef WORDS_BIGENDIAN r = (ptr[x + 1] * rm) >> 8; g = (ptr[x + 2] * gm) >> 8; @@ -1622,6 +1641,7 @@ for (y = h; --y >= 0;) { for (x = -(w * 4); x < 0; x += 4) { int r, g, b; + # ifdef WORDS_BIGENDIAN r = (ptr[x + 1] * rm) >> 8; g = (ptr[x + 2] * gm) >> 8; @@ -1656,12 +1676,14 @@ { unsigned char *ptr; int x, y; + ptr = (unsigned char *) data + (w * 3); if ((rm <= 256) && (gm <= 256) && (bm <= 256)) { /* No saturation */ for (y = h; --y >= 0;) { for (x = -(w * 3); x < 0; x += 3) { int r, g, b; + # ifdef WORDS_BIGENDIAN r = (ptr[x + 0] * rm) >> 8; g = (ptr[x + 1] * gm) >> 8; @@ -1684,6 +1706,7 @@ for (y = h; --y >= 0;) { for (x = -(w * 3); x < 0; x += 3) { int r, g, b; + # ifdef WORDS_BIGENDIAN r = (ptr[x + 0] * rm) >> 8; g = (ptr[x + 1] * gm) >> 8; @@ -1718,6 +1741,7 @@ XImage *ximg; register unsigned long i; + #if 0 register unsigned long v; unsigned long x, y; @@ -1728,6 +1752,7 @@ unsigned short rm, gm, bm, shade; Imlib_Color ctab[256]; int real_depth = 0; + D_PIXMAP(("colormod_trans(p == 0x%08x, gc, w == %hu, h == %hu) called.\n", p, w, h)); REQUIRE(p != None); if (iml->mod) { @@ -1758,6 +1783,7 @@ if (Xdepth <= 8) { XColor cols[256]; + for (i = 0; i < (unsigned long) (1 << Xdepth); i++) { cols[i].pixel = i; cols[i].flags = DoRed | DoGreen | DoBlue; @@ -1771,6 +1797,7 @@ } else if (Xdepth == 16) { XWindowAttributes xattr; + XGetWindowAttributes(Xdisplay, desktop_window, &xattr); if ((xattr.visual->green_mask == 0x3e0)) { real_depth = 15; @@ -1804,9 +1831,11 @@ /* Swap rm and bm for bgr */ { XWindowAttributes xattr; + XGetWindowAttributes(Xdisplay, desktop_window, &xattr); if (xattr.visual->blue_mask > xattr.visual->red_mask) { unsigned short tmp; + tmp = rm; rm = bm; bm = tmp; @@ -1855,6 +1884,7 @@ unsigned int pw, ph, pb, pd; int px, py; Window dummy; + if (w) { *w = 0; } @@ -1883,8 +1913,7 @@ XGetGeometry(Xdisplay, desktop_pixmap, &dummy, &px, &py, &pw, &ph, &pb, &pd); } if ((pw <= 0) || (ph <= 0)) { - print_error("Value of desktop pixmap property is invalid. Please restart your \n" - "window manager or use Esetroot to set a new one."); + print_error("Value of desktop pixmap property is invalid. Please restart your \n" "window manager or use Esetroot to set a new one."); desktop_pixmap = None; return 0; } @@ -1907,6 +1936,7 @@ unsigned char *data; unsigned int nchildren; Window w, root, *children, parent; + D_PIXMAP(("Current desktop window is 0x%08x\n", (unsigned int) desktop_window)); if ((desktop_window != None) && (desktop_window != Xroot)) { XSelectInput(Xdisplay, desktop_window, None); @@ -1925,11 +1955,8 @@ } - if ((XGetWindowProperty - (Xdisplay, w, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data)) != Success) { - if ((XGetWindowProperty - (Xdisplay, w, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, - &data)) != Success) { + if ((XGetWindowProperty(Xdisplay, w, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data)) != Success) { + if ((XGetWindowProperty(Xdisplay, w, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data)) != Success) { continue; } } @@ -1962,9 +1989,10 @@ static Pixmap color_pixmap = None, orig_desktop_pixmap; unsigned long length, after; unsigned char *data; + D_PIXMAP(("Current desktop pixmap is 0x%08x\n", (unsigned int) desktop_pixmap)); if (desktop_pixmap == None) { - orig_desktop_pixmap = None; /* Forced re-read. */ + orig_desktop_pixmap = None; /* Forced re-read. */ } if (desktop_window == None) { D_PIXMAP(("No desktop window. Aborting.\n")); @@ -1977,8 +2005,7 @@ LIBAST_X_FREE_PIXMAP(color_pixmap); color_pixmap = None; } - XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, - &format, &length, &after, &data); + XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_PIXMAP], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data); if (type == XA_PIXMAP) { p = *((Pixmap *) data); XFree(data); @@ -1998,6 +2025,7 @@ GC gc; XGCValues gcvalue; Screen *scr = ScreenOfDisplay(Xdisplay, Xscreen); + gcvalue.foreground = gcvalue.background = PixColors[bgColor]; gc = LIBAST_X_CREATE_GC(GCForeground | GCBackground, &gcvalue); XGetGeometry(Xdisplay, p, &w, &px, &py, &pw, &ph, &pb, &pd); @@ -2025,12 +2053,12 @@ } else { XFree(data); } - XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, - &format, &length, &after, &data); + XGetWindowProperty(Xdisplay, desktop_window, props[PROP_TRANS_COLOR], 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data); if (type == XA_CARDINAL) { XGCValues gcvalue; GC gc; Pixel pix; + free_desktop_pixmap(); pix = *((Pixel *) data); XFree(data); @@ -2068,12 +2096,14 @@ { static signed char have_shape = -1; + REQUIRE(d != None); REQUIRE(mask != None); D_PIXMAP(("shaped_window_apply_mask(d [0x%08x], mask [0x%08x]) called.\n", d, mask)); # ifdef HAVE_X_SHAPE_EXT if (have_shape == -1) { /* Don't know yet. */ int unused; + D_PIXMAP(("Looking for shape extension.\n")); if (XQueryExtension(Xdisplay, "SHAPE", &unused, &unused, &unused)) { have_shape = 1; @@ -2102,6 +2132,7 @@ Imlib_Color_Modifier tmp_cmod; XWMHints *wm_hints; int w = 8, h = 8; + if (pwm_hints) { wm_hints = pwm_hints; } else { @@ -2118,6 +2149,7 @@ if (icon_path != NULL) { XIconSize *icon_sizes; int count, i; + temp_im = imlib_load_image_with_error_return(filename, &im_err); if (temp_im == NULL) { print_error("Unable to load icon file \"%s\" -- %s\n", filename, imlib_strerror(im_err)); @@ -2126,8 +2158,7 @@ if (XGetIconSizes(Xdisplay, Xroot, &icon_sizes, &count)) { for (i = 0; i < count; i++) { D_PIXMAP(("Got icon sizes: Width %d to %d +/- %d, Height %d to %d +/- %d\n", icon_sizes[i].min_width, - icon_sizes[i].max_width, icon_sizes[i].width_inc, icon_sizes[i].min_height, icon_sizes[i].max_height, - icon_sizes[i].height_inc)); + icon_sizes[i].max_width, icon_sizes[i].width_inc, icon_sizes[i].min_height, icon_sizes[i].max_height, icon_sizes[i].height_inc)); if (icon_sizes[i].max_width > 64 || icon_sizes[i].max_height > 64) { continue; } =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/scream.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- scream.h 23 May 2002 18:14:41 -0000 1.5 +++ scream.h 3 Jun 2002 00:24:22 -0000 1.6 @@ -90,6 +90,7 @@ char *home; /* user's home dir. so we can find .screenrc */ char *sysrc; /* global screen config */ void *userdef; /* the term-app can store a pointer here */ + char *name; /* session name */ int fd; /* fd for communication */ char escape,literal; /* talking to screen: defaults to ^A, a */ int escdef; /* where was the escape sequence defined? */ @@ -131,13 +132,14 @@ int (*set_scroll_h)(void *,int); int (*redraw)(void *); int (*redraw_xywh)(void *,int,int,int,int); - int (*ins_disp)(void *,int,char *); + int (*expire_buttons)(void *,int); + int (*ins_disp)(void *,int,int,char *); int (*del_disp)(void *,int); int (*upd_disp)(void *,int,int,char *); int (*err_msg)(void *,int,char *); int (*execute)(void *,char **); int (*inp_text)(void *,int,char *); - int (*input_dialog)(void *,char *,int,char **,int (*)(void *,char *,size_t,size_t)); + int (*inp_dial)(void *,char *,int,char **,int (*)(void *,char *,size_t,size_t)); int (*inp_tab)(void *,char *[],int,char *,size_t,size_t); int (*waitstate)(void *,int); } _ns_efuns; @@ -162,18 +164,16 @@ _ns_efuns *ns_dst_efuns(_ns_efuns **); _ns_efuns *ns_get_efuns(_ns_sess *,_ns_disp *); -/* debug */ -void ns_desc_string(char *,char *); -void ns_desc_hop(_ns_hop *,char *); -void ns_desc_sess(_ns_sess *,char *); - -/* convenience */ -_ns_disp *disp_fetch_or_make(_ns_sess *,int); - /* transparent attach/detach */ _ns_sess *ns_attach_by_sess(_ns_sess **,int *); _ns_sess *ns_attach_by_URL(char *,char *,_ns_efuns **,int *,void *); +int ns_detach(_ns_sess **); +/* convenience */ +int ns_run(_ns_efuns *, char *); +int ns_get_ssh_port(void); +int disp_get_real_by_screen(_ns_sess *,int); +int disp_get_screen_by_real(_ns_sess *,int); /* send command to screen */ int ns_screen_command(_ns_sess *, char *); @@ -202,21 +202,25 @@ +/* backend abstraction */ /* things the term might ask screen/scream to do ***************************/ int ns_scroll2x(_ns_sess *,int); int ns_scroll2y(_ns_sess *,int); int ns_go2_disp(_ns_sess *,int); int ns_add_disp(_ns_sess *,int,char *); +int ns_mov_disp(_ns_sess * s,int,int); int ns_rsz_disp(_ns_sess *,int,int,int); int ns_rem_disp(_ns_sess *,int); int ns_ren_disp(_ns_sess *,int,char *); int ns_log_disp(_ns_sess *,int,char *); int ns_upd_stat(_ns_sess *); -int ns_input_dialog(_ns_sess *,char *,int,char **,int (*)(void *,char *,size_t,size_t)); +int ns_inp_dial(_ns_sess *,char *,int,char **,int (*)(void *,char *,size_t,size_t)); +char *ns_get_url(_ns_sess *,int); -/* register efuns (callbacks) **********************************************/ +/* frontend abstraction */ +/* things we might ask the terminal to do (register efuns (callbacks)) *****/ void ns_register_ssx(_ns_efuns *,int (*set_scroll_x)(void *,int)); void ns_register_ssy(_ns_efuns *,int (*set_scroll_y)(void *,int)); void ns_register_ssw(_ns_efuns *,int (*set_scroll_w)(void *,int)); @@ -224,8 +228,9 @@ void ns_register_red(_ns_efuns *,int (*redraw)(void *)); void ns_register_rda(_ns_efuns *,int (*redraw_xywh)(void *,int,int,int,int)); +void ns_register_exb(_ns_efuns *,int (*expire_buttons)(void *,int)); -void ns_register_ins(_ns_efuns *,int (*ins_disp)(void *,int,char *)); +void ns_register_ins(_ns_efuns *,int (*ins_disp)(void *,int,int,char *)); void ns_register_del(_ns_efuns *,int (*del_disp)(void *,int)); void ns_register_upd(_ns_efuns *,int (*upd_disp)(void *,int,int,char *)); @@ -238,20 +243,6 @@ void ns_register_tab(_ns_efuns *,int (*)(void *,char *[],int,char *,size_t,size_t)); void ns_register_fun(_ns_efuns *,int (*)(void *,int)); -/* from command.c */ -extern int set_scroll_x(void *, int); -extern int set_scroll_y(void *, int); -extern int set_scroll_w(void *, int); -extern int set_scroll_h(void *, int); -extern int redraw(void *); -extern int redraw_xywh(void *, int, int, int, int); -extern int ins_disp(void *, int, char *); -extern int del_disp(void *, int); -extern int upd_disp(void *, int, int, char *); -extern int err_msg(void *, int, char *); -extern int inp_text(void *, int, char *); -extern int input_dialog(void *, char *, int, char **, int (*) (void *, char *, size_t, size_t)); -extern int exe_prg(void *, char **); -extern int escreen_init(char **); + /***************************************************************************/ =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/screamcfg.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- screamcfg.h 22 May 2002 15:38:35 -0000 1.4 +++ screamcfg.h 3 Jun 2002 00:24:22 -0000 1.5 @@ -15,11 +15,8 @@ undef it, you're on your own. */ #define NS_PARANOID -/* define NS_DEBUG to get debug-info. no support for those who undef this. */ -#undef NS_DEBUG - -/* debug memory stuff. never actually used this. */ -#undef NS_DEBUG_MEM +/* compile in support for the GNU "screen" program as a backend */ +#define NS_HAVE_SCREEN 1 #define NS_MAXCMD 512 @@ -32,7 +29,7 @@ #define NS_SCREEN_OPTS "-xRR" #define NS_SCREEN_GREP "grep escape \"$SCREENRC\" 2>/dev/null || grep escape ~/.screenrc 2>/dev/null || grep escape \"$SYSSCREENRC\" 2>/dev/null || grep escape /etc/screenrc 2>/dev/null || grep escape /usr/local/etc/screenrc 2>/dev/null || echo \"escape ^Aa\"\n" #define NS_SCREEM_CALL "%s 2>/dev/null || %s" -#define NS_WRAP_CALL "export TERM=vt100; %s" +#define NS_WRAP_CALL "export TERM=vt100; screen -wipe; %s" #define NS_SCREEN_RC ".screenrc" /* this should never change. the escape-char for an out-of-the-box "screen". @@ -48,7 +45,9 @@ else is used in the session, libscream will convert it on the fly. */ /* DO NOT use \005Lw for your status, it breaks older screens!! */ #define NS_SCREEN_UPDATE "\x01w" -#define NS_SCREEN_INIT "\x0c\x01Z\x01:hardstatus lastline\r\x01:defhstatus \"\\005w\"\r\x01:hstatus \"\\005w\"\r\x01:msgminwait 0\r\x01:msgwait 1\r\x01:nethack off\r" NS_SCREEN_UPDATE +#define NS_SCREEN_VERSION "\x01v" +#define NS_SCREEN_SESSION "\x01:sessionname\r" +#define NS_SCREEN_INIT "\x01:msgminwait 0\r\x01:msgwait 1\r\x01:hardstatus lastline\r\x01:defhstatus \"\\005w\"\r\x01:hstatus \"\\005w\"\r\x01:nethack off\r\x0c" NS_SCREEN_UPDATE NS_SCREEN_VERSION NS_SCREEN_SESSION #define NS_SCREEN_PRVS_REG "\x01:focus up\r" #define NS_DFLT_SSH_PORT 22 @@ -59,14 +58,11 @@ #define NS_SCREEN_FLAGS "*-$!@L&Z" -#define NS_SCREEN_DK_CMD "unknown command '" -#define NS_SCREEN_VERSION "scre%s %d.%d.%d %s %s" +#define NS_SCREEN_DK_CMD_T "unknown command '" +#define NS_SCREEN_SESS_T "This session is named '" +#define NS_SCREEN_VERSION_T "scre%2s %d.%d.%d %16s %32s" #define NS_SCREEN_NO_DEBUG "Sorry, screen was compiled without -DDEBUG option." -/* if >0, force an update every NS_SCREEN_UPD_FREQ seconds. - a bit of a last resort. */ -#define NS_SCREEN_UPD_FREQ 0 - /* should be 1s */ #define NS_INIT_DELAY 1 @@ -79,7 +75,7 @@ #define NS_MENU_TITLE "Escreen" /* prefix for debug info */ -#define NS_PREFIX "libscream::" +#define NS_PREFIX "screamClient::" =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/screen.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -3 -r1.64 -r1.65 --- screen.c 23 May 2002 18:14:41 -0000 1.64 +++ screen.c 3 Jun 2002 00:24:22 -0000 1.65 @@ -3,7 +3,7 @@ * */ -static const char cvs_ident[] = "$Id: screen.c,v 1.64 2002/05/23 18:14:41 mej Exp $"; +static const char cvs_ident[] = "$Id: screen.c,v 1.65 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -41,6 +41,12 @@ #include "profile.h" #include "term.h" +#ifdef ESCREEN +# include "screamcfg.h" +#endif + +static int pb = 0; + /* These arrays store the text and rendering info that were last drawn to the screen. */ static text_t **drawn_text = NULL; static rend_t **drawn_rend = NULL; @@ -177,8 +183,7 @@ buf_rend = CALLOC(rend_t *, total_rows); drawn_rend = CALLOC(rend_t *, TermWin.nrow); swap.rend = CALLOC(rend_t *, TermWin.nrow); - D_SCREEN(("screen.text == %8p, screen.rend == %8p, swap.text == %8p, swap.rend == %8p\n", screen.text, screen.rend, swap.text, - swap.rend)); + D_SCREEN(("screen.text == %8p, screen.rend == %8p, swap.text == %8p, swap.rend == %8p\n", screen.text, screen.rend, swap.text, swap.rend)); for (i = 0; i < TermWin.nrow; i++) { j = i + TermWin.saveLines; @@ -221,8 +226,7 @@ buf_rend = REALLOC(buf_rend, total_rows * sizeof(rend_t *)); drawn_rend = REALLOC(drawn_rend, TermWin.nrow * sizeof(rend_t *)); swap.rend = REALLOC(swap.rend, TermWin.nrow * sizeof(rend_t *)); - D_SCREEN(("screen.text == %8p, screen.rend == %8p, swap.text == %8p, swap.rend == %8p\n", screen.text, screen.rend, swap.text, - swap.rend)); + D_SCREEN(("screen.text == %8p, screen.rend == %8p, swap.text == %8p, swap.rend == %8p\n", screen.text, screen.rend, swap.text, swap.rend)); /* we have fewer rows so fix up number of scrolled lines */ UPPER_BOUND(screen.row, TermWin.nrow - 1); @@ -238,8 +242,7 @@ buf_rend = REALLOC(buf_rend, total_rows * sizeof(rend_t *)); drawn_rend = REALLOC(drawn_rend, TermWin.nrow * sizeof(rend_t *)); swap.rend = REALLOC(swap.rend, TermWin.nrow * sizeof(rend_t *)); - D_SCREEN(("screen.text == %8p, screen.rend == %8p, swap.text == %8p, swap.rend == %8p\n", screen.text, screen.rend, swap.text, - swap.rend)); + D_SCREEN(("screen.text == %8p, screen.rend == %8p, swap.text == %8p, swap.rend == %8p\n", screen.text, screen.rend, swap.text, swap.rend)); k = MIN(TermWin.nscrolled, TermWin.nrow - prev_nrow); for (i = prev_total_rows; i < total_rows - k; i++) { @@ -724,13 +727,13 @@ c = str[i++]; #ifdef MULTI_CHARSET if ((encoding_method != LATIN1) && (chstat == WBYTE)) { - rstyle |= RS_multiMask; /* multibyte 2nd byte */ + rstyle |= RS_multiMask; /* multibyte 2nd byte */ chstat = SBYTE; if (encoding_method == EUCJ) { c |= 0x80; /* maybe overkill, but makes it selectable */ } } else if (chstat == SBYTE) { - if ((encoding_method != LATIN1) && (multi_byte || (c & 0x80))) { /* multibyte 1st byte */ + if ((encoding_method != LATIN1) && (multi_byte || (c & 0x80))) { /* multibyte 1st byte */ rstyle &= ~RS_multiMask; rstyle |= RS_multi1; chstat = WBYTE; @@ -756,8 +759,8 @@ screen.row++; row = screen.row + TermWin.saveLines; } - stp = screen.text[row]; /* _must_ refresh */ - srp = screen.rend[row]; /* _must_ refresh */ + stp = screen.text[row]; /* _must_ refresh */ + srp = screen.rend[row]; /* _must_ refresh */ continue; case '\r': LOWER_BOUND(stp[last_col], screen.col); @@ -785,8 +788,8 @@ screen.row++; row = screen.row + TermWin.saveLines; } - stp = screen.text[row]; /* _must_ refresh */ - srp = screen.rend[row]; /* _must_ refresh */ + stp = screen.text[row]; /* _must_ refresh */ + srp = screen.rend[row]; /* _must_ refresh */ screen.col = 0; screen.flags &= ~Screen_WrapNext; } @@ -820,7 +823,7 @@ #ifdef ESCREEN if (TermWin.screen_mode) { - if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */ + if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */ TermWin.screen_pending |= 1; } } @@ -908,7 +911,7 @@ screen.row += row; } } else { - if (screen.flags & Screen_Relative) { /* relative origin mode */ + if (screen.flags & Screen_Relative) { /* relative origin mode */ screen.row = row + screen.tscroll; UPPER_BOUND(screen.row, screen.bscroll); } else @@ -916,9 +919,9 @@ } #ifdef ESCREEN if (TermWin.screen_mode) { - if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */ + if (screen.row >= TermWin.nrow - 1) { /* last row -> upd-flag */ TermWin.screen_pending |= 1; - } else if (TermWin.screen_pending) { /* left last -> upd-finis */ + } else if (TermWin.screen_pending) { /* left last -> upd-finis */ TermWin.screen_pending |= 2; } } @@ -1048,7 +1051,7 @@ default: return; } - if (row >= 0 && row <= TermWin.nrow) { /* check OOB */ + if (row >= 0 && row <= TermWin.nrow) { /* check OOB */ UPPER_BOUND(num, (TermWin.nrow - row)); if (rstyle & RS_RVid || rstyle & RS_Uline) ren = -1; @@ -1477,8 +1480,7 @@ rect_end.row = Pixel2Row(y + height + TermWin.fheight - 1); BOUND(rect_end.row, 0, nr); - D_SCREEN(("scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)\n", x, y, width, height, rect_beg.col, rect_beg.row, - rect_end.col, rect_end.row)); + D_SCREEN(("scr_expose(x:%d, y:%d, w:%d, h:%d) area (c:%d,r:%d)-(c:%d,r:%d)\n", x, y, width, height, rect_beg.col, rect_beg.row, rect_end.col, rect_end.row)); for (i = rect_beg.row; i <= rect_end.row; i++) { MEMSET(&(drawn_text[i][rect_beg.col]), 0, rect_end.col - rect_beg.col + 1); @@ -1624,6 +1626,7 @@ int (*draw_string) (), (*draw_image_string) (); register int low_x = 99999, low_y = 99999, high_x = 0, high_y = 0; Drawable draw_buffer; + #ifndef NO_BOLDFONT int bfont = 0; /* we've changed font to bold font */ #endif @@ -1716,9 +1719,9 @@ /* compare new text with old - if exactly the same then continue */ rt1 = srp[col]; rt2 = drp[col]; - if ((stp[col] == dtp[col]) /* must match characters to skip */ - &&((rt1 == rt2) /* either rendition the same or */ - ||((stp[col] == ' ') /* space w/ no bg change */ + if ((stp[col] == dtp[col]) /* must match characters to skip */ + &&((rt1 == rt2) /* either rendition the same or */ + ||((stp[col] == ' ') /* space w/ no bg change */ &&(GET_BGATTR(rt1) == GET_BGATTR(rt2))))) { #ifdef MULTI_CHARSET /* if first byte is multibyte then compare second bytes */ @@ -1786,8 +1789,8 @@ /* XXX : maybe do the same thing for RS_multi2 */ /* corrupt character - you're outta there */ rend &= ~RS_multiMask; - drp[col] = rend; /* TODO check: may also want */ - dtp[col] = ' '; /* to poke into stp/srp */ + drp[col] = rend; /* TODO check: may also want */ + dtp[col] = ' '; /* to poke into stp/srp */ buffer[0] = ' '; } if (wbyte) { @@ -1829,10 +1832,10 @@ rvid = !rvid; if (rend & RS_Cursor) { if (focus) { - is_cursor = 2; /* normal cursor */ + is_cursor = 2; /* normal cursor */ rvid = !rvid; } else { - is_cursor = 1; /* outline cursor */ + is_cursor = 1; /* outline cursor */ rend &= ~RS_Cursor; } srp[col] &= ~RS_Cursor; @@ -2028,12 +2031,10 @@ gcmask |= (GCForeground | GCBackground); XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); if (font->ascent < ascent) { - XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, - Row2Pixel(row), Width2Pixel(len), ascent - font->ascent); + XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, Row2Pixel(row), Width2Pixel(len), ascent - font->ascent); } if (font->descent < descent) { - XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, - Row2Pixel(row) + ascent + font->descent, Width2Pixel(len), descent - font->descent); + XFillRectangle(Xdisplay, draw_buffer, TermWin.gc, xpixel, Row2Pixel(row) + ascent + font->descent, Width2Pixel(len), descent - font->descent); } SWAP_IT(gcvalue.foreground, gcvalue.background, ltmp); XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue); @@ -2099,22 +2100,18 @@ #endif } if (buffer_pixmap) { - D_SCREEN(("Update box dimensions: from (%d, %d) to (%d, %d). Dimensions %dx%d\n", low_x, low_y, high_x, high_y, - high_x - low_x + 1, high_y - low_y + 1)); + D_SCREEN(("Update box dimensions: from (%d, %d) to (%d, %d). Dimensions %dx%d\n", low_x, low_y, high_x, high_y, high_x - low_x + 1, high_y - low_y + 1)); XClearArea(Xdisplay, TermWin.vt, low_x, low_y, high_x - low_x + 1, high_y - low_y + 1, False); if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_BOTTOM_LEFT]) { - XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin.internalBorder - 1, 0, - 1, TermWin_TotalHeight() - 1, TermWin.internalBorder - 1, 0); + XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, TermWin.internalBorder - 1, 0); XClearArea(Xdisplay, TermWin.vt, TermWin.internalBorder - 1, 0, 1, TermWin_TotalHeight() - 1, False); } if (fshadow.shadow[SHADOW_TOP_RIGHT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT] || boldlast) { - XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin_TotalWidth() - 2, 0, - 1, TermWin_TotalHeight() - 1, TermWin_TotalWidth() - 2, 0); + XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, TermWin_TotalWidth() - 2, 0); XClearArea(Xdisplay, TermWin.vt, TermWin_TotalWidth() - 2, 0, 1, TermWin_TotalHeight() - 1, False); } if (fshadow.shadow[SHADOW_TOP_LEFT] || fshadow.shadow[SHADOW_TOP_RIGHT]) { - XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin.internalBorder - 1, - TermWin_TotalWidth() - 1, 1, 0, TermWin.internalBorder - 1); + XCopyArea(Xdisplay, pmap, buffer_pixmap, TermWin.gc, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, 0, TermWin.internalBorder - 1); XClearArea(Xdisplay, TermWin.vt, 0, TermWin.internalBorder - 1, TermWin_TotalWidth() - 1, 1, False); } if (fshadow.shadow[SHADOW_BOTTOM_LEFT] || fshadow.shadow[SHADOW_BOTTOM_RIGHT]) { @@ -2409,9 +2406,7 @@ return; } for (nread = 0, bytes_after = 1; bytes_after > 0;) { - if ((XGetWindowProperty - (Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, - &data) != Success) + if ((XGetWindowProperty(Xdisplay, win, prop, (nread / 4), PROP_SIZE, delete, AnyPropertyType, &actual_type, &actual_fmt, &nitems, &bytes_after, &data) != Success) || (actual_type == None) || (data == NULL)) { D_SELECT(("Unable to fetch the value of property %d from window 0x%08x\n", (int) prop, (int) win)); if (data != NULL) { @@ -2420,8 +2415,7 @@ return; } nread += nitems; - D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", - (int) actual_type, actual_fmt, nitems, data, bytes_after)); + D_SELECT(("Got selection info: Actual type %d (format %d), %lu items at 0x%08x, %lu bytes left over.\n", (int) actual_type, actual_fmt, nitems, data, bytes_after)); if (nitems == 0) { D_SELECT(("Retrieval of incremental selection complete.\n")); @@ -2850,7 +2844,7 @@ } if (!(Options & Opt_xterm_select)) { if (beg_col == col && beg_col > 0) { - if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */ + if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */ break; #ifdef MULTI_CHARSET srp = &(screen.rend[beg_row + row_offset][beg_col - 1]); @@ -2913,7 +2907,7 @@ } if (!(Options & Opt_xterm_select)) { if (end_col == col && end_col < last_col) { - if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */ + if (DELIMIT_TEXT(*stp)) /* space or tab or cutchar */ break; #ifdef MULTI_CHARSET srp = &(screen.rend[end_row + row_offset][end_col + 1]); @@ -3258,8 +3252,7 @@ target_list[0] = (Atom32) props[PROP_SELECTION_TARGETS]; target_list[1] = (Atom32) XA_STRING; XChangeProperty(Xdisplay, rq->requestor, rq->property, rq->target, - (8 * sizeof(target_list[0])), PropModeReplace, - (unsigned char *) target_list, (sizeof(target_list) / sizeof(target_list[0]))); + (8 * sizeof(target_list[0])), PropModeReplace, (unsigned char *) target_list, (sizeof(target_list) / sizeof(target_list[0]))); ev.xselection.property = rq->property; #if defined(MULTI_CHARSET) && defined(HAVE_X11_XMU_ATOMS_H) } else if (rq->target == XA_TEXT(Xdisplay) || rq->target == XA_COMPOUND_TEXT(Xdisplay)) { @@ -3271,8 +3264,7 @@ xtextp.nitems = 0; if (XmbTextListToTextProperty(Xdisplay, l, 1, XCompoundTextStyle, &xtextp) == Success) { if (xtextp.nitems > 0 && xtextp.value != NULL) { - XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace, xtextp.value, - xtextp.nitems); + XChangeProperty(Xdisplay, rq->requestor, rq->property, XA_COMPOUND_TEXT(Xdisplay), 8, PropModeReplace, xtextp.value, xtextp.nitems); ev.xselection.property = rq->property; } } @@ -3284,6 +3276,30 @@ XSendEvent(Xdisplay, rq->requestor, False, 0, &ev); } +void /* drag report as used by the "twin" program */ +mouse_drag_report(XButtonEvent * ev) +{ + int button_number, key_state, x = Pixel2Col(ev->x), y = Pixel2Row(ev->y); + + switch (ev->button) { + case AnyButton: /* Button release */ + button_number = pb + Button1; /* yeah, yeah */ + break; + case Button1: /* Button press */ + case Button2: + case Button3: + pb = button_number = ev->button - Button1; + break; + default: /* Wheel mouse */ + button_number = 64 + ev->button - Button3 - 1; + break; + } + key_state = ((ev->state & (ShiftMask | ControlMask)) + + ((ev->state & Mod1Mask) ? 2 : 0)); + tt_printf((unsigned char *) "\033[5M%c%c%c%c%c", + (32 + button_number + (key_state << 2)), (32 + (x & 0x7f) + 1), (32 + ((x >> 7) & 0x7f) + 1), (32 + (y & 0x7f) + 1), (32 + ((y >> 7) & 0x7f) + 1)); +} + void mouse_report(XButtonEvent * ev) { @@ -3296,7 +3312,7 @@ case Button1: /* Button press */ case Button2: case Button3: - button_number = ev->button - Button1; + pb = button_number = ev->button - Button1; break; default: /* Wheel mouse */ button_number = 64 + ev->button - Button3 - 1; @@ -3304,8 +3320,7 @@ } key_state = ((ev->state & (ShiftMask | ControlMask)) + ((ev->state & Mod1Mask) ? 2 : 0)); - tt_printf((unsigned char *) "\033[M%c%c%c", - (32 + button_number + (key_state << 2)), (32 + Pixel2Col(ev->x) + 1), (32 + Pixel2Row(ev->y) + 1)); + tt_printf((unsigned char *) "\033[M%c%c%c", (32 + button_number + (key_state << 2)), (32 + Pixel2Col(ev->x) + 1), (32 + Pixel2Row(ev->y) + 1)); } void @@ -3366,27 +3381,13 @@ #endif #ifdef ESCREEN +# ifdef NS_HAVE_SCREEN void parse_screen_status_if_necessary(void) { -#if 0 - static int hc = 0; -#endif - ns_parse_screen(TermWin.screen, (TermWin.screen_pending > 1), TermWin.ncol, screen.text[TermWin.nrow + TermWin.saveLines - 1]); if (TermWin.screen_pending > 1) TermWin.screen_pending = 0; -#if 0 - { - FILE *fh; - int c; - if ((fh = fopen("Escreen.log", "a"))) { - for (c = 0; c < 8; c++) - if (strcmp(drawn_text[c], drawn_text[c + 1])) - fprintf(fh, "%2d \"%s\"\n", c, drawn_text[c]); - fclose(fh); - } - } -#endif } +# endif #endif =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/screen.h,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- screen.h 22 May 2002 15:38:35 -0000 1.22 +++ screen.h 3 Jun 2002 00:24:22 -0000 1.23 @@ -302,6 +302,7 @@ extern void selection_rotate(int, int); extern void selection_send(XSelectionRequestEvent *); extern void mouse_report(XButtonEvent *); +extern void mouse_drag_report(XButtonEvent *); extern void mouse_tracking(int, int, int, int, int); extern void debug_colors(void); #ifdef MULTI_CHARSET =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/scrollbar.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- scrollbar.c 4 May 2002 14:25:29 -0000 1.39 +++ scrollbar.c 3 Jun 2002 00:24:22 -0000 1.40 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: scrollbar.c,v 1.39 2002/05/04 14:25:29 mej Exp $"; +static const char cvs_ident[] = "$Id: scrollbar.c,v 1.40 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -54,14 +54,16 @@ 0, 0, 0, 0 }; + #ifdef SCROLLBAR_BUTTON_CONTINUAL_SCROLLING short scroll_arrow_delay; #endif static GC gc_scrollbar; static short last_top = 0, last_bot = 0; + #ifdef XTERM_SCROLLBAR static GC gc_stipple, gc_border; -static unsigned char xterm_sb_bits[] = { 0xaa, 0x0a, 0x55, 0x05 }; /* 12x2 bitmap */ +static unsigned char xterm_sb_bits[] = { 0xaa, 0x0a, 0x55, 0x05 }; /* 12x2 bitmap */ #endif #if defined(MOTIF_SCROLLBAR) || defined(NEXT_SCROLLBAR) static GC gc_top, gc_bottom; @@ -216,8 +218,7 @@ #endif /* NO_SCROLLBAR_REPORT */ { D_EVENTS(("ButtonPress event for window 0x%08x at %d, %d\n", ev->xany.window, ev->xbutton.x, ev->xbutton.y)); - D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, - scrollbar.win)); + D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, scrollbar.win)); if (scrollbar_win_is_uparrow(ev->xany.window)) { scrollbar_draw_uparrow(IMAGE_STATE_CLICKED, 0); @@ -242,7 +243,7 @@ } switch (ev->xbutton.button) { case Button2: - button_state.mouse_offset = scrollbar_anchor_height() / 2; /* Align to center */ + button_state.mouse_offset = scrollbar_anchor_height() / 2; /* Align to center */ if (!scrollbar_win_is_anchor(ev->xany.window)) { scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height()); } else if (scrollbar.type == SCROLLBAR_XTERM) { @@ -332,8 +333,7 @@ return 1; D_EVENTS(("MotionNotify event for window 0x%08x\n", ev->xany.window)); - D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, - scrollbar.win)); + D_EVENTS((" up [0x%08x], down [0x%08x], anchor [0x%08x], trough [0x%08x]\n", scrollbar.up_win, scrollbar.dn_win, scrollbar.sa_win, scrollbar.win)); if ((scrollbar_win_is_trough(ev->xany.window) || scrollbar_win_is_anchor(ev->xany.window)) && scrollbar_is_moving()) { Window unused_root, unused_child; @@ -341,8 +341,7 @@ unsigned int unused_mask; while (XCheckTypedWindowEvent(Xdisplay, scrollbar.win, MotionNotify, ev)); - XQueryPointer(Xdisplay, scrollbar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), - &(ev->xbutton.y), &unused_mask); + XQueryPointer(Xdisplay, scrollbar.win, &unused_root, &unused_child, &unused_root_x, &unused_root_y, &(ev->xbutton.x), &(ev->xbutton.y), &unused_mask); scr_move_to(scrollbar_position(ev->xbutton.y) - button_state.mouse_offset, scrollbar_scrollarea_height()); refresh_count = refresh_limit = 0; scr_refresh(refresh_type); @@ -558,11 +557,9 @@ XSetForeground(Xdisplay, gc_top, get_top_shadow_color(images[image_sa].current->bg, "")); XSetForeground(Xdisplay, gc_bottom, get_bottom_shadow_color(images[image_sa].current->bg, "")); if (scrollbar_anchor_is_pressed()) { - draw_shadow(scrollbar.sa_win, gc_bottom, gc_top, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), - scrollbar_get_shadow()); + draw_shadow(scrollbar.sa_win, gc_bottom, gc_top, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow()); } else { - draw_shadow(scrollbar.sa_win, gc_top, gc_bottom, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), - scrollbar_get_shadow()); + draw_shadow(scrollbar.sa_win, gc_top, gc_bottom, 0, 0, scrollbar_anchor_width(), scrollbar_anchor_height(), scrollbar_get_shadow()); } } #endif @@ -603,8 +600,7 @@ UPPER_BOUND(th, scrollbar_anchor_height() >> 1); D_SCROLLBAR(("Thumb width/height has been calculated at %hux%hu.\n", tw, th)); if ((tw > 0) && (th > 0)) { - paste_simage(images[image_st].current, image_st, scrollbar.sa_win, pmap, - (scrollbar_anchor_width() - tw) >> 1, (scrollbar_anchor_height() - th) >> 1, tw, th); + paste_simage(images[image_st].current, image_st, scrollbar.sa_win, pmap, (scrollbar_anchor_width() - tw) >> 1, (scrollbar_anchor_height() - th) >> 1, tw, th); XSetWindowBackgroundPixmap(Xdisplay, scrollbar.sa_win, pmap); XClearWindow(Xdisplay, scrollbar.sa_win); IMLIB_FREE_PIXMAP(pmap); @@ -668,8 +664,7 @@ XFillRectangle(Xdisplay, scrollbar.win, gc_scrollbar, 0, 0, scrollbar_trough_width(), scrollbar_trough_height()); XSetForeground(Xdisplay, gc_top, get_top_shadow_color(images[image_sb].current->bg, "")); XSetForeground(Xdisplay, gc_bottom, get_bottom_shadow_color(images[image_sb].current->bg, "")); - draw_shadow(scrollbar.win, gc_bottom, gc_top, 0, 0, scrollbar_trough_width(), scrollbar_trough_height(), - scrollbar_get_shadow()); + draw_shadow(scrollbar.win, gc_bottom, gc_top, 0, 0, scrollbar_trough_width(), scrollbar_trough_height(), scrollbar_get_shadow()); } return; } @@ -693,8 +688,7 @@ Attributes.override_redirect = TRUE; Attributes.save_under = TRUE; cursor = XCreateFontCursor(Xdisplay, XC_left_ptr); - mask = ExposureMask | EnterWindowMask | LeaveWindowMask | ButtonPressMask | ButtonReleaseMask - | Button1MotionMask | Button2MotionMask | Button3MotionMask; + mask = ExposureMask | EnterWindowMask | LeaveWindowMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask; scrollbar_calc_size(width, height); scrollbar.anchor_top = scrollbar.scrollarea_start; scrollbar.anchor_bottom = scrollbar.scrollarea_end; @@ -725,8 +719,7 @@ /* The anchor window */ scrollbar.sa_win = XCreateWindow(Xdisplay, scrollbar.win, scrollbar_get_shadow(), scrollbar.anchor_top, scrollbar_anchor_width(), - scrollbar_anchor_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWColormap, - &Attributes); + scrollbar_anchor_height(), 0, Xdepth, InputOutput, CopyFromParent, CWOverrideRedirect | CWSaveUnder | CWColormap, &Attributes); XSelectInput(Xdisplay, scrollbar.sa_win, mask); XMapWindow(Xdisplay, scrollbar.sa_win); D_SCROLLBAR(("Created scrollbar anchor window 0x%08x\n", scrollbar.sa_win)); @@ -776,6 +769,11 @@ scrollbar_calc_size(int width, int height) { D_SCROLLBAR(("scrollbar_calc_size(%d, %d), type == %u\n", width, height, scrollbar_get_type())); +#ifdef ESCREEN + if (TermWin.screen && TermWin.screen->backend != NS_MODE_NONE) { + UPPER_BOUND(height, Height2Pixel(TermWin.nrow)); + } +#endif scrollbar.scrollarea_start = 0; scrollbar.scrollarea_end = height; scrollbar.up_arrow_loc = 0; @@ -800,8 +798,7 @@ scrollbar.height = height - (2 * scrollbar_get_shadow()); scrollbar.win_width = scrollbar.width + (2 * scrollbar_get_shadow()); scrollbar.win_height = height; - D_X11((" -> New scrollbar width/height == %hux%hu, win_width/height == %hux%hu\n", scrollbar.width, scrollbar.height, - scrollbar.win_width, scrollbar.win_height)); + D_X11((" -> New scrollbar width/height == %hux%hu, win_width/height == %hux%hu\n", scrollbar.width, scrollbar.height, scrollbar.win_width, scrollbar.win_height)); D_X11((" -> New scroll area start/end == %hu - %hu, up_arrow_loc == %hu, down_arrow_loc == %hu\n", scrollbar.scrollarea_start, scrollbar.scrollarea_end, scrollbar.up_arrow_loc, scrollbar.down_arrow_loc)); } @@ -816,8 +813,7 @@ D_SCROLLBAR(("scrollbar_resize(%d, %d)\n", width, height)); scrollbar_calc_size(width, height); D_SCROLLBAR((" -> XMoveResizeWindow(Xdisplay, 0x%08x, %d, y, %d, %d)\n", scrollbar.win, - ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), scrollbar_trough_width(), - scrollbar.win_height)); + ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), scrollbar_trough_width(), scrollbar.win_height)); XMoveResizeWindow(Xdisplay, scrollbar.win, ((Options & Opt_scrollbar_right) ? (width - scrollbar_trough_width()) : (0)), bbar_calc_docked_height(BBAR_DOCKED_TOP), scrollbar_trough_width(), scrollbar.win_height); scrollbar_draw_trough(IMAGE_STATE_CURRENT, MODE_MASK); =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/startup.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- startup.c 22 May 2002 15:38:35 -0000 1.31 +++ startup.c 3 Jun 2002 00:24:22 -0000 1.32 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: startup.c,v 1.31 2002/05/22 15:38:35 mej Exp $"; +static const char cvs_ident[] = "$Id: startup.c,v 1.32 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -76,7 +76,8 @@ int i; char *val; - static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ + static char windowid_string[20], *display_string, *term_string; /* "WINDOWID=\0" = 10 chars, UINT_MAX = 10 chars */ + orig_argv0 = argv[0]; /* Security enhancements -- mej */ @@ -156,8 +157,7 @@ sprintf(tmp, "ETERM_THEME_ROOT=%s", theme_dir); putenv(tmp); } - if ((user_dir = conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), - (PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) { + if ((user_dir = conf_parse_theme(&rs_theme, (rs_config_file ? rs_config_file : USER_CFG), (PARSE_TRY_USER_THEME | PARSE_TRY_NO_THEME))) != NULL) { char *tmp; D_OPTIONS(("conf_parse_theme() returned \"%s\"\n", user_dir)); @@ -172,7 +172,7 @@ len = strlen(initial_dir); if (rs_path) { - len += strlen(rs_path) + 1; /* +1 for the colon */ + len += strlen(rs_path) + 1; /* +1 for the colon */ } if (theme_dir) { len += strlen(theme_dir) + 1; @@ -204,15 +204,6 @@ p = p ? (p + 1) : orig_argv0; if (rs_url || !strncasecmp(ESCREEN_PREFIX, p, strlen(ESCREEN_PREFIX))) TermWin.screen_mode = NS_MODE_SCREEN; -# ifdef NS_DEBUG - if (!strncasecmp(ESCREEN_PREFIX, p, strlen(ESCREEN_PREFIX))) - fputs("You called me \"Escreen\"!\n", stderr); - else if (!strncasecmp(ETERM_PREFIX, p, strlen(ETERM_PREFIX))) - fputs("You called me \"Eterm\"!\n", stderr); - else - fputs("Stop calling me funky names!\n", stderr); - fprintf(stderr, "Escreen mode is %d (%d rows, URL is \"%s\")\n", TermWin.screen_mode, TermWin.nrow, rs_url); -# endif } #endif =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/system.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- system.c 4 May 2002 14:25:30 -0000 1.15 +++ system.c 3 Jun 2002 00:24:22 -0000 1.16 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: system.c,v 1.15 2002/05/04 14:25:30 mej Exp $"; +static const char cvs_ident[] = "$Id: system.c,v 1.16 2002/06/03 00:24:22 mej Exp $"; #include "../config.h" #include "feature.h" @@ -56,7 +56,7 @@ /* If the child that exited is the command we spawned, or if the child exited before fork() returned in the parent, it must be our immediate child that exited. We exit gracefully. */ - if ((pid == -1) && (errno == ECHILD)) { /* No children exist. Punt. */ + if ((pid == -1) && (errno == ECHILD)) { /* No children exist. Punt. */ errno = save_errno; break; } =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/term.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -3 -r1.81 -r1.82 --- term.c 13 May 2002 23:19:30 -0000 1.81 +++ term.c 3 Jun 2002 00:24:22 -0000 1.82 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: term.c,v 1.81 2002/05/13 23:19:30 mej Exp $"; +static const char cvs_ident[] = "$Id: term.c,v 1.82 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -58,7 +58,7 @@ unsigned long PrivateModes = PrivMode_Default; unsigned long SavedModes = PrivMode_Default; char *def_colorName[] = { - "rgb:aa/aa/aa", "rgb:0/0/0", /* fg/bg */ + "rgb:aa/aa/aa", "rgb:0/0/0", /* fg/bg */ "rgb:0/0/0", /* 0: black (#000000) */ #ifndef NO_BRIGHTCOLOR /* low-intensity colors */ @@ -200,6 +200,7 @@ static int numlock_state = 0; int ctrl, meta, shft, len; KeySym keysym; + #ifdef USE_XIM int valid_keysym = 0; static unsigned char short_buf[256]; @@ -244,15 +245,13 @@ } else { /* No XIM input context. Do it the normal way. */ len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(short_buf), &keysym, NULL); - D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", - len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len))); + D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len))); valid_keysym = 1; } #else /* USE_XIM */ /* Translate the key event into its corresponding string according to X. This also gets us a keysym. */ len = XLookupString(&ev->xkey, (char *) kbuf, sizeof(kbuf), &keysym, NULL); - D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", - len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len))); + D_TTY(("XLookupString() gave us len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len))); /* If there is no string and it's a Latin2-7 character, replace it with the Latin1 character instead. */ if (!len && (keysym >= 0x0100) && (keysym < 0x0900)) { @@ -262,6 +261,7 @@ #endif /* USE_XIM */ #ifdef ESCREEN +# ifdef NS_HAVE_SCREEN if (escreen_escape) { if (kbuf[0]) { escreen_escape = 0; @@ -273,6 +273,7 @@ escreen_escape = 1; LK_RET(); } +# endif #endif #ifdef USE_XIM @@ -338,31 +339,31 @@ shft = 0; } else if (!ctrl && !meta && (PrivateModes & PrivMode_ShiftKeys)) { switch (keysym) { - case XK_Prior: /* Shift-PgUp scrolls up a page */ + case XK_Prior: /* Shift-PgUp scrolls up a page */ if (TermWin.saveLines) { scr_page(UP, (TermWin.nrow - CONTEXT_LINES)); LK_RET(); } break; - case XK_Next: /* Shift-PgDn scrolls down a page */ + case XK_Next: /* Shift-PgDn scrolls down a page */ if (TermWin.saveLines) { scr_page(DN, (TermWin.nrow - CONTEXT_LINES)); LK_RET(); } break; - case XK_Insert: /* Shift-Ins pastes the current selection. */ + case XK_Insert: /* Shift-Ins pastes the current selection. */ selection_paste(XA_PRIMARY); LK_RET(); break; - case XK_KP_Add: /* Shift-Plus on the keypad increases the font size */ + case XK_KP_Add: /* Shift-Plus on the keypad increases the font size */ change_font(0, BIGGER_FONT); LK_RET(); break; - case XK_KP_Subtract: /* Shift-Minus on the keypad decreases the font size */ + case XK_KP_Subtract: /* Shift-Minus on the keypad decreases the font size */ change_font(0, SMALLER_FONT); LK_RET(); break; @@ -495,13 +496,13 @@ break; #ifdef XK_KP_Left - case XK_KP_Left: /* \033Ot or standard cursor key */ - case XK_KP_Up: /* \033Ox or standard cursor key */ - case XK_KP_Right: /* \033Ov or standard cursor key */ - case XK_KP_Down: /* \033Or or standard cursor key */ + case XK_KP_Left: /* \033Ot or standard cursor key */ + case XK_KP_Up: /* \033Ox or standard cursor key */ + case XK_KP_Right: /* \033Ov or standard cursor key */ + case XK_KP_Down: /* \033Or or standard cursor key */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { len = 3; - strcpy(kbuf, "\033OZ"); /* The Z is replaced by t, x, v, or r */ + strcpy(kbuf, "\033OZ"); /* The Z is replaced by t, x, v, or r */ kbuf[2] = ("txvr"[keysym - XK_KP_Left]); break; } else { @@ -509,16 +510,16 @@ } /* Continue on with the normal cursor keys... */ #endif - case XK_Left: /* "\033[D" */ + case XK_Left: /* "\033[D" */ case XK_Up: /* "\033[A" */ - case XK_Right: /* "\033[C" */ - case XK_Down: /* "\033[B" */ + case XK_Right: /* "\033[C" */ + case XK_Down: /* "\033[B" */ len = 3; strcpy(kbuf, "\033[@"); kbuf[2] = ("DACB"[keysym - XK_Left]); if (PrivateModes & PrivMode_aplCUR) { kbuf[1] = 'O'; - } else if (shft) { /* do Shift first */ + } else if (shft) { /* do Shift first */ kbuf[2] = ("dacb"[keysym - XK_Left]); } else if (ctrl) { kbuf[1] = 'O'; @@ -658,31 +659,31 @@ break; #endif /* XK_KP_Begin */ - case XK_KP_F1: /* "\033OP" */ - case XK_KP_F2: /* "\033OQ" */ - case XK_KP_F3: /* "\033OR" */ - case XK_KP_F4: /* "\033OS" */ + case XK_KP_F1: /* "\033OP" */ + case XK_KP_F2: /* "\033OQ" */ + case XK_KP_F3: /* "\033OR" */ + case XK_KP_F4: /* "\033OS" */ len = 3; strcpy(kbuf, "\033OP"); kbuf[2] += (keysym - XK_KP_F1); break; - case XK_KP_Multiply: /* "\033Oj" : "*" */ - case XK_KP_Add: /* "\033Ok" : "+" */ - case XK_KP_Separator: /* "\033Ol" : "," */ - case XK_KP_Subtract: /* "\033Om" : "-" */ - case XK_KP_Decimal: /* "\033On" : "." */ - case XK_KP_Divide: /* "\033Oo" : "/" */ - case XK_KP_0: /* "\033Op" : "0" */ - case XK_KP_1: /* "\033Oq" : "1" */ - case XK_KP_2: /* "\033Or" : "2" */ - case XK_KP_3: /* "\033Os" : "3" */ - case XK_KP_4: /* "\033Ot" : "4" */ - case XK_KP_5: /* "\033Ou" : "5" */ - case XK_KP_6: /* "\033Ov" : "6" */ - case XK_KP_7: /* "\033Ow" : "7" */ - case XK_KP_8: /* "\033Ox" : "8" */ - case XK_KP_9: /* "\033Oy" : "9" */ + case XK_KP_Multiply: /* "\033Oj" : "*" */ + case XK_KP_Add: /* "\033Ok" : "+" */ + case XK_KP_Separator: /* "\033Ol" : "," */ + case XK_KP_Subtract: /* "\033Om" : "-" */ + case XK_KP_Decimal: /* "\033On" : "." */ + case XK_KP_Divide: /* "\033Oo" : "/" */ + case XK_KP_0: /* "\033Op" : "0" */ + case XK_KP_1: /* "\033Oq" : "1" */ + case XK_KP_2: /* "\033Or" : "2" */ + case XK_KP_3: /* "\033Os" : "3" */ + case XK_KP_4: /* "\033Ot" : "4" */ + case XK_KP_5: /* "\033Ou" : "5" */ + case XK_KP_6: /* "\033Ov" : "6" */ + case XK_KP_7: /* "\033Ow" : "7" */ + case XK_KP_8: /* "\033Ox" : "8" */ + case XK_KP_9: /* "\033Oy" : "9" */ /* allow shift to override */ if ((PrivateModes & PrivMode_aplKP) ? !shft : shft) { len = 3; @@ -811,8 +812,7 @@ tt_write(&ch, 1); } - D_TTY(("After handling: len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", - len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len))); + D_TTY(("After handling: len %d, keysym \"%s\" (0x%04x), and buffer \"%s\"\n", len, XKeysymToString(keysym), keysym, safe_print_string(kbuf, len))); tt_write(kbuf, len); /* Send the resulting string to the child process */ LK_RET(); @@ -923,8 +923,8 @@ scr_add_lines((unsigned char *) "\n\r", 1, 2); break; case 'G': - if ((ch = cmd_getc()) == 'Q') { /* query graphics */ - tt_printf((unsigned char *) "\033G0\n"); /* no graphics */ + if ((ch = cmd_getc()) == 'Q') { /* query graphics */ + tt_printf((unsigned char *) "\033G0\n"); /* no graphics */ } else { do { ch = cmd_getc(); @@ -992,7 +992,7 @@ cmd_ungetc(); /* New escape sequence starting in the middle of one. Punt. */ return; } else if (ch < ' ') { - scr_add_lines(&ch, 0, 1); /* Insert verbatim non-printable character (NPC) */ + scr_add_lines(&ch, 0, 1); /* Insert verbatim non-printable character (NPC) */ return; } if (ch == '-') /* HACK: Ignore this sequence, but finish reading */ @@ -1093,7 +1093,7 @@ /* TODO: A different response should be sent depending on the value of priv and of arg[0], but what should those reponses be? */ #ifndef NO_VT100_ANS - tt_printf(VT100_ANS); + tt_printf((unsigned char *) VT100_ANS); #endif break; case 'd': /* Cursor to row n "\e[<n>d" */ @@ -1113,10 +1113,10 @@ case 'i': switch (arg[0]) { case 0: - scr_printscreen(0); /* Print screen "\e[0i" */ + scr_printscreen(0); /* Print screen "\e[0i" */ break; case 5: - process_print_pipe(); /* Start printing to print pipe "\e[5i" */ + process_print_pipe(); /* Start printing to print pipe "\e[5i" */ break; } break; @@ -1373,8 +1373,7 @@ BOUND(y, 1, scr->height / TermWin.fheight); BOUND(x, 1, scr->width / TermWin.fwidth); XResizeWindow(Xdisplay, TermWin.parent, - Width2Pixel(x) + 2 * TermWin.internalBorder + (scrollbar_is_visible()? scrollbar_trough_width() : 0), - Height2Pixel(y) + 2 * TermWin.internalBorder); + Width2Pixel(x) + 2 * TermWin.internalBorder + (scrollbar_is_visible()? scrollbar_trough_width() : 0), Height2Pixel(y) + 2 * TermWin.internalBorder); break; case 11: break; @@ -1385,8 +1384,7 @@ break; case 14: /* Store current width and height in x and y */ - XGetGeometry(Xdisplay, TermWin.parent, &dummy_child, &dummy_x, &dummy_y, (unsigned int *) (&x), (unsigned int *) (&y), - &dummy_border, &dummy_depth); + XGetGeometry(Xdisplay, TermWin.parent, &dummy_child, &dummy_x, &dummy_y, (unsigned int *) (&x), (unsigned int *) (&y), &dummy_border, &dummy_depth); snprintf(buff, sizeof(buff), "\033[4;%d;%dt", y, x); tt_write((unsigned char *) buff, strlen(buff)); break; @@ -1536,6 +1534,7 @@ case 1001: break; /* X11 mouse highlighting */ #endif + case 1010: /* Scroll to bottom on TTY output */ if (Options & Opt_home_on_output) Options &= ~Opt_home_on_output; @@ -1803,6 +1802,7 @@ char *nstr, *tnstr, *valptr; unsigned char eterm_seq_op; XWMHints *wm_hints; + #ifdef PIXMAP_SUPPORT unsigned char changed = 0, scaled = 0, which = 0; char *color, *mod, *orig_tnstr; @@ -1949,7 +1949,7 @@ free_desktop_pixmap(); } else if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) { LIBAST_X_FREE_PIXMAP(viewport_pixmap); - viewport_pixmap = None; /* Force the re-read */ + viewport_pixmap = None; /* Force the re-read */ } # endif changed = 1; @@ -1958,15 +1958,14 @@ if ((valptr = (char *) strsep(&tnstr, ";")) == NULL) { break; } - D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, - get_image_type(which), valptr)); + D_CMD(("Modifying the %s attribute of the %s color modifier of the %s image to be %s\n", mod, color, get_image_type(which), valptr)); changed = 1; # ifdef PIXMAP_OFFSET if (image_mode_is(which, MODE_TRANS) && (desktop_pixmap != None)) { free_desktop_pixmap(); } else if (image_mode_is(which, MODE_VIEWPORT) && (viewport_pixmap != None)) { LIBAST_X_FREE_PIXMAP(viewport_pixmap); - viewport_pixmap = None; /* Force the re-read */ + viewport_pixmap = None; /* Force the re-read */ } # endif if (!strcasecmp(color, "image")) { @@ -2307,8 +2306,7 @@ xev.message_type = props[PROP_DESKTOP]; xev.format = 32; xev.data.l[0] = rs_desktop; - XChangeProperty(Xdisplay, TermWin.parent, xev.message_type, XA_CARDINAL, 32, PropModeReplace, - (unsigned char *) &rs_desktop, 1); + XChangeProperty(Xdisplay, TermWin.parent, xev.message_type, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &rs_desktop, 1); XSendEvent(Xdisplay, Xroot, False, SubstructureNotifyMask, (XEvent *) & xev); } break; =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/timer.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- timer.c 4 May 2002 14:25:30 -0000 1.10 +++ timer.c 3 Jun 2002 00:24:22 -0000 1.11 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: timer.c,v 1.10 2002/05/04 14:25:30 mej Exp $"; +static const char cvs_ident[] = "$Id: timer.c,v 1.11 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -62,8 +62,7 @@ timer->handler = handler; timer->data = data; timer->next = NULL; - D_TIMER(("Added timer. Timer set to %lu/%lu with handler %8p and data %8p\n", timer->time.tv_sec, timer->time.tv_usec, timer->handler, - timer->data)); + D_TIMER(("Added timer. Timer set to %lu/%lu with handler %8p and data %8p\n", timer->time.tv_sec, timer->time.tv_usec, timer->handler, timer->data)); return ((timerhdl_t) timer); } =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/utmp.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- utmp.c 4 May 2002 14:25:30 -0000 1.14 +++ utmp.c 3 Jun 2002 00:24:22 -0000 1.15 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: utmp.c,v 1.14 2002/05/04 14:25:30 mej Exp $"; +static const char cvs_ident[] = "$Id: utmp.c,v 1.15 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -93,6 +93,7 @@ add_utmp_entry(const char *pty, const char *hostname, int fd) { struct passwd *pwent = getpwuid(my_ruid); + # ifdef HAVE_UTMPX_H struct utmpx utmp; struct utmp utmp2; @@ -109,12 +110,12 @@ if (!strncmp(pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3)) - strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ + strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ else { int n; if (sscanf(pty, "pts/%d", &n) == 1) - sprintf(ut_id, "vt%02x", n); /* sysv naming */ + sprintf(ut_id, "vt%02x", n); /* sysv naming */ else { print_error("can't parse tty name \"%s\"\n", pty); ut_id[0] = '\0'; /* entry not made */ @@ -340,7 +341,7 @@ if (!strncmp(pty, "/dev/", 5)) pty += 5; /* skip /dev/ prefix */ if (!strncmp(pty, "pty", 3) || !strncmp(pty, "tty", 3)) - strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ + strncpy(ut_id, (pty + 3), sizeof(ut_id)); /* bsd naming */ else { print_error("can't parse tty name \"%s\"\n", pty); ut_id[0] = '\0'; /* entry not made */ =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/src/windows.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -3 -r1.53 -r1.54 --- windows.c 4 May 2002 14:25:30 -0000 1.53 +++ windows.c 3 Jun 2002 00:24:22 -0000 1.54 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: windows.c,v 1.53 2002/05/04 14:25:30 mej Exp $"; +static const char cvs_ident[] = "$Id: windows.c,v 1.54 2002/06/03 00:24:22 mej Exp $"; #include "config.h" #include "feature.h" @@ -144,8 +144,7 @@ xcol.blue /= 2; if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, - xcol.green, xcol.blue); + print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, xcol.green, xcol.blue); xcol.pixel = PixColors[minColor]; } return (xcol.pixel); @@ -177,8 +176,7 @@ xcol.blue = MIN(white.blue, (xcol.blue * 7) / 5); if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, - xcol.green, xcol.blue); + print_error("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", type, xcol.pixel, xcol.red, xcol.green, xcol.blue); xcol.pixel = PixColors[WhiteColor]; } return (xcol.pixel); @@ -208,9 +206,7 @@ name = fallback; if (name) { if (!XParseColor(Xdisplay, cmap, name, &xcol)) { - print_warning - ("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n", - name); + print_warning("Unable to resolve \"%s\" as a color name. This should never fail. Please repair/restore your RGB database.\n", name); return ((Pixel) - 1); } } else { @@ -223,8 +219,7 @@ name = fallback; if (name) { if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel, xcol.red, - xcol.green, xcol.blue); + print_warning("Unable to allocate \"%s\" (0x%08x: 0x%04x, 0x%04x, 0x%04x) in the color map.\n", name, xcol.pixel, xcol.red, xcol.green, xcol.blue); return ((Pixel) - 1); } } else { @@ -249,12 +244,10 @@ } } if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel, - xcol.red, xcol.green, xcol.blue, fallback); + print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map. Falling back on 0x%08x.\n", xcol.pixel, xcol.red, xcol.green, xcol.blue, fallback); xcol.pixel = fallback; if (!XAllocColor(Xdisplay, cmap, &xcol)) { - print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red, xcol.green, - xcol.blue); + print_warning("Unable to allocate 0x%08x (0x%04x, 0x%04x, 0x%04x) in the color map.\n", xcol.pixel, xcol.red, xcol.green, xcol.blue); return ((Pixel) 0); } } @@ -299,7 +292,7 @@ break; #endif default: - pixel = PixColors[fgColor]; /* None */ + pixel = PixColors[fgColor]; /* None */ break; } } @@ -323,8 +316,7 @@ PixColors[unfocusedTopShadowColor] = get_top_shadow_color(images[image_sb].disabled->bg, "unfocusedTopShadowColor"); PixColors[menuBottomShadowColor] = get_bottom_shadow_color(images[image_menu].norm->bg, "menuBottomShadowColor"); - PixColors[unfocusedMenuBottomShadowColor] = - get_bottom_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuBottomShadowColor"); + PixColors[unfocusedMenuBottomShadowColor] = get_bottom_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuBottomShadowColor"); PixColors[menuTopShadowColor] = get_top_shadow_color(images[image_menu].norm->bg, "menuTopShadowColor"); PixColors[unfocusedMenuTopShadowColor] = get_top_shadow_color(images[image_menu].disabled->bg, "unfocusedMenuTopShadowColor"); } @@ -360,8 +352,7 @@ } Attributes.colormap = cmap; - szHint.base_width = - (2 * TermWin.internalBorder + ((Options & Opt_scrollbar) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0)); + szHint.base_width = (2 * TermWin.internalBorder + ((Options & Opt_scrollbar) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0)); szHint.base_height = (2 * TermWin.internalBorder) + bbar_calc_docked_height(BBAR_DOCKED); flags = (rs_geometry ? XParseGeometry(rs_geometry, &x, &y, &width, &height) : 0); @@ -401,8 +392,7 @@ Attributes.background_pixel = PixColors[bgColor]; Attributes.border_pixel = PixColors[bgColor]; D_X11(("Size Hints: x %d, y %d. Width/Height: Base %dx%d, Minimum %dx%d, Current %dx%d, Increment %dx%d\n", - szHint.x, szHint.y, szHint.base_width, szHint.base_height, szHint.min_width, szHint.min_height, - szHint.width, szHint.height, szHint.width_inc, szHint.height_inc)); + szHint.x, szHint.y, szHint.base_width, szHint.base_height, szHint.min_width, szHint.min_height, szHint.width, szHint.height, szHint.width_inc, szHint.height_inc)); TermWin.parent = XCreateWindow(Xdisplay, Xroot, szHint.x, szHint.y, szHint.width, szHint.height, 0, Xdepth, InputOutput, #ifdef PREFER_24BIT Xvisual, @@ -426,8 +416,7 @@ XSetWMProperties(Xdisplay, TermWin.parent, NULL, NULL, argv, argc, &szHint, &wmHint, &classHint); XSelectInput(Xdisplay, Xroot, PropertyChangeMask); - XSelectInput(Xdisplay, TermWin.parent, - (KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask | PropertyChangeMask)); + XSelectInput(Xdisplay, TermWin.parent, (KeyPressMask | FocusChangeMask | StructureNotifyMask | VisibilityChangeMask | PropertyChangeMask)); if (mwmhints.flags) { prop = XInternAtom(Xdisplay, "_MOTIF_WM_HINTS", False); XChangeProperty(Xdisplay, TermWin.parent, prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS); @@ -449,20 +438,17 @@ cursor = XCreateFontCursor(Xdisplay, XC_left_ptr); /* the vt window */ - TermWin.x = - (((Options & Opt_scrollbar) && !(Options & Opt_scrollbar_right)) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0); + TermWin.x = (((Options & Opt_scrollbar) && !(Options & Opt_scrollbar_right)) ? (scrollbar_get_width() + (2 * scrollbar_get_shadow())) : 0); TermWin.y = bbar_calc_docked_height(BBAR_DOCKED_TOP); - TermWin.vt = - XCreateWindow(Xdisplay, TermWin.parent, TermWin.x, TermWin.y, szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent, - CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWColormap, &Attributes); + TermWin.vt = XCreateWindow(Xdisplay, TermWin.parent, TermWin.x, TermWin.y, szHint.width, szHint.height, 0, Xdepth, InputOutput, CopyFromParent, + CWBackPixel | CWBorderPixel | CWOverrideRedirect | CWColormap, &Attributes); D_X11(("Created terminal window 0x%08x at %dx%d\n", TermWin.vt, TermWin.x, TermWin.y)); if (!(background_is_pixmap()) && !(Options & Opt_borderless)) { XSetWindowBackground(Xdisplay, TermWin.vt, PixColors[bgColor]); XClearWindow(Xdisplay, TermWin.vt); } XDefineCursor(Xdisplay, TermWin.vt, TermWin_cursor); - TermWin.mask = - (EnterWindowMask | LeaveWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button3MotionMask); + TermWin.mask = (EnterWindowMask | LeaveWindowMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask); XSelectInput(Xdisplay, TermWin.vt, TermWin.mask); /* If the user wants a specific desktop, tell the WM that */ @@ -562,15 +548,13 @@ szHint.width_inc = TermWin.fwidth; szHint.height_inc = TermWin.fheight; - D_X11(("Size Hints: base width/height == %lux%lu, width/height increment == %lux%lu\n", szHint.base_width, szHint.base_height, - szHint.width_inc, szHint.height_inc)); + D_X11(("Size Hints: base width/height == %lux%lu, width/height increment == %lux%lu\n", szHint.base_width, szHint.base_height, szHint.width_inc, szHint.height_inc)); szHint.min_width = szHint.base_width + szHint.width_inc; szHint.min_height = szHint.base_height + szHint.height_inc; szHint.width = szHint.base_width + TermWin.width; szHint.height = szHint.base_height + TermWin.height; - D_X11((" Minimum width/height == %lux%lu, width/height == %lux%lu\n", - szHint.min_width, szHint.min_height, szHint.width, szHint.height)); + D_X11((" Minimum width/height == %lux%lu, width/height == %lux%lu\n", szHint.min_width, szHint.min_height, szHint.width, szHint.height)); szHint.flags = PMinSize | PResizeInc | PBaseSize; XSetWMNormalHints(Xdisplay, TermWin.parent, &szHint); @@ -691,7 +675,7 @@ /* handle color aliases */ if (isdigit(*color)) { i = atoi(color); - if (i >= 8 && i <= 15) { /* bright colors */ + if (i >= 8 && i <= 15) { /* bright colors */ i -= 8; # ifndef NO_BRIGHTCOLOR PixColors[idx] = PixColors[minBright + i]; |
From: <enlightenment-cvs@li...> - 2002-06-03 00:24:52
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm Modified Files: ChangeLog reformat-code Log Message: Sun Jun 2 20:23:07 2002 Michael Jennings (mej) Latest Escreen patch along with twin support from Azundris. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/ChangeLog,v retrieving revision 1.291 retrieving revision 1.292 diff -u -3 -r1.291 -r1.292 --- ChangeLog 23 May 2002 18:14:39 -0000 1.291 +++ ChangeLog 3 Jun 2002 00:24:21 -0000 1.292 @@ -4679,3 +4679,7 @@ More cleanups and warning removals. ---------------------------------------------------------------------- +Sun Jun 2 20:23:07 2002 Michael Jennings (mej) + +Latest Escreen patch along with twin support from Azundris. +---------------------------------------------------------------------- =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/reformat-code,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- reformat-code 4 May 2002 14:25:26 -0000 1.3 +++ reformat-code 3 Jun 2002 00:24:21 -0000 1.4 @@ -1,10 +1,17 @@ #!/bin/sh +TYPENAMES="" + +for i in button_t buttonbar_t menu_t menuitem_t ; do + TYPENAMES="$TYPENAMES -T $i" +done + for i in *.c src/*.c utils/*.c ; do - if test -f $i; then - echo Reformatting $i - indent -bap -br -ce -ci4 -cli2 -cs -di1 -i4 -l140 -lp -lps -nbc -npcs -nss -nsob -psl $i - fi + if test -f $i; then + echo Reformatting $i + indent -bad -bap -bbo -br -brs -cdw -ce -ci4 -cli2 -cs -di1 -i4 -l180 \ + -lp -lps -nbc -nbfda -npcs -nprs -nsob -nss -nut -psl -saf -sai -saw $TYPENAMES $i + fi done perl -p -i.bak -e 's/(\w+)_t (\*+)\s+/$1_t $2/g;' */*.[ch] |
From: <enlightenment-cvs@li...> - 2002-06-03 00:24:52
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm/doc Modified Files: Eterm.1.in Log Message: Sun Jun 2 20:23:07 2002 Michael Jennings (mej) Latest Escreen patch along with twin support from Azundris. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/doc/Eterm.1.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- Eterm.1.in 13 May 2002 22:47:08 -0000 1.13 +++ Eterm.1.in 3 Jun 2002 00:24:21 -0000 1.14 @@ -618,9 +618,14 @@ .BI \-U " URL" ", \-\-url " URL Pick up a "screen" session at .I URL -rather than a local one. URLs look like so (screen://user@.../options), -with all parts optional, defaulting to current user at localhost, -respectively. Forces Escreen mode, overrides \-\-exec. +rather than a local (-U "") one. URLs look like so +(screen://user@...:port/screen_options), with all parts optional, +defaulting to "screen://current_user@...:22/-xRR";. Forces Escreen mode, +overrides \-\-exec. Note that only screen-options (see "man screen") are +allowed; do not pass a command (with or without arguments) here: to pass +a command to the screen-session, use +.I screen [<options>] <command> [<args>] +instead. .TP .BI \-Z " lclport:fw:fwport,delay" ", \-\-fw " lclport:fw:fwport,delay The URL given to \-U is in an intranet behind firewall |
From: <enlightenment-cvs@li...> - 2002-06-03 00:24:26
|
Enlightenment CVS committal Author : mej Project : eterm Module : Eterm Dir : eterm/Eterm/utils Modified Files: Esetroot.c Ettable.c Log Message: Sun Jun 2 20:23:07 2002 Michael Jennings (mej) Latest Escreen patch along with twin support from Azundris. =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/utils/Esetroot.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- Esetroot.c 4 May 2002 14:25:30 -0000 1.15 +++ Esetroot.c 3 Jun 2002 00:24:22 -0000 1.16 @@ -8,7 +8,7 @@ * */ -static const char cvs_ident[] = "$Id: Esetroot.c,v 1.15 2002/05/04 14:25:30 mej Exp $"; +static const char cvs_ident[] = "$Id: Esetroot.c,v 1.16 2002/06/03 00:24:22 mej Exp $"; #include "../config.h" @@ -55,8 +55,7 @@ if (prop_root != None && prop_esetroot != None) { XGetWindowProperty(Xdisplay, Xroot, prop_root, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data_root); if (type == XA_PIXMAP) { - XGetWindowProperty(Xdisplay, Xroot, prop_esetroot, 0L, 1L, False, AnyPropertyType, - &type, &format, &length, &after, &data_esetroot); + XGetWindowProperty(Xdisplay, Xroot, prop_esetroot, 0L, 1L, False, AnyPropertyType, &type, &format, &length, &after, &data_esetroot); if (data_root && data_esetroot) { if (debug) { fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): data_root == 0x%08x, data_esetroot == 0x%08x\n", __FILE__, @@ -64,8 +63,7 @@ } if (type == XA_PIXMAP && *((Pixmap *) data_root) == *((Pixmap *) data_esetroot)) { if (debug) { - fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): XKillClient() is being called.\n", __FILE__, __LINE__, - (unsigned int) p); + fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): XKillClient() is being called.\n", __FILE__, __LINE__, (unsigned int) p); } XKillClient(Xdisplay, *((Pixmap *) data_root)); } @@ -84,8 +82,7 @@ XChangeProperty(Xdisplay, Xroot, prop_root, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &p, 1); XChangeProperty(Xdisplay, Xroot, prop_esetroot, XA_PIXMAP, 32, PropModeReplace, (unsigned char *) &p, 1); if (debug) { - fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): _XROOTPMAP_ID and ESETROOT_PMAP_ID set to 0x%08x.\n", __FILE__, __LINE__, - (unsigned int) p, (unsigned int) p); + fprintf(stderr, "%s:%d: set_pixmap_property(0x%08x): _XROOTPMAP_ID and ESETROOT_PMAP_ID set to 0x%08x.\n", __FILE__, __LINE__, (unsigned int) p, (unsigned int) p); } XSetCloseDownMode(Xdisplay, RetainPermanent); XFlush(Xdisplay); @@ -147,15 +144,13 @@ if (debug) { fprintf(stderr, "%s:%d: Display name is \"%s\"\n", __FILE__, __LINE__, displayname ? displayname : "(nil)"); fprintf(stderr, "%s:%d: Background color name is \"%s\"\n", __FILE__, __LINE__, bgcolor ? bgcolor : "(nil)"); - fprintf(stderr, "%s:%d: Image will be %s\n", __FILE__, __LINE__, - scale ? "scaled" : (center ? "centered" : (fit ? "fit" : "tiled"))); + fprintf(stderr, "%s:%d: Image will be %s\n", __FILE__, __LINE__, scale ? "scaled" : (center ? "centered" : (fit ? "fit" : "tiled"))); fprintf(stderr, "%s:%d: Image file is %s\n", __FILE__, __LINE__, fname ? fname : "(nil)"); } if (!displayname) { displayname = getenv("DISPLAY"); if (debug) { - fprintf(stderr, "%s:%d: Display name set to %s via getenv(\"DISPLAY\")\n", __FILE__, __LINE__, - displayname ? displayname : "(nil)"); + fprintf(stderr, "%s:%d: Display name set to %s via getenv(\"DISPLAY\")\n", __FILE__, __LINE__, displayname ? displayname : "(nil)"); } } if (!displayname) { =================================================================== RCS file: /cvsroot/enlightenment/eterm/Eterm/utils/Ettable.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- Ettable.c 4 May 2002 14:25:30 -0000 1.5 +++ Ettable.c 3 Jun 2002 00:24:22 -0000 1.6 @@ -22,15 +22,15 @@ * */ -static const char cvs_ident[] = "$Id: Ettable.c,v 1.5 2002/05/04 14:25:30 mej Exp $"; +static const char cvs_ident[] = "$Id: Ettable.c,v 1.6 2002/06/03 00:24:22 mej Exp $"; #include <stdio.h> const char *lookup[] = { - "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */ - "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */ - "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */ - "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */ + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", /* 0-7 */ + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", /* 8-15 */ + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", /* 16-23 */ + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" /* 24-31 */ }; int |