Mercurial > mplayer.hg
comparison gui/wm/ws.c @ 35755:589cf8a5f165
Realize a smooth and flicker-free video when resizing during playback.
During playback, prevent the window manager from automatically refresh
the background of the video window by setting the video window's
background to no defined background pixmap. After playback, set the
window's background again.
Additionally, add a doygen comment for wsWindowBackground() and remove
an old comment.
Patch with grateful support by Hans-Dieter Kosch, hdkosch kabelbw de.
author | ib |
---|---|
date | Thu, 24 Jan 2013 15:57:37 +0000 |
parents | 5b5a3108e59f |
children | 3919b6360e54 |
comparison
equal
deleted
inserted
replaced
35754:5b5a3108e59f | 35755:589cf8a5f165 |
---|---|
1017 iconatom = XInternAtom(display, "_NET_WM_ICON", False); | 1017 iconatom = XInternAtom(display, "_NET_WM_ICON", False); |
1018 XChangeProperty(display, Win, iconatom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)icon->collection, icon->collection_size); | 1018 XChangeProperty(display, Win, iconatom, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)icon->collection, icon->collection_size); |
1019 } | 1019 } |
1020 } | 1020 } |
1021 | 1021 |
1022 // ---------------------------------------------------------------------------------------------- | |
1023 // Set window background to 'color'. | |
1024 // ---------------------------------------------------------------------------------------------- | |
1025 /** | 1022 /** |
1026 * @brief Pack color components @a r, @a g and @a b into 15 bits. | 1023 * @brief Pack color components @a r, @a g and @a b into 15 bits. |
1027 * | 1024 * |
1028 * @param r red (0 - 255) | 1025 * @param r red (0 - 255) |
1029 * @param g green (0 - 255) | 1026 * @param g green (0 - 255) |
1064 pixel |= b >> 3; | 1061 pixel |= b >> 3; |
1065 | 1062 |
1066 return pixel; | 1063 return pixel; |
1067 } | 1064 } |
1068 | 1065 |
1066 /** | |
1067 * @brief Set and fill, or unset a window background. | |
1068 * | |
1069 * @param win pointer to a ws window structure | |
1070 * @param r red (0 - 255, or -1) | |
1071 * @param g green (0 - 255, or -1) | |
1072 * @param b blue (0 - 255, or -1) | |
1073 * | |
1074 * @note Passing -1 for @a r, @a g and @a b unsets the background. | |
1075 */ | |
1069 void wsWindowBackground(wsWindow *win, int r, int g, int b) | 1076 void wsWindowBackground(wsWindow *win, int r, int g, int b) |
1070 { | 1077 { |
1071 int color = 0; | 1078 int color = 0; |
1072 | 1079 |
1073 switch (out_pix_fmt) { | 1080 switch (out_pix_fmt) { |
1099 | 1106 |
1100 default: | 1107 default: |
1101 ; | 1108 ; |
1102 } | 1109 } |
1103 | 1110 |
1111 if (r == -1 && g == -1 && b == -1) | |
1112 XSetWindowBackgroundPixmap(wsDisplay, win->WindowID, None); | |
1113 else { | |
1104 XSetWindowBackground(wsDisplay, win->WindowID, color); | 1114 XSetWindowBackground(wsDisplay, win->WindowID, color); |
1105 XClearWindow(wsDisplay, win->WindowID); | 1115 XClearWindow(wsDisplay, win->WindowID); |
1116 } | |
1106 } | 1117 } |
1107 | 1118 |
1108 // ---------------------------------------------------------------------------------------------- | 1119 // ---------------------------------------------------------------------------------------------- |
1109 // Move window to x, y. | 1120 // Move window to x, y. |
1110 // ---------------------------------------------------------------------------------------------- | 1121 // ---------------------------------------------------------------------------------------------- |