Merge branch 'master' into wayland-input
This commit is contained in:
commit
0813c1dd39
|
@ -47,15 +47,6 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
|
|||
wlr_renderer_end(sample->renderer);
|
||||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *kbstate,
|
||||
xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
kbstate->compositor->exit = true;
|
||||
} else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) {
|
||||
wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_pointer_motion(struct pointer_state *pstate,
|
||||
double d_x, double d_y) {
|
||||
struct sample_state *state = pstate->compositor->data;
|
||||
|
@ -117,7 +108,6 @@ int main(int argc, char *argv[]) {
|
|||
compositor.data = &state;
|
||||
compositor.output_add_cb = handle_output_add;
|
||||
compositor.output_frame_cb = handle_output_frame;
|
||||
compositor.keyboard_key_cb = handle_keyboard_key;
|
||||
compositor.pointer_motion_cb = handle_pointer_motion;
|
||||
compositor.pointer_button_cb = handle_pointer_button;
|
||||
compositor.pointer_axis_cb = handle_pointer_axis;
|
||||
|
|
|
@ -107,9 +107,6 @@ static void handle_keyboard_key(struct keyboard_state *kbstate,
|
|||
// Also, key repeat
|
||||
if (key_state == WLR_KEY_PRESSED) {
|
||||
switch (sym) {
|
||||
case XKB_KEY_Escape:
|
||||
kbstate->compositor->exit = true;
|
||||
break;
|
||||
case XKB_KEY_Left:
|
||||
update_velocities(kbstate->compositor, -16, 0);
|
||||
break;
|
||||
|
@ -123,10 +120,6 @@ static void handle_keyboard_key(struct keyboard_state *kbstate,
|
|||
update_velocities(kbstate->compositor, 0, 16);
|
||||
break;
|
||||
}
|
||||
|
||||
if (sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) {
|
||||
wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@ static void keyboard_key_notify(struct wl_listener *listener, void *data) {
|
|||
if (kbstate->compositor->keyboard_key_cb) {
|
||||
kbstate->compositor->keyboard_key_cb(kbstate, sym, key_state);
|
||||
}
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
wl_display_terminate(kbstate->compositor->display);
|
||||
} else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) {
|
||||
wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1);
|
||||
}
|
||||
}
|
||||
xkb_state_update_key(kbstate->xkb_state, keycode,
|
||||
event->state == WLR_KEY_PRESSED ? XKB_KEY_DOWN : XKB_KEY_UP);
|
||||
|
@ -470,10 +475,7 @@ void compositor_init(struct compositor_state *state) {
|
|||
}
|
||||
|
||||
void compositor_run(struct compositor_state *state) {
|
||||
while (!state->exit) {
|
||||
wl_event_loop_dispatch(state->event_loop, 0);
|
||||
}
|
||||
|
||||
wl_display_run(state->display);
|
||||
wlr_backend_destroy(state->backend);
|
||||
wlr_session_finish(state->session);
|
||||
wl_display_destroy(state->display);
|
||||
|
|
|
@ -38,15 +38,6 @@ void handle_output_frame(struct output_state *output, struct timespec *ts) {
|
|||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *kbstate,
|
||||
xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
kbstate->compositor->exit = true;
|
||||
} else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) {
|
||||
wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
struct sample_state state = {
|
||||
.color = { 1.0, 0.0, 0.0 },
|
||||
|
@ -55,7 +46,6 @@ int main() {
|
|||
struct compositor_state compositor = { 0,
|
||||
.data = &state,
|
||||
.output_frame_cb = handle_output_frame,
|
||||
.keyboard_key_cb = handle_keyboard_key,
|
||||
};
|
||||
compositor_init(&compositor);
|
||||
compositor_run(&compositor);
|
||||
|
|
|
@ -76,15 +76,6 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
|
|||
wlr_renderer_end(sample->renderer);
|
||||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *kbstate,
|
||||
xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
kbstate->compositor->exit = true;
|
||||
} else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) {
|
||||
wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_tool_axis(struct tablet_tool_state *tstate,
|
||||
struct wlr_event_tablet_tool_axis *event) {
|
||||
struct sample_state *sample = tstate->compositor->data;
|
||||
|
@ -152,7 +143,6 @@ int main(int argc, char *argv[]) {
|
|||
struct compositor_state compositor = { 0,
|
||||
.data = &state,
|
||||
.output_frame_cb = handle_output_frame,
|
||||
.keyboard_key_cb = handle_keyboard_key,
|
||||
.tool_axis_cb = handle_tool_axis,
|
||||
.tool_proximity_cb = handle_tool_proximity,
|
||||
.tool_button_cb = handle_tool_button,
|
||||
|
|
|
@ -54,15 +54,6 @@ static void handle_output_frame(struct output_state *output, struct timespec *ts
|
|||
wlr_renderer_end(sample->renderer);
|
||||
}
|
||||
|
||||
static void handle_keyboard_key(struct keyboard_state *kbstate,
|
||||
xkb_keysym_t sym, enum wlr_key_state key_state) {
|
||||
if (sym == XKB_KEY_Escape) {
|
||||
kbstate->compositor->exit = true;
|
||||
} else if (key_state == WLR_KEY_PRESSED && sym >= XKB_KEY_F1 && sym <= XKB_KEY_F12) {
|
||||
wlr_session_change_vt(kbstate->compositor->session, sym - XKB_KEY_F1 + 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void handle_touch_down(struct touch_state *tstate, int32_t slot,
|
||||
double x, double y, double width, double height) {
|
||||
struct sample_state *sample = tstate->compositor->data;
|
||||
|
@ -104,7 +95,6 @@ int main(int argc, char *argv[]) {
|
|||
struct compositor_state compositor = { 0,
|
||||
.data = &state,
|
||||
.output_frame_cb = handle_output_frame,
|
||||
.keyboard_key_cb = handle_keyboard_key,
|
||||
.touch_down_cb = handle_touch_down,
|
||||
.touch_up_cb = handle_touch_up,
|
||||
.touch_motion_cb = handle_touch_motion,
|
||||
|
|
|
@ -89,8 +89,11 @@ bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode
|
|||
if (!output->impl || !output->impl->set_mode) {
|
||||
return false;
|
||||
}
|
||||
bool result = output->impl->set_mode(output->state, mode);
|
||||
if (result) {
|
||||
wlr_output_update_matrix(output);
|
||||
return output->impl->set_mode(output->state, mode);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void wlr_output_transform(struct wlr_output *output,
|
||||
|
|
Loading…
Reference in New Issue