rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.git] / cinelerra-5.1 / guicast / bcdisplay.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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  USA
19  * 
20  */
21
22 #ifndef BCDISPLAY_H
23 #define BCDISPLAY_H
24
25 #include "arraylist.h"
26 #include "bcclipboard.inc"
27 #include "bcrepeater.inc"
28 #include "bcwindowbase.inc"
29 #include "bcwindowevents.inc"
30 #include "condition.inc"
31 #include "mutex.inc"
32
33 #include <stdint.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <X11/Xatom.h>
37 #ifdef HAVE_XFT
38 #include <X11/Xft/Xft.h>
39 #endif
40 #include <X11/Xlib.h>
41 #include <X11/Xutil.h>
42 #include <X11/keysym.h>
43 #include <X11/cursorfont.h>
44 #include <pthread.h>
45
46 // For single threaded event handling
47
48
49 #ifdef SINGLE_THREAD
50 class BC_Display
51 {
52 public:
53         BC_Display(const char *display_name);
54         ~BC_Display();
55
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);
61         void handle_event();
62         int get_event_count(BC_WindowBase *window);
63         int get_event_count();
64         XEvent* get_event();
65         void set_repeat(BC_WindowBase *window, int64_t duration);
66         void unset_repeat(BC_WindowBase *window, int64_t duration);
67         int 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();
74         void loop();
75         void put_event(XEvent *event);
76         void dump_windows();
77
78 // Common events coming from X server and repeater.
79         ArrayList<XEvent*> common_events;
80 // Locks for common events
81 // Locking order:
82 // 1) event_condition
83 // 2) event_lock
84         Mutex *event_lock;
85         Condition *event_condition;
86 // 1) table_lock
87 // 2) lock_window
88 //      Mutex *table_lock;
89         ArrayList<BC_WindowBase*> windows;
90         BC_WindowEvents *event_thread;
91         int done;
92         int motion_events;
93         int resize_events;
94         int translation_events;
95 // Array of repeaters for multiple repeating objects.
96         ArrayList<BC_Repeater*> repeaters;
97
98         Display *display;
99         static BC_Display *display_global;
100         static pthread_mutex_t display_lock;
101         int window_locked;
102 // Copy of atoms which every window has.
103         Atom DelWinXAtom;
104         Atom ProtoXAtom;
105         Atom RepeaterXAtom;
106         Atom SetDoneXAtom;
107         
108         
109         BC_Clipboard *clipboard;
110 };
111 #endif
112
113
114
115
116 #endif
117
118
119