[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] [PATCH 2/6] Use xrandr output identifiers in sselect.
From: |
Mathieu OTHACEHE |
Subject: |
[RP] [PATCH 2/6] Use xrandr output identifiers in sselect. |
Date: |
Fri, 25 Nov 2016 15:35:19 +0100 |
Handle xrandr output identifiers as input for sselect.
Disable sselect if there is no xrandr support.
---
src/actions.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 606116c..77d5cee 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -4662,6 +4662,13 @@ cmd_prevscreen (int interactive UNUSED, struct cmdarg
**args UNUSED)
return cmdret_new (RET_SUCCESS, NULL);
}
+#ifndef HAVE_XRANDR
+cmdret *
+cmd_sselect(int interactive UNUSED, struct cmdarg **args UNUSED)
+{
+ return cmdret_new (RET_FAILURE, "sselect: no xrandr support");
+}
+#else
cmdret *
cmd_sselect(int interactive UNUSED, struct cmdarg **args)
{
@@ -4669,23 +4676,21 @@ cmd_sselect(int interactive UNUSED, struct cmdarg
**args)
rp_frame *new_frame;
rp_screen *screen;
+ if (!rp_have_xrandr) {
+ return cmdret_new (RET_FAILURE, "sselect: no xrandr support");
+ }
+
new_screen = ARG(0,number);
- if (new_screen < 0)
- return cmdret_new (RET_FAILURE, "sselect: out of range");
+ screen = xrandr_screen_output(new_screen);
+ if (!screen)
+ return cmdret_new (RET_FAILURE, "sselect: screen not found");
- if (new_screen < screen_count ())
- {
- screen = screen_at (new_screen);
- new_frame = screen_get_frame (screen, screen->current_frame);
- set_active_frame (new_frame, 1);
- }
- else
- {
- return cmdret_new (RET_FAILURE, "sselect: out of range");
- }
+ new_frame = screen_get_frame (screen, screen->current_frame);
+ set_active_frame (new_frame, 1);
return cmdret_new (RET_SUCCESS, NULL);
}
+#endif
cmdret *
cmd_warp (int interactive UNUSED, struct cmdarg **args)
--
2.10.0
- [RP] [PATCH 1/6] Expose xrandr functions to find a screen by output or crtc number, (continued)
- [RP] [PATCH 1/6] Expose xrandr functions to find a screen by output or crtc number, Mathieu OTHACEHE, 2016/11/25
- [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Mathieu OTHACEHE, 2016/11/25
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Jeremie Courreges-Anglas, 2016/11/26
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Mathieu OTHACEHE, 2016/11/27
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Jeremie Courreges-Anglas, 2016/11/27
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Mathieu OTHACEHE, 2016/11/27
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Jeremie Courreges-Anglas, 2016/11/27
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Mathieu OTHACEHE, 2016/11/28
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., |cos|, 2016/11/27
- Re: [RP] [PATCH 3/6] Disable sfdump if there is no xrandr support., Mathieu OTHACEHE, 2016/11/28
[RP] [PATCH 2/6] Use xrandr output identifiers in sselect.,
Mathieu OTHACEHE <=
[RP] [PATCH 5/6] Kill gcc uninitialized warning, Mathieu OTHACEHE, 2016/11/25
[RP] [PATCH 4/6] Use xrandr output identifiers in srestore., Mathieu OTHACEHE, 2016/11/25
[RP] [PATCH 6/6] Update XRandr related documentation and man., Mathieu OTHACEHE, 2016/11/25