Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add Ctrl+F1 for iterate switch screen resolution

  • Loading branch information...
commit d5d459d3fd1d72a70583569108190ec28d64ab85 1 parent 5e03616
Xiangfu Liu authored
Showing with 28 additions and 0 deletions.
  1. +8 −0 src/fb.c
  2. +1 −0  src/fb.h
  3. +19 −0 src/shortcuts.c
View
8 src/fb.c
@@ -29,6 +29,7 @@
int framebuffer_fd;
static int blanked;
+static int g_render_mode = 0;
static void get_resolution(int mode, int *hres, int *vres)
{
@@ -84,6 +85,7 @@ void fb_render_mode()
if(sysconfig_get_resolution() != SC_RESOLUTION_640_480)
ioctl(framebuffer_fd, FBIOSETVIDEOMODE, SC_RESOLUTION_640_480);
ioctl(framebuffer_fd, FBIOSETBUFFERMODE, FB_TRIPLE_BUFFERED);
+ g_render_mode = 1;
}
void fb_gui_mode()
@@ -92,6 +94,12 @@ void fb_gui_mode()
ioctl(framebuffer_fd, FBIOSETVIDEOMODE, sysconfig_get_resolution());
ioctl(framebuffer_fd, FBIOSETBUFFERMODE, FB_SINGLE_BUFFERED);
blanked = 0;
+ g_render_mode = 0;
+}
+
+int fb_get_mode()
+{
+ return g_render_mode;
}
void fb_resize_gui()
View
1  src/fb.h
@@ -25,5 +25,6 @@ void fb_unblank();
void fb_render_mode();
void fb_gui_mode();
void fb_resize_gui();
+int fb_get_mode();
#endif /* __FB_H */
View
19 src/shortcuts.c
@@ -23,9 +23,26 @@
#include "input.h"
#include "shutdown.h"
#include "fbgrab.h"
+#include "sysconfig.h"
+#include "fb.h"
static int ctrl, alt;
+static void switch_resolution()
+{
+ int res;
+
+ if(fb_get_mode()) return;
+
+ res = sysconfig_get_resolution();
+ res++;
+
+ if (res > SC_RESOLUTION_1024_768)
+ res = SC_RESOLUTION_640_480;
+
+ sysconfig_set_resolution(res);
+}
+
static void shortcuts_callback(mtk_event *e, int count)
{
int i;
@@ -40,6 +57,8 @@ static void shortcuts_callback(mtk_event *e, int count)
clean_shutdown(0);
else if(ctrl && (e[i].press.code == MTK_KEY_F12))
fbgrab(NULL);
+ else if(ctrl && (e[i].press.code == MTK_KEY_F1))
+ switch_resolution();
} else if (e[i].type == EVENT_TYPE_RELEASE) {
if(e[i].release.code == MTK_KEY_LEFTCTRL)
ctrl = 0;
Please sign in to comment.
Something went wrong with that request. Please try again.