~brandontschaefer/mir/deprecate-set-event-handler

« back to all changes in this revision

Viewing changes to examples/tooltip.c

* Merge parent, fix conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
    mir_eglapp_swap_buffers();
51
51
 
52
52
    MirConnection* const connection = mir_eglapp_native_connection();
53
 
    MirSurface* const parent = mir_eglapp_native_surface();
 
53
    MirWindow* const parent = mir_eglapp_native_window();
54
54
 
55
 
    MirSurfaceSpec* const spec = mir_connection_create_spec_for_changes(connection);
56
 
    mir_surface_spec_set_name(spec, "tooltip example");
57
 
    mir_surface_spec_set_min_width(spec, width/2);
58
 
    mir_surface_spec_set_max_width(spec, width*2);
59
 
    mir_surface_spec_set_min_height(spec, height/2);
60
 
    mir_surface_spec_set_max_height(spec, height*2);
61
 
    mir_surface_apply_spec(parent, spec);
62
 
    mir_surface_spec_release(spec);
 
55
    MirWindowSpec* const spec = mir_create_window_spec(connection);
 
56
    mir_window_spec_set_name(spec, "tooltip example");
 
57
    mir_window_spec_set_min_width(spec, width/2);
 
58
    mir_window_spec_set_max_width(spec, width*2);
 
59
    mir_window_spec_set_min_height(spec, height/2);
 
60
    mir_window_spec_set_max_height(spec, height*2);
 
61
    mir_window_apply_spec(parent, spec);
 
62
    mir_window_spec_release(spec);
63
63
 
64
64
    MirSurface* tooltip = create_tooltip(connection, parent, select_pixel_format(connection));
65
65
    while (mir_eglapp_running())
66
66
    {
67
67
    }
68
68
 
69
 
    mir_surface_release_sync(tooltip);
 
69
    mir_window_release_sync(tooltip);
70
70
    mir_eglapp_cleanup();
71
71
 
72
72
    return 0;
102
102
    MirRectangle zone = { 0, 0, 10, 10 };
103
103
    int const width = 50;
104
104
    int const height = 20;
105
 
    MirSurfaceSpec* const spec = mir_connection_create_spec_for_tip(
106
 
        connection, width, height, format, parent, &zone, mir_edge_attachment_vertical);
107
 
 
108
 
    mir_surface_spec_set_buffer_usage(spec, mir_buffer_usage_software);
109
 
    mir_surface_spec_set_name(spec, "tooltip");
110
 
    mir_surface_spec_set_min_width(spec, width);
111
 
    mir_surface_spec_set_max_width(spec, width);
112
 
    mir_surface_spec_set_min_height(spec, height);
113
 
    mir_surface_spec_set_max_height(spec, height);
114
 
 
115
 
    MirSurface* tooltip = mir_surface_create_sync(spec);
116
 
    mir_surface_spec_release(spec);
117
 
 
118
 
    MirBufferStream* const bs = mir_surface_get_buffer_stream(tooltip);
 
105
    MirWindowSpec* const spec = mir_create_tip_window_spec(
 
106
        connection, width, height, parent, &zone, mir_edge_attachment_vertical);
 
107
    mir_window_spec_set_pixel_format(spec, format);
 
108
 
 
109
    mir_window_spec_set_buffer_usage(spec, mir_buffer_usage_software);
 
110
    mir_window_spec_set_name(spec, "tooltip");
 
111
    mir_window_spec_set_min_width(spec, width);
 
112
    mir_window_spec_set_max_width(spec, width);
 
113
    mir_window_spec_set_min_height(spec, height);
 
114
    mir_window_spec_set_max_height(spec, height);
 
115
 
 
116
    MirSurface* tooltip = mir_window_create_sync(spec);
 
117
    mir_window_spec_release(spec);
 
118
 
 
119
    MirBufferStream* const bs = mir_window_get_buffer_stream(tooltip);
119
120
    MirGraphicsRegion buffer;
120
121
    mir_buffer_stream_get_graphics_region(bs, &buffer);
121
122