WL_EVENT_READABLE, on_drm_input, ec);
setup_tty(ec, loop);
ec->base.present = drm_compositor_present;
+ ec->base.focus = 1;
return &ec->base;
}
XCB_EVENT_MASK_BUTTON_RELEASE |
XCB_EVENT_MASK_POINTER_MOTION |
XCB_EVENT_MASK_EXPOSURE |
- XCB_EVENT_MASK_STRUCTURE_NOTIFY,
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY |
+ XCB_EVENT_MASK_ENTER_WINDOW |
+ XCB_EVENT_MASK_LEAVE_WINDOW,
0
};
r->width = expose->width;
r->height = expose->height;
break;
+
+ case XCB_ENTER_NOTIFY:
+ c->base.focus = 1;
+ wlsc_compositor_schedule_repaint(&c->base);
+ break;
+
+ case XCB_LEAVE_NOTIFY:
+ c->base.focus = 0;
+ wlsc_compositor_schedule_repaint(&c->base);
+ break;
+
case XCB_CLIENT_MESSAGE:
client_message = (xcb_client_message_event_t *) event;
atom = client_message->data.data32[0];
wl_list_for_each(es, &ec->surface_list, link)
wlsc_surface_draw(es, output);
- wl_list_for_each(eid, &ec->input_device_list, link)
- wlsc_surface_draw(eid->sprite, output);
+ if (ec->focus)
+ wl_list_for_each(eid, &ec->input_device_list, link)
+ wlsc_surface_draw(eid->sprite, output);
}
static void
ec->repaint_needed = 0;
}
-static void
+void
wlsc_compositor_schedule_repaint(struct wlsc_compositor *compositor)
{
compositor->repaint_needed = 1;
uint32_t current_frame;
uint32_t modifier_state;
+ uint32_t focus;
void (*present)(struct wlsc_compositor *c);
};
void
wlsc_compositor_finish_frame(struct wlsc_compositor *compositor, int msecs);
-struct wlsc_input_device *
-wlsc_input_device_create(struct wlsc_compositor *ec);
+void
+wlsc_compositor_schedule_repaint(struct wlsc_compositor *compositor);
int
wlsc_compositor_init(struct wlsc_compositor *ec, struct wl_display *display);