X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=driver%2Fxscreensaver.h;h=646a5179c5afa570161a6f20661f21c235933b7e;hp=6fc68ba855b755580665ea5afed0e54f114abec0;hb=ffd8c0873576a9e3065696a624dce6b766b77062;hpb=2a991a811de4c7b22f812682b267b616a809fd9a diff --git a/driver/xscreensaver.h b/driver/xscreensaver.h index 6fc68ba8..646a5179 100644 --- a/driver/xscreensaver.h +++ b/driver/xscreensaver.h @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1993-1998 Jamie Zawinski +/* xscreensaver, Copyright (c) 1993-2004 Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -20,10 +20,15 @@ #include #include +#ifdef HAVE_SIGACTION +# include /* for sigset_t */ +#endif + +#include "prefs.h" + extern char *progname; extern char *progclass; -typedef struct saver_preferences saver_preferences; typedef struct saver_info saver_info; typedef struct saver_screen_info saver_screen_info; typedef struct passwd_dialog_data passwd_dialog_data; @@ -34,53 +39,12 @@ typedef struct splash_dialog_data splash_dialog_data; -/* This structure holds all the user-specified parameters, read from the - command line, the resource database, or entered through a dialog box. - */ -struct saver_preferences { - Bool verbose_p; /* whether to print out lots of status info */ - Bool timestamp_p; /* whether to mark messages with a timestamp */ - Bool debug_p; /* pay no mind to the man behind the curtain */ - Bool xsync_p; /* whether XSynchronize has been called */ - - Bool lock_p; /* whether to lock as well as save */ - Bool lock_vt_p; /* whether to lock VTs too, if possible */ - Bool fade_p; /* whether to fade to black, if possible */ - Bool unfade_p; /* whether to fade from black, if possible */ - int fade_seconds; /* how long that should take */ - int fade_ticks; /* how many ticks should be used */ - - Bool install_cmap_p; /* whether we should use our own colormap - when using the screen's default visual. */ - - char **screenhacks; /* the programs to run */ - int screenhacks_count; - - int nice_inferior; /* nice value for subprocs */ - - Time initial_delay; /* how long to sleep after launch */ - Time splash_duration; /* how long the splash screen stays up */ - Time timeout; /* how much idle time before activation */ - Time lock_timeout; /* how long after activation locking starts */ - Time cycle; /* how long each hack should run */ - Time passwd_timeout; /* how much time before pw dialog goes down */ - Time pointer_timeout; /* how often to check mouse position */ - Time notice_events_timeout; /* how long after window creation to select */ - Time watchdog_timeout; /* how often to re-raise and re-blank screen */ - - Bool use_xidle_extension; /* which extension to use, if possible */ - Bool use_mit_saver_extension; - Bool use_sgi_saver_extension; - - char *shell; /* where to find /bin/sh */ - - char *help_url; /* Where the help document resides. */ - char *load_url_command; /* How one loads URLs. */ -}; - - /* This structure holds all the data that applies to the program as a whole, or to the non-screen-specific parts of the display connection. + + The saver_preferences structure (prefs.h) holds all the user-specified + parameters, read from the command line, the resource database, or entered + through a dialog box. */ struct saver_info { char *version; @@ -90,9 +54,6 @@ struct saver_info { saver_screen_info *screens; saver_screen_info *default_screen; /* ...on which dialogs will appear. */ - time_t init_file_date; /* The date (from stat()) of the .xscreensaver - file the last time this process read or - wrote it. */ /* ======================================================================= global connection info @@ -100,12 +61,17 @@ struct saver_info { XtAppContext app; Display *dpy; - XrmDatabase db; /* ======================================================================= server extension info ======================================================================= */ + Bool xinerama_p; /* Whether Xinerama is in use. */ + Bool using_xidle_extension; /* which extension is being used. */ + Bool using_mit_saver_extension; /* Note that `p->use_*' is the *request*, */ + Bool using_sgi_saver_extension; /* and `si->using_*' is the *reality*. */ + Bool using_proc_interrupts; + # ifdef HAVE_MIT_SAVER_EXTENSION int mit_saver_ext_event_number; int mit_saver_ext_error_number; @@ -114,6 +80,10 @@ struct saver_info { int sgi_saver_ext_event_number; int sgi_saver_ext_error_number; # endif +# ifdef HAVE_RANDR + int randr_event_number; + int randr_error_number; +# endif /* ======================================================================= @@ -123,7 +93,14 @@ struct saver_info { Bool screen_blanked_p; /* Whether the saver is currently active. */ Window mouse_grab_window; /* Window holding our mouse grab */ Window keyboard_grab_window; /* Window holding our keyboard grab */ + int mouse_grab_screen; /* The screen number the mouse grab is on */ + int keyboard_grab_screen; /* The screen number the keyboard grab is on */ Bool fading_possible_p; /* Whether fading to/from black is possible. */ + Bool throttled_p; /* Whether we should temporarily just blank + the screen, not run hacks. */ + time_t blank_time; /* The time at which the screen was blanked + (if currently blanked) or unblanked (if + not blanked.) */ /* ======================================================================= @@ -149,14 +126,22 @@ struct saver_info { Window passwd_dialog; /* The password dialog, if its up. */ passwd_dialog_data *pw_data; /* Other info necessary to draw it. */ + int unlock_failures; /* Counts failed login attempts while the + screen is locked. */ + + char *unlock_typeahead; /* If the screen is locked, and the user types + a character, we assume that it is the first + character of the password. It's stored here + for the password dialog to use to populate + itself. */ + /* ======================================================================= demoing ======================================================================= */ - Bool demo_mode_p; /* Whether demo-mode is active */ - char *demo_hack; /* The hack that has been selected from the - dialog box, which should be run next. */ + Bool demoing_p; /* Whether we are demoing a single hack + (without UI.) */ Window splash_dialog; /* The splash dialog, if its up. */ splash_dialog_data *sp_data; /* Other info necessary to draw it. */ @@ -172,9 +157,18 @@ struct saver_info { XtIntervalId watchdog_id; /* Timer to implement `prefs.watchdog */ XtIntervalId check_pointer_timer_id; /* `prefs.pointer_timeout' */ + XtIntervalId de_race_id; /* Timer to make sure screen un-blanks */ + int de_race_ticks; + time_t last_activity_time; /* Used only when no server exts. */ + time_t last_wall_clock_time; /* Used to detect laptop suspend. */ saver_screen_info *last_activity_screen; + Bool emergency_lock_p; /* Set when the wall clock has jumped + (presumably due to laptop suspend) and we + need to lock down right away instead of + waiting for the lock timer to go off. */ + /* ======================================================================= remote control @@ -182,8 +176,9 @@ struct saver_info { int selection_mode; /* Set to -1 if the NEXT ClientMessage has just been received; set to -2 if PREV has just - been received; set to N if SELECT has - been received. (This is kind of nasty.) */ + been received; set to N if SELECT or DEMO N + has been received. (This is kind of nasty.) + */ /* ======================================================================= subprocs @@ -201,7 +196,19 @@ struct saver_info { struct saver_screen_info { saver_info *global; - Screen *screen; + int number; /* The internal ordinal of this screen, + counting Xinerama rectangles as separate + screens. */ + int real_screen_number; /* The number of the underlying X screen on + which this rectangle lies. */ + Screen *screen; /* The X screen in question. */ + + int x, y, width, height; /* The size and position of this rectangle + on its underlying X screen. */ + + Bool real_screen_p; /* This will be true of exactly one ssi per + X screen. */ + Widget toplevel_shell; /* ======================================================================= @@ -214,13 +221,17 @@ struct saver_screen_info { destroy and recreate it on different visuals. */ Colormap cmap; /* The colormap that goes with the window. */ - Bool install_cmap_p; /* whether we should use our own colormap. - This can be overridden on a per-hack basis. - */ + Bool install_cmap_p; /* Whether this screen should have its own + colormap installed, for whichever of several + reasons. This is definitive (even a false + value here overrides prefs->install_cmap_p.) + */ Visual *current_visual; /* The visual of the window. */ - Visual *default_visual; /* visual to use when none other specified */ int current_depth; /* How deep the visual (and the window) are. */ + Visual *default_visual; /* visual to use when none other specified */ + Visual *best_gl_visual; /* visual to use for GL hacks */ + Window real_vroot; /* The original virtual-root window. */ Window real_vroot_value; /* What was in the __SWM_VROOT property. */ @@ -228,6 +239,13 @@ struct saver_screen_info { real root window. */ unsigned long black_pixel; /* Black, allocated from `cmap'. */ + int blank_vp_x, blank_vp_y; /* Where the virtual-scrolling viewport was + when the screen went blank. We need to + prevent the X server from letting the mouse + bump the edges to scroll while the screen + is locked, so we reset to this when it has + moved, and the lock dialog is up... */ + # ifdef HAVE_MIT_SAVER_EXTENSION Window server_mit_saver_window; # endif @@ -275,8 +293,8 @@ struct saver_screen_info { server extensions and virtual roots ======================================================================= */ -extern void restore_real_vroot (saver_info *si); -extern void disable_builtin_screensaver (saver_info *si, Bool turn_off_p); +extern Bool restore_real_vroot (saver_info *si); +extern void disable_builtin_screensaver (saver_info *, Bool unblank_screen_p); extern Bool ensure_no_screensaver_running (Display *, Screen *); #ifdef HAVE_MIT_SAVER_EXTENSION @@ -285,6 +303,15 @@ extern Bool query_mit_saver_extension (saver_info *); #ifdef HAVE_SGI_SAVER_EXTENSION extern Bool query_sgi_saver_extension (saver_info *); #endif +#ifdef HAVE_XIDLE_EXTENSION +extern Bool query_xidle_extension (saver_info *); +#endif +#ifdef HAVE_RANDR +extern Bool query_randr_extension (saver_info *); +#endif +#ifdef HAVE_PROC_INTERRUPTS +extern Bool query_proc_interrupts_available (saver_info *, const char **why); +#endif /* Display Power Management System (DPMS) interface. */ extern Bool monitor_powered_on_p (saver_info *si); @@ -299,10 +326,16 @@ extern void initialize_screensaver_window (saver_info *si); extern void raise_window (saver_info *si, Bool inhibit_fade, Bool between_hacks_p, Bool dont_clear); -extern void blank_screen (saver_info *si); +extern Bool blank_screen (saver_info *si); extern void unblank_screen (saver_info *si); -extern void grab_keyboard_and_mouse (saver_info *si, Window, Cursor); -extern void ungrab_keyboard_and_mouse (saver_info *si); +extern void resize_screensaver_window (saver_info *si); + +extern void get_screen_viewport (saver_screen_info *ssi, + int *x_ret, int *y_ret, + int *w_ret, int *h_ret, + int target_x, int target_y, + Bool verbose_p); + /* ======================================================================= locking @@ -310,16 +343,16 @@ extern void ungrab_keyboard_and_mouse (saver_info *si); #ifndef NO_LOCKING extern Bool unlock_p (saver_info *si); -extern Bool lock_init (int argc, char **argv); -extern Bool passwd_valid_p (const char *typed_passwd); +extern Bool lock_priv_init (int argc, char **argv, Bool verbose_p); +extern Bool lock_init (int argc, char **argv, Bool verbose_p); +extern Bool passwd_valid_p (const char *typed_passwd, Bool verbose_p); +#endif /* NO_LOCKING */ -extern void make_passwd_window (saver_info *si); -extern void draw_passwd_window (saver_info *si); -extern void update_passwd_window (saver_info *si, const char *printed_passwd, - float ratio); -extern void destroy_passwd_window (saver_info *si); +extern void set_locked_p (saver_info *si, Bool locked_p); +extern int move_mouse_grab (saver_info *si, Window to, Cursor cursor, + int to_screen_no); +extern int mouse_screen (saver_info *si); -#endif /* NO_LOCKING */ /* ======================================================================= runtime privileges @@ -340,47 +373,45 @@ extern void draw_shaded_rectangle (Display *dpy, Window window, unsigned long bottom_color); extern int string_width (XFontStruct *font, char *s); - -#ifndef NO_DEMO_MODE -extern void demo_mode (saver_info *si); -extern void demo_mode_restart_process (saver_info *si); -extern void create_demo_dialog (Widget, Visual *, Colormap); -extern void create_resources_dialog (Widget, Visual *, Colormap); -#endif - -#if !defined(NO_LOCKING) || !defined(NO_DEMO_MODE) -extern void pop_up_dialog_box (Widget dialog, Widget form, int where); -extern void format_into_label (Widget label, const char *arg); -extern void steal_focus_and_colormap (Widget dialog); -#endif - extern void make_splash_dialog (saver_info *si); extern void handle_splash_event (saver_info *si, XEvent *e); -extern void skull (Display *, Window, GC, GC, int, int, int, int); /* ======================================================================= timers ======================================================================= */ -extern void start_notice_events_timer (saver_info *, Window); +extern void start_notice_events_timer (saver_info *, Window, Bool verbose_p); extern void cycle_timer (XtPointer si, XtIntervalId *id); extern void activate_lock_timer (XtPointer si, XtIntervalId *id); extern void reset_watchdog_timer (saver_info *si, Bool on_p); extern void idle_timer (XtPointer si, XtIntervalId *id); +extern void de_race_timer (XtPointer si, XtIntervalId *id); extern void sleep_until_idle (saver_info *si, Bool until_idle_p); +extern void reset_timers (saver_info *si); +extern void schedule_wakeup_event (saver_info *si, Time when, Bool verbose_p); + /* ======================================================================= remote control ======================================================================= */ extern Bool handle_clientmessage (saver_info *, XEvent *, Bool); +extern void maybe_reload_init_file (saver_info *); /* ======================================================================= subprocs ======================================================================= */ +extern void handle_signals (saver_info *si); +#ifdef HAVE_SIGACTION + extern sigset_t block_sigchld (void); +#else /* !HAVE_SIGACTION */ + extern int block_sigchld (void); +#endif /* !HAVE_SIGACTION */ +extern void unblock_sigchld (void); extern void hack_environment (saver_info *si); +extern void hack_subproc_environment (saver_screen_info *ssi); extern void init_sigchld (void); extern void spawn_screenhack (saver_info *si, Bool first_time_p); extern void kill_screenhack (saver_info *si); @@ -388,7 +419,10 @@ extern void suspend_screenhack (saver_info *si, Bool suspend_p); extern Bool screenhack_running_p (saver_info *si); extern void emergency_kill_subproc (saver_info *si); extern Bool select_visual (saver_screen_info *ssi, const char *visual_name); +extern void store_saver_status (saver_info *si); extern const char *signal_name (int signal); +extern void exec_command (const char *shell, const char *command, + int nice_level); /* ======================================================================= subprocs diagnostics @@ -399,15 +433,7 @@ extern FILE *real_stdout; extern void initialize_stderr (saver_info *si); extern void reset_stderr (saver_screen_info *ssi); extern void clear_stderr (saver_screen_info *ssi); - -/* ======================================================================= - the .xscreensaver file - ======================================================================= */ - -extern int read_init_file (saver_info *si); -extern int write_init_file (saver_info *si); -extern int maybe_reload_init_file (saver_info *si); -extern void get_resources (saver_info *si); +extern void shutdown_stderr (saver_info *si); /* ======================================================================= @@ -423,10 +449,13 @@ extern int saver_ehandler (Display *dpy, XErrorEvent *error); extern int BadWindow_ehandler (Display *dpy, XErrorEvent *error); extern Bool window_exists_p (Display *dpy, Window window); extern char *timestring (void); +extern Bool display_is_on_console_p (saver_info *si); +extern Visual *get_best_gl_visual (saver_screen_info *ssi); +extern void check_for_leaks (const char *where); -extern Atom XA_VROOT, XA_XSETROOT_ID; +extern Atom XA_VROOT, XA_XSETROOT_ID, XA_ESETROOT_PMAP_ID, XA_XROOTPMAP_ID; extern Atom XA_SCREENSAVER, XA_SCREENSAVER_VERSION, XA_SCREENSAVER_ID; -extern Atom XA_SCREENSAVER_TIME; +extern Atom XA_SCREENSAVER_STATUS, XA_LOCK, XA_BLANK; extern Atom XA_DEMO, XA_PREFS; #endif /* __XSCREENSAVER_H__ */