Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / guicast / bcwindowbase.h
bloba2a15c74b09a2c45c54b203361afd84642400d03
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("this window isn't handled properly\n"); 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 // Function to overload to recieve customly defined atoms
563 virtual int recieve_custom_xatoms(xatom_event *event);
565 void init_cursors();
566 int init_colors();
567 int init_window_shape();
568 static int evaluate_color_model(int client_byte_order, int server_byte_order, int depth);
569 int create_private_colors();
570 int create_color(int color);
571 int create_shared_colors();
572 // Get width of a single line. Used by get_text_width
573 int get_single_text_width(int font, char *text, int length);
574 int allocate_color_table();
575 int init_gc();
576 int init_fonts();
577 void init_xft();
578 int get_color_rgb8(int color);
579 int64_t get_color_rgb16(int color);
580 int64_t get_color_bgr16(int color);
581 int64_t get_color_bgr24(int color);
582 XFontStruct* get_font_struct(int font);
583 #ifdef HAVE_XFT
584 XftFont* get_xft_struct(int font);
585 #endif
586 Cursor get_cursor_struct(int cursor);
587 XFontSet get_fontset(int font);
588 XFontSet get_curr_fontset(void);
589 void set_fontset(int font);
590 int dispatch_event();
592 int get_key_masks(XEvent *event);
594 int trigger_tooltip();
595 int untrigger_tooltip();
596 void draw_tooltip();
597 int arm_repeat(int64_t duration);
598 // delete all repeater opjects for a close
599 int unset_all_repeaters();
601 // Block and get event from common events.
602 XEvent* get_event();
603 // Return number of events in table.
604 int get_event_count();
605 // Put event in common events.
606 void put_event(XEvent *event);
608 // Recursive event dispatchers
609 int dispatch_resize_event(int w, int h);
610 int dispatch_focus_in();
611 int dispatch_focus_out();
612 int dispatch_motion_event();
613 int dispatch_keypress_event();
614 int dispatch_repeat_event(int64_t duration);
615 int dispatch_repeat_event_master(int64_t duration);
616 int dispatch_button_press();
617 int dispatch_button_release();
618 int dispatch_cursor_leave();
619 int dispatch_cursor_enter();
620 int dispatch_translation_event();
621 int dispatch_drag_start();
622 int dispatch_drag_motion();
623 int dispatch_drag_stop();
624 int dispatch_expose_event();
626 // Get the port ID for a color model or return -1 for failure
627 int grab_port_id(BC_WindowBase *window, int color_model);
629 int find_next_textbox(BC_WindowBase **first_textbox, BC_WindowBase **next_textbox, int &result);
630 int find_prev_textbox(BC_WindowBase **last_textbox, BC_WindowBase **prev_textbox, int &result);
633 void translate_coordinates(Window src_w,
634 Window dest_w,
635 int src_x,
636 int src_y,
637 int *dest_x_return,
638 int *dest_y_return);
640 // Top level window above this window
641 BC_WindowBase* top_level;
642 // Window just above this window
643 BC_WindowBase* parent_window;
644 // list of window bases in this window
645 BC_SubWindowList* subwindows;
646 // list of window bases in this window
647 BC_WidgetGridList* widgetgrids;
648 // Position of window
649 int x, y, w, h;
650 // Default colors
651 int light1, light2, medium, dark1, dark2, bg_color;
652 // Type of window defined above
653 int window_type;
654 // Pointer to the active menubar in the window.
655 BC_MenuBar* active_menubar;
656 // pointer to the active popup menu in the window
657 BC_PopupMenu* active_popup_menu;
658 // pointer to the active subwindow
659 BC_WindowBase* active_subwindow;
661 // Window parameters
662 int allow_resize;
663 int hidden, private_color, bits_per_pixel, color_model;
664 int server_byte_order, client_byte_order;
665 // number of colors in color table
666 int total_colors;
667 // last color found in table
668 int current_color_value, current_color_pixel;
669 // table for every color allocated
670 int color_table[256][2];
671 // Turn on optimization
672 int video_on;
673 // Event handler completion
674 int done;
675 // Return value of event handler
676 int return_value;
677 // Motion event compression
678 int motion_events, last_motion_x, last_motion_y;
679 // window of buffered motion
680 Window last_motion_win;
681 // Resize event compression
682 int resize_events, last_resize_w, last_resize_h;
683 int translation_events, last_translate_x, last_translate_y;
684 int prev_x, prev_y;
685 // Since the window manager automatically translates the window at boot,
686 // use the first translation event to get correction factors
687 int translation_count;
688 int x_correction, y_correction;
689 // Key masks
690 int ctrl_mask, shift_mask, alt_mask;
691 // Cursor motion information
692 int cursor_x, cursor_y;
693 // Button status information
694 int button_down, button_number;
695 // When button was pressed and whether it qualifies as a double click
696 uint64_t button_time1, button_time2;
697 int double_click;
698 // Which button is down. 1, 2, 3, 4, 5
699 int button_pressed;
700 // Last key pressed
701 int key_pressed;
702 // During a selection drag involving toggles, set the same value for each toggle
703 int toggle_value;
704 int toggle_drag;
705 // Whether the window has the focus
706 int has_focus;
708 static BC_Resources resources;
709 // Array of repeaters for multiple repeating objects.
710 ArrayList<BC_Repeater*> repeaters;
711 // int64_t next_repeat_id;
712 // Text for tooltip if one exists
713 char tooltip_text[BCTEXTLEN];
714 // If the current window's tooltip is visible
715 int tooltip_on;
716 // Repeat ID of tooltip
717 // int64_t tooltip_id;
718 // Popup window for tooltip
719 BC_Popup *tooltip_popup;
720 // If this subwindow has already shown a tooltip since the last EnterNotify
721 int tooltip_done;
722 // If the tooltip shouldn't be hidden
723 int persistant_tooltip;
727 // Font sets
728 XFontSet largefontset, mediumfontset, smallfontset, curr_fontset;
730 // Fonts
731 int current_font;
732 XFontStruct *largefont, *mediumfont, *smallfont;
734 // Must be void so users don't need to include the wrong libpng version.
735 void *largefont_xft, *mediumfont_xft, *smallfont_xft;
738 int64_t current_color;
739 // Coordinate of drag start
740 int drag_x, drag_y;
741 // Boundaries the cursor must pass to start a drag
742 int drag_x1, drag_x2, drag_y1, drag_y2;
743 // Dragging is specific to the subwindow
744 int is_dragging;
745 // Don't delete the background pixmap
746 int shared_bg_pixmap;
747 char title[BCTEXTLEN];
749 // X Window parameters
750 int screen;
751 Window rootwin;
752 // windows previous events happened in
753 Window event_win, drag_win;
754 Visual *vis;
755 Colormap cmap;
756 // Display for all synchronous operations
757 Display *display;
758 // Display to send events on
759 Display *event_display;
760 Window win;
761 #ifdef HAVE_GL
762 // The first context to be created and the one whose texture id
763 // space is shared with the other contexts.
764 GLXContext gl_win_context;
765 #endif
766 int window_lock;
767 GC gc;
768 // Depth given by the X Server
769 int default_depth;
770 Atom DelWinXAtom;
771 Atom ProtoXAtom;
772 Atom RepeaterXAtom;
773 Atom SetDoneXAtom;
774 // Number of times start_hourglass was called
775 int hourglass_total;
776 // Cursor set by last set_cursor which wasn't an hourglass or transparent.
777 int current_cursor;
778 // If hourglass overrides current cursor. Only effective in top level.
779 int is_hourglass;
780 // If transparent overrides all cursors. Only effective in subwindow.
781 int is_transparent;
782 Cursor arrow_cursor;
783 Cursor cross_cursor;
784 Cursor ibeam_cursor;
785 Cursor vseparate_cursor;
786 Cursor hseparate_cursor;
787 Cursor move_cursor;
788 Cursor temp_cursor;
789 Cursor left_cursor;
790 Cursor right_cursor;
791 Cursor upright_arrow_cursor;
792 Cursor upleft_resize_cursor;
793 Cursor upright_resize_cursor;
794 Cursor downleft_resize_cursor;
795 Cursor downright_resize_cursor;
796 Cursor hourglass_cursor;
797 Cursor transparent_cursor;
799 int xvideo_port_id;
800 ArrayList<BC_ResizeCall*> resize_history;
801 // Back buffer
802 BC_Pixmap *pixmap;
803 // Background tile if tiled
804 BC_Pixmap *bg_pixmap;
805 // Icon
806 BC_Popup *icon_window;
807 BC_Pixmap *icon_pixmap;
808 // Temporary
809 BC_Bitmap *temp_bitmap;
810 // Clipboard
811 BC_Clipboard *clipboard;
812 #ifdef HAVE_LIBXXF86VM
813 // Mode switch information.
814 int vm_switched;
815 XF86VidModeModeInfo orig_modeline;
816 #endif
818 // Common events coming from X server and repeater.
819 ArrayList<XEvent*> common_events;
820 // Locks for common events
821 // Locking order:
822 // 1) event_condition
823 // 2) event_lock
824 Mutex *event_lock;
825 Condition *event_condition;
826 BC_WindowEvents *event_thread;
827 int is_deleting;
828 // Hide cursor when video is enabled
829 Timer *cursor_timer;
830 // unique ID of window.
831 int id;
833 protected:
834 Atom create_xatom(char *atom_name);
835 int send_custom_xatom(xatom_event *event);
841 #endif
843 // Local Variables:
844 // mode: C++
845 // c-file-style: "linux"
846 // End: