~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to libvo/x11_common.c

  • Committer: Gauvain Pocentek
  • Date: 2012-03-06 11:59:12 UTC
  • mfrom: (66.1.15 precise)
  • Revision ID: gauvain@pocentek.net-20120306115912-h9d6kt9j0l532oo5
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* New upstream snapshot
* upload to unstable
* Build against external libmpeg2
* drop 51_FTBFS_arm.patch again
* no longer build depend on libcdparanoia-dev on the Hurd
* Fix FTBFS on the hurd.
  Thanks to Samuel Thibault <sthibault@debian.org> (Closes: #654974)
* Fix FTBFS on arm
* New upstream snapshot, Closes: #650339, #643621, #481807
* Imported Upstream version 1.0~rc4+svn34492
* Bump standards version
* Bump dependency on libav >= 4:0.8~, Closes: #653887
* Fix build-indep
* Build mplayer-gui again, Closes: #568514
* Drop debian/all-lang-config-mak.sh, no longer needed
* include .dfsg1 in version number
* remove get-orig-source target
* no longer prune compiler flags from the environment
* No longer advertise nor build 3fdx, mga and dxr3 backends,
  Closes: #496106, #442181, #533546
* beautify mplayer version identification string
* Brown paperbag upload.
* Next try to fix build failure on sparce after recent binutils change.
* Brown paperbag upload.
* Really fix build failure on sparc after recent binutils change.
* Properly set Replaces/Conflicts on mplayer2{,-dbg} to avoid
  file overwrite errors.
* Adjust versioning of mplayer listed in the mplayer-dbg's Depends field.
* Fix build failure on sparc after recent binutils change.
* Urgency medium bumped because of RC-level bugfix
  and speeding up x264 transition.
* Update to my @debian.org email.
* Upload to unstable
* Enable joystick support on Linux only, Closes: #638408
* Rebuild fixes toolchain issue on arm, Closes: #637077
* New upstream snapshot
* following the discussion started by Diego Biurrun <diego@biurrun.de>
  in debian-devel, I have prepared a new packaging of 'mplayer'
  (with code that comes from CVS)
* the upstream tar.bz cannot be distributed by Debian, since it contains
   CSS code; so I am repackaging it 
* I have tried my best to address all known issues:
  - the package contains the detailed Copyright made by Diego Biurrun 
  - the package does not contain CSS code, or  AFAIK other code on which 
     there is active patent enforcement
  - there is a script  debian/cvs-changelog.sh  that shows all changes
     done to files included in this source.
    This should comply with GPLv2 sec 2.a  (in spirit if not in letter)
    For this reason, the source code contains CVS directories.
* needs   make (>= 3.80) for 'html-chunked-$(1)' in DOCS/xml/Makefile

* some corrections, as suggested Diego Biurrun
  - binary codecs should go into /usr/lib/codecs (upstream default)
  - better template 'mplayer/install_codecs'
  - an empty 'font=' in mplayer.conf breaks mplayer: postinst corrected
* correction in 'mplayer/cfgnote'
* better mplayer.postinst and mplayer.config

* New upstream release
* better debian/copyright file
* do not ship a skin
* New upstream release
* changed DEB_BUILD_OPTIONS to DEB_BUILD_CONFIGURE ,
  DEB_BUILD_OPTIONS is used as in debian policy
* use gcc-3.4
* changed xlibs-dev to a long list of dependencies, for Debian/etch
* try to adhere to  http://www.mplayerhq.hu/DOCS/tech/binary-packaging.txt
  (see README.Debian for details)
* removed dependency on xlibmesa-dev, disabled opengl
* New upstream release
* Simon McVittie <hacks@pseudorandom.co.uk> wonderful work:
- Work around Debian bug #267442 (glibc's sys/uio.h and gcc's altivec.h have
  conflicting uses for __vector) by re-ordering #includes
- Fix potential symlink attack in ./configure
- Disable support for binary codecs on platforms for which those codecs
  aren't available; also disable the corresponding Debconf note when it's
  inappropriate
- Changed Build-Depends: so it works in pbuilder
- Explicitly build-depend on libjpeg62-dev, libfontconfig1-dev,
  libungif4-dev 
