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
22 #ifndef BCWINDOWBASE_H
23 #define BCWINDOWBASE_H
25 #if defined(HAVE_CONFIG_H)
29 //#define HAVE_LIBXXF86VM
34 #define POPUP_WINDOW 2
36 #ifdef HAVE_LIBXXF86VM
37 #define VIDMODE_SCALED_WINDOW 3
40 #define TOOLTIP_MARGIN 2
41 #define BC_INFINITY 65536
43 #include "arraylist.h"
45 #include "bcbitmap.inc"
46 #include "bcbutton.inc"
47 #include "bccapture.inc"
48 #include "bcclipboard.inc"
49 #include "bccmodels.inc"
50 #include "bcdisplay.inc"
51 #include "bcdragwindow.inc"
52 #include "bcfilebox.inc"
53 #include "bckeyboard.h"
54 #include "bclistbox.inc"
55 #include "bcmenubar.inc"
56 #include "bcmeter.inc"
58 #include "bcpbuffer.inc"
59 #include "bcpixmap.inc"
60 #include "bcpopup.inc"
61 #include "bcpopupmenu.inc"
63 #include "bcprogress.inc"
64 #include "bcrepeater.inc"
65 #include "bcresources.inc"
66 #include "bcscrollbar.inc"
67 #include "bcslider.inc"
68 #include "bcsubwindow.inc"
69 #include "bcsynchronous.inc"
70 #include "bctextbox.inc"
71 #include "bctimer.inc"
72 #include "bctitle.inc"
73 #include "bctoggle.inc"
74 #include "bctumble.inc"
75 #include "bcwindow.inc"
76 #include "bcwindowbase.inc"
77 #include "bcwindowevents.inc"
78 #include "condition.inc"
88 #include <X11/Xatom.h>
90 #include <X11/Xft/Xft.h>
93 #include <X11/Xutil.h>
94 #include <X11/keysym.h>
95 #include <X11/cursorfont.h>
96 #ifdef HAVE_LIBXXF86VM
97 #include <X11/extensions/xf86vmode.h>
99 #include <X11/extensions/Xinerama.h>
107 //typedef void* GLXContext;
113 BC_ResizeCall(int w, int h);
117 typedef XClientMessageEvent xatom_event;
120 class BC_ActiveBitmaps : public List<BC_BitmapImage> {
123 void reque(XEvent *ev);
124 void insert(BC_BitmapImage *image, Drawable pixmap);
125 void remove_buffers(BC_WindowBase *wdw);
132 // Windows, subwindows, popupwindows inherit from this
136 BC_WindowBase(int opts=0);
137 virtual ~BC_WindowBase();
140 friend class BC_BitmapImage;
141 friend class BC_XImage;
142 friend class BC_XShmImage;
143 friend class BC_XvImage;
144 friend class BC_XvShmImage;
145 friend class BC_Bitmap;
146 friend class BC_Button;
147 friend class BC_GenericButton;
148 friend class BC_Capture;
149 friend class BC_Clipboard;
150 friend class BC_Display;
151 friend class BC_DragWindow;
152 friend class BC_FileBox;
153 friend class BC_FullScreen;
154 friend class BC_ListBox;
155 friend class BC_Menu;
156 friend class BC_MenuBar;
157 friend class BC_MenuItem;
158 friend class BC_MenuPopup;
159 friend class BC_Meter;
161 friend class BC_PBuffer;
162 friend class BC_Pixmap;
163 friend class BC_PixmapSW;
164 friend class BC_Popup;
165 friend class BC_PopupMenu;
167 friend class BC_ProgressBar;
168 friend class BC_Repeater;
169 friend class BC_Resources;
170 friend class BC_ScrollBar;
171 friend class BC_Slider;
172 friend class BC_SubWindow;
173 friend class BC_Synchronous;
174 friend class BC_TextBox;
175 friend class BC_Title;
176 friend class BC_Toggle;
177 friend class BC_Tumbler;
178 friend class BC_Window;
179 friend class BC_WindowEvents;
183 // Terminal event dispatchers
184 virtual int close_event();
185 virtual int resize_event(int w, int h);
186 virtual int repeat_event(int64_t duration) { return 0; };
187 virtual int focus_in_event() { return 0; };
188 virtual int focus_out_event() { return 0; };
189 virtual int button_press_event() { return 0; };
190 virtual int button_release_event() { return 0; };
191 virtual int cursor_motion_event() { return 0; };
192 virtual int cursor_leave_event();
193 virtual int cursor_enter_event();
194 virtual int keypress_event() { return 0; };
195 virtual int keyrelease_event() { return 0; };
196 virtual int translation_event() { return 0; };
197 virtual int drag_start_event() { return 0; };
198 virtual int drag_motion_event() { return 0; };
199 virtual int drag_stop_event() { return 0; };
200 virtual int uses_text() { return 0; };
201 // Only if opengl is enabled
202 virtual int expose_event() { return 0; };
203 virtual void create_objects() { return; };
205 int get_window_type() { return window_type; }
206 // Wait until event loop is running
208 int is_running() { return window_running; }
209 // Check if a hardware accelerated colormodel is available and reserve it
210 int accel_available(int color_model, int lock_it);
211 void get_input_context();
212 void close_input_context();
213 // Get color model adjusted for byte order and pixel size
214 int get_color_model();
215 // return the colormap pixel of the color for all bit depths
216 int get_color(int64_t color);
217 // return the currently selected color
219 virtual int show_window(int flush = 1);
220 virtual int hide_window(int flush = 1);
223 // Shouldn't deference a pointer to delete a window if a parent is
224 // currently being deleted. This returns 1 if any parent is being deleted.
229 //============================= OpenGL functions ===============================
230 // OpenGL functions must be called from inside a BC_Synchronous command.
231 // Create openGL context and bind it to the current window.
232 // If it's called inside start_video/stop_video, the context is bound to the window.
233 // If it's called outside start_video/stop_video, the context is bound to the pixmap.
234 // Must be called at the beginning of any opengl routine to make sure
235 // the context is current.
236 // No locking is performed.
237 void enable_opengl();
238 void disable_opengl();
241 // Calls the BC_Synchronous version of the function with the window_id.
242 // Not run in OpenGL thread because it has its own lock.
243 unsigned int get_shader(char *title, int *got_it);
244 void put_shader(unsigned int handle, char *title);
245 int get_opengl_server_version();
247 int flash(int x, int y, int w, int h, int flush = 1);
248 int flash(int flush = 1);
251 // Lock out other threads
252 int lock_window(const char *location = 0);
254 int get_window_lock();
256 BC_MenuBar* add_menubar(BC_MenuBar *menu_bar);
257 BC_WindowBase* add_subwindow(BC_WindowBase *subwindow);
258 BC_WindowBase* add_tool(BC_WindowBase *subwindow);
260 // Use this to get events for the popup window.
261 // Events are not propagated to the popup window.
262 BC_WindowBase* add_popup(BC_WindowBase *window);
263 void remove_popup(BC_WindowBase *window);
265 static BC_Resources* get_resources();
266 // User must create synchronous object first
267 static BC_Synchronous* get_synchronous();
268 static int shm_completion_event;
269 // bckeyboard / remote control
270 virtual int keyboard_listener(BC_WindowBase *wp) { return 0; }
271 void add_keyboard_listener(int(BC_WindowBase::*handler)(BC_WindowBase *));
272 void del_keyboard_listener(int(BC_WindowBase::*handler)(BC_WindowBase *));
278 int get_root_w(int lock_display);
279 int get_root_h(int lock_display);
280 XineramaScreenInfo *get_xinerama_info(int screen);
281 int get_screen_w(int lock_display, int screen);
282 int get_screen_h(int lock_display, int screen);
283 int get_screen_x(int lock_display, int screen);
284 int get_screen_y(int lock_display, int screen);
285 // Get current position
286 int get_abs_cursor_x(int lock_window);
287 int get_abs_cursor_y(int lock_window);
288 int get_relative_cursor_x();
289 int get_relative_cursor_y();
290 // Return 1 if cursor is over an unobscured part of this window.
291 // An argument is provided for excluding a drag popup
292 int get_cursor_over_window();
293 // Return 1 if cursor is above/inside window
295 // For traversing windows... return 1 if this or any subwindow is win
296 int match_window(Window win);
298 // 1 or 0 if a button is down
299 int get_button_down();
300 // Number of button pressed 1 - 5
301 int get_buttonpress();
304 wchar_t* get_wkeystring(int *length = 0);
306 #ifdef X_HAVE_UTF8_STRING
307 char* get_keypress_utf8();
309 int keysym_lookup(XEvent *event);
310 // Get cursor position of last event
313 // Cursor position of drag start
319 int get_double_click();
320 int get_triple_click();
321 // Bottom right corner
325 void set_bg_color(int color);
326 BC_Pixmap* get_bg_pixmap();
327 int get_text_ascent(int font);
328 int get_text_descent(int font);
329 int get_text_height(int font, const char *text = 0);
330 int get_text_width(int font, const char *text, int length = -1);
331 int get_text_width(int font, const wchar_t *text, int length = -1);
332 BC_Clipboard* get_clipboard();
333 void set_dragging(int value);
336 BC_WindowBase* get_top_level();
337 BC_WindowBase* get_parent();
338 // Event happened in this window
341 // Deactivate everything and activate this subwindow
342 virtual int activate();
343 // Deactivate this subwindow
344 virtual int deactivate();
345 void set_active_subwindow(BC_WindowBase *subwindow);
346 // Get value of toggle value when dragging a selection
347 int get_toggle_value();
348 // Get if toggle is being dragged
349 int get_toggle_drag();
351 // Set the gc to the color
352 void set_color(int64_t color);
353 void set_line_width(int value);
354 void set_line_dashes(int value);
356 int get_current_font();
357 void set_font(int font);
358 // Set the cursor to a macro from cursors.h
359 // Set override if the caller is enabling hourglass or hiding the cursor
360 void set_cursor(int cursor, int override /* = 0 */, int flush);
361 // Set the cursor to a character in the X cursor library. Used by test.C
362 void set_x_cursor(int cursor);
364 // Shows the cursor after it's hidden by video playback
365 void unhide_cursor();
366 // Called by video updating routines to hide the cursor after a timeout
367 void update_video_cursor();
369 // Entry point for starting hourglass.
370 // Converts all cursors and saves the previous cursor.
371 void start_hourglass();
372 void stop_hourglass();
374 // Recursive part of hourglass commands.
375 void start_hourglass_recursive();
376 void stop_hourglass_recursive();
378 BC_Pixmap *create_pixmap(VFrame *vframe);
381 void copy_area(int x1, int y1, int x2, int y2, int w, int h, BC_Pixmap *pixmap = 0);
382 void clear_box(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
383 void draw_box(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
384 void draw_circle(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
385 void draw_arc(int x, int y, int w, int h,
386 int start_angle, int angle_length, BC_Pixmap *pixmap = 0);
387 void draw_disc(int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
388 void draw_text(int x, int y, const char *text, int length = -1, BC_Pixmap *pixmap = 0);
389 void draw_utf8_text(int x, int y, const char *text, int length = -1, BC_Pixmap *pixmap = 0);
390 void draw_text_line(int x, int y, const char *text, int len, BC_Pixmap *pixmap = 0);
391 void draw_xft_text(int x, int y, const char *text, int len,
392 BC_Pixmap *pixmap = 0, int is_utf8 = 0);
393 void draw_xft_text(int x, int y, const wchar_t *text,
394 int length, BC_Pixmap *pixmap);
395 void draw_wtext(int x, int y, const wchar_t *text, int length = -1,
396 BC_Pixmap *pixmap = 0, int *charpos = 0);
397 // truncate the text to a ... version that fits in the width, using the current_font
398 void truncate_text(char *result, const char *text, int w);
399 void draw_center_text(int x, int y, const char *text, int length = -1);
400 void draw_line(int x1, int y1, int x2, int y2, BC_Pixmap *pixmap = 0);
401 void draw_polygon(ArrayList<int> *x, ArrayList<int> *y, BC_Pixmap *pixmap = 0);
402 void fill_polygon(ArrayList<int> *x, ArrayList<int> *y, BC_Pixmap *pixmap = 0);
403 void draw_rectangle(int x, int y, int w, int h);
404 void draw_3segment(int x, int y, int w, int h, BC_Pixmap *left_image,
405 BC_Pixmap *mid_image, BC_Pixmap *right_image, BC_Pixmap *pixmap = 0);
406 void draw_3segment(int x, int y, int w, int h, VFrame *left_image,
407 VFrame *mid_image, VFrame *right_image, BC_Pixmap *pixmap = 0);
408 // For drawing a changing level
409 void draw_3segmenth(int x, int y, int w, int total_x, int total_w,
410 VFrame *image, BC_Pixmap *pixmap);
411 void draw_3segmenth(int x, int y, int w, int total_x, int total_w,
412 BC_Pixmap *src, BC_Pixmap *dst = 0);
413 void draw_3segmentv(int x, int y, int h, int total_y, int total_h,
414 BC_Pixmap *src, BC_Pixmap *dst = 0);
415 void draw_3segmentv(int x, int y, int h, int total_y, int total_h,
416 VFrame *src, BC_Pixmap *dst = 0);
417 // For drawing a single level
418 void draw_3segmenth(int x, int y, int w, VFrame *image, BC_Pixmap *pixmap = 0);
419 void draw_3segmenth(int x, int y, int w, BC_Pixmap *src, BC_Pixmap *dst = 0);
420 void draw_3segmentv(int x, int y, int h, BC_Pixmap *src, BC_Pixmap *dst = 0);
421 void draw_3segmentv(int x, int y, int h, VFrame *src, BC_Pixmap *dst = 0);
422 void draw_9segment(int x, int y, int w, int h, VFrame *src, BC_Pixmap *dst = 0);
423 void draw_9segment(int x, int y, int w, int h, BC_Pixmap *src, BC_Pixmap *dst = 0);
424 void draw_3d_box(int x, int y, int w, int h, int light1, int light2,
425 int middle, int shadow1, int shadow2, BC_Pixmap *pixmap = 0);
426 void draw_3d_box(int x, int y, int w, int h, int is_down, BC_Pixmap *pixmap = 0);
427 void draw_3d_border(int x, int y, int w, int h,
428 int light1, int light2, int shadow1, int shadow2);
429 void draw_3d_border(int x, int y, int w, int h, int is_down);
430 void draw_colored_box(int x, int y, int w, int h, int down, int highlighted);
431 void draw_check(int x, int y);
432 void draw_triangle_down_flat(int x, int y, int w, int h);
433 void draw_triangle_up(int x, int y, int w, int h,
434 int light1, int light2, int middle, int shadow1, int shadow2);
435 void draw_triangle_down(int x, int y, int w, int h,
436 int light1, int light2, int middle, int shadow1, int shadow2);
437 void draw_triangle_left(int x, int y, int w, int h,
438 int light1, int light2, int middle, int shadow1, int shadow2);
439 void draw_triangle_right(int x, int y, int w, int h,
440 int light1, int light2, int middle, int shadow1, int shadow2);
441 // Set the gc to opaque
444 void set_background(VFrame *bitmap);
445 // Change the window title.
446 void set_title(const char *text);
447 const char *get_title();
448 void set_utf8title(const char *text);
449 // Change the window title. The title is translated internally.
453 void set_done(int return_value);
454 void close(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, int dont_wait,
459 int dest_x = 0, int dest_y = 0, int dest_w = 0, int dest_h = 0,
460 int src_x = 0, int src_y = 0, int src_w = 0, int src_h = 0,
461 BC_Pixmap *pixmap = 0);
462 void draw_pixel(int x, int y, BC_Pixmap *pixmap = 0);
463 // Draw a pixmap on the window
464 void draw_pixmap(BC_Pixmap *pixmap,
465 int dest_x = 0, int dest_y = 0, int dest_w = -1, int dest_h = -1,
466 int src_x = 0, int src_y = 0, BC_Pixmap *dst = 0);
467 // Draw a vframe on the window
468 void draw_vframe(VFrame *frame,
469 int dest_x = 0, int dest_y = 0, int dest_w = -1, int dest_h = -1,
470 int src_x = 0, int src_y = 0, int src_w = 0, int src_h = 0,
471 BC_Pixmap *pixmap = 0);
472 void draw_border(char *text, int x, int y, int w, int h);
473 // Draw a region of the background
474 void draw_top_background(BC_WindowBase *parent_window, int x, int y, int w, int h, BC_Pixmap *pixmap = 0);
475 void draw_top_tiles(BC_WindowBase *parent_window, int x, int y, int w, int h);
476 void draw_background(int x, int y, int w, int h);
477 void draw_tiles(BC_Pixmap *tile, int origin_x, int origin_y,
478 int x, int y, int w, int h);
479 void slide_left(int distance);
480 void slide_right(int distance);
481 void slide_up(int distance);
482 void slide_down(int distance);
484 int cycle_textboxes(int amount);
486 int raise_window(int do_flush = 1);
487 int lower_window(int do_flush = 1);
488 void set_force_tooltip(int v);
489 void set_tooltips(int v);
490 int resize_window(int w, int h);
491 int reposition_window(int x, int y);
492 int reposition_window(int x, int y, int w, int h);
493 int reposition_window_relative(int dx, int dy);
494 int reposition_window_relative(int dx, int dy, int w, int h);
495 // Cause a repeat event to be dispatched every duration.
496 // duration is milliseconds
497 int set_repeat(int64_t duration);
498 // Stop a repeat event from being dispatched.
499 int unset_repeat(int64_t duration);
500 const char *get_tooltip();
501 int set_tooltip(const char *text);
502 int show_tooltip(int w = -1, int h = -1);
504 int set_icon(VFrame *data);
505 int load_defaults(BC_Hash *defaults);
506 int save_defaults(BC_Hash *defaults);
508 #ifdef HAVE_LIBXXF86VM
509 // Mode switch methods.
510 void closest_vm(int *vm, int *width, int *height);
511 void scale_vm(int vm);
517 char keys_return[KEYPRESSLEN];
522 virtual int create_window(BC_WindowBase *parent_window,
523 const char *title, int x, int y, int w, int h,
524 int minw, int minh, int allow_resize, int private_color,
525 int hide, int bg_color, const char *display_name,
526 int window_type, BC_Pixmap *bg_pixmap, int group_it);
528 static Display* init_display(const char *display_name);
529 // Get display from top level
530 Display* get_display();
532 virtual int initialize();
534 // Function to overload to recieve customly defined atoms
535 virtual int recieve_custom_xatoms(xatom_event *event);
539 int init_window_shape();
540 static int evaluate_color_model(int client_byte_order, int server_byte_order, int depth);
541 int create_private_colors();
542 int create_color(int color);
543 int create_shared_colors();
544 // Get width of a single line. Used by get_text_width
545 int get_single_text_width(int font, const char *text, int length);
546 int get_single_text_width(int font, const wchar_t *text, int length);
547 int allocate_color_table();
553 int get_color_rgb8(int color);
554 int64_t get_color_rgb16(int color);
555 int64_t get_color_bgr16(int color);
556 int64_t get_color_bgr24(int color);
557 XFontStruct* get_font_struct(int font);
558 XftFont* get_xft_struct(int font);
559 int wcharpos(const wchar_t *text, XftFont *font, int length, int *charpos);
560 Cursor get_cursor_struct(int cursor);
561 XFontSet get_fontset(int font);
562 XFontSet get_curr_fontset(void);
563 void set_fontset(int font);
564 int dispatch_event(XEvent *event);
566 int get_key_masks(unsigned int key_state);
568 int trigger_tooltip();
569 int untrigger_tooltip();
571 int arm_repeat(int64_t duration);
572 // delete all repeater opjects for a close
573 int unset_all_repeaters();
575 // Block and get event from common events.
577 // Return number of events in table.
578 int get_event_count();
579 // Put event in common events.
580 void put_event(XEvent *event);
582 // Recursive event dispatchers
583 int dispatch_resize_event(int w, int h);
584 int dispatch_focus_in();
585 int dispatch_focus_out();
586 int dispatch_motion_event();
587 int dispatch_keypress_event();
588 int dispatch_keyrelease_event();
589 int dispatch_repeat_event(int64_t duration);
590 int dispatch_repeat_event_master(int64_t duration);
591 int dispatch_button_press();
592 int dispatch_button_release();
593 int dispatch_cursor_leave();
594 int dispatch_cursor_enter();
595 int dispatch_translation_event();
596 int dispatch_drag_start();
597 int dispatch_drag_motion();
598 int dispatch_drag_stop();
599 int dispatch_expose_event();
601 // Get the port ID for a color model or return -1 for failure
602 int grab_port_id(BC_WindowBase *window, int color_model);
604 int find_next_textbox(BC_WindowBase **first_textbox, BC_WindowBase **next_textbox, int &result);
605 int find_prev_textbox(BC_WindowBase **last_textbox, BC_WindowBase **prev_textbox, int &result);
608 void translate_coordinates(Window src_w,
615 // Top level window above this window
616 BC_WindowBase* top_level;
617 // Window just above this window
618 BC_WindowBase* parent_window;
619 // list of window bases in this window
620 BC_SubWindowList* subwindows;
621 // list of window bases in this window
622 ArrayList<BC_WindowBase*> popups;
623 // Position of window
626 int light1, light2, medium, dark1, dark2, bg_color;
627 // Type of window defined above
629 // Pointer to the active menubar in the window.
630 BC_MenuBar* active_menubar;
631 // pointer to the active popup menu in the window
632 BC_PopupMenu* active_popup_menu;
633 // pointer to the active subwindow
634 BC_WindowBase* active_subwindow;
635 // thread id of display locker
636 pthread_t display_lock_owner;
640 int hidden, private_color, bits_per_pixel, color_model;
641 int server_byte_order, client_byte_order;
642 // number of colors in color table
644 // last color found in table
645 int current_color_value, current_color_pixel;
646 // table for every color allocated
647 int color_table[256][2];
648 // Turn on optimization
650 // Event handler completion
651 int done, done_set, window_running;
652 // Return value of event handler
654 // Motion event compression
655 int motion_events, last_motion_x, last_motion_y;
656 unsigned int last_motion_state;
657 // window of buffered motion
658 Window last_motion_win;
659 // Resize event compression
660 int resize_events, last_resize_w, last_resize_h;
661 int translation_events, last_translate_x, last_translate_y;
663 // Since the window manager automatically translates the window at boot,
664 // use the first translation event to get correction factors
665 int translation_count;
666 int x_correction, y_correction;
670 int ctrl_mask, shift_mask, alt_mask;
671 // Cursor motion information
672 int cursor_x, cursor_y;
673 // Button status information
674 int button_down, button_number;
675 // When button was pressed and whether it qualifies as a double click
676 int64_t button_time1;
677 int64_t button_time2;
678 int64_t button_time3;
681 // Which button is down. 1, 2, 3, 4, 5
685 int wkey_string_length;
686 wchar_t wkey_string[4];
687 #ifdef X_HAVE_UTF8_STRING
688 char* key_pressed_utf8;
690 // During a selection drag involving toggles, set the same value for each toggle
693 // Whether the window has the focus
696 static BC_Resources resources;
698 #ifndef SINGLE_THREAD
699 // Array of repeaters for multiple repeating objects.
700 ArrayList<BC_Repeater*> repeaters;
702 // Text for tooltip if one exists
703 const char *tooltip_text;
704 // tooltip forced for this window
706 // If the current window's tooltip is visible
708 // Repeat ID of tooltip
709 // int64_t tooltip_id;
710 // Popup window for tooltip
711 BC_Popup *tooltip_popup;
712 // If this subwindow has already shown a tooltip since the last EnterNotify
719 XFontSet smallfontset, mediumfontset, largefontset, bigfontset, curr_fontset;
723 XFontStruct *smallfont, *mediumfont, *largefont, *bigfont;
725 // Must be void so users don't need to include the wrong libpng version.
726 void *smallfont_xft, *mediumfont_xft, *largefont_xft, *bigfont_xft;
731 void *bold_largefont_xft, *bold_mediumfont_xft, *bold_smallfont_xft;
732 int64_t current_color;
733 // Coordinate of drag start
735 // Boundaries the cursor must pass to start a drag
736 int drag_x1, drag_x2, drag_y1, drag_y2;
737 // Dragging is specific to the subwindow
739 // Don't delete the background pixmap
740 int shared_bg_pixmap;
741 char title[BCTEXTLEN];
743 // X Window parameters
746 // windows previous events happened in
747 Window event_win, drag_win;
751 char display_name[BCTEXTLEN];
752 // Display for all synchronous operations
755 int xinerama_screens;
756 XineramaScreenInfo *xinerama_info;
758 int glx_fb_configs(int *attrs, GLXFBConfig *&cfgs);
759 int glx_test_fb_configs(int *attrs, GLXFBConfig *&cfgs,
760 const char *msg, int &msgs);
761 GLXFBConfig *glx_fbcfgs_window, *glx_window_fb_configs();
763 GLXFBConfig *glx_fbcfgs_pbuffer, *glx_pbuffer_fb_configs();
764 int n_fbcfgs_pbuffer;
765 GLXFBConfig *glx_fbcfgs_pixmap, *glx_pixmap_fb_configs();
767 Visual *get_glx_visual(Display *display);
769 void sync_lock(const char *cp);
771 GLXWindow glx_window();
773 // The first context to be created and the one whose texture id
774 // space is shared with the other contexts.
775 GLXContext glx_get_context();
776 bool glx_make_current(GLXDrawable draw);
777 bool glx_make_current(GLXDrawable draw, GLXContext glx_ctxt);
779 GLXFBConfig glx_fb_config;
780 GLXContext glx_win_context;
786 // Depth given by the X Server
792 // Number of times start_hourglass was called
794 // Cursor set by last set_cursor which wasn't an hourglass or transparent.
796 // If hourglass overrides current cursor. Only effective in top level.
798 // If transparent overrides all cursors. Only effective in subwindow.
803 Cursor vseparate_cursor;
804 Cursor hseparate_cursor;
809 Cursor upright_arrow_cursor;
810 Cursor upleft_resize_cursor;
811 Cursor upright_resize_cursor;
812 Cursor downleft_resize_cursor;
813 Cursor downright_resize_cursor;
814 Cursor hourglass_cursor;
815 Cursor transparent_cursor;
818 ArrayList<BC_ResizeCall*> resize_history;
821 // Background tile if tiled
822 BC_Pixmap *bg_pixmap;
824 BC_Popup *icon_window;
825 BC_Pixmap *icon_pixmap;
826 BC_Pixmap **_7segment_pixmaps;
828 BC_Bitmap *temp_bitmap;
829 BC_ActiveBitmaps active_bitmaps;
831 #ifndef SINGLE_THREAD
832 BC_Clipboard *clipboard;
835 #ifdef HAVE_LIBXXF86VM
836 // Mode switch information.
838 XF86VidModeModeInfo orig_modeline;
844 #ifndef SINGLE_THREAD
845 // Common events coming from X server and repeater.
846 ArrayList<XEvent*> common_events;
847 // Locks for common events
849 // 1) event_condition
852 Condition *event_condition;
853 // Lock that waits until the event handler is running
854 Condition *init_lock;
856 Condition *completion_lock;
863 BC_WindowEvents *event_thread;
865 // Hide cursor when video is enabled
867 // unique ID of window.
870 // Used to communicate with the input method (IM) server
872 // Used for retaining the state, properties, and semantics
873 // of communication with the input method (IM) server
877 Atom create_xatom(const char *atom_name);
878 int send_custom_xatom(xatom_event *event);