4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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 USA
25 #include "arraylist.h"
26 #include "bcclipboard.inc"
27 #include "bcrepeater.inc"
28 #include "bcwindowbase.inc"
29 #include "bcwindowevents.inc"
30 #include "condition.inc"
36 #include <X11/Xatom.h>
38 #include <X11/Xft/Xft.h>
41 #include <X11/Xutil.h>
42 #include <X11/keysym.h>
43 #include <X11/cursorfont.h>
46 // For single threaded event handling
53 BC_Display(const char *display_name);
56 static Display* get_display(const char *name);
57 void new_window(BC_WindowBase *window);
58 void delete_window(BC_WindowBase *window);
59 int is_first(BC_WindowBase *window);
60 int is_event_win(XEvent *event, BC_WindowBase *window);
62 int get_event_count(BC_WindowBase *window);
63 int get_event_count();
65 void set_repeat(BC_WindowBase *window, int64_t duration);
66 void unset_repeat(BC_WindowBase *window, int64_t duration);
67 void unset_all_repeaters(BC_WindowBase *window);
68 void unlock_repeaters(int64_t duration);
69 void arm_repeat(int64_t duration);
70 void arm_completion(BC_WindowBase *window);
71 static void lock_display(const char *location);
72 static void unlock_display();
73 int get_display_locked();
75 void put_event(XEvent *event);
78 // Common events coming from X server and repeater.
79 ArrayList<XEvent*> common_events;
80 // Locks for common events
85 Condition *event_condition;
89 ArrayList<BC_WindowBase*> windows;
90 BC_WindowEvents *event_thread;
94 int translation_events;
95 // Array of repeaters for multiple repeating objects.
96 ArrayList<BC_Repeater*> repeaters;
99 static BC_Display *display_global;
100 static pthread_mutex_t display_lock;
102 // Copy of atoms which every window has.
109 BC_Clipboard *clipboard;