Make teapot and cairo demos better WM citizens
This commit is contained in:
parent
57ea175f97
commit
6e27dee830
@ -58,6 +58,8 @@ int main(int argc, char * argv[]) {
|
||||
ctx = init_graphics_yutani(window);
|
||||
draw_fill(ctx, rgba(0,0,0,127));
|
||||
|
||||
yutani_window_advertise_icon(yctx, window, "Cairo Demo", "cairo-demo");
|
||||
|
||||
render();
|
||||
|
||||
while (1) {
|
||||
@ -73,6 +75,14 @@ int main(int argc, char * argv[]) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case YUTANI_MSG_WINDOW_MOUSE_EVENT:
|
||||
{
|
||||
struct yutani_msg_window_mouse_event * me = (void*)m->data;
|
||||
if (me->command == YUTANI_MOUSE_EVENT_DOWN && me->buttons & YUTANI_MOUSE_BUTTON_LEFT) {
|
||||
yutani_window_drag_start(yctx, window);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case YUTANI_MSG_SESSION_END:
|
||||
goto done;
|
||||
default:
|
||||
|
@ -492,6 +492,8 @@ int main(int argc, char** argv) {
|
||||
draw_fill(ctx, rgb(0,0,0));
|
||||
yutani_window_update_shape(yctx, wina, YUTANI_SHAPE_THRESHOLD_HALF);
|
||||
|
||||
yutani_window_advertise_icon(yctx, wina, "GL Teapot", "teapot");
|
||||
|
||||
OSMesaContext gl_ctx = OSMesaCreateContext(OSMESA_BGRA, NULL);
|
||||
if (resize(ctx, gl_ctx)) {
|
||||
fprintf(stderr, "%s: Something bad happened.\n", argv[0]);
|
||||
@ -517,6 +519,14 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case YUTANI_MSG_WINDOW_MOUSE_EVENT:
|
||||
{
|
||||
struct yutani_msg_window_mouse_event * me = (void*)m->data;
|
||||
if (me->command == YUTANI_MOUSE_EVENT_DOWN && me->buttons & YUTANI_MOUSE_BUTTON_LEFT) {
|
||||
yutani_window_drag_start(yctx, wina);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case YUTANI_MSG_SESSION_END:
|
||||
quit = 1;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user