- Tweak debian/rules to avoid certain errors being ignored
- Use --language=all
* provide a target  'debian/rules get-orig-source' 
  that recreates the orig.tar.gz ; then use the above orig.tar.gz
* rewrote some parts of debian/rules
* don't clean and recompile docs if upstream ships them
* mplayer-doc was shipping too much stuff
* translated man pages where not installed properly
* compile with libdv4-dev
* correct README.Debian
* Forgot build-dep on libtheora
* Must not depend on libxvidcore
* New upstream release
* new release.
* rc1 to become 0.90
* new pre-release
* new pre-release
* gtk bug fixed.
* new release.
* version bumped
* 0.60 pre2 release
* 0.60 pre-release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "libavutil/common.h"
29
29
#include "x11_common.h"
30
30
 
31
 
#ifdef X11_FULLSCREEN
32
 
 
33
31
#include <string.h>
34
32
#include <unistd.h>
35
33
#include <assert.h>
89
87
static int orig_layer = 0;
90
88
static int old_gravity = NorthWestGravity;
91
89
 
92
 
int stop_xscreensaver = 0;
 
90
int stop_xscreensaver = 1;
93
91
 
94
92
static int dpms_disabled = 0;
95
93
 
141
139
/*
142
140
 * Sends the EWMH fullscreen state event.
143
141
 *
 
142
 * win:    id of the window to which the event shall be sent
144
143
 * action: could be one of _NET_WM_STATE_REMOVE -- remove state
145
144
 *                         _NET_WM_STATE_ADD    -- add state
146
145
 *                         _NET_WM_STATE_TOGGLE -- toggle
147
146
 */
148
 
void vo_x11_ewmh_fullscreen(int action)
 
147
void vo_x11_ewmh_fullscreen(Window win, int action)
149
148
{
150
149
    assert(action == _NET_WM_STATE_REMOVE ||
151
150
           action == _NET_WM_STATE_ADD || action == _NET_WM_STATE_TOGGLE);
159
158
        xev.xclient.serial = 0;
160
159
        xev.xclient.send_event = True;
161
160
        xev.xclient.message_type = XA_NET_WM_STATE;
162
 
        xev.xclient.window = vo_window;
 
161
        xev.xclient.window = win;
163
162
        xev.xclient.format = 32;
164
163
        xev.xclient.data.l[0] = action;
165
164
        xev.xclient.data.l[1] = XA_NET_WM_STATE_FULLSCREEN;
177
176
    }
178
177
}
179
178
 
180
 
void vo_hidecursor(Display * disp, Window win)
 
