~ubuntu-branches/ubuntu/trusty/brightside/trusty

« back to all changes in this revision

Viewing changes to src/brightside.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-03-14 12:55:57 UTC
  • Revision ID: james.westby@ubuntu.com-20050314125557-s7vle73vmcspbi8x
Tags: upstream-1.3.2
ImportĀ upstreamĀ versionĀ 1.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* BRIGHTSIDE
 
2
 * Copyright (C) 2004 Ed Catmur <ed@catmur.co.uk>
 
3
 *
 
4
 * brightside.h
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 
 
19
 * USA.
 
20
 */
 
21
 
 
22
#ifndef __BRIGHTSIDE_H__
 
23
#define __BRIGHTSIDE_H__
 
24
 
 
25
#include <gnome.h>
 
26
#include <gconf/gconf-client.h>
 
27
 
 
28
#define DIALOG_TIMEOUT 1000     /* timeout in ms for action icon dialog */
 
29
 
 
30
#define SELECTION_NAME "_BRIGHTSIDE_SELECTION" /* X selection to communicate
 
31
                                               between daemon and capplet */
 
32
 
 
33
#define BRIGHTSIDE_KEY_ROOT "/apps/brightside"
 
34
 
 
35
#define TIMEVAL_ELAPSED_MSEC(a, b) ((((a).tv_sec - (b).tv_sec) * 1000) \
 
36
                        + (((a).tv_usec - (b).tv_usec) / 1000))
 
37
 
 
38
#if defined(__powerpc__) && defined (__linux__)
 
39
#define USE_FBLEVEL
 
40
#else
 
41
#undef USE_FBLEVEL
 
42
#endif
 
43
 
 
44
enum {
 
45
        MUTE_VOLUME_ACTION,
 
46
        NO_SCREENSAVER_ACTION,
 
47
        SCREENSAVER_ACTION,
 
48
        DPMS_STANDBY_ACTION,
 
49
        DPMS_SUSPEND_ACTION,
 
50
        DPMS_OFF_ACTION,
 
51
#ifdef USE_FBLEVEL
 
52
        DIM_BACKLIGHT_ACTION,
 
53
#endif
 
54
        CUSTOM_ACTION,
 
55
        HANDLED_ACTIONS,
 
56
};
 
57
 
 
58
/* struct GConfEnumStringPair {
 
59
 *   gint enum_value;
 
60
 *   const gchar* str;
 
61
 * }; */
 
62
const static struct {
 
63
        gint enum_value;
 
64
        const gchar *str;
 
65
        const char *description;
 
66
} actions[HANDLED_ACTIONS] = {
 
67
        { MUTE_VOLUME_ACTION, "mute",
 
68
                N_("Mute volume") },
 
69
        { NO_SCREENSAVER_ACTION, "noscreensaver",
 
70
                N_("Prevent screensaver starting") },
 
71
        { SCREENSAVER_ACTION, "screensaver",
 
72
                N_("Start screensaver") },
 
73
        { DPMS_STANDBY_ACTION, "standby",
 
74
                N_("Enter DPMS standby mode") },
 
75
        { DPMS_SUSPEND_ACTION, "suspend",
 
76
                N_("Enter DPMS suspend mode") },
 
77
        { DPMS_OFF_ACTION, "off",
 
78
                N_("Enter DPMS off mode") },
 
79
#ifdef USE_FBLEVEL
 
80
        { DIM_BACKLIGHT_ACTION, "dimbacklight",
 
81
                N_("Dim laptop backlight") },
 
82
#endif
 
83
        { CUSTOM_ACTION, "custom",
 
84
                N_("Custom action...") },
 
85
};
 
86
 
 
87
static GConfEnumStringPair actions_lookup_table[HANDLED_ACTIONS + 1] = {
 
88
        { MUTE_VOLUME_ACTION, "mute", },
 
89
        { NO_SCREENSAVER_ACTION, "noscreensaver", },
 
90
        { SCREENSAVER_ACTION, "screensaver", },
 
91
        { DPMS_STANDBY_ACTION, "standby", },
 
92
        { DPMS_SUSPEND_ACTION, "suspend", },
 
93
        { DPMS_OFF_ACTION, "off", },
 
94
#ifdef USE_FBLEVEL
 
95
        { DIM_BACKLIGHT_ACTION, "dimbacklight", },
 
96
#endif
 
97
        { CUSTOM_ACTION, "custom", },
 
98
        { -1, NULL },
 
99
};
 
100
 
 
101
/* Can change ordering as long as whole contents of this file are updated */
 
102
typedef enum { NW, SW, NE, SE, 
 
103
        TOP, BOTTOM, LEFT, RIGHT, NONE = -1 } BrightsideRegionType;
 
104
typedef BrightsideRegionType BrightsideCornerType;
 
105
#define REGION_FIRST_CORNER NW
 
106
#define REGION_IS_CORNER(r) ((r) >= NW && (r) <= SE)
 
107
#define REGION_IS_EDGE(r) ((r) >= TOP && (r) <= RIGHT)
 
108
#define REGION_ADJACENT_REGIONS(r, s) ( \
 
109
 ((r) == NW && (s) == TOP)      || ((r) == TOP &&       (s) == NE) || \
 
110
 ((r) == NE && (s) == RIGHT)    || ((r) == RIGHT &&     (s) == SE) || \
 
