mirror of
https://github.com/NickHu/sway
synced 2024-12-27 21:58:11 +01:00
Rename fowa enum and use switch in view_request_activate
This commit is contained in:
parent
f057a0195e
commit
6fb03817c9
2 changed files with 19 additions and 19 deletions
|
@ -60,7 +60,7 @@ struct sway_mouse_binding {
|
|||
/**
|
||||
* Focus on window activation.
|
||||
*/
|
||||
enum fowa {
|
||||
enum sway_fowa {
|
||||
FOWA_SMART,
|
||||
FOWA_URGENT,
|
||||
FOWA_FOCUS,
|
||||
|
@ -350,7 +350,7 @@ struct sway_config {
|
|||
size_t font_height;
|
||||
bool pango_markup;
|
||||
size_t urgent_timeout;
|
||||
enum fowa focus_on_window_activation;
|
||||
enum sway_fowa focus_on_window_activation;
|
||||
|
||||
// Flags
|
||||
bool focus_follows_mouse;
|
||||
|
|
|
@ -281,25 +281,25 @@ void view_set_activated(struct sway_view *view, bool activated) {
|
|||
}
|
||||
|
||||
void view_request_activate(struct sway_view *view) {
|
||||
if (config->focus_on_window_activation == FOWA_NONE) {
|
||||
return;
|
||||
}
|
||||
if (config->focus_on_window_activation == FOWA_FOCUS) {
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
seat_set_focus(seat, view->swayc);
|
||||
return;
|
||||
}
|
||||
if (config->focus_on_window_activation == FOWA_URGENT) {
|
||||
view_set_urgent(view, true);
|
||||
return;
|
||||
}
|
||||
// FOWA_SMART
|
||||
struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
|
||||
if (workspace_is_visible(ws)) {
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
seat_set_focus(seat, view->swayc);
|
||||
} else {
|
||||
struct sway_seat *seat = input_manager_current_seat(input_manager);
|
||||
|
||||
switch (config->focus_on_window_activation) {
|
||||
case FOWA_SMART:
|
||||
if (workspace_is_visible(ws)) {
|
||||
seat_set_focus(seat, view->swayc);
|
||||
} else {
|
||||
view_set_urgent(view, true);
|
||||
}
|
||||
break;
|
||||
case FOWA_URGENT:
|
||||
view_set_urgent(view, true);
|
||||
break;
|
||||
case FOWA_FOCUS:
|
||||
seat_set_focus(seat, view->swayc);
|
||||
break;
|
||||
case FOWA_NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue