@ -335,13 +335,15 @@ move_grab_motion(struct wl_pointer_grab *grab,
static void
static void
move_grab_button ( struct wl_pointer_grab * grab ,
move_grab_button ( struct wl_pointer_grab * grab ,
uint32_t time , uint32_t button , uint32_t state )
uint32_t time , uint32_t button , uint32_t state_w )
{
{
struct shell_grab * shell_grab = container_of ( grab , struct shell_grab ,
struct shell_grab * shell_grab = container_of ( grab , struct shell_grab ,
grab ) ;
grab ) ;
struct wl_pointer * pointer = grab - > pointer ;
struct wl_pointer * pointer = grab - > pointer ;
enum wl_pointer_button_state state = state_w ;
if ( pointer - > button_count = = 0 & & state = = 0 ) {
if ( pointer - > button_count = = 0 & &
state = = WL_POINTER_BUTTON_STATE_RELEASED ) {
shell_grab_finish ( shell_grab ) ;
shell_grab_finish ( shell_grab ) ;
wl_pointer_end_grab ( pointer ) ;
wl_pointer_end_grab ( pointer ) ;
free ( grab ) ;
free ( grab ) ;
@ -608,12 +610,14 @@ static const struct weston_shell_client shell_client = {
static void
static void
resize_grab_button ( struct wl_pointer_grab * grab ,
resize_grab_button ( struct wl_pointer_grab * grab ,
uint32_t time , uint32_t button , uint32_t state )
uint32_t time , uint32_t button , uint32_t state_w )
{
{
struct weston_resize_grab * resize = ( struct weston_resize_grab * ) grab ;
struct weston_resize_grab * resize = ( struct weston_resize_grab * ) grab ;
struct wl_pointer * pointer = grab - > pointer ;
struct wl_pointer * pointer = grab - > pointer ;
enum wl_pointer_button_state state = state_w ;
if ( pointer - > button_count = = 0 & & state = = 0 ) {
if ( pointer - > button_count = = 0 & &
state = = WL_POINTER_BUTTON_STATE_RELEASED ) {
shell_grab_finish ( & resize - > base ) ;
shell_grab_finish ( & resize - > base ) ;
wl_pointer_end_grab ( pointer ) ;
wl_pointer_end_grab ( pointer ) ;
free ( grab ) ;
free ( grab ) ;
@ -1097,12 +1101,13 @@ popup_grab_motion(struct wl_pointer_grab *grab,
static void
static void
popup_grab_button ( struct wl_pointer_grab * grab ,
popup_grab_button ( struct wl_pointer_grab * grab ,
uint32_t time , uint32_t button , uint32_t state )
uint32_t time , uint32_t button , uint32_t state_w )
{
{
struct wl_resource * resource ;
struct wl_resource * resource ;
struct shell_surface * shsurf =
struct shell_surface * shsurf =
container_of ( grab , struct shell_surface , popup . grab ) ;
container_of ( grab , struct shell_surface , popup . grab ) ;
struct wl_display * display ;
struct wl_display * display ;
enum wl_pointer_button_state state = state_w ;
uint32_t serial ;
uint32_t serial ;
resource = grab - > pointer - > focus_resource ;
resource = grab - > pointer - > focus_resource ;
@ -1110,7 +1115,7 @@ popup_grab_button(struct wl_pointer_grab *grab,
display = wl_client_get_display ( resource - > client ) ;
display = wl_client_get_display ( resource - > client ) ;
serial = wl_display_get_serial ( display ) ;
serial = wl_display_get_serial ( display ) ;
wl_pointer_send_button ( resource , serial , time , button , state ) ;
wl_pointer_send_button ( resource , serial , time , button , state ) ;
} else if ( state = = 0 & &
} else if ( state = = WL_POINTER_BUTTON_STATE_RELEASED & &
( shsurf - > popup . initial_up | |
( shsurf - > popup . initial_up | |
time - shsurf - > popup . seat - > pointer - > grab_time > 500 ) ) {
time - shsurf - > popup . seat - > pointer - > grab_time > 500 ) ) {
wl_shell_surface_send_popup_done ( & shsurf - > resource ) ;
wl_shell_surface_send_popup_done ( & shsurf - > resource ) ;
@ -1118,7 +1123,7 @@ popup_grab_button(struct wl_pointer_grab *grab,
shsurf - > popup . grab . pointer = NULL ;
shsurf - > popup . grab . pointer = NULL ;
}
}
if ( state = = 0 )
if ( state = = WL_POINTER_BUTTON_STATE_RELEASED )
shsurf - > popup . initial_up = 1 ;
shsurf - > popup . initial_up = 1 ;
}
}
@ -1776,14 +1781,16 @@ rotate_grab_motion(struct wl_pointer_grab *grab,
static void
static void
rotate_grab_button ( struct wl_pointer_grab * grab ,
rotate_grab_button ( struct wl_pointer_grab * grab ,
uint32_t time , uint32_t button , uint32_t state )
uint32_t time , uint32_t button , uint32_t state_w )
{
{
struct rotate_grab * rotate =
struct rotate_grab * rotate =
container_of ( grab , struct rotate_grab , base . grab ) ;
container_of ( grab , struct rotate_grab , base . grab ) ;
struct wl_pointer * pointer = grab - > pointer ;
struct wl_pointer * pointer = grab - > pointer ;
struct shell_surface * shsurf = rotate - > base . shsurf ;
struct shell_surface * shsurf = rotate - > base . shsurf ;
enum wl_pointer_button_state state = state_w ;
if ( pointer - > button_count = = 0 & & state = = 0 ) {
if ( pointer - > button_count = = 0 & &
state = = WL_POINTER_BUTTON_STATE_RELEASED ) {
if ( shsurf )
if ( shsurf )
weston_matrix_multiply ( & shsurf - > rotation . rotation ,
weston_matrix_multiply ( & shsurf - > rotation . rotation ,
& rotate - > rotation ) ;
& rotate - > rotation ) ;
@ -1931,12 +1938,14 @@ is_black_surface (struct weston_surface *es, struct weston_surface **fs_surface)
static void
static void
click_to_activate_binding ( struct wl_seat * seat ,
click_to_activate_binding ( struct wl_seat * seat ,
uint32_t time , uint32_t key ,
uint32_t time , uint32_t key ,
uint32_t button , uint32_t axis , int32_t state , void * data )
uint32_t button , uint32_t axis , int32_t state_w ,
void * data )
{
{
struct weston_seat * ws = ( struct weston_seat * ) seat ;
struct weston_seat * ws = ( struct weston_seat * ) seat ;
struct desktop_shell * shell = data ;
struct desktop_shell * shell = data ;
struct weston_surface * focus ;
struct weston_surface * focus ;
struct weston_surface * upper ;
struct weston_surface * upper ;
enum wl_pointer_button_state state = state_w ;
focus = ( struct weston_surface * ) seat - > pointer - > focus ;
focus = ( struct weston_surface * ) seat - > pointer - > focus ;
if ( ! focus )
if ( ! focus )
@ -1945,7 +1954,8 @@ click_to_activate_binding(struct wl_seat *seat,
if ( is_black_surface ( focus , & upper ) )
if ( is_black_surface ( focus , & upper ) )
focus = upper ;
focus = upper ;
if ( state & & seat - > pointer - > grab = = & seat - > pointer - > default_grab )
if ( state = = WL_POINTER_BUTTON_STATE_PRESSED & &
seat - > pointer - > grab = = & seat - > pointer - > default_grab )
activate ( shell , focus , ws ) ;
activate ( shell , focus , ws ) ;
}
}