1 |
673 |
markom |
/*
|
2 |
|
|
* The contents of this file are subject to the Mozilla Public License
|
3 |
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
4 |
|
|
* compliance with the License. You may obtain a copy of the License at
|
5 |
|
|
* http://www.mozilla.org/MPL/
|
6 |
|
|
*
|
7 |
|
|
* Software distributed under the License is distributed on an "AS IS"
|
8 |
|
|
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
9 |
|
|
* License for the specific language governing rights and limitations
|
10 |
|
|
* under the License.
|
11 |
|
|
*
|
12 |
|
|
* The Original Code is NanoLauncher.
|
13 |
|
|
*
|
14 |
|
|
* The Initial Developer of the Original Code is Alex Holden.
|
15 |
|
|
* Portions created by Alex Holden are Copyright (C) 2000
|
16 |
|
|
* Alex Holden <alex@linuxhacker.org>. All Rights Reserved.
|
17 |
|
|
*
|
18 |
|
|
* Contributor(s):
|
19 |
|
|
*
|
20 |
|
|
* Alternatively, the contents of this file may be used under the terms
|
21 |
|
|
* of the GNU General Public license (the "[GNU] License"), in which case the
|
22 |
|
|
* provisions of [GNU] License are applicable instead of those
|
23 |
|
|
* above. If you wish to allow use of your version of this file only
|
24 |
|
|
* under the terms of the [GNU] License and not to allow others to use
|
25 |
|
|
* your version of this file under the MPL, indicate your decision by
|
26 |
|
|
* deleting the provisions above and replace them with the notice and
|
27 |
|
|
* other provisions required by the [GNU] License. If you do not delete
|
28 |
|
|
* the provisions above, a recipient may use your version of this file
|
29 |
|
|
* under either the MPL or the [GNU] License.
|
30 |
|
|
*/
|
31 |
|
|
|
32 |
|
|
#ifndef LAUNCHER_H
|
33 |
|
|
#define LAUNCHER_H
|
34 |
|
|
|
35 |
|
|
#define ITEM_WIDTH 100
|
36 |
|
|
#define ITEM_HEIGHT 60
|
37 |
|
|
#define ITEM_TEXT_COLOUR BLACK
|
38 |
|
|
#define ITEM_BORDER_COLOUR BLACK
|
39 |
|
|
#define ITEM_BACKGROUND_COLOUR LTGRAY
|
40 |
|
|
#define ICON_WIDTH 32
|
41 |
|
|
#define ICON_HEIGHT 32
|
42 |
|
|
#define ICON_X_POSITION ((ITEM_WIDTH - ICON_WIDTH) / 2)
|
43 |
|
|
#define ICON_Y_POSITION 6
|
44 |
|
|
#define TEXT_Y_POSITION (ITEM_HEIGHT - 6)
|
45 |
|
|
#define MAX_ARGUMENTS 12
|
46 |
|
|
|
47 |
|
|
struct command_argv {
|
48 |
|
|
char *command;
|
49 |
|
|
char *argv[MAX_ARGUMENTS];
|
50 |
|
|
};
|
51 |
|
|
typedef struct command_argv prog_item;
|
52 |
|
|
|
53 |
|
|
struct launcher_item {
|
54 |
|
|
char *name;
|
55 |
|
|
char *icon;
|
56 |
|
|
prog_item *prog;
|
57 |
|
|
struct launcher_item *next;
|
58 |
|
|
struct launcher_item *prev;
|
59 |
|
|
GR_IMAGE_ID iconid;
|
60 |
|
|
GR_WINDOW_ID wid;
|
61 |
|
|
};
|
62 |
|
|
typedef struct launcher_item litem;
|
63 |
|
|
|
64 |
|
|
struct screensaver_item {
|
65 |
|
|
prog_item *prog;
|
66 |
|
|
struct screensaver_item *next;
|
67 |
|
|
};
|
68 |
|
|
typedef struct screensaver_item sitem;
|
69 |
|
|
|
70 |
|
|
struct launcher_state {
|
71 |
|
|
char *config_file;
|
72 |
|
|
GR_WINDOW_ID main_window;
|
73 |
|
|
litem *litems;
|
74 |
|
|
litem *lastlitem;
|
75 |
|
|
int numlitems;
|
76 |
|
|
sitem *sitems;
|
77 |
|
|
sitem *cursitem;
|
78 |
|
|
GR_GC_ID gc;
|
79 |
|
|
GR_EVENT event;
|
80 |
|
|
int window_background_mode;
|
81 |
|
|
char *window_background_image;
|
82 |
|
|
GR_WINDOW_ID background_pixmap;
|
83 |
|
|
};
|
84 |
|
|
typedef struct launcher_state lstate;
|
85 |
|
|
|
86 |
|
|
void reaper(int signum);
|
87 |
|
|
void *my_malloc(size_t size);
|
88 |
|
|
void usage(void);
|
89 |
|
|
prog_item *make_prog_item(char *command, int lineno);
|
90 |
|
|
void set_window_background_colour(char *buf, int lineno);
|
91 |
|
|
void parse_config_line(lstate *state, char *buf, int lineno);
|
92 |
|
|
void read_config(lstate *state);
|
93 |
|
|
void draw_item(lstate *state, litem *item);
|
94 |
|
|
void handle_exposure_event(lstate *state);
|
95 |
|
|
void launch_program(prog_item *prog);
|
96 |
|
|
void handle_mouse_event(lstate *state);
|
97 |
|
|
void handle_screensaver_event(lstate *state);
|
98 |
|
|
void handle_event(lstate *state);
|
99 |
|
|
void do_event_loop(lstate *state);
|
100 |
|
|
void initialise(lstate *state);
|
101 |
|
|
|
102 |
|
|
#endif
|