r917: Implement Asynchronous updates for awinodw, thus removing the reason for the...
[cinelerra_cv/mob.git] / guicast / bcwindowbase.h
blob9102a8e14266fe263fa3932c8cfbad4a6591f618
1 #ifndef BCWINDOWBASE_H
2 #define BCWINDOWBASE_H
4 #if defined(HAVE_CONFIG_H)
5 #include "config.h"
6 #endif
8 // Window types
10 #define MAIN_WINDOW 0
11 #define SUB_WINDOW 1
12 #define POPUP_WINDOW 2
13 #ifdef HAVE_LIBXXF86VM
14 #define VIDMODE_SCALED_WINDOW 3
15 #endif
17 #define TOOLTIP_MARGIN 2
18 #define BC_INFINITY 65536
20 #include "arraylist.h"
21 #include "bcbar.inc"
22 #include "bcbitmap.inc"
23 #include "bcbutton.inc"
24 #include "bccapture.inc"
25 #include "bcclipboard.inc"
26 #include "bcdragwindow.inc"
27 #include "bcfilebox.inc"
28 #include "bclistbox.inc"
29 #include "bcmenubar.inc"
30 #include "bcmeter.inc"
31 #include "bcpan.inc"
32 #include "bcpbuffer.inc"
33 #include "bcpixmap.inc"
34 #include "bcpopup.inc"
35 #include "bcpopupmenu.inc"
36 #include "bcpot.inc"
37 #include "bcprogress.inc"
38 #include "bcrelocatablewidget.h"
39 #include "bcrepeater.inc"
40 #include "bcresources.inc"
41 #include "bcscrollbar.inc"
42 #include "bcslider.inc"
43 #include "bcsubwindow.inc"
44 #include "bcsynchronous.inc"
45 #include "bctextbox.inc"
46 #include "bctimer.inc"
47 #include "bctitle.inc"
48 #include "bctoggle.inc"
49 #include "bctumble.inc"
50 #include "bcwidgetgrid.inc"
51 #include "bcwindow.inc"
52 #include "bcwindowbase.inc"
53 #include "bcwindowevents.inc"
54 #include "condition.inc"
55 #include "bchash.inc"
56 #include "linklist.h"
57 #include "mutex.inc"
58 #include "vframe.inc"
61 #include <stdint.h>
62 #include <stdio.h>
63 #include <stdlib.h>
64 #include <X11/Xatom.h>
65 #ifdef HAVE_XFT
66 #include <X11/Xft/Xft.h>
67 #endif
68 #include <X11/Xlib.h>
69 #include <X11/Xutil.h>
70 #include <X11/keysym.h>
71 #include <X11/cursorfont.h>
72 #ifdef HAVE_LIBXXF86VM
73 #include <X11/extensions/xf86vmode.h>
74 #endif
75 #ifdef HAVE_GL
76 #include <GL/glx.h>
77 #endif
81 #ifdef HAVE_GL
82 //typedef void* GLXContext;
83 #endif
86 // Struct for async event marshalling, the same as XClientMessageEvent currently, but can be changed if we change toolkit ever
87 // it is defined here so we don't use X headers in /cinelerra
88 typedef struct {
89 int type; /* ClientMessage */
90 unsigned long serial; /* # of last request processed by server */
91 Bool send_event; /* true if this came from a SendEvent request */
92 Display *display; /* Display the event was read from */
93 Window window;
94 Atom message_type;
95 int format;
96 union {
97 char b[20];
98 short s[10];
99 long l[5];
100 } data;
101 } xatom_event;
104 class BC_ResizeCall
106 public:
107 BC_ResizeCall(int w, int h);
108 int w, h;
112 // Windows, subwindows, popupwindows inherit from this
113 class BC_WindowBase : public BC_RelocatableWidget
115 public:
116 BC_WindowBase();
117 virtual ~BC_WindowBase();
119 friend class BC_Bar;
120 friend class BC_Bitmap;
121 friend class BC_Button;
122 friend class BC_GenericButton;
123 friend class BC_Capture;
124 friend class BC_Clipboard;
125 friend class BC_DragWindow;
126 friend class BC_FileBox;
127 friend class BC_FullScreen;
128 friend class BC_ListBox;
129 friend class BC_Menu;
130 friend class BC_MenuBar;
131 friend class BC_MenuItem;
132 friend class BC_MenuPopup;
133 friend class BC_Meter;
134 friend class BC_Pan;
135 friend class BC_PBuffer;
136 friend class BC_Pixmap;
137 friend class BC_PixmapSW;
138 friend class BC_Popup;
139 friend class BC_PopupMenu;
140 friend class BC_Pot;
141 friend class BC_ProgressBar;
142 friend class BC_Repeater;
143 friend class BC_Resources;
144 friend class BC_ScrollBar;
145 friend class BC_Slider;
146 friend class BC_SubWindow;
147 friend class BC_Synchronous;
148 friend class BC_TextBox;
149 friend class BC_Title;
150 friend class BC_Toggle;
151 friend class BC_Tumbler;
152 friend class BC_Window;
153 friend class BC_WindowEvents;
155 // Main loop
156 int run_window();
157 // Terminal event dispatchers
158 virtual int close_event();
159 virtual int resize_event(int w, int h);
160 virtual int repeat_event(int64_t duration) { return 0; };
161 virtual int focus_in_event() { return 0; };
162 virtual int focus_out_event() { return 0; };
163 virtual int button_press_event() { return 0; };
164 virtual int button_release_event() { return 0; };
165 virtual int cursor_motion_event() { return 0; };
166 virtual int cursor_leave_event();
167 virtual int cursor_enter_event();
168 virtual int keypress_event() { return 0; };
169 virtual int translation_event() { return 0; };
170 virtual int drag_start_event() { return 0; };
171 virtual int drag_motion_event() { return 0; };
172 virtual int drag_stop_event() { return 0; };
173 virtual int uses_text() { return 0; };
174 // Only if opengl is enabled
175 virtual int expose_event() { return 0; };
177 // Check if a hardware accelerated colormodel is available and reserve it
178 int accel_available(int color_model, int lock_it);
179 // Get color model adjusted for byte order and pixel size
180 int get_color_model();
181 // return the colormap pixel of the color for all bit depths
182 int get_color(int64_t color);
183 // return the currently selected color
184 int64_t get_color();
185 int show_window(int flush = 1);
186 int hide_window(int flush = 1);
187 int get_hidden();
188 int get_video_on();
189 // Shouldn't deference a pointer to delete a window if a parent is
190 // currently being deleted. This returns 1 if any parent is being deleted.
191 int get_deleting();
195 //============================= OpenGL functions ===============================
196 // OpenGL functions must be called from inside a BC_Synchronous command.
197 // Create openGL context and bind it to the current window.
198 // If it's called inside start_video/stop_video, the context is bound to the window.
199 // If it's called outside start_video/stop_video, the context is bound to the pixmap.
200 // Must be called at the beginning of any opengl routine to make sure
201 // the context is current.
202 // No locking is performed.
203 void enable_opengl();
204 void disable_opengl();
205 void flip_opengl();
207 // Calls the BC_Synchronous version of the function with the window_id.
208 // Not run in OpenGL thread because it has its own lock.
209 unsigned int get_shader(char *title, int *got_it);
210 void put_shader(unsigned int handle, char *title);
213 int flash(int x, int y, int w, int h, int flush = 1);
214 int flash(int flush = 1);
215 void flush();
216 void sync_display();
217 // Lock out other threads
218 int lock_window(char *location = 0);
219 int unlock_window();
220 int get_window_lock();
222 BC_MenuBar* add_menubar(BC_MenuBar *menu_bar);
223 BC_WindowBase* add_subwindow(BC_WindowBase *subwindow);
224 BC_WindowBase* add_tool(BC_WindowBase *subwindow);
225 BC_WidgetGrid* add_widgetgrid(BC_WidgetGrid *widgetgrid);
228 static BC_Resources* get_resources();
229 // User must create synchronous object first
230 static BC_Synchronous* get_synchronous();
232 // Dimensions
233 virtual int get_w();
234 virtual int get_h();
235 virtual int get_x();
236 virtual int get_y();
237 virtual int reposition_widgets(){ printf("foo1"); return 0; }
238 int get_root_w(int ignore_dualhead = 0, int lock_display = 0);
239 int get_root_h(int lock_display);
240 // Get current position
241 int get_abs_cursor_x(int lock_window);
242 int get_abs_cursor_y(int lock_window);
243 int get_relative_cursor_x();
244 int get_relative_cursor_y();
245 // Return 1 if cursor is over an unobscured part of this window.
246 // An argument is provided for excluding a drag popup
247 int get_cursor_over_window();
248 // For traversing windows... return 1 if this or any subwindow is win
249 int match_window(Window win);
251 // 1 or 0 if a button is down
252 int get_button_down();
253 // Number of button pressed 1 - 5
254 int get_buttonpress();
255 int get_has_focus();
256 int get_dragging();
257 int get_keypress();
258 // Get cursor position of last event
259 int get_cursor_x();
260 int get_cursor_y();
261 // Cursor position of drag start
262 int get_drag_x();
263 int get_drag_y();
264 int relative_cursor_x(BC_WindowBase *pov);
265 int relative_cursor_y(BC_WindowBase *pov);
266 int alt_down();
267 int shift_down();
268 int ctrl_down();
269 int get_double_click();
270 // Bottom right corner
271 int get_x2();
272 int get_y2();
273 int get_bg_color();
274 BC_Pixmap* get_bg_pixmap();
275 int get_text_ascent(int font);
276 int get_text_descent(int font);
277 int get_text_height(int font, char *text = 0);
278 int get_text_width(int font, char *text, int length = -1);
279 BC_Clipboard* get_clipboard();
280 void set_dragging(int value);
281 int set_w(int w);
282 int set_h(int h);
283 BC_WindowBase* get_top_level();
284 BC_WindowBase* get_parent();
285 // Event happened in this window
286 int is_event_win();
287 int cursor_inside();
288 // Deactivate everything and activate this subwindow
289 virtual int activate();
290 // Deactivate this subwindow
291 virtual int deactivate();
292 void set_active_subwindow(BC_WindowBase *subwindow);
293 // Get value of toggle value when dragging a selection
294 int get_toggle_value();
295 // Get if toggle is being dragged
296 int get_toggle_drag();
298 // Set the gc to the color
299 void set_color(int64_t color);
300 int get_bgcolor();
301 void set_font(int font);
302 // Set the cursor to a macro from cursors.h
303 // Set override if the caller is enabling hourglass or hiding the cursor
304 void set_cursor(int cursor, int override = 0);
305 // Set the cursor to a character in the X cursor library. Used by test.C
306 void set_x_cursor(int cursor);
307 int get_cursor();
308 // Shows the cursor after it's hidden by video playback
309 void unhide_cursor();
310 // Called by video updating routines to hide the cursor after a timeout
311 void update_video_cursor();
313 // Entry point for starting hourglass.
314 // Converts all cursors and saves the previous cursor.
315 void start_hourglass();
316 void stop_hourglass();
318 // Recursive part of hourglass commands.
319 void start_hourglass_recursive();
320 void stop_hourglass_recursive();
322 // Drawing
323 void copy_area(int x1, int y1, int x2, int y2, int w, int h, BC_Pixmap *pixmap = 0);
324 void clear_box(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
325 void draw_box(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
326 void draw_circle(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
327 void draw_disc(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
328 void draw_text(int x, int y, char *text, int length = -1, BC_Pixmap *pixmap = 0);
329 void draw_xft_text(int x,
330 int y,
331 char *text,
332 int length,
333 BC_Pixmap *pixmap,
334 int x2,
335 int k,
336 int y2,
337 int j,
338 int i);
339 void draw_center_text(int x, int y, char *text, int length = -1);
340 void draw_line(int x1, int y1, int x2, int y2, BC_Pixmap *pixmap = 0);
341 void draw_polygon(ArrayList<int> *x, ArrayList<int> *y, BC_Pixmap *pixmap = 0);
342 void draw_rectangle(int x, int y, int w, int h);
343 void draw_3segment(int x,
344 int y,
345 int w,
346 int h,
347 BC_Pixmap *left_image,
348 BC_Pixmap *mid_image,
349 BC_Pixmap *right_image,
350 BC_Pixmap *pixmap = 0);
351 void draw_3segment(int x,
352 int y,
353 int w,
354 int h,
355 VFrame *left_image,
356 VFrame *mid_image,
357 VFrame *right_image,
358 BC_Pixmap *pixmap = 0);
359 // For drawing a changing level
360 void draw_3segmenth(int x,
361 int y,
362 int w,
363 int total_x,
364 int total_w,
365 VFrame *image,
366 BC_Pixmap *pixmap);
367 void draw_3segmenth(int x,
368 int y,
369 int w,
370 int total_x,
371 int total_w,
372 BC_Pixmap *src,
373 BC_Pixmap *dst = 0);
374 void draw_3segmentv(int x,
375 int y,
376 int h,
377 int total_y,
378 int total_h,
379 BC_Pixmap *src,
380 BC_Pixmap *dst = 0);
381 void draw_3segmentv(int x,
382 int y,
383 int h,
384 int total_y,
385 int total_h,
386 VFrame *src,
387 BC_Pixmap *dst = 0);
388 // For drawing a single level
389 void draw_3segmenth(int x,
390 int y,
391 int w,
392 VFrame *image,
393 BC_Pixmap *pixmap = 0);
394 void draw_3segmenth(int x,
395 int y,
396 int w,
397 BC_Pixmap *src,
398 BC_Pixmap *dst = 0);
399 void draw_3segmentv(int x,
400 int y,
401 int h,
402 BC_Pixmap *src,
403 BC_Pixmap *dst = 0);
404 void draw_3segmentv(int x,
405 int y,
406 int h,
407 VFrame *src,
408 BC_Pixmap *dst = 0);
409 void draw_9segment(int x,
410 int y,
411 int w,
412 int h,
413 VFrame *src,
414 BC_Pixmap *dst = 0);
415 void draw_9segment(int x,
416 int y,
417 int w,
418 int h,
419 BC_Pixmap *src,
420 BC_Pixmap *dst = 0);
421 void draw_3d_box(int x,
422 int y,
423 int w,
424 int h,
425 int light1,
426 int light2,
427 int middle,
428 int shadow1,
429 int shadow2,
430 BC_Pixmap *pixmap = 0);
431 void draw_3d_border(int x, int y, int w, int h,
432 int light1, int light2, int shadow1, int shadow2);
433 void draw_colored_box(int x, int y, int w, int h, int down, int highlighted);
434 void draw_check(int x, int y);
435 void draw_triangle_down_flat(int x, int y, int w, int h);
436 void draw_triangle_up(int x, int y, int w, int h,
437 int light1, int light2, int middle, int shadow1, int shadow2);
438 void draw_triangle_down(int x, int y, int w, int h,
439 int light1, int light2, int middle, int shadow1, int shadow2);
440 void draw_triangle_left(int x, int y, int w, int h,
441 int light1, int light2, int middle, int shadow1, int shadow2);
442 void draw_triangle_right(int x, int y, int w, int h,
443 int light1, int light2, int middle, int shadow1, int shadow2);
444 // Set the gc to opaque
445 void set_opaque();
446 void set_inverse();
447 void set_background(VFrame *bitmap);
448 // Change the window title. The title is translated internally.
449 void set_title(char *text);
450 char* get_title();
451 void start_video();
452 void stop_video();
453 int get_id();
454 void set_done(int return_value);
455 // Get a bitmap to draw on the window with
456 BC_Bitmap* new_bitmap(int w, int h, int color_model = -1);
457 // Draw a bitmap on the window
458 void draw_bitmap(BC_Bitmap *bitmap,
459 int dont_wait,
460 int dest_x = 0,
461 int dest_y = 0,
462 int dest_w = 0,
463 int dest_h = 0,
464 int src_x = 0,
465 int src_y = 0,
466 int src_w = 0,
467 int src_h = 0,
468 BC_Pixmap *pixmap = 0);
469 void draw_pixel(int x, int y, BC_Pixmap *pixmap = 0);
470 // Draw a pixmap on the window
471 void draw_pixmap(BC_Pixmap *pixmap,
472 int dest_x = 0,
473 int dest_y = 0,
474 int dest_w = -1,
475 int dest_h = -1,
476 int src_x = 0,
477 int src_y = 0,
478 BC_Pixmap *dst = 0);
479 // Draw a vframe on the window
480 void draw_vframe(VFrame *frame,
481 int dest_x = 0,
482 int dest_y = 0,
483 int dest_w = -1,
484 int dest_h = -1,
485 int src_x = 0,
486 int src_y = 0,
487 int src_w = 0,
488 int src_h = 0,
489 BC_Pixmap *pixmap = 0);
490 void draw_border(char *text, int x, int y, int w, int h);
491 // Draw a region of the background
492 void draw_top_background(BC_WindowBase *parent_window, int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
493 void draw_top_tiles(BC_WindowBase *parent_window, int x, int y, int w, int h);
494 void draw_background(int x, int y, int w, int h);
495 void draw_tiles(BC_Pixmap *tile,
496 int origin_x,
497 int origin_y,
498 int x,
499 int y,
500 int w,
501 int h);
502 void slide_left(int distance);
503 void slide_right(int distance);
504 void slide_up(int distance);
505 void slide_down(int distance);
507 int cycle_textboxes(int amount);
509 int raise_window(int do_flush = 1);
510 int set_tooltips(int tooltips_enabled);
511 int resize_window(int w, int h);
512 int reposition_widget(int x, int y, int w = -1, int h = -1);
513 int reposition_window(int x, int y, int w = -1, int h = -1);
514 // Cause a repeat event to be dispatched every duration.
515 // duration is milliseconds
516 int set_repeat(int64_t duration);
517 // Stop a repeat event from being dispatched.
518 int unset_repeat(int64_t duration);
519 int set_tooltip(char *text);
520 int show_tooltip(int w = -1, int h = -1);
521 int hide_tooltip();
522 int set_icon(VFrame *data);
523 int load_defaults(BC_Hash *defaults);
524 int save_defaults(BC_Hash *defaults);
526 #ifdef HAVE_LIBXXF86VM
527 // Mode switch methods.
528 void closest_vm(int *vm, int *width, int *height);
529 void scale_vm(int vm);
530 void restore_vm();
531 #endif
534 int test_keypress;
537 private:
538 // Create a window
539 virtual int create_window(BC_WindowBase *parent_window,
540 char *title,
541 int x,
542 int y,
543 int w,
544 int h,
545 int minw,
546 int minh,
547 int allow_resize,
548 int private_color,
549 int hide,
550 int bg_color,
551 char *display_name,
552 int window_type,
553 BC_Pixmap *bg_pixmap,
554 int group_it);
556 static Display* init_display(char *display_name);
557 // Get display from top level
558 Display* get_display();
559 int get_screen();
560 virtual int initialize();
561 int get_atoms();
562 // Create custom atoms to be used for async messages between windows
563 virtual int create_custom_xatoms();
564 // Function to overload to recieve customly defined atoms
565 virtual int recieve_custom_xatoms(xatom_event *event);
567 void init_cursors();
568 int init_colors();
569 int init_window_shape();
570 static int evaluate_color_model(int client_byte_order, int server_byte_order, int depth);
571 int create_private_colors();
572 int create_color(int color);
573 int create_shared_colors();
574 // Get width of a single line. Used by get_text_width
575 int get_single_text_width(int font, char *text, int length);
576 int allocate_color_table();
577 int init_gc();
578 int init_fonts();
579 void init_xft();
580 int get_color_rgb8(int color);
581 int64_t get_color_rgb16(int color);
582 int64_t get_color_bgr16(int color);
583 int64_t get_color_bgr24(int color);
584 XFontStruct* get_font_struct(int font);
585 #ifdef HAVE_XFT
586 XftFont* get_xft_struct(int font);
587 #endif
588 Cursor get_cursor_struct(int cursor);
589 XFontSet get_fontset(int font);
590 XFontSet get_curr_fontset(void);
591 void set_fontset(int font);
592 int dispatch_event();
594 int get_key_masks(XEvent *event);
596 int trigger_tooltip();
597 int untrigger_tooltip();
598 void draw_tooltip();
599 int arm_repeat(int64_t duration);
600 // delete all repeater opjects for a close
601 int unset_all_repeaters();
603 // Block and get event from common events.
604 XEvent* get_event();
605 // Return number of events in table.
606 int get_event_count();
607 // Put event in common events.
608 void put_event(XEvent *event);
610 // Recursive event dispatchers
611 int dispatch_resize_event(int w, int h);
612 int dispatch_focus_in();
613 int dispatch_focus_out();
614 int dispatch_motion_event();
615 int dispatch_keypress_event();
616 int dispatch_repeat_event(int64_t duration);
617 int dispatch_repeat_event_master(int64_t duration);
618 int dispatch_button_press();
619 int dispatch_button_release();
620 int dispatch_cursor_leave();
621 int dispatch_cursor_enter();
622 int dispatch_translation_event();
623 int dispatch_drag_start();
624 int dispatch_drag_motion();
625 int dispatch_drag_stop();
626 int dispatch_expose_event();
628 // Get the port ID for a color model or return -1 for failure
629 int grab_port_id(BC_WindowBase *window, int color_model);
631 int find_next_textbox(BC_WindowBase **first_textbox, BC_WindowBase **next_textbox, int &result);
632 int find_prev_textbox(BC_WindowBase **last_textbox, BC_WindowBase **prev_textbox, int &result);
635 void translate_coordinates(Window src_w,
636 Window dest_w,
637 int src_x,
638 int src_y,
639 int *dest_x_return,
640 int *dest_y_return);
642 // Top level window above this window
643 BC_WindowBase* top_level;
644 // Window just above this window
645 BC_WindowBase* parent_window;
646 // list of window bases in this window
647 BC_SubWindowList* subwindows;
648 // list of window bases in this window
649 BC_WidgetGridList* widgetgrids;
650 // Position of window
651 int x, y, w, h;
652 // Default colors
653 int light1, light2, medium, dark1, dark2, bg_color;
654 // Type of window defined above
655 int window_type;
656 // Pointer to the active menubar in the window.
657 BC_MenuBar* active_menubar;
658 // pointer to the active popup menu in the window
659 BC_PopupMenu* active_popup_menu;
660 // pointer to the active subwindow
661 BC_WindowBase* active_subwindow;
663 // Window parameters
664 int allow_resize;
665 int hidden, private_color, bits_per_pixel, color_model;
666 int server_byte_order, client_byte_order;
667 // number of colors in color table
668 int total_colors;
669 // last color found in table
670 int current_color_value, current_color_pixel;
671 // table for every color allocated
672 int color_table[256][2];
673 // Turn on optimization
674 int video_on;
675 // Event handler completion
676 int done;
677 // Return value of event handler
678 int return_value;
679 // Motion event compression
680 int motion_events, last_motion_x, last_motion_y;
681 // window of buffered motion
682 Window last_motion_win;
683 // Resize event compression
684 int resize_events, last_resize_w, last_resize_h;
685 int translation_events, last_translate_x, last_translate_y;
686 int prev_x, prev_y;
687 // Since the window manager automatically translates the window at boot,
688 // use the first translation event to get correction factors
689 int translation_count;
690 int x_correction, y_correction;
691 // Key masks
692 int ctrl_mask, shift_mask, alt_mask;
693 // Cursor motion information
694 int cursor_x, cursor_y;
695 // Button status information
696 int button_down, button_number;
697 // When button was pressed and whether it qualifies as a double click
698 uint64_t button_time1, button_time2;
699 int double_click;
700 // Which button is down. 1, 2, 3, 4, 5
701 int button_pressed;
702 // Last key pressed
703 int key_pressed;
704 // During a selection drag involving toggles, set the same value for each toggle
705 int toggle_value;
706 int toggle_drag;
707 // Whether the window has the focus
708 int has_focus;
710 static BC_Resources resources;
711 // Array of repeaters for multiple repeating objects.
712 ArrayList<BC_Repeater*> repeaters;
713 // int64_t next_repeat_id;
714 // Text for tooltip if one exists
715 char tooltip_text[BCTEXTLEN];
716 // If the current window's tooltip is visible
717 int tooltip_on;
718 // Repeat ID of tooltip
719 // int64_t tooltip_id;
720 // Popup window for tooltip
721 BC_Popup *tooltip_popup;
722 // If this subwindow has already shown a tooltip since the last EnterNotify
723 int tooltip_done;
724 // If the tooltip shouldn't be hidden
725 int persistant_tooltip;
729 // Font sets
730 XFontSet largefontset, mediumfontset, smallfontset, curr_fontset;
732 // Fonts
733 int current_font;
734 XFontStruct *largefont, *mediumfont, *smallfont;
736 // Must be void so users don't need to include the wrong libpng version.
737 void *largefont_xft, *mediumfont_xft, *smallfont_xft;
740 int64_t current_color;
741 // Coordinate of drag start
742 int drag_x, drag_y;
743 // Boundaries the cursor must pass to start a drag
744 int drag_x1, drag_x2, drag_y1, drag_y2;
745 // Dragging is specific to the subwindow
746 int is_dragging;
747 // Don't delete the background pixmap
748 int shared_bg_pixmap;
749 char title[BCTEXTLEN];
751 // X Window parameters
752 int screen;
753 Window rootwin;
754 // windows previous events happened in
755 Window event_win, drag_win;
756 Visual *vis;
757 Colormap cmap;
758 // Display for all synchronous operations
759 Display *display;
760 // Display to send events on
761 Display *event_display;
762 Window win;
763 #ifdef HAVE_GL
764 // The first context to be created and the one whose texture id
765 // space is shared with the other contexts.
766 GLXContext gl_win_context;
767 #endif
768 int window_lock;
769 GC gc;
770 // Depth given by the X Server
771 int default_depth;
772 Atom DelWinXAtom;
773 Atom ProtoXAtom;
774 Atom RepeaterXAtom;
775 Atom SetDoneXAtom;
776 // Number of times start_hourglass was called
777 int hourglass_total;
778 // Cursor set by last set_cursor which wasn't an hourglass or transparent.
779 int current_cursor;
780 // If hourglass overrides current cursor. Only effective in top level.
781 int is_hourglass;
782 // If transparent overrides all cursors. Only effective in subwindow.
783 int is_transparent;
784 Cursor arrow_cursor;
785 Cursor cross_cursor;
786 Cursor ibeam_cursor;
787 Cursor vseparate_cursor;
788 Cursor hseparate_cursor;
789 Cursor move_cursor;
790 Cursor temp_cursor;
791 Cursor left_cursor;
792 Cursor right_cursor;
793 Cursor upright_arrow_cursor;
794 Cursor upleft_resize_cursor;
795 Cursor upright_resize_cursor;
796 Cursor downleft_resize_cursor;
797 Cursor downright_resize_cursor;
798 Cursor hourglass_cursor;
799 Cursor transparent_cursor;
801 int xvideo_port_id;
802 ArrayList<BC_ResizeCall*> resize_history;
803 // Back buffer
804 BC_Pixmap *pixmap;
805 // Background tile if tiled
806 BC_Pixmap *bg_pixmap;
807 // Icon
808 BC_Popup *icon_window;
809 BC_Pixmap *icon_pixmap;
810 // Temporary
811 BC_Bitmap *temp_bitmap;
812 // Clipboard
813 BC_Clipboard *clipboard;
814 #ifdef HAVE_LIBXXF86VM
815 // Mode switch information.
816 int vm_switched;
817 XF86VidModeModeInfo orig_modeline;
818 #endif
820 // Common events coming from X server and repeater.
821 ArrayList<XEvent*> common_events;
822 // Locks for common events
823 // Locking order:
824 // 1) event_condition
825 // 2) event_lock
826 Mutex *event_lock;
827 Condition *event_condition;
828 BC_WindowEvents *event_thread;
829 int is_deleting;
830 // Hide cursor when video is enabled
831 Timer *cursor_timer;
832 // unique ID of window.
833 int id;
835 protected:
836 Atom create_xatom(char *atom_name);
837 int send_custom_xatom(xatom_event *event);
843 #endif