
Example B-2. The trigger_notice.c program (continued)
/*
* my_notify_proc() -- called when the user selects the "Move"
* panel button. Put up a notice_prompt to get new coordinates
* to move the main window.
*/
Xv_opaque
my_notify_proc(item, event)
Panel_item item;
Event *event;
{
int result, x, y;
Panel panel = (Panel)xv_get(item, PANEL_PARENT_PANEL);
Frame frame = (Frame)xv_get(panel, XV_OWNER);
x = event_x(event), y = event_y(event);
printf("original click relative to panel: %d, %d0, x, y);
result = notice_prompt(panel, event,
NOTICE_FOCUS_XY, x, y,
NOTICE_MESSAGE_STRINGS,
"You may move the window to a new location specified by",
"clicking the Left Mouse Button somewhere on the screen",
"or cancel this operation by selecting
NULL,
NOTICE_BUTTON_YES, "cancel",
NOTICE_TRIGGER, MS_LEFT,
NOTICE_NO_BEEPING, TRUE,
NULL);
if (result == NOTICE_TRIGGERED) {
x = event_x(event) + (int)xv_get(frame, XV_X);
y = event_y(event) + (int)xv_get(frame, XV_Y);
printf("screen x,y: %d, %d0, x, y);
xv_set(frame, XV_X, x, XV_Y, y, NULL);
}
}
When this program is run and the user selects the Move panel button, a notice is displayed
instructing the user to select a new position for the application window. When the user
selects a new location, the window frame moves to that position. Note that the window man-
ager adds a title bar and other decorations around the frame; do not expect the upper-left cor-
ner of the frame to move to the