111
 ((r) == SE && (s) == BOTTOM)   || ((r) == BOTTOM &&    (s) == SW) || \
 
112
 ((r) == SW && (s) == LEFT)     || ((r) == LEFT &&      (s) == NW) || \
 
113
 ((s) == NW && (r) == TOP)      || ((s) == TOP &&       (r) == NE) || \
 
114
 ((s) == NE && (r) == RIGHT)    || ((s) == RIGHT &&     (r) == SE) || \
 
115
 ((s) == SE && (r) == BOTTOM)   || ((s) == BOTTOM &&    (r) == SW) || \
 
116
 ((s) == SW && (r) == LEFT)     || ((s) == LEFT &&      (r) == NW) || \
 
117
 0 )
 
118
#define REGION_CORNER_TO_ADJACENT_EDGE(r, s) ( \
 
119
 ((r) == NW && (s) == TOP)      || ((r) == NE && (s) == RIGHT) || \
 
120
 ((r) == SE && (s) == BOTTOM)   || ((r) == SW && (s) == LEFT) || \
 
121
 ((r) == NW && (s) == LEFT)     || ((r) == NE && (s) == TOP) || \
 
122
 ((r) == SE && (s) == RIGHT)    || ((r) == SW && (s) == BOTTOM) || \
 
123
 0 )
 
124
#define REGION_GESTURE_CODES "FLTJNSWE" /* corners are Graffiti strokes */
 
125
#define REGION_GESTURE_HISTORY 8
 
126
 
 
127
static struct {
 
128
        BrightsideCornerType id;
 
129
        const gchar *enabled_key;
 
130
        const char *enabled_toggle_id;
 
131
        const gchar *action_key;
 
132
        const char *action_menu_id;
 
133
        const gchar *custom_in_key;
 
134
        const gchar *custom_out_key;
 
135
        const gchar *custom_kill_key;
 
136
        gint default_action; /* see also brightside.schemas.in */
 
137
} corners[4] = {
 
138
        { NW, "/apps/brightside/nw_enabled", "nw_enabled",
 
139
                "/apps/brightside/nw_action", "nw_action",
 
140
                "/apps/brightside/nw_custom_in", "/apps/brightside/nw_custom_out",
 
141
                "/apps/brightside/nw_custom_kill", MUTE_VOLUME_ACTION, },
 
142
        { SW, "/apps/brightside/sw_enabled", "sw_enabled",
 
143
                "/apps/brightside/sw_action", "sw_action",
 
144
                "/apps/brightside/sw_custom_in", "/apps/brightside/sw_custom_out",
 
145
                "/apps/brightside/sw_custom_kill", NO_SCREENSAVER_ACTION, },
 
146
        { NE, "/apps/brightside/ne_enabled", "ne_enabled",
 
147
                "/apps/brightside/ne_action", "ne_action",
 
148
                "/apps/brightside/ne_custom_in", "/apps/brightside/ne_custom_out",
 
149
                "/apps/brightside/ne_custom_kill", SCREENSAVER_ACTION, },
 
150
        { SE, "/apps/brightside/se_enabled", "se_enabled",
 
151
                "/apps/brightside/se_action", "se_action",
 
152
                "/apps/brightside/se_custom_in", "/apps/brightside/se_custom_out",
 
153
                "/apps/brightside/se_custom_kill", DPMS_STANDBY_ACTION },
 
154
};
 
155
 
 
156
#define CORNER_DELAY_KEY "/apps/brightside/corner_delay"
 
157
#define CORNER_FLIP_KEY "/apps/brightside/corner_flip"
 
158
#define ENABLE_EDGE_FLIP_KEY "/apps/brightside/enable_edge_flip"
 
159
#define AFTER_FLIP_COMMAND_KEY "/apps/brightside/after_flip_command"
 
160
#define EDGE_DELAY_KEY "/apps/brightside/edge_delay"
 
161
#define EDGE_WRAP_KEY "/apps/brightside/edge_wrap"
 
162
#define ORIENTABLE_WORKSPACES_KEY "/apps/brightside/orientable_workspaces"
 
163
#define USE_PCM_KEY "/apps/brightside/use_pcm"
 
164
 
 
165
#define CUSTOM_SHOW_LIST_KEY "/apps/panel/profiles/default/general/show_program_list"
 
166
 
 
167
#define MOVING_WINDOW_ATOM "_NET_MOVING_WINDOW"
 
168
#define RESIZING_WINDOW_ATOM "_NET_RESIZING_WINDOW"
 
169
#define DESKTOP_LAYOUT_ATOM "_NET_DESKTOP_LAYOUT"
 
170
#define WM_MOVERESIZE_ATOM "_NET_WM_MOVERESIZE"
 
171
#define ACTIVE_WINDOW_ATOM "_NET_ACTIVE_WINDOW"
 
172
/* fragment of EWMH spec */
 
173
#define _NET_WM_MOVERESIZE_MOVE              8   /* movement only */
 
174
 
 
175
#define BRIGHTSIDE_URL PACKAGE_BUGREPORT
 
176
 
 
177
#define EASTER_EGG_GESTURE "TFLJWEWE"   /* Euro symbol */
 
178
 
 
179
#endif /* __BRIGHTSIDE_H__ */
 
180