1
1

* dialog.h (dlg_widget_active): New function - check if the

widget is active.
* boxes.c (display_callback): Use it.
* layout.c (swap_panels): Likewise.
* screen.c (do_panel_event): Likewise.
Этот коммит содержится в:
Pavel Roskin 2003-11-27 00:46:39 +00:00
родитель 73241613c2
Коммит 04b4194371
5 изменённых файлов: 24 добавлений и 10 удалений

Просмотреть файл

@ -1,5 +1,11 @@
2003-11-26 Pavel Roskin <proski@gnu.org>
* dialog.h (dlg_widget_active): New function - check if the
widget is active.
* boxes.c (display_callback): Use it.
* layout.c (swap_panels): Likewise.
* screen.c (do_panel_event): Likewise.
* dialog.c: Eliminate callback macro.
* dialog.c (dlg_replace_widget): Use dlg_select_widget().

Просмотреть файл

@ -88,7 +88,7 @@ display_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{
switch (msg) {
case DLG_UNFOCUS:
if ((WRadio *) h->current == my_radio) {
if (dlg_widget_active (my_radio)) {
assign_text (status, displays_status[my_radio->sel]);
input_set_point (status, 0);
}
@ -96,28 +96,27 @@ display_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
case DLG_KEY:
if (parm == '\n') {
if ((WRadio *) h->current == my_radio) {
if (dlg_widget_active (my_radio)) {
assign_text (status, displays_status[my_radio->sel]);
dlg_stop (h);
return MSG_HANDLED;
}
if ((WInput *) h->current == user) {
if (dlg_widget_active (user)) {
h->ret_value = B_USER + 6;
dlg_stop (h);
return MSG_HANDLED;
}
if ((WInput *) h->current == status) {
if (dlg_widget_active (status)) {
h->ret_value = B_USER + 7;
dlg_stop (h);
return MSG_HANDLED;
}
}
if (tolower (parm) == user_hotkey
&& h->current != (Widget *) user
&& h->current != (Widget *) status) {
if (tolower (parm) == user_hotkey && dlg_widget_active (user)
&& dlg_widget_active (status)) {
my_radio->sel = 3;
dlg_select_widget (h, my_radio); /* force redraw */
dlg_select_widget (h, user);

Просмотреть файл

@ -202,6 +202,14 @@ send_message (Widget *w, widget_msg_t msg, int parm)
return (*(w->callback)) (w, msg, parm);
}
/* Return 1 if the widget is active, 0 otherwise */
static inline int
dlg_widget_active (void *w)
{
Widget *w1 = (Widget *) w;
return (w1->parent->current == w1);
}
void dlg_replace_widget (Dlg_head *h, Widget *old, Widget *new);
int dlg_overlap (Widget *a, Widget *b);
void widget_erase (Widget *);

Просмотреть файл

@ -1037,9 +1037,10 @@ void swap_panels ()
current_panel = panel2;
else
current_panel = panel1;
if (midnight_dlg->current == panels[0].widget)
if (dlg_widget_active (panels[0].widget))
dlg_select_widget (midnight_dlg, (void *) panels [1].widget);
else if (midnight_dlg->current == panels[1].widget)
else if (dlg_widget_active (panels[1].widget))
dlg_select_widget (midnight_dlg, (void *) panels [0].widget);
} else {
WPanel *tmp_panel;

Просмотреть файл

@ -2309,7 +2309,7 @@ do_panel_event (Gpm_Event *event, WPanel *panel, int *redir)
event->y -= 2;
if ((event->type & (GPM_DOWN | GPM_DRAG))) {
if (&panel->widget != current_dlg->current)
if (!dlg_widget_active (panel))
change_panel ();
if (event->y <= 0) {