Commit Graph

391 Commits

Author SHA1 Message Date
wm4 f684d12db1 x11: fix crash when using switch_video (broken by UTF-8 input changes) 2012-02-24 09:39:00 +01:00
wm4 d5a8059f93 x11: fix setting UTF-8 window titles for some special cases
Setting the WM_NAME/WM_ICON_NAME window properties didn't always work:
apparently there are some characters that can't be represented in the X
STRING or COMPOUND_TEXT encodings, such as U+2013 EN DASH. The function
Xutf8TextListToTextProperty partially converts the string, and returns
a value different from 'Success'. This means vo_x11_set_property_string
didn't set these window properties.

On most modern window managers, this is not a problem, since these use
the _NET_WM_NAME/_NET_ICON_NAME and the UTF8_STRING encoding. Some older
WMs like IceWM don't read these, and the window title remains blank.

It's not clear what exactly we should do in this situation, but fix it
by setting set the WM_NAME/WM_ICON_NAME properties as UTF8_TEXT. This
violates the ICCCM, but at least IceWM seems to handle this well.

See also:
  http://lists.freedesktop.org/archives/xorg/2004-September/003391.html
  http://lists.freedesktop.org/archives/xorg/2004-September/003395.html

Also fix a minor memory leak when conversion to COMPOUND_TEXT fails.
2012-01-25 02:51:35 +01:00
wm4 064f8c2fb6 Merge branch 'utf8_input' into my_master 2012-01-18 04:19:24 +01:00
wm4 dd4452ad02 x11: remove wskeys.h
Use the <X11/keysymdef.h> xlib header instead. I'm not sure why mplayer
defined these constants itself.
2012-01-18 04:13:27 +01:00
wm4 fdc7155ced x11: add print and menu keys 2012-01-18 04:13:27 +01:00
wm4 10ab86b73d x11: add KP_Separator to key mapping
At least on some keyboards, the key between '0' and 'Enter' on the
key pad is mapped to KP_Separator. Since X11 VOs accept unicode
input, the mplayer keycode this key generates depended on the numlock
state, and with numlock enabled this mapped to an ASCII character.
This is probably not what the user wanted, since two physical keys
will always map to the same key code.

Map it to KP_DEC.
2012-01-18 04:13:27 +01:00
wm4 ad455c43f5 x11: allow unicode input
This change allows using non-ASCII keys with X11. These keys were ingored
before.

Technically, this creates an invisible, non-interactive input method
context. If creation fails, the code falls back to the old method, which
allows a subset of ASCII only.
2012-01-18 04:13:27 +01:00
wm4 2e0bae181f x11: simplify setting unicode text properties 2012-01-18 02:53:30 +01:00
wm4 82118dc35e libvo: change default window title to "mplayer2"
Also change the WM_CLASS "application class" string from "MPlayer" to
"mplayer2". This string is visible as application name in Gnome 3.
2011-12-06 20:32:33 +01:00
wm4 3df6dc718a x11: set window titles as UTF-8
Always set the X11 window title properties as UTF-8. This is a bit tricky
for X11 window properties which are not specified to use UTF-8, such as
WM_NAME.

We also properly set WM_ICON_NAME, which means the window caption and the
text used in the task bar (of the WM has one) will be the same on most
window managers. Before this commit, WM_ICON_NAME was always hardcoded to
"MPlayer", even if --title or --use-filename-title was used.

Also update the window title only on reconfigure, like it is done in
mplayer-svn commit 34380.
2011-12-06 20:32:33 +01:00
wm4 d4de92e808 libvo: remove title argument from struct vo_driver.config
This affects only the "new" VO API. The config() title argument was barely
used, and it's hardcoded to "MPlayer" in vf_vo.c. The X11 and the Cocoa
GUI backends, which are the only ones properly supporting window titles,
ignored this argument. Remove the title argument.

Add the vo_get_window_title function. All GUI VOs are supposed to use it
for the window title.
2011-12-06 20:32:33 +01:00
Uoti Urpala 85f0577cd9 vo: X key input: remove ambiguous KeySym remapping
Code mapping X keyboard events to internal player key names remapped
the incoming KeySym values in a way that only kept information about
the lowest byte of the value and whether or not the value was below
256. This caused collisions between values. Remove this obviously
broken mapping and use the raw KeySym values instead. I'm not familiar
enough with X key handling to tell whether there was any valid
motivation whatsoever for the mapping, but the implementation was
certainly broken; if something else breaks it'll have to be fixed
later.
2011-07-29 08:46:50 +03:00
Uoti Urpala 2670ceeb81 Merge branch 'mplayer1_changes' 2011-07-06 13:07:37 +03:00
diego d6e34fe91a VO: support Pause/Break key in X11 input
Allow Pause/Break key to be bound as MPlayer input key under X11.
patch by Steaphan Greene, sgreene cs.binghamton edu

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33609 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 13:01:07 +03:00
iive ab1544b74d cleanup: x11_common: remove pointless GC operations
Remove useless XSetBackground() call right before freeing the graphic
context.

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

