Commit Graph

113 Commits

Author SHA1 Message Date
wm4 70fe8d12fa win32: don't crash if vo_w32_uninit() is called without vo_w32_init()
This is a recent regression. At least vo_direct3d uses vo_w32_uninit()
in this way, and crashed if initialization failed at an early point.
2012-04-24 01:25:10 +02:00
wm4 b6b09b23f6 win32: fix handling of AltGr
Windows implicitly enables Ctrl+Alt on AltGr. These modifiers are
unwanted for keys that have special mappings on AltGr.

Add warning about different behavior on wine.
2012-04-14 18:29:28 +02:00
wm4 3bb456b14d win32: simplify icon loading
I have no idea why the code used this roundabout method.
Also detab mplayer.rc.
2012-04-14 17:03:11 +02:00
wm4 923f353d2a win32: move global variables into a struct & some refactoring
This reflects the changes done to x11_common in mplayer2 some years
ago. It makes it possible to open multiple VOs at once.

The removed defines are probably for ancient versions of MinGW with
incomplete headers.

Remove some minor code duplication.
2012-04-14 17:03:11 +02:00
wm4 8c041127d1 win32: use GetKeyState() instead of maintaining the state manually 2012-04-14 17:02:03 +02:00
wm4 4dc0e54d4f win32: prevent modifier keys from getting stuck
Especially Alt would get stuck when using Alt+Tab to change focus.
Apparently Windows doesn't send an appropriate key up message. Solve
this by resetting the modifier state on focus change.
2012-04-13 17:27:18 +02:00
wm4 1d527f0cf2 win32: make F10 key not enter the window menu
Normally, F10 enters the window menu (it's invisible at first, and the
blocking/recursive message handling by Windows makes it look like
mplayer was paused, without much visual indication). Stop this almost
completely useless behavior by signalling Windows that the F10 key was
handled. This makes the F10 key usable as normal mplayer shortcut.

This is probably still somewhat questionable.
2012-04-07 15:46:36 +02:00
wm4 440797ca71 win32: fix behavior of enter key
Windows sends the same character code on CTRL+Enter and CTRL+J. I'm not
sure what's the proper way to deal with this, but the hack added with
this commit seems to work fine.

