button-test: Use wl_display_roundtrip instead of yield()
[profile/ivi/weston.git] / clients / flower.c
index 7a34616..dac52d5 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <fcntl.h>
-#include <unistd.h>
 #include <math.h>
 #include <time.h>
 #include <cairo.h>
 #include <sys/time.h>
-#include <glib.h>
 
 #include <linux/input.h>
 #include <wayland-client.h>
@@ -134,29 +131,30 @@ redraw_handler(struct widget *widget, void *data)
 
 static int
 motion_handler(struct widget *widget, struct input *input,
-              uint32_t time, int32_t x, int32_t y, void *data)
+              uint32_t time, float x, float y, void *data)
 {
-       return POINTER_HAND1;
+       return CURSOR_HAND1;
 }
 
 static void
 button_handler(struct widget *widget,
               struct input *input, uint32_t time,
-              int button, int state, void *data)
+              uint32_t button, enum wl_pointer_button_state state, void *data)
 {
        struct flower *flower = data;
 
        switch (button) {
        case BTN_LEFT:
-               if (state)
-                       window_move(flower->window, input, time);
+               if (state == WL_POINTER_BUTTON_STATE_PRESSED)
+                       window_move(flower->window, input,
+                                   display_get_serial(flower->display));
                break;
        case BTN_MIDDLE:
-               if (state)
+               if (state == WL_POINTER_BUTTON_STATE_PRESSED)
                        widget_schedule_redraw(widget);
                break;
        case BTN_RIGHT:
-               if (state)
+               if (state == WL_POINTER_BUTTON_STATE_PRESSED)
                        window_show_frame_menu(flower->window, input, time);
                break;
        }
@@ -182,6 +180,7 @@ int main(int argc, char *argv[])
        flower.display = d;
        flower.window = window_create(d);
        flower.widget = window_add_widget(flower.window, &flower);
+       window_set_title(flower.window, "Flower");
 
        widget_set_resize_handler(flower.widget, resize_handler);
        widget_set_redraw_handler(flower.widget, redraw_handler);