Create empty vo_gc graphic context instead of one with
undefined foreground color.

The code that uses vo_gc already employs XSetForeground()/XSetBackground()
to change the context accordingly.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@33525 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-07-06 09:10:56 +03:00
Uoti Urpala 47ccb48ac9 vo: avoid losing initial expose event
The x11_common.c window creation code could lose the initial expose
event due to input mask changes. This meant that the window might
not be cleared at start (there's a vo_x11_clearwindow() call but it
may do nothing if it runs before the window is mapped). Modify the
code to avoid losing the expose event. Handling that event should
ensure the window is cleared and otherwise set up properly.
2011-07-06 08:42:57 +03:00
Uoti Urpala aeafa7a2b4 vo_xv: avoid clearing too much on resize
vo_xv set the "use_fs" parameter to vo_x11_clearwindow_part(). This
meant it always used the whole screen size to calculate the area to
clear. I can't see why overriding the vo->dwidth/dheight values would
ever be the right thing to do (if in fullscreen they should be set to
match that), so remove the use_fs parameter and always use the
dwidth/dheight values in the function. Also delete code drawing back
borders in vo_xv_draw colorkey. That should already happen in
vo_x11_clearwindow_part(); if it doesn't then things need to be fixed
anyway because colorkey code only ran in fullscreen mode (but borders
must work in window mode too).
2011-07-06 08:36:46 +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
Clément Bœsch 52743acba3 cleanup: avoid various GCC warnings 2011-04-20 04:22:53 +03:00
Uoti Urpala ca5399d04f VO: don't wait for map event in X VO initialization
After creating a video window the common X code waited for a MapNotify
event before proceeding. This meant that if the window was opened on
another workspace the player would be stuck until the user switched to
that workspace and the window could become actually visible. Remove
this waiting code. I don't know why it was there or if it was actually
beneficial/needed for some setup (at least common uses seem to work
fine without it); it comes from the earliest MPlayer versions visible
in VCS history.
2011-04-08 02:30:13 +03:00
Uoti Urpala 106c5f9989 x11_common: fix for reconfig with pos/xineramascreen set
vo_x11_create_vo_window() only called vo_x11_update_geometry() if no
window position had been specified by -geometry or -xineramascreen, to
avoid overwriting the specified position with values from the existing
window. However window size should be initialized to the existing
window here, and setting new window title for -use-filename-title is
also done in vo_x11_update_geometry() (for whatever reason, it doesn't
match what else that function does). Change the code in
vo_x11_create_vo_window() to always call vo_x11_update_geometry() for
size variable and window title updates, but add a flag that tells it
not to update position variables.
2011-02-03 21:49:12 +02:00
Uoti Urpala 67fd58d6f0 input: support bindings with modifier keys for X input
Add support for binding commands to modifier+key combinations like
"Shift+Left" or "Ctrl+Alt+x", and support reading such combinations
from the output window of X VOs.

The recognized modifier names are Shift, Ctrl, Alt and Meta. Any
combination of those and then a non-modifier key name, separated by
'+', is accepted as a key name in input.conf. For non-special keys
that produce characters shift is ignored as a modifier. For example
"A" is handled as a key without modifiers even if you use shift to
write the capital letter; 'a' vs 'A' already distinguishes the
combinations with a normal keymap, and having separate 'a', 'Shift+A'
and 'A' (written with caps lock for example) would bring more
confusion than benefit.

Currently reading the modifier+key combinations is only supported in
the output window of those VOs that use x11_common.c event
handling. It's not possible to input the key combinations in other VOs
or in a terminal window.
2010-12-20 19:02:24 +02:00
Uoti Urpala 4f610adfc2 libvo: register X11 connection fd in input event system
Register the X11 connection fd in the input system so that
mp_input_get_cmd() can immediately wake up and handle keyboard or
other X events. The callback calls vo_check_events() and tells the
input system to handle any input possibly recorded during that. Before
this was done for vo_xv only; this commit generalizes it to all VOs
that call vo_x11_create_vo_window() - those are hopefully ones that
will handle all X events in check_events().

