1 #ifndef ASINTERNALS_H_HEADER_INCLUDED 2 #define ASINTERNALS_H_HEADER_INCLUDED 3 4 #include "../../libAfterStep/asapp.h" 5 6 #include "../../libAfterImage/afterimage.h" 7 8 #include "../../libAfterStep/afterstep.h" 9 #include "../../libAfterStep/event.h" 10 #include "../../libAfterStep/decor.h" 11 #include "../../libAfterStep/screen.h" 12 #include "../../libAfterStep/module.h" 13 #include "../../libAfterStep/mystyle.h" 14 #include "../../libAfterStep/mylook.h" 15 #include "../../libAfterStep/clientprops.h" 16 #include "../../libAfterStep/hints.h" 17 #include "../../libAfterStep/balloon.h" 18 #include "../../libAfterStep/parser.h" 19 #include "../../libAfterStep/shape.h" 20 21 #include "menus.h" 22 23 #ifdef SHAPE 24 #include <X11/Xresource.h> 25 #endif /* SHAPE */ 26 27 struct FunctionData; 28 struct ASWindow; 29 struct ASRectangle; 30 struct ASDatabase; 31 struct ASWMProps; 32 struct MoveResizeData; 33 struct MenuItem; 34 struct ASEvent; 35 struct ASFeel; 36 struct MyLook; 37 struct ASHintWindow; 38 39 struct ASWindow; 40 41 typedef struct ASWindowGroup 42 { 43 Window leader; 44 long member_count; 45 char* sm_client_id; 46 47 struct ASVector* members ; 48 }ASWindowGroup; 49 50 typedef struct ASInternalWindow 51 { 52 ASMagic *data; /* internal data structure */ 53 struct ASWindow *owner; 54 55 /* adds all the subwindows to window->ASWindow xref */ 56 void (*register_subwindows)( struct ASInternalWindow *asiw ); 57 58 void (*on_moveresize)( struct ASInternalWindow *asiw, Window w ); 59 /* fwindow looses/gains focus : */ 60 void (*on_hilite_changed)( struct ASInternalWindow *asiw, ASMagic *data, Bool focused ); 61 /* ButtonPress/Release event on one of the contexts : */ 62 void (*on_pressure_changed)( struct ASInternalWindow *asiw, int pressed_context ); 63 /* Mouse wheel scrolling event : */ 64 void (*on_scroll_event)( struct ASInternalWindow *asiw, struct ASEvent *event ); 65 /* Motion notify : */ 66 void (*on_pointer_event)( struct ASInternalWindow *asiw, struct ASEvent *event ); 67 /* KeyPress/Release : */ 68 void (*on_keyboard_event)( struct ASInternalWindow *asiw, struct ASEvent *event ); 69 70 /* reconfiguration : */ 71 void (*on_look_feel_changed)( struct ASInternalWindow *asiw, struct ASFeel *feel, struct MyLook *look, ASFlagType what ); 72 void (*on_root_background_changed)( struct ASInternalWindow *asiw ); 73 74 /* destruction */ 75 void (*destroy)( struct ASInternalWindow *asiw ); 76 77 }ASInternalWindow; 78 79 /* for each window that is on the display, one of these structures 80 * is allocated and linked into a list 81 */ 82 typedef struct ASWindow 83 { 84 unsigned long magic ; 85 Window w; /* the child window */ 86 Window frame; /* the frame window */ 87 #define get_window_frame(asw) (asw->frame) 88 89 struct ASHints *hints; 90 91 /* Window geometry: 92 * 3 different settings: anchor, status and canvas 93 * 1) anchor reflects anchor point of the client window according 94 * to its size and gravity and requested position. It is calculated in virtual coordinates 95 * for non-sticky windows. For example in case of SouthEastGravity anchor.x will be at the 96 * right edge of the frame, and anchor.y will be at the bottom edge of the frame. 97 * 2) status reflects current size and position of the frame as calculated based upon anchor 98 * point and frame decorations size. It is always in real screen coordinates. 99 * status->viewport_x and status->viewport_y reflect viewport position at the time of such 100 * calculation. Whenever viewport changes - this two must be changed and status recalculated. 101 * 3) canvases reflect window position as reported in last received ConfigureNotify event and 102 * reflect exact position of window on screen as viewed by user. 103 * 104 * Anchor is needed so we could handle changing size of the frame decorations 105 * status represents desired geometry/state of the window 106 * canvases represent factual geometry/state of the window 107 */ 108 struct ASStatusHints *status; 109 XRectangle anchor ; 110 XRectangle saved_anchor; /* status prior to maximization */ 111 112 struct ASWindow *transient_owner; 113 struct ASVector *transients; 114 115 ASWindowGroup *group; 116 117 118 #define ASWIN_NAME(t) ((t)->hints->names[0]) 119 #define ASWIN_NAME_ENCODING(t) ((t)->hints->names_encoding[0]) 120 #define ASWIN_CLASS(t) ((t)->hints->res_class) 121 #define ASWIN_RES_NAME(t) ((t)->hints->res_name) 122 #define ASWIN_ICON_NAME(t) ((t)->hints->icon_name) 123 #define ASWIN_ICON_NAME_ENC(t) (get_hint_name_encoding((t)->hints, (t)->hints->icon_name_idx)) 124 #define ASWIN_DESK(t) ((t)->status->desktop) 125 #define ASWIN_LAYER(t) ((t)->status->layer) 126 #define ASWIN_HFLAGS(t,f) get_flags((t)->hints->flags,(f)) 127 #define ASWIN_PROTOS(t,f) get_flags((t)->hints->protocols,(f)) 128 #define ASWIN_GET_FLAGS(t,f) get_flags((t)->status->flags,(f)) 129 #define ASWIN_SET_FLAGS(t,f) set_flags((t)->status->flags,(f)) 130 #define ASWIN_CLEAR_FLAGS(t,f) clear_flags((t)->status->flags,(f)) 131 #define ASWIN_FUNC_MASK(t) ((t)->hints->function_mask) 132 133 #define ASWIN_FOCUSABLE(asw) (ASWIN_HFLAGS(asw, AS_AcceptsFocus) || get_flags((asw)->hints->protocols, AS_DoesWmTakeFocus)) 134 135 #define IsBtnDisabled(t,b) get_flags((t)->hints->disabled_buttons,(0x01<<(b))) 136 #define IsBtnEnabled(t,b) (!get_flags((t)->hints->disabled_buttons,(0x01<<(b)))) 137 #define DisableBtn(t,b) clear_flags((t)->hints->disabled_buttons,(0x01<<(b))) 138 139 /********************************************************************/ 140 /* ASWindow frame decorations : */ 141 /********************************************************************/ 142 /* window frame decoration consists of : 143 Top level window 144 4 canvases - one for each side : 145 Top or left canvas contains titlebar+ adjusen frame side+corners if any 146 Bottom or right canvas contains sidebar which is the same as south frame side with corners 147 Remaining two canvasses contain east and west frame sides only ( if any ); 148 Canvasses surround main window and its sizes are actually the frame size. 149 */ 150 151 struct ASCanvas *frame_canvas ; 152 struct ASCanvas *client_canvas ; 153 struct ASCanvas *frame_sides[FRAME_SIDES] ; 154 struct ASCanvas *icon_canvas ; 155 struct ASCanvas *icon_title_canvas ; /* same as icon_canvas if !SeparateButtonTitle */ 156 157 struct MyFrame *frame_data; /* currently selected frame decorations for this window */ 158 159 struct ASTBarData *frame_bars[FRAME_PARTS] ; /* regular sidebar is the same as frame with S, SE and SW parts */ 160 struct ASTBarData *tbar ; /* same as frame_bars[FRAME_PARTS] for convinience */ 161 struct ASTBarData *icon_button ; 162 struct ASTBarData *icon_title ; 163 164 int shading_steps; 165 166 ASInternalWindow *internal ; /* optional related data structure, 167 * such as ASMenu or something else */ 168 169 enum { 170 #define ASWT_FROM_WITHDRAWN (0x01<<0) 171 #define ASWT_TO_ICONIC (0x01<<1) 172 #define ASWT_FROM_ICONIC (0x01<<2) 173 #define ASWT_TO_WITHDRAWN (0x01<<3) 174 175 ASWT_StableState = 0, 176 ASWT_Withdrawn2Normal = ASWT_FROM_WITHDRAWN, 177 ASWT_Withdrawn2Iconic = ASWT_FROM_WITHDRAWN|ASWT_TO_ICONIC, 178 ASWT_Normal2Iconic = ASWT_TO_ICONIC, 179 ASWT_Iconic2Normal = ASWT_FROM_ICONIC, 180 ASWT_Normal2Withdrawn = ASWT_TO_WITHDRAWN, 181 ASWT_Iconic2Withdrawn = ASWT_FROM_ICONIC|ASWT_TO_WITHDRAWN, 182 /* window may be unmapped/destroyed even prior to being withdrawn */ 183 ASWT_Withdrawn2Withdrawn = ASWT_FROM_WITHDRAWN|ASWT_TO_WITHDRAWN 184 }wm_state_transition ; 185 186 Time last_restack_time ; 187 int DeIconifyDesk; /* Desk to deiconify to, for StubbornIcons */ 188 189 int maximize_ratio_x, maximize_ratio_y ; 190 191 #define ASWF_WindowComplete (0x01<<0) /* if set - then AddWindow has been completed */ 192 #define ASWF_PendingShapeRemoval (0x01<<1) 193 #define ASWF_NameChanged (0x01<<2) 194 #define ASWF_FirstCornerFollowsTbarSize (0x01<<3) 195 #define ASWF_LastCornerFollowsTbarSize (0x01<<6) 196 ASFlagType internal_flags ; 197 198 /* we use that to avoid excessive refreshes when property is updated with exact same contents */ 199 XWMHints saved_wm_hints ; 200 XSizeHints saved_wm_normal_hints; 201 }ASWindow; 202 203 typedef struct ASLayer 204 { 205 int layer ; 206 Window w ; 207 struct ASVector *members ; /* vector of ASDesktopElems */ 208 }ASLayer; 209 210 typedef struct ASWindowList 211 { 212 struct ASBiDirList *clients ; 213 struct ASHashTable *aswindow_xref; /* xreference of window/resource IDs to ASWindow structures */ 214 struct ASHashTable *layers ; /* list of ASLayer structures from above hashed by layer num */ 215 struct ASHashTable *bookmarks ; /* list of windows with bookmark names assignet to them */ 216 217 struct ASHashTable *window_groups; 218 219 /* lists of pointers to the ASWindow structures */ 220 struct ASVector *circulate_list ; 221 struct ASVector *sticky_list ; 222 223 ASWindow *root ; /* root window - special purpose ASWindow struct to 224 * enable root window handling same way as any other window */ 225 226 /* warping/circulation pointers : */ 227 int warp_curr_index; /* last warped to window */ 228 int warp_init_dir; /* initial warping direction */ 229 int warp_curr_dir, warp_user_dir; /* current warping direction 230 * - internal direction maybe different from 231 * user direction in YOYO mode */ 232 233 /* focus pointers : */ 234 ASWindow *active; /* currently active client 235 * - may not have focus during housekeeping operations 236 * - may be different from hilited/ungrabbed if we changed active 237 * client during house keeping operation */ 238 ASWindow *focused; /* currently focused client. Will be NULL during housekeeping */ 239 /* needed for proper AutoRaise implementation : */ 240 time_t last_focus_change_sec; 241 time_t last_focus_change_usec; 242 243 ASWindow *ungrabbed; /* client that has no grab on mouse events */ 244 ASWindow *hilited; /* client who's frame decorations has been hilited 245 * to show that it is focused. May not be same as focused/ungrabbed 246 * right after focus is handed over and before FocusIn event */ 247 ASWindow *previous_active; /* last active client */ 248 ASWindow *pressed; /* the client wich has one of its frame parts pressed at the moment */ 249 /* Focus management is somewhat tricky. 250 * Firstly, we have to track pointer movements to see when mouse enters the window 251 * so we can switch focus to that window. ( or mouse clicked in the window 252 * where ClickToFocus is requested ). To Accomplish that we grab mouse 253 * events on all the windows but currently focused. 254 * Secondly we need to hilite currently active window with frame decorations, when window 255 * gets focus. So right after focus is forced on window and before FocusIn event 256 * we'll have : (focused == ungrabbed) != hilited 257 * Thirdly, we may need to steal focus for our own needs while we perform housekeeping 258 * like desk switching, etc. ( GrabEm/UngrabEm ) In such situation window 259 * remains hilited, but has no focus, and has no pointer event grabs. 260 * (focused == NULL) != (ungrabbed == hilited) 261 * Fourthsly, When housekeeping is completed we want to give the focus back to it, but 262 * in some situations housekeeping operations will make us give the focus to 263 * some other window. To do that we substitute focused pointer to new window 264 * right before UngrabEm. In this case focused != ( ungrabbed == hilited ) 265 */ 266 267 ASVector *stacking_order ; /* array of pointers to ASWindow structures */ 268 269 }ASWindowList; 270 271 /* Mirror Note : 272 * 273 * For the purpose of sizing/placing left and right sides and corners - we employ somewhat 274 * twisted logic - we mirror sides over lt2rb diagonal in case of 275 * vertical title orientation. That allows us to apply simple x/y switching instead of complex 276 * calculations. Note that we only do that for placement purposes. Contexts and images are 277 * still taken from MyFrame parts as if it was rotated counterclockwise instead of mirrored. 278 */ 279 280 281 typedef struct ASOrientation 282 { 283 unsigned int frame_contexts[FRAME_PARTS]; 284 unsigned int frame_rotation[FRAME_PARTS]; 285 unsigned int tbar2canvas_xref[FRAME_PARTS+1]; 286 unsigned int tbar_side; 287 unsigned int tbar_corners[2]; 288 unsigned int tbar_mirror_corners[2]; /* see note below */ 289 unsigned int sbar_side; 290 unsigned int sbar_corners[2]; 291 unsigned int sbar_mirror_corners[2]; /* see note below */ 292 unsigned int left_side, right_side; 293 unsigned int left_mirror_side, right_mirror_side; /* see note below */ 294 unsigned long horz_side_mask; 295 int left_btn_order, right_btn_order; 296 int *in_x, *in_y; 297 unsigned int *in_width, *in_height; 298 int *out_x, *out_y; 299 unsigned int *out_width, *out_height; 300 int flip; 301 #define ASO_TBAR_ELEM_LBTN MYFRAME_TITLE_BACK_LBTN 302 #define ASO_TBAR_ELEM_LSPACER MYFRAME_TITLE_BACK_LSPACER 303 #define ASO_TBAR_ELEM_LTITLE_SPACER MYFRAME_TITLE_BACK_LTITLE_SPACER 304 #define ASO_TBAR_ELEM_LBL MYFRAME_TITLE_BACK_LBL 305 #define ASO_TBAR_ELEM_RTITLE_SPACER MYFRAME_TITLE_BACK_RTITLE_SPACER 306 #define ASO_TBAR_ELEM_RSPACER MYFRAME_TITLE_BACK_RSPACER 307 #define ASO_TBAR_ELEM_RBTN MYFRAME_TITLE_BACK_RBTN 308 #define ASO_TBAR_ELEM_NUM MYFRAME_TITLE_BACKS 309 unsigned int default_tbar_elem_col[ASO_TBAR_ELEM_NUM]; 310 unsigned int default_tbar_elem_row[ASO_TBAR_ELEM_NUM]; 311 ASFlagType left_spacer_needed_align ; 312 ASFlagType right_spacer_needed_align ; 313 }ASOrientation; 314 315 316 typedef struct queue_buff_struct 317 { 318 struct queue_buff_struct *next; 319 unsigned char *data; 320 short size; 321 short done; 322 short prealloced_idx ; 323 short unused; 324 /* 16 bytes total */ 325 }queue_buff_struct; 326 327 typedef struct module_ibuf_t 328 { 329 /* we always use 32 bit values for communications */ 330 CARD32 len; 331 CARD32 done; 332 CARD32 window; 333 CARD32 size; 334 char *text; 335 CARD32 name_size, text_size; 336 struct FunctionData *func; 337 CARD32 cont; 338 }module_ibuf_t; 339 340 typedef struct module_t 341 { 342 int fd; 343 int active; 344 char *name; 345 char *cmd_line; 346 CARD32 mask; 347 CARD32 lock_on_send_mask; 348 queue_buff_struct *output_queue; 349 module_ibuf_t ibuf; 350 }module_t; 351 352 353 /******************************************************************/ 354 /* these are global functions and variables private for afterstep */ 355 356 /* from configure.c */ 357 void error_point(); 358 void tline_error(const char* err_text); 359 void str_error(const char* err_format, const char* string); 360 361 int is_executable_in_path (const char *name); 362 363 /* from dirtree.c */ 364 char * strip_whitespace (char *str); 365 366 /* from configure.c */ 367 extern struct ASDatabase *Database; 368 369 /**************************************************************************/ 370 /* Global variables : */ 371 /**************************************************************************/ 372 373 extern ASFlagType AfterStepState; /* see ASS_ flags above */ 374 /* this are linked lists of structures : */ 375 extern struct ASDatabase *Database; 376 extern ASHashTable *ComplexFunctions; 377 378 extern ASBalloonState *MenuBalloons ; 379 extern ASBalloonState *TitlebarBalloons ; 380 381 382 /* global variables for Look values : */ 383 extern unsigned long XORvalue; 384 extern int RubberBand; 385 extern char *RMGeom; 386 extern int Xzap, Yzap; 387 extern int DrawMenuBorders; 388 extern int TextureMenuItemsIndividually; 389 extern int StartMenuSortMode; 390 extern int ShadeAnimationSteps; 391 392 extern int fd_width, x_fd; 393 394 extern struct ASWindow *ColormapWin; 395 396 extern int ASDBus_fd; 397 398 extern struct ASVector *Modules; /* dynamically resizable array of module_t data structures */ 399 #define MODULES_LIST VECTOR_HEAD(module_t,*Modules) 400 #define MODULES_NUM VECTOR_USED(*Modules) 401 402 extern int Module_fd; 403 extern int Module_npipes; 404 405 extern Bool menu_event_mask[LASTEvent]; /* menu event filter */ 406 407 extern int menuFromFrameOrWindowOrTitlebar; 408 409 #define BACKGROUND_DRAW_CHILD (MAX_SINGLETONS_NUM-1) 410 411 extern ASOrientation HorzOrientation ; 412 extern ASOrientation VertOrientation ; 413 414 /**************************************************************************/ 415 /**************************************************************************/ 416 /* Function prototypes : */ 417 /**************************************************************************/ 418 419 /*************************** afterstep.c : ********************************/ 420 Bool RequestLogout (); 421 Bool RequestShutdown (FunctionCode kind); 422 Bool CanShutdown (); 423 Bool CanSuspend (); 424 Bool CanHibernate (); 425 Bool CanRestart (); 426 Bool CanLogout (); 427 Bool CanQuit (); 428 429 void Done (Bool restart, char *command); 430 void SaveSession (Bool force); 431 void CloseSessionClients (Bool only_modules); 432 433 /*************************** from aswindow.c : ****************************/ 434 ASWindowList *init_aswindow_list(); 435 void destroy_aswindow_list( ASWindowList **list, Bool restore_root ); 436 void publish_aswindow_list( ASWindowList *list, Bool stacking_only ); 437 438 ASWindow *window2ASWindow( Window w ); 439 Bool register_aswindow( Window w, ASWindow *asw ); 440 Bool unregister_aswindow( Window w ); 441 Bool destroy_registered_window( Window w ); 442 Bool bookmark_aswindow( ASWindow *asw, char *bookmark ); 443 ASWindow *bookmark2ASWindow( const char *bookmark ); 444 ASWindow *pattern2ASWindow( const char *pattern ); 445 ASWindow *complex_pattern2ASWindow( char *pattern ); 446 ASLayer *get_aslayer( int layer, ASWindowList *list ); 447 ASWindow *find_group_lead_aswindow( Window id ); 448 void tie_aswindow( ASWindow *t ); 449 void untie_aswindow( ASWindow *t ); 450 void add_aswindow_to_layer( ASWindow *asw, int layer ); 451 void remove_aswindow_from_layer( ASWindow *asw, int layer ); 452 Bool enlist_aswindow( ASWindow *t ); 453 void delist_aswindow( ASWindow *t ); 454 void save_aswindow_list( ASWindowList *list, char *file, Bool skip_session_managed); 455 void close_aswindow_list (ASWindowList *list, Bool skip_session_managed); /* close all windows */ 456 457 ASWindow* find_topmost_client( int desk, int root_x, int root_y ); 458 void free_scratch_layers_vector(); 459 void free_scratch_ids_vector(); 460 void update_stacking_order(); 461 void restack_window_list( int desk); 462 void send_stacking_order( int desk ); 463 void apply_stacking_order( int desk ); 464 465 466 Bool is_window_obscured (ASWindow * above, ASWindow * below); 467 void restack_window( ASWindow *t, Window sibling_window, int stack_mode ); 468 469 #ifndef NO_DEBUG_OUTPUT 470 #define RaiseWindow(asw) do{show_progress(__FILE__ " %s:%d R",__FUNCTION__ ,__LINE__);restack_window((asw),None,Above);}while(0) 471 #define LowerWindow(asw) do{show_progress(__FILE__ " %s:%d L",__FUNCTION__ ,__LINE__);restack_window((asw),None,Below);}while(0) 472 #define RaiseObscuredWindow(asw) do{show_progress(__FILE__ " %s:%d RO",__FUNCTION__,__LINE__);restack_window((asw),None,TopIf);}while(0) 473 #define RaiseLowerWindow(asw) do{show_progress(__FILE__ " %s:%d RL",__FUNCTION__,__LINE__);restack_window((asw),None,Opposite);}while(0) 474 #else 475 #define RaiseWindow(asw) restack_window((asw),None,Above) 476 #define LowerWindow(asw) restack_window((asw),None,Below) 477 #define RaiseObscuredWindow(asw) restack_window((asw),None,TopIf) 478 #define RaiseLowerWindow(asw) restack_window((asw),None,Opposite) 479 #endif 480 481 ASWindow *get_next_window (ASWindow * curr_win, char *action, int dir); 482 ASWindow *warp_aswindow_list ( ASWindowList *list, Bool backwards ); 483 484 MenuData *make_desk_winlist_menu( ASWindowList *list, int desk, int sort_order, Bool icon_name ); 485 486 void unset_focused_window(); 487 void hide_focus(); 488 Bool focus_window( ASWindow *asw, Window w ); 489 void autoraise_window( ASWindow *asw ); 490 #define FOCUS_ASW_CAN_AUTORAISE False 491 #define FOCUS_ASW_DONT_AUTORAISE True 492 Bool focus_aswindow( ASWindow *asw, Bool suppress_autoraise ); 493 Bool focus_active_window(); 494 void focus_next_aswindow( ASWindow *asw ); /* should be called when window is unmapped or destroyed */ 495 void focus_prev_aswindow( ASWindow *asw ); /* should be called when window is unmapped or destroyed */ 496 void commit_circulation(); 497 498 499 /*************************** from add_window.c : *************************/ 500 void destroy_icon_windows( ASWindow *asw ); 501 Bool get_icon_root_geometry( ASWindow *asw, ASRectangle *geom ); 502 503 /* swiss army knife - does everything about grabbing : */ 504 void grab_window_input( ASWindow *asw, Bool release_grab ); 505 ASImage* get_window_icon_image( ASWindow *asw ); 506 507 508 void redecorate_window( ASWindow *asw, Bool free_resources ); 509 void update_window_transparency( ASWindow *asw, Bool force ); 510 void on_window_moveresize( ASWindow *asw, Window w ); 511 void on_icon_changed( ASWindow *asw ); 512 void on_window_title_changed( ASWindow *asw, Bool update_display ); 513 void on_window_hints_changed( ASWindow *asw ); 514 void on_window_opacity_changed( ASWindow *asw ); 515 void on_window_status_changed( ASWindow *asw, Bool reconfigured ); 516 void on_window_hilite_changed( ASWindow *asw, Bool focused ); 517 void on_window_pressure_changed( ASWindow *asw, int pressed_context ); 518 519 void SelectDecor (ASWindow *); 520 void check_aswindow_shaped( ASWindow *asw ); 521 ASWindow *AddWindow (Window w, Bool from_map_request); 522 ASWindow *AddInternalWindow (Window w, 523 ASInternalWindow **pinternal, 524 struct ASHints **phints, struct ASStatusHints *status); 525 void Destroy (ASWindow *, Bool); 526 void RestoreWithdrawnLocation (ASWindow *, Bool); 527 void SetShape (ASWindow *, int); 528 void ClearShape (ASWindow *asw); 529 void SendConfigureNotify(ASWindow *asw); 530 531 532 533 /*************************** colormaps.c : ********************************/ 534 void SetupColormaps(); 535 void CleanupColormaps(); 536 void InstallWindowColormaps (ASWindow *asw); 537 void UninstallWindowColormaps (ASWindow *asw); 538 void InstallRootColormap (void); 539 void UninstallRootColormap (void); 540 void InstallAfterStepColormap (void); 541 void UninstallAfterStepColormap (void); 542 543 544 /*************************** configure.c **********************************/ 545 Bool GetIconFromFile (char *file, MyIcon * icon, int max_colors); 546 struct ASImage *GetASImageFromFile (char *file); 547 548 void InitBase (Bool free_resources); 549 void InitDatabase (Bool free_resources); 550 551 void InitLook (struct MyLook *look, Bool free_resources); 552 void InitFeel (struct ASFeel *feel, Bool free_resources); 553 554 #define PARSE_BASE_CONFIG BASE_CONFIG 555 #define PARSE_LOOK_CONFIG LOOK_CONFIG 556 #define PARSE_FEEL_CONFIG FEEL_CONFIG 557 #define PARSE_DATABASE_CONFIG DATABASE_CONFIG 558 559 #define PARSE_EVERYTHING (0xFFFFFFFF) 560 561 void LoadASConfig (int thisdesktop, ASFlagType what); 562 563 /*************************** cover.c **************************************/ 564 565 void remove_desktop_cover(); 566 Window get_desktop_cover_window(); 567 void restack_desktop_cover(); 568 void cover_desktop(); 569 void desktop_cover_cleanup(); 570 void display_progress( Bool new_line, const char *msg_format, ... ); 571 572 /*************************** dbus.c ***************************************/ 573 int asdbus_init(); 574 void asdbus_shutdown(); 575 void asdbus_process_messages (); 576 577 char *asdbus_RegisterSMClient(const char *sm_client_id); 578 void asdbus_Notify(const char *summary, const char *body, int timeout); 579 580 typedef enum { 581 ASDBUS_Logout_Normal = 0, 582 ASDBUS_Logout_Confirmed, 583 ASDBUS_Logout_Force 584 } ASDbusLogoutMode; 585 586 Bool asdbus_GetCanLogout (); 587 Bool asdbus_Logout (ASDbusLogoutMode mode, int timeout); 588 Bool asdbus_GetCanShutdown (); 589 Bool asdbus_Shutdown (int timeout); 590 Bool get_gnome_autosave (); 591 592 /*************************** decorations.c ********************************/ 593 ASOrientation* get_orientation_data( ASWindow *asw ); 594 void grab_aswindow_buttons( ASWindow *asw, Bool focused ); 595 596 int check_allowed_function2 (int func, ASHints *hints); 597 int check_allowed_function (FunctionData *fdata, ASHints *hints); 598 ASFlagType compile_titlebuttons_mask (ASHints *hints); 599 void estimate_titlebar_size( ASHints *hints, unsigned int *width_ret, unsigned int *height_ret ); 600 void disable_titlebuttons_with_function (ASWindow * t, int function); 601 Bool hints2decorations( ASWindow *asw, ASHints *old_hints ); 602 void invalidate_window_mystyles( ASWindow *asw ); 603 604 /*************************** events.c ********************************/ 605 const char *context2text(int ctx); 606 void DigestEvent ( struct ASEvent *event ); 607 void DispatchEvent ( struct ASEvent *event, Bool deferred ); 608 void HandleEvents (); 609 void HandleEventsWhileFunctionsPending (); 610 void InteractiveMoveLoop (); 611 void WaitForButtonsUpLoop (); 612 Bool WaitEventLoop( struct ASEvent *event, int finish_event_type, long timeout, struct ASHintWindow *hint ); 613 Bool IsClickLoop( struct ASEvent *event, unsigned int end_mask, unsigned int click_time ); 614 ASWindow *WaitWindowLoop( char *pattern, long timeout ); 615 void ConfigureNotifyLoop(); 616 void MapConfigureNotifyLoop(); 617 618 619 void AlarmHandler (int nonsense); 620 621 Bool KeyboardShortcuts (XEvent * xevent, int return_event, int move_size); 622 623 void HandleExpose (struct ASEvent*); 624 void HandleFocusIn (struct ASEvent *event); 625 void HandleDestroyNotify (struct ASEvent *event); 626 void HandleMapRequest (struct ASEvent *event); 627 void HandleMapNotify (struct ASEvent *event); 628 void HandleUnmapNotify (struct ASEvent *event); 629 void HandleButtonRelease(struct ASEvent *event, Bool deffered); 630 void HandleButtonPress (struct ASEvent *event, Bool deffered); 631 void HandleEnterNotify (struct ASEvent *event); 632 void HandleLeaveNotify (struct ASEvent *event); 633 void HandleConfigureRequest (struct ASEvent *event); 634 void HandleClientMessage (struct ASEvent *event); 635 void HandlePropertyNotify (struct ASEvent *event); 636 void HandleKeyPress (struct ASEvent *event); 637 void HandleVisibilityNotify (struct ASEvent *event); 638 void HandleColormapNotify (struct ASEvent *event); 639 void HandleSelectionClear( struct ASEvent *event ); 640 641 void HandleShapeNotify (struct ASEvent *event); 642 void HandleShmCompletion(struct ASEvent *event); 643 /*************************** functions.c **********************************/ 644 void SetupFunctionHandlers(); 645 ComplexFunction *get_complex_function( char *name ); 646 647 /* schedule function for execution( add to queue ) */ 648 void ExecuteFunction (struct FunctionData *data, struct ASEvent *event, int Module); 649 void ExecuteFunctionForClient(struct FunctionData *data, Window client); 650 void ExecuteFunctionExt (struct FunctionData *data, struct ASEvent *event, int module, Bool defered); 651 /* execute all the scheduled functions from the queue */ 652 Bool FunctionsPending (); 653 void ExecutePendingFunctions(); 654 void DestroyPendingFunctionsQueue(); 655 /* non-window specific, non-defferrable functions are run : */ 656 void ExecuteBatch ( ComplexFunction *batch ); 657 658 int DeferExecution (struct ASEvent *event, int cursor, int FinishEvent); 659 void QuickRestart (char *what); 660 661 /************************* housekeeping.c ********************************/ 662 Bool GrabEm ( struct ScreenInfo *scr, Cursor cursor ); 663 void UngrabEm (); 664 void CheckGrabbedFocusDestroyed(ASWindow *destroyed); 665 666 667 Bool StartWarping(struct ScreenInfo *scr); 668 void ChangeWarpingFocus(ASWindow *new_focus); 669 void CheckWarpingFocusDestroyed(ASWindow *destroyed); 670 void EndWarping(); 671 672 void PasteSelection (struct ScreenInfo *scr ); 673 674 /*************************** icons.c *********************************/ 675 void destroy_asiconbox( ASIconBox **pib ); 676 ASIconBox *get_iconbox( int desktop ); 677 Bool add_iconbox_icon( ASWindow *asw ); 678 Bool remove_iconbox_icon( ASWindow *asw ); 679 Bool change_iconbox_icon_desk( ASWindow *asw, int from_desk, int to_desk ); 680 void rearrange_iconbox_icons( int desktop ); 681 682 683 /*************************** menus.c *********************************/ 684 685 /*************************** menuitem.c *********************************/ 686 int parse_modifier( char *tline ); 687 FunctionData *String2Func ( const char *string, FunctionData *p_fdata, Bool quiet ); 688 void ParsePopupEntry (char *tline, FILE * fd, char **junk, int *junk2); 689 690 691 /*************************** misc.c *********************************/ 692 inline void ungrab_window_buttons( Window w ); 693 inline void ungrab_window_keys (Window w ); 694 void MyXGrabButton ( unsigned button, unsigned modifiers, 695 Window grab_window, Bool owner_events, unsigned event_mask, 696 int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor); 697 void MyXUngrabButton ( unsigned button, unsigned modifiers, Window grab_window); 698 void grab_window_buttons (Window w, ASFlagType context_mask); 699 void grab_window_keys (Window w, ASFlagType context_mask); 700 void grab_focus_click( Window w ); 701 void ungrab_focus_click( Window w ); 702 void SetTimer (int delay); 703 704 705 /***************************** module.c ***********************************/ 706 void SetupModules(void); 707 708 void ExecModule (char *action, Window win, int context); 709 int AcceptModuleConnection (int socket_fd); 710 711 void SendVector (int channel, send_data_type msg_type, ASVector *vector); 712 void SendPacket ( int channel, send_data_type msg_type, send_data_type num_datum, ...); 713 void SendConfig (int module, send_data_type event_type, ASWindow * t); 714 void SendString ( int channel, send_data_type msg_type, 715 Window w, Window frame, ASWindow *asw_ptr, 716 char *string, send_data_type encoding ); 717 void SendStackingOrder (int channel, send_data_type msg_type, send_data_type desk, ASVector *ids); 718 /* simplified specialized interface to above functions : */ 719 void broadcast_focus_change( ASWindow *asw, Bool focused ); 720 void broadcast_window_name( ASWindow *asw ); 721 void broadcast_icon_name( ASWindow *asw ); 722 void broadcast_res_names( ASWindow *asw ); 723 void broadcast_status_change( int message, ASWindow *asw ); 724 void broadcast_config (send_data_type event_type, ASWindow * t); 725 726 727 void HandleModuleInOut(unsigned int channel, Bool has_input, Bool has_output); 728 729 void KillModuleByName (char *name); 730 void KillAllModulesByName (char *name); 731 int KillAllModules(); 732 733 int FindModuleByName (char *name); 734 char *GetModuleCmdLineByName(char *name); 735 void DeadPipe (int nonsense); 736 void ShutdownModules(Bool dont_free_memory); 737 738 void RunCommand (FunctionData * fdata, unsigned int channel, Window w); 739 740 void FlushAllQueues(); 741 MenuData *make_module_menu( FunctionCode func, const char *title, int sort_order ); 742 #define make_stop_module_menu(sort_order) make_module_menu( F_KILLMODULEBYNAME, "Stop Running Module", sort_order ) 743 #define make_restart_module_menu(sort_order) make_module_menu( F_RESTARTMODULEBYNAME, "Restart Running Module", sort_order ) 744 745 746 /******************************* outline.c ********************************/ 747 void MoveOutline( struct MoveResizeData * pdata ); 748 749 /******************************* pager.c ***********************************/ 750 /* we use 4 windows that are InputOnly and therefore are invisible on the 751 * sides of the screen to steal mouse events and allow for virtual viewport 752 * move when cursor reaches edge of the screen. :*/ 753 void MoveViewport (int newx, int newy, Bool grab); 754 void HandlePaging (int HorWarpSize, int VertWarpSize, int *xl, 755 int *yt, int *delta_x, int *delta_y, Bool Grab, struct ASEvent *event); 756 757 void ChangeDesks (int new_desk); 758 void ChangeDeskAndViewport ( int new_desk, int new_vx, int new_vy, Bool force_grab); 759 MyBackground *get_desk_back_or_default( int desk, Bool old_desk ); 760 void change_desktop_background( int desk ); 761 void HandleBackgroundRequest( struct ASEvent *event ); 762 Bool is_background_xfer_ximage( unsigned long id ); 763 void stop_all_background_xfer(); 764 void release_all_old_background( Bool forget ); 765 766 int as_desk2ext_desk_safe (int as_desk); 767 768 769 770 /******************************* placement.c *******************************/ 771 ASGrid* make_desktop_grid (int desk, int min_layer, Bool frame_only, ASWindow *target); 772 void setup_aswindow_moveresize (ASWindow *asw, struct ASMoveResizeData *mvrdata); 773 Bool place_aswindow (ASWindow *asw); 774 void apply_aswindow_move (struct ASMoveResizeData *data); 775 void apply_aswindow_moveresize (struct ASMoveResizeData *data); 776 void complete_aswindow_move (struct ASMoveResizeData *data, Bool cancelled); 777 void complete_aswindow_moveresize (struct ASMoveResizeData *data, Bool cancelled); 778 void enforce_avoid_cover (ASWindow *asw); 779 void obey_avoid_cover (ASWindow *asw, ASStatusHints *tmp_status, XRectangle *tmp_anchor, int max_layer); 780 781 782 /******************************* theme.c ***********************************/ 783 Bool install_theme_file( const char *src ); 784 785 /******************************* winstatus.c *******************************/ 786 void complete_wm_state_transition( ASWindow *asw, int state ); 787 Bool apply_window_status_size(register ASWindow *asw, ASOrientation *od); 788 Bool set_window_wm_state( ASWindow *asw, Bool iconify, Bool force_unmapped ); 789 Bool make_aswindow_visible( ASWindow *asw, Bool deiconify ); 790 void change_aswindow_layer( ASWindow *asw, int layer ); 791 void quietly_reparent_aswindow( ASWindow *asw, Window dst, Bool user_root_pos ); 792 void change_aswindow_desktop( ASWindow *asw, int new_desk, Bool force ); 793 void toggle_aswindow_status( ASWindow *asw, ASFlagType flags ); 794 Bool check_canvas_offscreen (ASCanvas *pc); 795 Bool check_window_offscreen (ASWindow *asw); 796 Bool check_frame_offscreen (ASWindow *asw); 797 Bool check_frame_side_offscreen (ASWindow *asw, int i); 798 799 void update_window_frame_pos(ASWindow *asw); 800 801 802 void hide_hilite(); /* unhilites currently highlited window */ 803 void hilite_aswindow( ASWindow *asw ); /* actually hilites focused window on reception of event */ 804 void warp_to_aswindow( ASWindow *asw, Bool deiconify ); 805 Bool activate_aswindow( ASWindow *asw, Bool force, Bool deiconify ); 806 void press_aswindow( ASWindow *asw, int context ); 807 void release_pressure(); 808 809 void save_aswindow_anchor( ASWindow *asw, Bool hor, Bool vert ); 810 void moveresize_aswindow_wm( ASWindow *asw, int x, int y, unsigned int width, unsigned int height, Bool save_anchor ); 811 812 void on_window_anchor_changed( ASWindow *asw ); 813 void validate_window_anchor (ASWindow *asw, XRectangle *new_anchor, Bool initial_placement); 814 815 816 Bool init_aswindow_status( ASWindow *t, ASStatusHints *status ); 817 818 819 #endif /* ASINTERNALS_H_HEADER_INCLUDED */ 820