-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for 'exclusive' keyboard interactivity on top and bottom…
… layers. (#170)
- Loading branch information
Showing
5 changed files
with
80 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,8 @@ static void _wlmaker_layer_panel_destroy( | |
|
||
static bool _wlmaker_layer_panel_apply_keyboard( | ||
wlmaker_layer_panel_t *layer_panel_ptr, | ||
enum zwlr_layer_surface_v1_keyboard_interactivity interactivity); | ||
enum zwlr_layer_surface_v1_keyboard_interactivity interactivity, | ||
enum zwlr_layer_shell_v1_layer zwlr_layer); | ||
static bool _wlmaker_layer_panel_apply_layer( | ||
wlmaker_layer_panel_t *layer_panel_ptr, | ||
enum zwlr_layer_shell_v1_layer zwlr_layer); | ||
|
@@ -251,19 +252,54 @@ wlmtk_workspace_layer_t _wlmaker_layer_from_zwlr_layer( | |
} | ||
|
||
/* ------------------------------------------------------------------------- */ | ||
/** Applies the requested keyboard setting. Currently warns on non-zero. */ | ||
/** | ||
* Applies the requested keyboard setting. | ||
* | ||
* Supports 'NONE' and 'EXCLUSIVE' interactivity, but the latter only on | ||
* top and overlay layers. | ||
* | ||
* TODO([email protected]): Implement full support, once layer elements have a | ||
* means to organically obtain and release keyboard focus (eg. through pointer | ||
* button clicks). | ||
* | ||
* @param layer_panel_ptr | ||
* @param interactivity | ||
* @param zwlr_layer | ||
* | ||
* @return true on success. | ||
*/ | ||
bool _wlmaker_layer_panel_apply_keyboard( | ||
wlmaker_layer_panel_t *layer_panel_ptr, | ||
enum zwlr_layer_surface_v1_keyboard_interactivity interactivity) | ||
enum zwlr_layer_surface_v1_keyboard_interactivity interactivity, | ||
enum zwlr_layer_shell_v1_layer zwlr_layer) | ||
{ | ||
if (ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE != interactivity) { | ||
switch (interactivity) { | ||
case ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE: | ||
break; | ||
|
||
case ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE: | ||
if (ZWLR_LAYER_SHELL_V1_LAYER_TOP != zwlr_layer && | ||
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY != zwlr_layer) { | ||
wl_resource_post_error( | ||
layer_panel_ptr->wlr_layer_surface_v1_ptr->resource, | ||
WL_DISPLAY_ERROR_IMPLEMENTATION, | ||
"Exclusive interactivity unsupported on layer %d", zwlr_layer); | ||
return false; | ||
} | ||
|
||
wlmtk_surface_set_activated(layer_panel_ptr->wlmtk_surface_ptr, true); | ||
break; | ||
|
||
case ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND: | ||
default: | ||
wl_resource_post_error( | ||
layer_panel_ptr->wlr_layer_surface_v1_ptr->resource, | ||
WL_DISPLAY_ERROR_IMPLEMENTATION, | ||
"Unsupported setting for keyboard interactivity: %d", | ||
interactivity); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
|
@@ -380,12 +416,13 @@ void _wlmaker_layer_panel_handle_surface_commit( | |
&pos); | ||
|
||
// Updates keyboard and layer values. Ignore failures here. | ||
_wlmaker_layer_panel_apply_keyboard( | ||
layer_panel_ptr, | ||
state_ptr->keyboard_interactive); | ||
_wlmaker_layer_panel_apply_layer( | ||
layer_panel_ptr, | ||
state_ptr->layer); | ||
_wlmaker_layer_panel_apply_keyboard( | ||
layer_panel_ptr, | ||
state_ptr->keyboard_interactive, | ||
state_ptr->layer); | ||
} | ||
|
||
/* ------------------------------------------------------------------------- */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,6 +316,8 @@ void wlmtk_window_set_activated( | |
wlmtk_window_t *window_ptr, | ||
bool activated) | ||
{ | ||
if (window_ptr->activated == activated) return; | ||
|
||
window_ptr->activated = activated; | ||
wlmtk_content_set_activated(window_ptr->content_ptr, activated); | ||
if (NULL != window_ptr->titlebar_ptr) { | ||
|
@@ -324,6 +326,11 @@ void wlmtk_window_set_activated( | |
|
||
if (!activated) { | ||
wlmtk_window_menu_set_enabled(window_ptr, false); | ||
|
||
// TODO([email protected]): Should test this behaviour. | ||
if (NULL != window_ptr->workspace_ptr) { | ||
wlmtk_workspace_activate_window(window_ptr->workspace_ptr, NULL); | ||
} | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters