Annotation of /mcore-src/trunk/mcore-tools/daemon/client/include/graphic.client.class
Parent Directory | Revision Log
Revision 1248 -
(hide annotations)
(download)
Wed Feb 2 20:20:24 2011 UTC (13 years, 7 months ago) by niro
File size: 1452 byte(s)
Wed Feb 2 20:20:24 2011 UTC (13 years, 7 months ago) by niro
File size: 1452 byte(s)
-initial version
1 | niro | 1248 | # $Id$ |
2 | |||
3 | provide basic-video x0vnc | ||
4 | |||
5 | help_graphic_resolution() | ||
6 | { | ||
7 | mecho "set graphic.resolution [resolution]" | ||
8 | mecho " 800x600, 1024x768, 1280x1024 etc" | ||
9 | } | ||
10 | |||
11 | help_graphic_refresh() | ||
12 | { | ||
13 | mecho "set graphic.refresh [refresh rate]" | ||
14 | mecho " 60, 100 - all values are Hz" | ||
15 | } | ||
16 | |||
17 | # set_graphic_resolution ${value} | ||
18 | set_graphic_resolution() | ||
19 | { | ||
20 | local value="$1" | ||
21 | [[ -z ${value} ]] && help_graphic_resolution && return 1 | ||
22 | |||
23 | echo "${value}" > ${SETTINGSPATH}/xorg/resolution | ||
24 | |||
25 | if pidof X | ||
26 | then | ||
27 | x11runas "DISPLAY=:0 xrandr --size ${value}" | ||
28 | fi | ||
29 | } | ||
30 | |||
31 | # set_graphic_refresh ${value} | ||
32 | set_graphic_refresh() | ||
33 | { | ||
34 | local value="$1" | ||
35 | [[ -z ${value} ]] && help_graphic_resolution && return 1 | ||
36 | |||
37 | echo "${value}" > ${SETTINGSPATH}/xorg/refresh | ||
38 | |||
39 | if pidof X | ||
40 | then | ||
41 | x11runas "DISPLAY=:0 xrandr --refresh ${value}" | ||
42 | fi | ||
43 | } | ||
44 | |||
45 | # helper_graphic_addconf $@ | ||
46 | helper_graphic_addconf() | ||
47 | { | ||
48 | echo "$@" >> ${conf} | ||
49 | } | ||
50 | |||
51 | helper_graphic_rebuild_xorg_conf() | ||
52 | { | ||
53 | local conf="/etc/X11/xorg.conf" | ||
54 | |||
55 | # create empty conf | ||
56 | :> ${conf} | ||
57 | |||
58 | if [ -f ${SETTINGSPATH}/xorg/gfxcard ] | ||
59 | then | ||
60 | helper_graphic_addconf 'Section "Device"' | ||
61 | helper_graphic_addconf " Identifier \"Builtin Default ${value} Device 0\"" | ||
62 | helper_graphic_addconf " Driver \"${value}\"" | ||
63 | helper_graphic_addconf 'EndSection' | ||
64 | fi | ||
65 | } | ||
66 | |||
67 | # set_graphic_gfxcard ${value} | ||
68 | set_graphic_gfxcard() | ||
69 | { | ||
70 | local value="$1" | ||
71 | |||
72 | echo "${value}" > ${SETTINGSPATH}/xorg/gfxcard | ||
73 | helper_graphic_rebuild_xorg_conf | ||
74 | |||
75 | if pidof X | ||
76 | then | ||
77 | /etc/init.d/single-x11 restart | ||
78 | fi | ||
79 | } |