Many minor usability improvements to various demos

This commit is contained in:
Kevin Lange 2016-12-05 21:48:38 +09:00
parent eb3a068938
commit 32f8d3b0f3
5 changed files with 31 additions and 2 deletions

View File

@ -119,6 +119,7 @@ int main (int argc, char ** argv) {
yutani_window_move(yctx, window, left, top);
w_ctx = init_graphics_yutani_double_buffer(window);
yutani_window_update_shape(yctx, window, YUTANI_SHAPE_THRESHOLD_CLEAR);
yutani_window_advertise_icon(yctx, window, "Clock", "clock");
while (!should_exit) {
yutani_msg_t * m = yutani_poll_async(yctx);
@ -133,6 +134,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:
should_exit = 1;
goto done;
@ -149,7 +158,7 @@ int main (int argc, char ** argv) {
last = now.tv_sec;
draw(last);
}
usleep(10000);
usleep(100);
}
done:

View File

@ -50,6 +50,7 @@ int main (int argc, char ** argv) {
yctx = yutani_init();
wina = yutani_window_create(yctx, width, height);
yutani_window_move(yctx, wina, left, top);
yutani_window_advertise_icon(yctx, wina, "drawlines", "drawlines");
ctx = init_graphics_yutani(wina);
draw_fill(ctx, rgb(0,0,0));
@ -70,6 +71,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:
should_exit = 1;
break;

View File

@ -259,7 +259,7 @@ int main(int argc, char ** argv) {
yctx = yutani_init();
window = yutani_window_create(yctx, 2 * WINDOW_SIZE, 2 * WINDOW_SIZE);
yutani_window_move(yctx, window, 10, 10);
yutani_window_move(yctx, window, 100, 100);
ctx = init_graphics_yutani_double_buffer(window);
draw_fill(ctx,rgb(0,0,0));
flip(ctx);

View File

@ -187,6 +187,7 @@ int main(int argc, char * argv[]) {
draw_fill(ctx, rgba(0,0,0,0));
flip(ctx);
yutani_flip(yctx, window);
yutani_window_advertise_icon(yctx, window, "Cairo Snow Demo", "snow");
snowflakes = list_create();
for (int i = 0; i < 100; ++i) {

View File

@ -24,6 +24,8 @@ int main(int argc, char * argv[]) {
ctx = init_graphics_yutani(window);
draw_fill(ctx, rgba(0,0,0,255));
yutani_window_advertise_icon(yctx, window, "pixman Demo", "pixman-demo");
pixman_image_t *checkerboard;
pixman_image_t *destination;
#define D2F(d) (pixman_double_to_fixed(d))
@ -99,6 +101,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: