~alan-griffiths/mir/knee-jerk-mir_surface_state_automatic

« back to all changes in this revision

Viewing changes to src/client/android/mir_native_window.cpp

  • Committer: Kevin DuBois
  • Date: 2012-11-13 01:36:29 UTC
  • mfrom: (245 trunk)
  • mto: This revision was merged to the branch mainline in revision 246.
  • Revision ID: kevin.dubois@canonical.com-20121113013629-q4496w4mp5e33auk
merge in base branch. move the demo clients to a new directory, examples/

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include "mir_client/client_buffer.h"
21
21
#include "mir/thread/all.h"
22
22
namespace mcl=mir::client;
 
23
namespace mcla=mir::client::android;
23
24
 
24
25
namespace
25
26
{
41
42
 
42
43
int query_static(const ANativeWindow* anw, int key, int* value)
43
44
{
44
 
    auto self = static_cast<const mcl::MirNativeWindow*>(anw);
 
45
    auto self = static_cast<const mcla::MirNativeWindow*>(anw);
45
46
    return self->query(key, value);
46
47
47
48
 
49
50
{
50
51
    va_list args;
51
52
    va_start(args, key);
52
 
    auto self = static_cast<const mcl::MirNativeWindow*>(window);
 
53
    auto self = static_cast<mcla::MirNativeWindow*>(window);
53
54
    auto ret = self->perform(key, args);
54
55
    va_end(args);
55
56
 
59
60
int dequeueBuffer_static (struct ANativeWindow* window,
60
61
                          struct ANativeWindowBuffer** buffer)
61
62
{   
62
 
    auto self = static_cast<const mcl::MirNativeWindow*>(window);
 
63
    auto self = static_cast<mcla::MirNativeWindow*>(window);
63
64
    return self->dequeueBuffer(buffer);
64
65
}
65
66
 
66
67
int queueBuffer_static(struct ANativeWindow* window,
67
68
                       struct ANativeWindowBuffer* buffer)
68
69
{
69
 
    auto self = static_cast<const mcl::MirNativeWindow*>(window);
 
70
    auto self = static_cast<mcla::MirNativeWindow*>(window);
70
71
    return self->queueBuffer(buffer);
71
72
}
72
73
 
90
91
 
91
92
}
92
93
 
93
 
mcl::MirNativeWindow::MirNativeWindow(ClientSurface* client_surface)
 
94
mcla::MirNativeWindow::MirNativeWindow(ClientSurface* client_surface)
94
95
 : surface(client_surface),
95
96
   driver_pixel_format(-1)
96
97
{
109
110
    const_cast<int&>(ANativeWindow::maxSwapInterval) = 1;
110
111
}
111
112
 
112
 
int mcl::MirNativeWindow::dequeueBuffer (struct ANativeWindowBuffer** buffer_to_driver)
 
113
int mcla::MirNativeWindow::dequeueBuffer (struct ANativeWindowBuffer** buffer_to_driver)
113
114
{
114
115
    int ret = 0;
115
116
    auto buffer = surface->get_current_buffer();
120
121
 
121
122
static void empty(MirSurface * /*surface*/, void * /*client_context*/)
122
123
{}
123
 
int mcl::MirNativeWindow::queueBuffer(struct ANativeWindowBuffer* /*buffer*/)
 
124
int mcla::MirNativeWindow::queueBuffer(struct ANativeWindowBuffer* /*buffer*/)
124
125
{
125
126
    mir_wait_for(surface->next_buffer(empty, NULL));
126
127
    return 0;
127
128
}
128
129
 
129
 
int mcl::MirNativeWindow::query(int key, int* value ) const
 
130
int mcla::MirNativeWindow::query(int key, int* value ) const
130
131
{
131
132
    int ret = 0;
132
133
    switch (key)
152
153
    return ret;
153
154
}
154
155
 
155
 
int mcl::MirNativeWindow::perform(int key, va_list arg_list )
 
156
int mcla::MirNativeWindow::perform(int key, va_list arg_list )
156
157
{
157
158
    int ret = 0;
158
159
    va_list args;