/usr/share/doc/xviewg/examples/misc/fullscreen.c is in xview-examples 3.2p1.4-28.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | /*
* fullscreen.c
* Demonstrate the fullscreen package. Create a panel button that
* creates a fullscreen instance, thus grabbing the X server. User
* presses a mouse button to release the server.
*/
#include <xview/xview.h>
#include <xview/panel.h>
#include <xview/fullscreen.h>
main(argc, argv)
char *argv[];
{
Frame frame;
Panel panel;
void exit(), grab();
xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL);
frame = (Frame)xv_create(XV_NULL, FRAME, NULL);
panel = (Panel)xv_create(frame, PANEL, NULL);
(void) xv_create(panel, PANEL_BUTTON,
PANEL_LABEL_STRING, "Quit",
PANEL_NOTIFY_PROC, exit,
NULL);
(void) xv_create(panel, PANEL_BUTTON,
PANEL_LABEL_STRING, "Fullscreen",
PANEL_NOTIFY_PROC, grab,
NULL);
window_fit(panel);
window_fit(frame);
xv_main_loop(frame);
}
/*
* Notify procedure for when the "Fullscreen" button is pushed.
* Create a fullscreen instance, scan for a button event, then
* destroy it.
*/
void
grab(item, event)
Panel_item item;
Event *event;
{
Panel panel = (Panel)xv_get(item, PANEL_PARENT_PANEL);
Frame frame = (Frame)xv_get(panel, XV_OWNER);
Fullscreen fs;
Inputmask im;
/* set up an input mask for the call to xv_input_readevent(). */
win_setinputcodebit(&im, MS_LEFT);
win_setinputcodebit(&im, MS_MIDDLE);
win_setinputcodebit(&im, MS_RIGHT);
win_setinputcodebit(&im, LOC_MOVE);
/*
* Create a fullscreen object (initialize X server grab).
* Specify which events should be allowed to pass through.
* These events should match the input mask coded above.
*/
fs = xv_create(panel, FULLSCREEN,
WIN_CONSUME_EVENTS,
WIN_MOUSE_BUTTONS, LOC_MOVE, NULL,
NULL);
/* Loop till user generates a button event */
while (xv_input_readevent(panel, event, TRUE, TRUE, &im) != -1)
if (event_is_button(event))
break;
/* Destroy the fullscreen (release the X server grab) */
xv_destroy(fs);
/* Report which button was pushed. */
printf("event was button %d (%d, %d)\n",
event_id(event) - BUT_FIRST+1,
event_x(event) + (int)xv_get(frame, XV_X),
event_y(event) + (int)xv_get(frame, XV_Y));
}
|