~raof/mir/prober-drm-device-probe

« back to all changes in this revision

Viewing changes to src/client/mir_surface.cpp

  • Committer: Daniel van Vugt
  • Date: 2013-04-24 05:22:20 UTC
  • mfrom: (628 trunk)
  • mto: This revision was merged to the branch mainline in revision 629.
  • Revision ID: daniel.van.vugt@canonical.com-20130424052220-qhpyhw2resxzr7bq
MergeĀ latestĀ lp:mir

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    for (int i = 0; i < mir_surface_attrib_arraysize_; i++)
60
60
        attrib_cache[i] = -1;
61
61
    attrib_cache[mir_surface_attrib_type] = mir_surface_type_normal;
 
62
    attrib_cache[mir_surface_attrib_state] = mir_surface_state_unknown;
62
63
}
63
64
 
64
65
MirSurface::~MirSurface()
176
177
    auto platform = connection->get_client_platform();
177
178
    accelerated_window = platform->create_egl_native_window(this);
178
179
 
 
180
    connection->on_surface_created(id(), this);
179
181
    callback(this, context);
180
182
    
181
183
    create_wait_handle.result_received();
261
263
        configure_result.surfaceid().value() == surface.id().value() &&
262
264
        configure_result.has_attrib())
263
265
    {
264
 
        switch (configure_result.attrib())
 
266
        int a = configure_result.attrib();
 
267
 
 
268
        switch (a)
265
269
        {
266
270
        case mir_surface_attrib_type:
 
271
        case mir_surface_attrib_state:
267
272
            if (configure_result.has_ivalue())
268
 
            {
269
 
                int t = configure_result.ivalue();
270
 
                attrib_cache[mir_surface_attrib_type] = t;
271
 
            } // else error is probably set due to an unsupported attrib/value
 
273
                attrib_cache[a] = configure_result.ivalue();
 
274
            else
 
275
                assert(configure_result.has_error());
272
276
            break;
273
277
        default:
274
278
            assert(false);
307
311
        }
308
312
    }
309
313
}
 
314
 
 
315
void MirSurface::handle_event(MirEvent const& e)
 
316
{
 
317
    if (e.type == mir_event_type_surface)
 
318
    {
 
319
        MirSurfaceAttrib a = e.surface.attrib;
 
320
        if (a < mir_surface_attrib_arraysize_)
 
321
            attrib_cache[a] = e.surface.value;
 
322
    }
 
323
 
 
324
    if (handle_event_callback)
 
325
        handle_event_callback(&e);
 
326
}