179
static void vo_hidecursor(Display * disp, Window win)
181
180
{
182
181
    Cursor no_ptr;
183
182
    Pixmap bm_no;
185
184
    Colormap colormap;
186
185
    static char bm_no_data[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
187
186
 
188
 
    if (WinID == 0)
189
 
        return;                 // do not hide if playing on the root window
 
187
    if (WinID >= 0)
 
188
        return;        // do not hide if attached to an existing window
190
189
 
191
190
    colormap = DefaultColormap(disp, DefaultScreen(disp));
192
191
    if ( !XAllocNamedColor(disp, colormap, "black", &black, &dummy) )
202
201
    XFreeColors(disp,colormap,&black.pixel,1,0);
203
202
}
204
203
 
205
 
void vo_showcursor(Display * disp, Window win)
 
204
static void vo_showcursor(Display * disp, Window win)
206
205
{
207
 
    if (WinID == 0)
208
 
        return;
 
206
    if (WinID >= 0)
 
207
        return;        // do not show if attached to an existing window
209
208
    XDefineCursor(disp, win, 0);
210
209
}
211
210
 
551
550
#include "osdep/keycodes.h"
552
551
#include "wskeys.h"
553
552
 
554
 
#ifdef XF86XK_AudioPause
555
553
static const struct mp_keymap keysym_map[] = {
 
554
#ifdef XF86XK_AudioPause
556
555
    {XF86XK_MenuKB, KEY_MENU},
557
556
    {XF86XK_AudioPlay, KEY_PLAY}, {XF86XK_AudioPause, KEY_PAUSE}, {XF86XK_AudioStop, KEY_STOP},
558
557
    {XF86XK_AudioPrev, KEY_PREV}, {XF86XK_AudioNext, KEY_NEXT},
559
558
    {XF86XK_AudioMute, KEY_MUTE}, {XF86XK_AudioLowerVolume, KEY_VOLUME_DOWN}, {XF86XK_AudioRaiseVolume, KEY_VOLUME_UP},
 
559
#endif
560
560
    {0, 0}
561
561
};
562
562
 
563
 
static void vo_x11_putkey_ext(int keysym)
 
563
static int vo_x11_putkey_ext(int keysym)
564
564
{
565
565
    int mpkey = lookup_keymap_table(keysym_map, keysym);
566
566
    if (mpkey)
567
567
        mplayer_put_key(mpkey);
 
568
    return mpkey != 0;
568
569
}
569
 
#endif
570
570
 
571
571
static const struct mp_keymap keymap[] = {
572
572
    // special keys
729
729
{
730
730
    XClassHint wmClass;
731
731
    pid_t pid = getpid();
 
732
    long prop = pid & 0x7FFFFFFF;
732
733
 
733
734
    wmClass.res_name = vo_winname ? vo_winname : name;
734
735
    wmClass.res_class = "MPlayer";
735
736
    XSetClassHint(display, window, &wmClass);
 
737
 
 
738
    /* PID sizes other than 32-bit are not handled by the EWMH spec */
 
739
    if ((pid_t)prop != pid)
 
740
        return;
 
741
 
736
742
    XChangeProperty(display, window, XA_NET_WM_PID, XA_CARDINAL, 32,
737
 
                    PropModeReplace, (unsigned char *) &pid, 1);
 
743
                    PropModeReplace, (unsigned char *)&prop, 1);
738
744
}
739
745
 
740
746
Window vo_window = None;
806
812
    char buf[100];
807
813
    KeySym keySym;
808
814
    static XComposeStatus stat;
 
815
    static int ctrl_state;
809
816
 
810
817
    if (vo_mouse_autohide && mouse_waiting_hide &&
811
818
                                 (GetTimerMS() - mouse_timer >= 1000)) {
821
828
#ifdef CONFIG_GUI
822
829
        if (use_gui)
823
830
        {
824
 
            guiGetEvent(0, (char *) &Event);
 
831
            gui(GUI_HANDLE_X_EVENT, &Event);
825
832
            if (vo_window != Event.xany.window)
826
833
                continue;
827
834
        }
838
845
                ret |= check_resize();
839
846
                break;
840
847
            case KeyPress:
 
848
            case KeyRelease:
841
849
                {
842
850
                    int key;
843
851
 
847
855
 
848
856
                    XLookupString(&Event.xkey, buf, sizeof(buf), &keySym,
849
857
                                  &stat);
850
 
#ifdef XF86XK_AudioPause
851
 
                    vo_x11_putkey_ext(keySym);
852
 
#endif
853
858
                    key =
854
859
                        ((keySym & 0xff00) !=
855
860
                         0 ? ((keySym & 0x00ff) + 256) : (keySym));
856
 
                    vo_x11_putkey(key);
 
861
                    if (key == wsLeftCtrl || key == wsRightCtrl) {
 
862
                        ctrl_state = Event.type == KeyPress;
 
863
                        mplayer_put_key(KEY_CTRL |
 
864
                            (ctrl_state ? MP_KEY_DOWN : 0));
 
865
                    } else if (Event.type == KeyRelease) {
 
866
                        break;
 
867
                    }
 
868
                    // Attempt to fix if somehow our state got out of
 
869
                    // sync with reality.
 
870
                    // This usually happens when a shortcut involving CTRL
 
871
                    // was used to switch to a different window/workspace.
 
872
                    if (ctrl_state != !!(Event.xkey.state & 4)) {
 
873
                        ctrl_state = !!(Event.xkey.state & 4);
 
874
                        mplayer_put_key(KEY_CTRL |
 
875
                            (ctrl_state ? MP_KEY_DOWN : 0));
 
876
                    }
 
877
                    if (!vo_x11_putkey_ext(keySym)) {
 
878
                        vo_x11_putkey(key);
 
879
                    }
857
880
                    ret |= VO_EVENT_KEYPRESS;
858
881
                }
859
882
                break;
1068
1091
                             Colormap col_map,
1069
1092
                             const char *classname, const char *title)
1070
1093
{
 
1094
  if (vo_wintitle)
 
1095
    title = vo_wintitle;
1071
1096
  if (WinID >= 0) {
1072
1097
    vo_fs = flags & VOFLAG_FULLSCREEN;
1073
1098
    vo_window = WinID ? (Window)WinID : mRootWin;
1090
1115
      // if it relies on events being forwarded to the parent of WinID.
1091
1116
      // It also is consistent with the w32_common.c code.
1092
1117
      vo_x11_selectinput_witherr(mDisplay, vo_window,
1093
 
          StructureNotifyMask | KeyPressMask | PointerMotionMask |
 
1118
          StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
1094
1119
          ButtonPressMask | ButtonReleaseMask | ExposureMask);
1095
1120
 
1096
1121
    vo_x11_update_geometry();
1106
1131
  }
1107
1132
  if (flags & VOFLAG_HIDDEN)
1108
1133
    goto final;
 
1134
  XStoreName(mDisplay, vo_window, title);
1109
1135
  if (window_state & VOFLAG_HIDDEN) {
1110
1136
    XSizeHints hint;
1111
1137
    XEvent xev;
1112
1138
    window_state &= ~VOFLAG_HIDDEN;
1113
1139
    vo_x11_classhint(mDisplay, vo_window, classname);
1114
 
    XStoreName(mDisplay, vo_window, title);
1115
1140
    vo_hidecursor(mDisplay, vo_window);
1116
1141
    XSelectInput(mDisplay, vo_window, StructureNotifyMask);
1117
1142
    hint.x = x; hint.y = y;
1131
1156
    XSelectInput(mDisplay, vo_window, NoEventMask);
1132
1157
    XSync(mDisplay, False);
1133
1158
    vo_x11_selectinput_witherr(mDisplay, vo_window,
1134
 
          StructureNotifyMask | KeyPressMask | PointerMotionMask |
 
1159
          StructureNotifyMask | KeyPressMask | KeyReleaseMask | PointerMotionMask |
1135
1160
          ButtonPressMask | ButtonReleaseMask | ExposureMask);
1136
1161
  }
1137
1162
  if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop);
1340
1365
    if (w <= INT_MAX && h <= INT_MAX) { vo_dwidth = w; vo_dheight = h; }
1341
1366
    XTranslateCoordinates(mDisplay, vo_window, mRootWin, 0, 0, &vo_dx, &vo_dy,
1342
1367
                          &dummy_win);
1343
 
    if (vo_wintitle)
1344
 
        XStoreName(mDisplay, vo_window, vo_wintitle);
1345
1368
 
1346
1369
    return depth <= INT_MAX ? depth : 0;
1347
1370
}
1363
1386
 
