| /* KERNIX_ORIG.C - to test MB1 & Enter_Events */
#include "decw$include:dwtappl.h"
#define IMS_X11_REGISTER_ACTION(n, p, act) \
( (act).string = (String) (n), (act).proc = (XtActionProc) (p) )
unsigned int main (unsigned int argc, char *argv)
{
DRMType widget_class;
DRMHierarchy DRM_id;
Widget shell_widget;
Widget widget;
static char *file_name[]={"kernix_orig.uid"};
void Enter_event ();
void Leave_event ();
XtActionsRec actions[2];
DwtInitializeDRM ();
shell_widget = XtInitialize (
"KERNIX", /* Icon name */
"keRNIX", /* root class name */
NULL, /* options list */
0, /* number of options */
&argc, /* number of command pars*/
argv); /* command parameters */
DwtOpenHierarchy (
1, /* Number of UID files */
file_name, /* Array of file names */
0,
&DRM_id); /* Returned DRM handle */
IMS_X11_REGISTER_ACTION ("Enter_event", Enter_event, actions[0]);
IMS_X11_REGISTER_ACTION ("Leave_event", Leave_event, actions[1]);
XtAddActions (actions, (Cardinal) 2);
DwtFetchWidget
(DRM_id,
"KERNIX_APPLICATIONS_WINDOW",
shell_widget,
&widget,
&widget_class);
XtManageChild (widget);
XtRealizeWidget (shell_widget);
XtMainLoop ();
}
void Enter_event (Widget widget, XEvent *event)
{
printf ("Enter event\n");
}
void Leave_event (Widget widget, XEvent *event)
{
printf ("Leave event\n");
}
|
| /* KERNIX_ORIG.UIL - to test MB1 & Enter_Events... */
module kernix_ui
version = 'V1.0'
names = case_sensitive
include file 'DwtAppl.uil' ;
list !4
icon_menu_translations : !4
arguments !4
{ !4
translations = translation_table !4
( !4
'Shift<Enter> : Enter_event()', !10
'Shift<Leave> : Leave_event()' !10
); !4
}; !4
!4
list !4
other_translations : !4
arguments !4
{ !4
translations = translation_table !4
( !4
'Button1<Enter> : Enter_event()', !10
'Button1<Leave> : Leave_event()' !10
); !4
}; !4
!4
value
g1_yellow : color ('yellow', foreground); !10
g1_lightblue : color ('lightblue', background); !9
value
g1_icon_ct : color_table !10
( g1_yellow = 'o', !10
g1_lightblue = '.', !10
background color = ' ' ); !10
value
g1_icon_pixmap : icon (color_table = g1_icon_ct, !10
'oooooooooooooooooooooooooooooooo',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'o..............................o',
'oooooooooooooooooooooooooooooooo');
object KERNIX_APPLICATIONS_WINDOW : main_window
{
arguments
{
border_width = 0 ;
x = 100 ;
y = 200 ;
width = 0 ;
height = 0 ;
} ;
controls
{
scroll_window A0_APPLICATIONS_SCROLL_WINDOW ; !9
} ;
} ;
!--------------------------(SCROLL WINDOW)--------------------------------------
object A0_APPLICATIONS_SCROLL_WINDOW : scroll_window !9
{
arguments
{
border_width = 0 ;
width = 700 ;
height = 350 ;
} ;
controls
{
work_area_menu KERNIX_ICON;
work_area_menu KERNIX_OTHER_ICON;
};
} ;
object KERNIX_ICON : work_area_menu !10
{
arguments
{
x = 1;
y = 1;
border_width = 0;
spacing = 1;
arguments icon_menu_translations;
}; !9
controls
{
label icon_pixmap;
};
};
object KERNIX_OTHER_ICON : work_area_menu !10
{
arguments
{
x = 50;
y = 1;
border_width = 0;
spacing = 1;
arguments other_translations;
}; !9
controls
{
label icon_pixmap;
};
};
object icon_pixmap : label !10
{
arguments
{
label_label_type = DwtPixmap;
label_pixmap = g1_icon_pixmap; !10
};
};
end module;
|
| More information on this problem...
After some experiments, what seems to be really happenning is that
only the widget that saw the button1 down event ever sees the button1
down <enter> and <leave> events, until button1 is released. The
effect being that even though other widgets have the button1 down
<enter> and <leave> in their translation tables they do not see
the event if the pointer is moved with the button1 still depressed.
The problem that still remains is that the customer does want other
widgets, additional to the one that was the button1 down, to see
the later <enter>'s and <leaves>'s. My guess is that the initial
widget does something with grabbing the pointer and therefore is
the only one that see later events. If this is the case, can a
grab be associated with a group of widget, rather just one. If so,
how ?
|
| > My guess is that the initial
> widget does something with grabbing the pointer and therefore is
> the only one that see later events. If this is the case, can a
> grab be associated with a group of widget, rather just one. If so,
> how ?
Close, but the problem is that the SERVER initiates a grab by default
when the button is pressed (read a protocol or Xlib manual for
details...). If what you are looking for is to allow the button
to go down anywhere inside the work area menu, then you need to
catch button 1 down and call XUngrab"something-or-other"
(where I think "something-or-other" is "Pointer", but I don't
have a manual with me).
Leo
|