Just to be sure, don't forward the modified wParam to DefWindowProc.
Add the missing "break;" in the switch statement, which sometimes
produced bogus mouse button events.
Fix the F12 key, which wasn't mapped correctly due to a typo.
2012-04-07 14:47:06 +02:00
wm4 a659429f86 win32: use more unicode functions
Use the *W variants instead of the implicit *A functions. (One could
define the UNICODE macro to switch the functions without suffix from
A to W, but I'm too lazy to figure out how portable that is, etc.)

Also make sure io.h defines a unicode aware printf().
2012-04-06 23:56:30 +02:00
wm4 ce7562705e win32: support key modifiers (shift, ctrl, alt)
Support for this is rather simple, and some combinations of modifiers
and keys don't work. For example, Ctrl+Alt+character is not supported,
because Windows doesn't emit a WM_CHAR in this case.

Also add support for the pause and print screen keys. Remove the
pointless KEY_CTRL translation. Remove KEY_CTRL altogether, because it
was not clear what it was actually supposed to mean.
2012-04-06 23:56:30 +02:00
wm4 1bb08fc1e6 win32: properly set window title
Set the window title on win32 based VOs using the same logic as on X11
and Cocoa.

Until now, the window title when using vo_direct3d and vo_gl was hardcoded
to "MPlayer - The Movie Player", and vo_directx showed "MPlayer". Now it
will show "mplayer2", unless the --title or --use-filename-title options
are used.

Change the internal window class name to the string "mplayer2" too.
2012-03-17 21:06:30 +01:00
wm4 d813a4ede8 win32: fix fullscreen not working on Windows 7
Switching to fullscreen mode on Windows 7 didn't work: the window position
and size weren't set to fullscreen. It turns out that merely calling
SetWindowLong caused windows to send move/resize messages, which changed
the global variables that were supposed to contain the new window size.
Move the SetWindowLong call out of the way to guarantee that always the
correct values are used.
2012-03-17 21:06:30 +01:00
wm4 67fcdcd8a3 win32: different method to force window aspect ratio
The code used WM_WINDOWPOSCHANGING to force an spect ratio. This didn't
behave well if the left/top window borders were used for resizing.
Resizing with these borders changed the screen position of the right/bottom
as well, which is unintuitive and annoying.

Use WM_SIZING instead. Unlike WM_WINDOWPOSCHANGING, WM_SIZING knows about
which border is being used for resizing and can act accordingly.

Note that the calculated window size doesn't necessarily match with the
size mplayer calculates, but this problem exists on x11 as well.
2012-03-17 20:58:16 +01:00
wm4 32de5df90c win32, vo_directx: don't use vo_dx/dy, directly query window position
This should be a bit robuster than trying to maintain vo_dx/dy.
vo_dy/dy are now completely unused on win32, except for initialization.
2012-03-17 20:58:16 +01:00
wm4 2449cbde2c win32: fix window creation and size handling
This commit fixes various issues with the way the window position and
size is setup. Most importantly, it fixes some bugs with restoring from
fullscreen state.

Rename create_rendering_context() to reinit_window_state(). This function
doesn't create anything, it just sets the window bounds and styles.

Do not use vo_dx/dy for the window position, as video_out.c overwrites it
with each vo_config() call. Use private variables window_x/y instead.

A big cause for issues was that reinit_window_state() accidentally cleared
the WS_VISIBLE style. I suspect that the API call to temporarily hide the
window was a hack to deal with this. Another bug was that the window style
was changed without calling SetWindowPos with SWP_FRAMECHANGED (as the
MSDN documentation says).

Properly initialize window position and size on vo_config following the
same rules as the x11 backend:

- Never change the window position. The window position should be kept, as
  the user might move the window, and resetting the window position e.g.
  during ordered chapter playback is not desired.
- Never change the window size, unless the size of the video changes.

These rules don't apply to fullscreen. When switching from fullscreen to
windowed mode, the backend should restore the previous windowed size and
position. When the VO was reconfigured during playback (vo_config() etc.),
the saved window position and size should be changed according to the
rules above, even if the window was in fullscreen mode during
reconfiguring.

Note that these rules might be perceived as awkward by some users: if you
play multiple files with different resolutions, the window won't be
centered when playing the files after the first. This is not a bug.
2012-03-17 20:58:16 +01:00
wm4 24be34f1e9 cleanup: Silence compilation warnings on MinGW-w64
Some of the code, especially the dshow and windows codec loader parts,
are extremely hacky and likely full of bugs. The goal is merely getting
rid of warnings that could obscure more important warnings and actual
bugs, instead of fixing actual problems. This reduces the number of
warnings from over 500 to almost the same as when compiling on Linux.

Note that many problems stem from using the ancient wine-derived
windows headers. There are some differences to the "proper" windows
header. Changing the code to compile with the proper headers would be
too much trouble, and it still has to work on Unix.

Some of the changes might actually break compilation on legacy MinGW,
but we don't support that anymore. Always use MinGW-w64, even when
compiling to 32 bit.

Fixes some warnings in the win32 loader code on Linux too.
2012-03-01 00:22:30 +02:00
reimar 1b6ae1ff58 VO: w32_common: also generate VO_EVENT_MOVE
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33650 b3059339-0415-0410-9bf9-f77b7e298cf2

Generate VO_EVENT_MOVE also with -wid.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33656 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
Rudolf Polzer 84d86719fc Windows: vo/input: handle WM_XBUTTONDOWN message
WM_XBUTTONDOWN is used for extra mouse buttons (mapped to button 5 and
button 6 in mplayer2). Previously only vo_directx handled this
message.  Add support to w32_common.c event handling too (used by
vo_direct3d and vo_gl/vo_gl2 on Windows).
2011-06-19 04:05:36 +03:00
Uoti Urpala 23cb829072 input: move all key code lists to input/keycodes.h
Move the definitions of all special key codes (those not passed by
ASCII value) to input/keycodes.h. Before they were spread between
osdep/keycodes.h, input/joystick.h, input/mouse.h and input/ar.h, plus
some special values in input.h. This was especially inconvenient as
the codes had to be coordinated to not conflict between the files.

The change requires a bit of ugliness as appleir.c includes
<linux/input.h> which contains various conflicting KEY_* definitions.
Work around this by adding a special preprocessor variable which can
be used to avoid defining these in keycodes.h.
2011-05-02 00:43:31 +03:00
reimar 111757c3f4 vo_gl: create stereo-capable window when using Quadbuffer 3D
Select a stereo pixel format for window when Quadbuffer OpenGL was
selected as 3D mode.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32620 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:32:00 +02:00
reimar 94f543d114 libvo/w32_common.c: Move setting of pixel format from init to config
This allows it to depend on flags etc.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32619 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:31:10 +02:00
reimar 00b2a5d7b2 libvo/w32_common.c: minor cleanup
Some indentation fixes.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32611 b3059339-0415-0410-9bf9-f77b7e298cf2

Simplify: Use early return instead of large if block.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32612 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-14 12:23:56 +02:00
Uoti Urpala e74361c488 Merge svn changes up to r31189 2010-05-30 15:51:33 +03:00
reimar 7be96c3792 Do not return pointer to on-stack memory.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31184 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-19 17:58:17 +00:00
reimar d08822aaac Fix return value (it was missing completely).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31183 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-19 17:55:39 +00:00
reimar f62044777b Handle -wid Window being closed for direct3d and gl vos on Windows.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31182 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-19 17:53:47 +00:00
Uoti Urpala f38efd166e Merge svn changes up to r31097 2010-04-26 19:23:32 +03:00
reimar 14c018a80f Avoid duplicating mouse-movement command-generation code.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31091 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-04-25 16:13:57 +00:00
reimar 2f629d7969 Deduplicate enable_mouse_movements declaration.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31089 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-04-25 15:49:46 +00:00
siretart 9cef48bac7 rename 'struct keymap' -> 'struct mp_keymap'
This avoids the compilation failure on kFreeBSD (at least amd64):

  In file included from libvo/vo_directfb2.c:44:
  libvo/video_out.h:267: error: redefinition of 'struct keymap'

This is because libvo/vo_directfb2.c #includes sys/kd.h, which in turn
includes sys/kbio.h, which defines another 'struct keymap'.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31059 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-04-23 10:22:44 +00:00
Uoti Urpala 173beb5608 Merge svn changes up to r30514 2010-03-09 19:58:02 +02:00
reimar 1cd3b3c5dd Add support for VOFLAG_HIDDEN to the w32 backend.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30509 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-04 22:46:45 +00:00
reimar bf6dc310dc Set the PixelFormat right after creating the window and set it only once.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30508 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-04 22:46:01 +00:00
Uoti Urpala 5995bc175a Merge svn changes up to r29962 2009-11-23 01:56:21 +02:00
reimar 4805ea9864 Add support for Windows OpenGL rendering onto a device instead of into a window.
Has little use except for experimenting - on Windows 9x it could be used to
render on monitors that were not managed by Windows, but that feature was
removed in newer Windows versions.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29946 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-11-21 22:27:40 +00:00
Uoti Urpala 0e1b7765be Merge svn changes up to r29644 2009-09-04 19:49:35 +03:00
reimar 16c2a6660a Disable -keepaspect with -wid in w32_common code.
This does not work in a useful way and was unintentionally "enabled"
when -wid was made to use a separate window.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29559 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-08-27 13:20:21 +00:00
Uoti Urpala 0eb321bf2c Remove trailing whitespace from most files 2009-07-07 02:34:35 +03:00
diego 6e9cbdc104 whitespace cosmetics: Remove all trailing whitespace.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-05-13 02:58:57 +00:00
Uoti Urpala cf9edda1d3 Merge svn changes up to r29117 2009-04-01 02:43:47 +03:00
diego 7155671f37 "MPlayer - The Movie Player" should be used as the player name.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28955 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-03-15 09:47:51 +00:00
Uoti Urpala 54bb7a2582 Merge svn changes up to r28728 2009-02-25 05:03:51 +02:00
reimar 74efde9480 Calculate border size in aspect keeping code by using AdjustWindowRect
instead of GetClientRect and GetWindowRect since GetClientRect returns
nonsensical values if Window is still minimized.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28713 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-23 21:40:02 +00:00
Uoti Urpala 1e86963828 Merge svn changes up to r28537 2009-02-12 04:17:55 +02:00
diego befc528297 Add standard license headers, unify header formatting.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28481 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-02-08 03:27:30 +00:00
Uoti Urpala 9bcd12fdf5 Merge svn changes up to r28310
The libdvdread4 and libdvdnav directories, which are externals in the
svn repository, are at least for now not included in any form. I added
configure checks to automatically disable internal libdvdread and
libdvdnav if the corresponding directories are not present; if they're
added manually then things work the same as in svn.
2009-01-15 05:57:31 +02:00
reimar c51ba3aed9 Support F- and numpad keys for w32_common based vos.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28214 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-30 17:00:11 +00:00
Uoti Urpala fccb0a7e45 Merge svn changes up to r28176
Conflicts:
	libvo/video_out.c
	libvo/x11_common.c
2008-12-22 00:46:02 +02:00
reimar d1065dffe1 Add and use a special lookup function to do table-based translation to MPlayer keycodes.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28172 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-12-20 11:52:11 +00:00
Uoti Urpala 8c144171bb Merge svn changes up to r28087
Conflicts:
	command.c
	libao2/ao_ivtv.c
	libao2/ao_v4l2.c
	libmpcodecs/dec_video.h
	libvo/aspect.h
	libvo/sub.c
	libvo/sub.h
	libvo/vo_directx.c
	libvo/vo_macosx.m
	libvo/vo_quartz.c
	mp_core.h
	mplayer.c
	mplayer.h
	osdep/getch2.h
	osdep/timer.h
2008-12-04 01:55:52 +02:00