swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 43dc1b4d53e5a5d592dbfede0f5a355a22b715b4
parent b8c441e460ee76e94b6b7ce453cc04019a823164
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 22 Jan 2014 16:18:22 -0800

pointer: Center cursor in screen

Diffstat:
Mlibswc/pointer.c | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libswc/pointer.c b/libswc/pointer.c @@ -154,9 +154,14 @@ static void handle_view_event(struct wl_listener * listener, void * data) bool swc_pointer_initialize(struct swc_pointer * pointer) { struct wld_buffer * buffer; - - pointer->x = wl_fixed_from_int(0); - pointer->y = wl_fixed_from_int(0); + struct swc_screen_internal * screen; + + /* Center cursor in the geometry of the first screen. */ + screen = CONTAINER_OF(swc.screens.next, typeof(*screen), link); + pointer->x = wl_fixed_from_int + (screen->base.geometry.x + screen->base.geometry.width / 2); + pointer->y = wl_fixed_from_int + (screen->base.geometry.y + screen->base.geometry.height / 2); pointer->focus_handler.enter = &enter; pointer->focus_handler.leave = &leave;