~ubuntu-branches/ubuntu/maverick/zapping/maverick

« back to all changes in this revision

Viewing changes to src/x11stuff.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-03-08 23:19:08 UTC
  • mfrom: (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050308231908-oip7rfv6lcmo8c0e
Tags: 0.9.2-2ubuntu1
Rebuilt for Python transition (2.3 -> 2.4)

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 * the routines contained here are all the X-specific stuff in Zapping
23
23
 */
24
24
#ifdef HAVE_CONFIG_H
25
 
#  include <config.h>
 
25
#  include "config.h"
26
26
#endif
 
27
 
27
28
#include <gtk/gtk.h>
28
29
 
29
 
#include <tveng.h>
 
30
#include "tveng.h" /* tv_overlay_target, tv_pixfmt */
 
31
#include "libtv/screen.h"
30
32
 
31
33
/*
32
34
 * Returns a pointer to the data contained in the given GdkImage
46
48
gint
47
49
x11_get_bpp(void);
48
50
 
49
 
/*
50
 
 * Returns a pointer to a clips array (that you need to free()
51
 
 * afterwards if not NULL).
52
 
 * Pass the GdkWindow that you want to get the clip status of.
53
 
 * num_clips get filled with the number of clips in the array.
54
 
 */
55
 
struct tveng_clip *
56
 
x11_get_clips(GdkWindow * win, gint x, gint y, gint w, gint h, gint *
57
 
              num_clips);
 
51
const gchar *
 
52
x11_display_name (void);
58
53
 
59
54
/*
60
55
 * Maps and unmaps a window of the given (screen) geometry, thus
61
56
 * forcing an expose event in that area
62
57
 */
63
58
void
64
 
x11_force_expose(gint x, gint y, gint w, gint h);
 
59
x11_force_expose(gint x, gint y, guint w, guint h);
65
60
 
66
61
/*
67
62
 * Returns TRUE if the window is viewable
69
64
gboolean
70
65
x11_window_viewable(GdkWindow *window);
71
66
 
72
 
/*
73
 
 * Sets the X screen saver on/off
74
 
 */
75
 
void
76
 
x11_set_screensaver(gboolean on);
77
 
 
78
 
/**
79
 
 * XvImage handling (SHM, etc)
80
 
 */
81
 
typedef struct {
82
 
  gint                  w, h;
83
 
  gpointer              data;
84
 
  gint                  data_size; /* in bytes */
85
 
  struct _xvzImagePrivate *priv; /* X-related data, not interesting */
86
 
} xvzImage;
87
 
 
88
 
/**
89
 
 * Create a new XV image with the given attributes, returns NULL on error.
90
 
 */
91
 
xvzImage * xvzImage_new(enum tveng_frame_pixformat pixformat,
92
 
                        gint width, gint height);
93
 
 
94
 
/**
95
 
 * Puts the image in the given drawable, scales to the drawable's size.
96
 
 */
97
 
void xvzImage_put(xvzImage *image, GdkWindow *window, GdkGC *gc);
98
 
 
99
 
/**
100
 
 * Frees the data associated with the image
101
 
 */
102
 
void xvzImage_destroy(xvzImage *image);
103
 
 
104
 
/**
105
 
 * Tries to grab a port for displaying the xvzImages. FALSE on error.
106
 
 * Must be called before all the rest of xvz routines, or they won't
107
 
 * work.
108
 
 */
109
 
gboolean xvz_grab_port(tveng_device_info *info);
110
 
 
111
 
/**
112
 
 * Ungrabs any previously grabbed port.
113
 
 */
114
 
void xvz_ungrab_port(tveng_device_info *info);
115
 
 
116
 
/**
117
 
 * Inits the video backends.
118
 
 */
119
 
void startup_xvz(void);
120
 
 
121
 
/**
122
 
 * Closes the video backends.
123
 
 */
124
 
void shutdown_xvz(void);
125
 
 
126
 
/* some useful constants */
127
 
#ifndef OFF
128
 
#define OFF FALSE
129
 
#endif
130
 
#ifndef ON
131
 
#define ON TRUE
132
 
#endif
133
 
 
134
 
/**
135
 
 * Struct for video backends
136
 
 */
137
 
typedef struct {
138
 
  /* A descriptive name for the backend */
139
 
  char          *name;
140
 
  /* see xvz_grab_port, open devices in here, FALSE on error */
141
 
  gboolean      (*grab)(tveng_device_info *info);
142
 
  /* see xvz_ungrab_port, close devices */
143
 
  void          (*ungrab)(tveng_device_info *info);
144
 
  /* Create a suitable image, will always be called with the port
145
 
     grabbed */
146
 
  xvzImage*     (*image_new)(enum tveng_frame_pixformat pixformat,
147
 
                             gint width, gint height);
148
 
  /* Destroy the given image */
149
 
  void          (*image_destroy)(xvzImage *image);
150
 
  /* Put the image in the drawable, do scaling as necessary */
151
 
  void          (*image_put)(xvzImage *image, GdkWindow *window,
152
 
                             GdkGC *gc);
153
 
} video_backend;
154
 
 
155
 
extern void (* window_on_top)(GtkWidget *widget, gboolean on);
156
 
extern int wm_detect (void);
 
67
/* Keep-window-on-top routines */
 
68
 
 
69
extern void
 
70
(* x11_window_on_top)           (GtkWindow *window, gboolean on);
 
71
extern void
 
72
(* x11_window_fullscreen)       (GtkWindow *window, gboolean on);
 
73
extern void
 
74
(* x11_window_below)            (GtkWindow *window, gboolean on);
 
75
extern gboolean
 
76
wm_hints_detect                 (void);
 
77
 
 
78
/* VidMode routines */
 
79
 
 
80
typedef struct _x11_vidmode_info x11_vidmode_info;
 
81
 
 
82
struct _x11_vidmode_info {
 
83
  x11_vidmode_info *    next;
 
84
 
 
85
  unsigned int          width;
 
86
  unsigned int          height;
 
87
  double                hfreq;          /* Hz */
 
88
  double                vfreq;          /* Hz */
 
89
  double                aspect;         /* pixel y/x */
 
90
};
 
91
 
 
92
typedef struct _x11_vidmode_state x11_vidmode_state;
 
93
 
 
94
struct _x11_vidmode_state {
 
95
  /* <Private> */
 
96
  struct {
 
97
    const x11_vidmode_info *vm;
 
98
    struct {
 
99
      int                   x;
 
100
      int                   y;
 
101
    }                     pt, vp;
 
102
  }                     _old, _new;
 
103
};
 
104
 
 
105
extern void
 
106
x11_vidmode_list_delete         (x11_vidmode_info *     list);
 
107
extern x11_vidmode_info *
 
108
x11_vidmode_list_new            (const char *           display_name,
 
109
                                 int                    screen_number);
 
110
extern const x11_vidmode_info *
 
111
x11_vidmode_by_name             (const x11_vidmode_info *list,
 
112
                                 const gchar *          name);
 
113
extern const x11_vidmode_info *
 
114
x11_vidmode_current             (const x11_vidmode_info *list);
 
115
extern void
 
116
x11_vidmode_clear_state         (x11_vidmode_state *    vs);
 
117
extern gboolean
 
118
x11_vidmode_switch              (const x11_vidmode_info *vlist,
 
119
                                 const tv_screen *      slist,
 
120
                                 const x11_vidmode_info *vm,
 
121
                                 x11_vidmode_state *    vs);
 
122
extern void
 
123
x11_vidmode_restore             (const x11_vidmode_info *list,
 
124
                                 x11_vidmode_state *    vs);
 
125
 
 
126
/* Screensaver routines */
 
127
 
 
128
#define X11_SCREENSAVER_ON              0
 
129
#define X11_SCREENSAVER_DISPLAY_ACTIVE  (1 << 0) /* for overlay modes */
 
130
#define X11_SCREENSAVER_CPU_ACTIVE      (1 << 1) /* for capture modes */
 
131
 
 
132
extern void
 
133
x11_screensaver_set             (unsigned int           level);
 
134
extern void
 
135
x11_screensaver_control         (gboolean               enable);
 
136
extern void
 
137
x11_screensaver_init            (void);
 
138
 
 
139
/* XVideo routines */
 
140
 
 
141
#ifdef HAVE_XV_EXTENSION
 
142
 
 
143
#include <X11/extensions/Xvlib.h>
 
144
 
 
145
extern tv_pixfmt
 
146
x11_xv_image_format_to_pixfmt   (const XvImageFormatValues *format);
 
147
 
 
148
#endif
 
149
 
 
150
extern void
 
151
x11_xvideo_dump                 (void);
 
152
 
 
153
/* Clipping */
 
154
 
 
155
extern tv_bool
 
156
x11_window_clip_vector          (tv_clip_vector *       vector,
 
157
                                 Display *              display,
 
158
                                 Window                 window,
 
159
                                 int                    x,
 
160
                                 int                    y,
 
161
                                 unsigned int           width,
 
162
                                 unsigned int           height);
157
163
 
158
164
#endif /* x11stuff.h */