OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [mw/] [src/] [demos/] [nanowm/] [events.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 673 markom
/*
2
 * NanoWM - Window Manager for Nano-X
3
 *
4
 * Copyright (C) 2000 Greg Haerr <greg@censoft.com>
5
 * Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
6
 */
7
#include <stdio.h>
8
#include <stdlib.h>
9
#define MWINCLUDECOLORS
10
#include "nano-X.h"
11
/* Uncomment this if you want debugging output from this file */
12
/*#define DEBUG*/
13
 
14
#include "nanowm.h"
15
 
16
void do_exposure(GR_EVENT_EXPOSURE *event)
17
{
18
        win *window;
19
 
20
        Dprintf("do_exposure: wid %d, x %d, y %d, width %d, height %d\n",
21
                event->wid, event->x, event->y, event->width, event->height);
22
 
23
        if(!(window = find_window(event->wid))) return;
24
 
25
        switch(window->type) {
26
                case WINDOW_TYPE_CONTAINER:
27
                        container_exposure(window, event);
28
                        break;
29
                default:
30
                        printf("Unhandled exposure on window %d "
31
                                "(type %d)\n", window->wid, window->type);
32
                        break;
33
        }
34
 
35
}
36
 
37
void do_button_down(GR_EVENT_BUTTON *event)
38
{
39
        win *window;
40
 
41
        Dprintf("do_button_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
42
                "y %d, buttons %d, changebuttons %d, modifiers %d\n",
43
                event->wid, event->subwid, event->rootx, event->rooty, event->x,
44
                event->y, event->buttons, event->changebuttons,
45
                event->modifiers);
46
 
47
        if(!(window = find_window(event->wid))) return;
48
 
49
        switch(window->type) {
50
                case WINDOW_TYPE_CONTAINER:
51
                        container_buttondown(window, event);
52
                        break;
53
                default:
54
                        printf("Unhandled button down on window %d "
55
                                "(type %d)\n", window->wid, window->type);
56
                        break;
57
        }
58
}
59
 
60
void do_button_up(GR_EVENT_BUTTON *event)
61
{
62
        win *window;
63
 
64
        Dprintf("do_button_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
65
                "y %d, buttons %d, changebuttons %d, modifiers %d\n",
66
                event->wid, event->subwid, event->rootx, event->rooty, event->x,
67
                event->y, event->buttons, event->changebuttons,
68
                event->modifiers);
69
 
70
        if(!(window = find_window(event->wid))) return;
71
 
72
        switch(window->type) {
73
                case WINDOW_TYPE_CONTAINER:
74
                        container_buttonup(window, event);
75
                        break;
76
                default:
77
                        printf("Unhandled button up on window %d "
78
                                "(type %d)\n", window->wid, window->type);
79
                        break;
80
        }
81
}
82
 
83
void do_mouse_enter(GR_EVENT_GENERAL *event)
84
{
85
        win *window;
86
 
87
        Dprintf("do_mouse_enter: wid %d\n", event->wid);
88
 
89
        if(!(window = find_window(event->wid)))
90
                return;
91
 
92
        switch(window->type) {
93
                default:
94
                        printf("Unhandled mouse enter from window %d "
95
                                "(type %d)\n", window->wid, window->type);
96
                        break;
97
        }
98
}
99
 
100
void do_mouse_exit(GR_EVENT_GENERAL *event)
101
{
102
        win *window;
103
 
104
        Dprintf("do_mouse_exit: wid %d\n", event->wid);
105
 
106
        if(!(window = find_window(event->wid))) return;
107
 
108
        switch(window->type) {
109
                default:
110
                        printf("Unhandled mouse exit from window %d "
111
                                "(type %d)\n", window->wid, window->type);
112
                        break;
113
        }
114
}
115
 
116
void do_mouse_moved(GR_EVENT_MOUSE *event)
117
{
118
        win *window;
119
 
120
        Dprintf("do_mouse_moved: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
121
                "y %d, buttons %d, modifiers %d\n", event->wid, event->subwid,
122
                event->rootx, event->rooty, event->x, event->y, event->buttons,
123
                event->modifiers);
124
 
125
        if(!(window = find_window(event->wid))) return;
126
 
127
        switch(window->type) {
128
                case WINDOW_TYPE_CONTAINER:
129
                        container_mousemoved(window, event);
130
                        break;
131
                default:
132
                        printf("Unhandled mouse movement in window %d "
133
                                "(type %d)\n", window->wid, window->type);
134
                        break;
135
        }
136
}
137
 
138
void do_focus_in(GR_EVENT_GENERAL *event)
139
{
140
        win *window;
141
 
142
        printf("do_focus_in: wid %d\n", event->wid);
143
 
144
        if(!(window = find_window(event->wid)))
145
                return;
146
 
147
        switch(window->type) {
148
                default:
149
                        printf("Unhandled focus in from window %d "
150
                                "(type %d)\n", window->wid, window->type);
151
                        break;
152
        }
153
}
154
 
155
void do_key_down(GR_EVENT_KEYSTROKE *event)
156
{
157
        Dprintf("do_key_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
158
                "y %d, buttons %d, modifiers %d, uch %lu, special %d, "
159
                "ch %d, content %d\n", event->wid, event->subwid, event->rootx,
160
                event->rooty, event->x, event->y, event->buttons,
161
                event->modifiers, event->uch, event->special, event->ch,
162
                event->content);
163
 
164
        /* FIXME: Implement keyboard shortcuts */
165
}
166
 
167
void do_key_up(GR_EVENT_KEYSTROKE *event)
168
{
169
        Dprintf("do_key_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
170
                "y %d, buttons %d, modifiers %d, uch %lu, special %d, "
171
                "ch %d, content %d\n", event->wid, event->subwid, event->rootx,
172
                event->rooty, event->x, event->y, event->buttons,
173
                event->modifiers, event->uch, event->special, event->ch,
174
                event->content);
175
}
176
 
177
void do_update(GR_EVENT_UPDATE *event)
178
{
179
        win *window;
180
 
181
        Dprintf("do_update: wid %d, subwid %d, x %d, y %d, width %d, height %d, "
182
                "utype %d\n", event->wid, event->subwid, event->x, event->y, event->width,
183
                event->height, event->utype);
184
 
185
        if(!(window = find_window(event->subwid))) {
186
                if (event->utype == GR_UPDATE_MAP)
187
                        new_client_window(event->subwid);
188
                return;
189
        }
190
 
191
        if(window->type == WINDOW_TYPE_CONTAINER) {
192
                if (event->utype == GR_UPDATE_ACTIVATE)
193
                        redraw_ncarea(window);
194
                return;
195
        }
196
 
197
        if(window->type != WINDOW_TYPE_CLIENT)
198
                return;
199
 
200
        if(event->utype == GR_UPDATE_DESTROY)
201
                client_window_destroy(window);
202
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.