1364
1387
    if (vo_fs)
1365
1388
    {
1366
 
        vo_x11_ewmh_fullscreen(_NET_WM_STATE_REMOVE);   // removes fullscreen state if wm supports EWMH
 
1389
        vo_x11_ewmh_fullscreen(vo_window, _NET_WM_STATE_REMOVE);   // removes fullscreen state if wm supports EWMH
1367
1390
        vo_fs = VO_FALSE;
1368
1391
    } else
1369
1392
    {
1370
1393
        // win->fs
1371
 
        vo_x11_ewmh_fullscreen(_NET_WM_STATE_ADD);      // sends fullscreen state to be added if wm supports EWMH
 
1394
        vo_x11_ewmh_fullscreen(vo_window, _NET_WM_STATE_ADD);      // sends fullscreen state to be added if wm supports EWMH
1372
1395
 
1373
1396
        vo_fs = VO_TRUE;
1374
1397
        if ( ! (vo_fs_type & vo_wm_FULLSCREEN) ) // not needed with EWMH fs
1516
1539
{
1517
1540
    int nothing;
1518
1541
 
1519
 
    if (screensaver_off)
 
1542
    if (!stop_xscreensaver || screensaver_off)
1520
1543
        return;
1521
1544
    screensaver_off = 1;
1522
1545
    if (xss_suspend(True))
1681
1704
}
1682
1705
#endif
1683
1706
 
1684
 
#endif                          /* X11_FULLSCREEN */
1685
 
 
1686
1707
 
1687
1708
/*
1688
1709
 * Scan the available visuals on this Display/Screen.  Try to find