Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!mcsun!hp4nl!tnosoes!joep From: joep@tnosoes.izf.tno.nl (Joep Mathijssen) Newsgroups: comp.windows.open-look Subject: Bug in WIN_BACKGROUND_COLOR for Textsw ? Message-ID: <1574@tnosoes.izf.tno.nl> Date: 29 May 91 12:34:19 GMT Article-I.D.: tnosoes.1574 Organization: TNO Institute for Perception, Soesterberg, The Netherlands Lines: 95 Hi, Below is a small (?!) C-program to demonstrate a problem I'm having. When you press a LEFT or RIGHT shiftbutton, the background colors from the two textsw are set. This works fine as long as you do not type text into the windows. When you do and then change the colors the margin before the text gets the wrong color (color[0]). Is this a bug or a feature? Joep =============================================================================== Joep Mathijssen TNO Institute for Perception Phone : +31 34 63 562 11 P.O. Box 23 Fax : +31 34 63 539 77 3769 ZG Soesterberg E-mail: uunet!hp4nl.nluug.nl!tnosoes!joep The Netherlands or: joep@izf.tno.nl =============================================================================== ---------------------------------------------------------------------- #include #include #include #include #include typedef struct { Frame BaseWindow; Textsw Text1, Text2; } BaseFrame; BaseFrame basefrm; Notify_value swap(win, e, a, t) Xv_window win; Event *e; Notify_arg a; Notify_event_type t; { if (event_action(e) == SHIFT_LEFT) { xv_set( basefrm.Text1, WIN_BACKGROUND_COLOR, CMS_CONTROL_COLORS, NULL); xv_set( basefrm.Text2, WIN_BACKGROUND_COLOR, CMS_CONTROL_COLORS+1,NULL); } if (event_action(e) == SHIFT_RIGHT) { xv_set( basefrm.Text1, WIN_BACKGROUND_COLOR, CMS_CONTROL_COLORS+1,NULL); xv_set( basefrm.Text2, WIN_BACKGROUND_COLOR, CMS_CONTROL_COLORS, NULL); } return notify_next_event_func(win, (Notify_event)e, a, t); } main() { Cms cms; struct itimerval timer; static Xv_singlecolor colors[] = { 225, 141, 204, 125, 241, 104, 0, 0, 0, 0, 0, 0 }; cms = (Cms)xv_create(NULL, CMS, CMS_NAME, "palette", CMS_TYPE, XV_STATIC_CMS, CMS_CONTROL_CMS,TRUE, CMS_SIZE, CMS_CONTROL_COLORS + 4, CMS_COLORS, colors, NULL); basefrm.BaseWindow = xv_create(NULL, FRAME, FRAME_LABEL, "Press LEFT/RIGHT-SHIFT to swap colors!", NULL); basefrm.Text1 = xv_create(basefrm.BaseWindow, TEXTSW, WIN_HEIGHT, 75, WIN_CMS, cms, NULL); basefrm.Text2 = xv_create(basefrm.BaseWindow, TEXTSW, WIN_HEIGHT, 75, WIN_CMS, cms, NULL); window_fit(basefrm.BaseWindow); notify_interpose_event_func(textsw_first(basefrm.Text1), (Notify_func) swap, NOTIFY_SAFE); notify_interpose_event_func(textsw_first(basefrm.Text2), (Notify_func) swap, NOTIFY_SAFE); xv_main_loop(basefrm.BaseWindow); exit(0); }