~kgunn72/mir/dont-crash-when-shooting-invalid-surface

« back to all changes in this revision

Viewing changes to examples/demo-shell/window_manager.cpp

  • Committer: Tarmac
  • Author(s): Alan Griffiths, Alexandros Frantzis, Daniel van Vugt, Kevin DuBois, Christopher James Halse Rogers, chris.gagnon, Mathieu Trudel-Lapierre, Robert Carr, Automatic PS uploader, Kevin Gunn, Daniel d'Andrada, Christopher James Halse Rogers, Michael Terry, Brandon Schaefer, Timo Jyrinki, Mir Team, Andreas Pokorny
  • Date: 2013-12-20 11:11:22 UTC
  • mfrom: (1169.1.1 version-0.1.3)
  • Revision ID: tarmac-20131220111122-h503fd1fnq7pn9za
Latest upstream release: Mir 0.1.3 (r1298).

Approved by Alan Griffiths, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "mir/compositor/compositor.h"
28
28
 
29
29
#include <linux/input.h>
 
30
#include <android/keycodes.h>  // TODO remove this dependency
30
31
 
31
32
#include <cassert>
32
33
#include <cstdlib>
133
134
            focus_controller->focus_next();
134
135
            return true;
135
136
        }
136
 
        if (event.key.modifiers & mir_key_modifier_alt && event.key.scan_code == KEY_P)
 
137
        else if ((event.key.modifiers & mir_key_modifier_alt &&
 
138
                  event.key.scan_code == KEY_P) ||
 
139
                 (event.key.key_code == AKEYCODE_POWER))
137
140
        {
138
141
            compositor->stop();
139
142
            auto conf = display->configuration();
155
158
            display_off = !display_off;
156
159
 
157
160
            display->configure(*conf.get());
158
 
            compositor->start();
 
161
            if (!display_off)
 
162
                compositor->start();
159
163
            return true;
160
164
        }
161
165
    }