~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to src/frame.c

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-25 15:47:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080225154712-qvr11ekcea4c9ry8
Tags: 1.1.6-0.1ubuntu1
* Merge from debian-multimedia (LP: #120003), Ubuntu Changes:
 - For ffmpeg-related build-deps, remove cvs from package names.
 - Standards-Version 3.7.3
 - Maintainer Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file frame.c
 
3
 *
 
4
 * This file contains some state variables for the capture area frame
 
5
 * and generic functions like setter/getter for state etc.
 
6
 */
 
7
 
1
8
/*
2
 
 * frame.c
3
 
 *
4
9
 * Copyright (C) 1997 Rasca Gmelch, Berlin
 
10
 * Copyright (C) 2004-07 Karl, Frankfurt
5
11
 *
6
12
 * This program is free software; you can redistribute it and/or modify
7
13
 * it under the terms of the GNU General Public License as published by
10
16
 *
11
17
 * This program is distributed in the hope that it will be useful,
12
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
20
 * GNU General Public License for more details.
15
21
 *
16
22
 * You should have received a copy of the GNU General Public License
18
24
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
25
 */
20
26
 
21
 
 
 
27
#include <stdio.h>
22
28
#include <X11/Intrinsic.h>
23
29
#include "frame.h"
24
30
 
25
 
/*
26
 
 * return a pointer to the current area enclosed by the frame
 
31
#ifndef DOXYGEN_SHOULD_SKIP_THIS
 
32
#define DEBUGFILE "frame.c"
 
33
#endif     // DOXYGEN_SHOULD_SKIP_THIS
 
34
 
 
35
/** \brief stores the state of the frame lock */
 
36
static int xvc_frame_lock;
 
37
 
 
38
/** \brief stores the area enclosed by the frame as an XRectangle */
 
39
static XRectangle xvc_frame_rectangle;
 
40
 
 
41
/**
 
42
 * \brief return a pointer to the current area enclosed by the capture frame
 
43
 *
 
44
 * @return a pointer to an XRectangle struct
27
45
 */
28
46
XRectangle *
29
 
GetArea(void) {
30
 
    extern XRectangle XVC_frame_rectangle;
31
 
    
32
 
    return (&XVC_frame_rectangle);
 
47
xvc_get_capture_area (void)
 
48
{
 
49
    return (&xvc_frame_rectangle);
33
50
}
34
51
 
35
 
 
36
 
/*
 
52
/**
 
53
 * \brief get the state of the frame lock
 
54
 *
 
55
 * @return integer state of the frame lock: 1 = locked, 0 = unlocked
37
56
 */
38
57
int
39
 
IsFrameLocked() {
40
 
    extern int XVC_frame_lock;
41
 
    
42
 
    return (XVC_frame_lock);
 
58
xvc_is_frame_locked ()
 
59
{
 
60
    return (xvc_frame_lock);
 
61
}
 
62
 
 
63
/**
 
64
 * \brief set the state of the frame lock
 
65
 *
 
66
 * @param lock integer state of the frame lock: 0 = unlocked, >0 = locked
 
67
 */
 
68
void
 
69
xvc_set_frame_locked (int lock)
 
70
{
 
71
    if (lock == 0)
 
72
        xvc_frame_lock = lock;
 
73
    else
 
74
        xvc_frame_lock = 1;
 
75
}
 
76
 
 
77
/**
 
78
 * \brief get the window attributes for the given window
 
79
 *
 
80
 * @param win a Window to retrieve the attributes for. Can be a single window,
 
81
 *      the root window (if manually selected) or None (in which case we will
 
82
 *      select the root window ourselves
 
83
 * @param wa return pointer to the XWindowAttributes struct to write to
 
84
 */
 
85
void
 
86
xvc_get_window_attributes (Window win, XWindowAttributes * wa)
 
87
{
 
88
#define DEBUGFUNCTION "xvc_get_window_attributes()"
 
89
 
 
90
    Display *display = xvc_frame_get_capture_display ();
 
91
 
 
92
    if (win == None) {
 
93
        win = DefaultRootWindow (display);
 
94
    }
 
95
 
 
96
    if (!XGetWindowAttributes (display, win, wa)) {
 
97
        char msg[256];
 
98
 
 
99
        snprintf (msg, 256, "%s %s: Can't get window attributes!\n",
 
100
                  DEBUGFILE, DEBUGFUNCTION);
 
101
        perror (msg);
 
102
    }
 
103
#undef DEBUGFUNCTTION
43
104
}