]>
Commit | Line | Data |
---|---|---|
b9796f11 MM |
1 | Proof of concept patch for using kde's virtual workspaces from withing qemu, |
2 | when running full screen (so that a virtual workspace is a whole OS). | |
3 | This should: | |
4 | - use configurable key bindings or even be able to get them from the current | |
5 | environment | |
6 | - use dcop directly (preferably using runtime probing for dcop libs), without | |
7 | having to invoke the dcop app (which is obviously slower) | |
8 | ||
9 | But for now whoever wants to can just hack in his key bindings and it will | |
10 | kind of work. | |
11 | ||
12 | Would actually be nice if kde (and gnome) had the ability to create workspaces | |
13 | on the fly, so qemu could have a mode when it assigns itself a completely new | |
14 | workspace on startup. This way I could have another OS running in the | |
15 | 'background' without altering my workflow (that is -- without depriving me of | |
16 | one workspace which I normally use). | |
17 | ||
18 | --- qemu-0.8.2/sdl.c 2006-07-22 19:23:34.000000000 +0200 | |
19 | +++ qemu-0.8.2.new/sdl.c 2006-11-25 20:57:12.220599750 +0100 | |
20 | @@ -35,9 +35,11 @@ | |
21 | static int gui_saved_grab; | |
22 | static int gui_fullscreen; | |
23 | static int gui_key_modifier_pressed; | |
24 | +static int gui_key_modifier_pressed2; | |
25 | static int gui_keysym; | |
26 | static int gui_fullscreen_initial_grab; | |
27 | static int gui_grab_code = KMOD_LALT | KMOD_LCTRL; | |
28 | +static int gui_switch_workspace_code = KMOD_LMETA; | |
29 | static uint8_t modifiers_state[256]; | |
30 | static int width, height; | |
31 | static SDL_Cursor *sdl_cursor_normal; | |
32 | @@ -382,13 +384,36 @@ | |
33 | case SDL_KEYDOWN: | |
34 | case SDL_KEYUP: | |
35 | if (ev->type == SDL_KEYDOWN) { | |
36 | + mod_state = (SDL_GetModState() & gui_switch_workspace_code) == | |
37 | + gui_switch_workspace_code; | |
38 | + gui_key_modifier_pressed2 = mod_state; | |
39 | mod_state = (SDL_GetModState() & gui_grab_code) == | |
40 | gui_grab_code; | |
41 | gui_key_modifier_pressed = mod_state; | |
42 | - if (gui_key_modifier_pressed) { | |
43 | + if (gui_key_modifier_pressed2) { | |
44 | int keycode; | |
45 | + char cmd[] = "dcop kwin default setCurrentDesktop 1 >/dev/null"; | |
46 | keycode = sdl_keyevent_to_keycode(&ev->key); | |
47 | switch(keycode) { | |
48 | + case 0x02 ... 0x0a: /* '1' to '9' keys */ | |
49 | + sdl_grab_end(); | |
50 | + cmd[36] =(char)keycode+'0'-1; | |
51 | + system(cmd); | |
52 | + break; | |
53 | + default: | |
54 | + break; | |
55 | + | |
56 | + break; | |
57 | + } | |
58 | + } | |
59 | + else if (gui_key_modifier_pressed) { | |
60 | + int keycode; | |
61 | + keycode = sdl_keyevent_to_keycode(&ev->key); | |
62 | + switch(keycode) { | |
63 | + case 0x10: | |
64 | + case 0x2d: /* 'q' or 'x' */ | |
65 | + qemu_system_shutdown_request(); | |
66 | + break; | |
67 | case 0x21: /* 'f' key on US keyboard */ | |
68 | toggle_full_screen(ds); | |
69 | gui_keysym = 1; | |
70 | @@ -508,6 +533,9 @@ | |
71 | !ev->active.gain && !gui_fullscreen_initial_grab) { | |
72 | sdl_grab_end(); | |
73 | } | |
74 | + else if(gui_fullscreen && ev->active.state == SDL_APPINPUTFOCUS) { | |
75 | + sdl_grab_start(); | |
76 | + } | |
77 | break; | |
78 | default: | |
79 | break; |