The callback is only kept registered while the vo is properly
configured. At other times calling check_events() would not clear
pending input and so could lead to a busy loop.
2010-12-14 22:33:12 +02:00
Clément Bœsch 952f9b85a7 options: move -name and -title to option struct 2010-11-04 05:54:12 +02:00
reimar fef7b17c34 x11_common: add VO_EVENT_MOVE
Add VO_EVENT_MOVE which is required for VOs that interact directly
with hardware like MGA and VIDIX.

Patch by Dirk Porezag [porezag yahoo com]

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32454 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:09 +02:00
siretart 2e6ff523dd spelling fixes
Found by the Debian QA tool 'lintian'

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

reintroduce typo in genres.h that was fixed fixed r31913 to match the id3v2 spec

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31920 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:15:03 +02:00
reimar 61ed4c2945 x11_common: Get window dimensions also for -wid 0
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31623 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:20 +02:00
reimar efdce758ce x11_common.c: minor cleanup
Remove some commented-out code that has no purpose and is only confusing.

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

Remove useless ()

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31621 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:14:20 +02:00
reimar 4fc7f3b296 x11_common.c: Some indentation fixes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31602 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:13:00 +02:00
reimar 1e159f4ecc x11_common: Do not try to grab input from -wid windows
It will most likely break their input processing.
If someone needs the previous behaviour, an option could be added (and
also used in the w32_common.c code).

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

Fix resizing with -wid after previous commit.

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

Always request expose events, we have to handle them, the application
that created the -wid window can't.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31605 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:13:00 +02:00
reimar 82e546da0d x11_common: Consistently use "None" instead of "NULL" for X resources
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31422 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:10:10 +02:00
Uoti Urpala 7a669a6407 vo: improve fixed-vo behavior when video size changes in x11 VOs
Now the window is only resized when video size (or size specified by
-geometry) changes; reconfiguring the window with the same size no
longer changes back to default size from possibly user-modified one.

Also fix a bug in fullscreen handling that could cause incorrect
window size when turning fullscreen off.
2010-07-23 03:38:40 +03:00
Uoti Urpala 497c32cdad Merge svn changes up to r31291 2010-06-02 18:55:18 +03:00
reimar 233c74254e Change code to let Window Manager chose window location by default.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31289 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-30 19:14:18 +00:00
Uoti Urpala e74361c488 Merge svn changes up to r31189 2010-05-30 15:51:33 +03:00
reimar 5c74db3bf6 Quit MPlayer if we receive a DestroyNotify event.
This in particular avoids MPlayer continuing to play when
a frontend using -wid crashed.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31179 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-05-14 18:00:04 +00:00
Uoti Urpala 033e479bec Merge svn changes up to r31104 2010-05-07 21:02:42 +03:00
Uoti Urpala a817e69131 Merge svn changes up to r31100 2010-05-07 20:59:01 +03:00
reimar 46f3b7d263 Move variable declaration into the block where it is actually used.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31103 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-04-27 19:04:23 +00:00
diego 04d20b550d Move "screen" variable declaration below the relevant #ifdef, fixes the warning:
libvo/x11_common.c:369: warning: unused variable 'screen'


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31100 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-04-27 15:16:42 +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 00323c06e2 Delete things related to old translation system
Remove the help/ subdirectory, configure code to create toplevel
help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
2010-03-10 03:47:14 +02:00
Uoti Urpala bc1d0ca37d Merge svn changes up to r30798 2010-03-10 02:35:02 +02:00
Uoti Urpala 173beb5608 Merge svn changes up to r30514 2010-03-09 19:58:02 +02:00
Uoti Urpala bc0f524909 Merge svn changes up to r30502
Conflicts:
	libswscale/rgb2rgb.c
	libswscale/rgb2rgb.h
	libswscale/swscale.c
	libvo/x11_common.c
2010-03-09 19:44:28 +02:00
Uoti Urpala 5c6795a687 Merge svn changes up to r30494
Conflicts:
	libvo/vo_gl.c
	libvo/x11_common.c
2010-03-09 19:34:30 +02:00
reimar 05c24134de Enable StructureNotifyMask before waiting for a DestroyNotify event.
Fixes hangs if OpenGL initialization fails in vo gl preinit and we
call uninit while the window is still hidden.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30760 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-27 17:55:57 +00:00