comparison src/video/x11/SDL_x11window.c @ 5031:5e3291605ad0

Added XFlush() so changes happen immediately instead of waiting for the next event loop.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 19 Jan 2011 10:14:11 -0800
parents 24d44c7c4c63
children 8b7988f42fcb
comparison
equal deleted inserted replaced
5030:6a0803e47c7b 5031:5e3291605ad0
744 PropertyChangeMask | StructureNotifyMask | 744 PropertyChangeMask | StructureNotifyMask |
745 KeymapStateMask)); 745 KeymapStateMask));
746 } 746 }
747 #endif 747 #endif
748 748
749 XFlush(display);
750
749 return 0; 751 return 0;
750 } 752 }
751 753
752 int 754 int
753 X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) 755 X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
856 XFree(iconprop.value); 858 XFree(iconprop.value);
857 } 859 }
858 } 860 }
859 #endif 861 #endif
860 } 862 }
863 XFlush(display);
861 } 864 }
862 865
863 void 866 void
864 X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) 867 X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
865 { 868 {
904 } 907 }
905 SDL_FreeSurface(surface); 908 SDL_FreeSurface(surface);
906 } else { 909 } else {
907 XDeleteProperty(display, data->xwindow, _NET_WM_ICON); 910 XDeleteProperty(display, data->xwindow, _NET_WM_ICON);
908 } 911 }
912 XFlush(display);
909 } 913 }
910 914
911 void 915 void
912 X11_SetWindowPosition(_THIS, SDL_Window * window) 916 X11_SetWindowPosition(_THIS, SDL_Window * window)
913 { 917 {
932 y = (y - window->h) / 2; 936 y = (y - window->h) / 2;
933 } else { 937 } else {
934 y = window->y; 938 y = window->y;
935 } 939 }
936 XMoveWindow(display, data->xwindow, x, y); 940 XMoveWindow(display, data->xwindow, x, y);
941 XFlush(display);
937 } 942 }
938 943
939 void 944 void
940 X11_SetWindowSize(_THIS, SDL_Window * window) 945 X11_SetWindowSize(_THIS, SDL_Window * window)
941 { 946 {
943 Display *display = data->videodata->display; 948 Display *display = data->videodata->display;
944 949
945 if (SDL_IsShapedWindow(window)) 950 if (SDL_IsShapedWindow(window))
946 X11_ResizeWindowShape(window); 951 X11_ResizeWindowShape(window);
947 XResizeWindow(display, data->xwindow, window->w, window->h); 952 XResizeWindow(display, data->xwindow, window->w, window->h);
953 XFlush(display);
948 } 954 }
949 955
950 void 956 void
951 X11_ShowWindow(_THIS, SDL_Window * window) 957 X11_ShowWindow(_THIS, SDL_Window * window)
952 { 958 {
953 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 959 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
954 Display *display = data->videodata->display; 960 Display *display = data->videodata->display;
955 961
956 XMapRaised(display, data->xwindow); 962 XMapRaised(display, data->xwindow);
963 XFlush(display);
957 } 964 }
958 965
959 void 966 void
960 X11_HideWindow(_THIS, SDL_Window * window) 967 X11_HideWindow(_THIS, SDL_Window * window)
961 { 968 {
962 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 969 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
963 Display *display = data->videodata->display; 970 Display *display = data->videodata->display;
964 971
965 XUnmapWindow(display, data->xwindow); 972 XUnmapWindow(display, data->xwindow);
973 XFlush(display);
966 } 974 }
967 975
968 void 976 void
969 X11_RaiseWindow(_THIS, SDL_Window * window) 977 X11_RaiseWindow(_THIS, SDL_Window * window)
970 { 978 {
971 SDL_WindowData *data = (SDL_WindowData *) window->driverdata; 979 SDL_WindowData *data = (SDL_WindowData *) window->driverdata;
972 Display *display = data->videodata->display; 980 Display *display = data->videodata->display;
973 981
974 XRaiseWindow(display, data->xwindow); 982 XRaiseWindow(display, data->xwindow);
983 XFlush(display);
975 } 984 }
976 985
977 static void 986 static void
978 X11_SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized) 987 X11_SetWindowMaximized(_THIS, SDL_Window * window, SDL_bool maximized)
979 { 988 {
1018 PropModeReplace, (unsigned char *)atoms, count); 1027 PropModeReplace, (unsigned char *)atoms, count);
1019 } else { 1028 } else {
1020 XDeleteProperty(display, data->xwindow, _NET_WM_STATE); 1029 XDeleteProperty(display, data->xwindow, _NET_WM_STATE);
1021 } 1030 }
1022 } 1031 }
1032 XFlush(display);
1023 } 1033 }
1024 1034
1025 void 1035 void
1026 X11_MaximizeWindow(_THIS, SDL_Window * window) 1036 X11_MaximizeWindow(_THIS, SDL_Window * window)
1027 { 1037 {
1035 SDL_DisplayData *displaydata = 1045 SDL_DisplayData *displaydata =
1036 (SDL_DisplayData *) window->display->driverdata; 1046 (SDL_DisplayData *) window->display->driverdata;
1037 Display *display = data->videodata->display; 1047 Display *display = data->videodata->display;
1038 1048
1039 XIconifyWindow(display, data->xwindow, displaydata->screen); 1049 XIconifyWindow(display, data->xwindow, displaydata->screen);
1050 XFlush(display);
1040 } 1051 }
1041 1052
1042 void 1053 void
1043 X11_RestoreWindow(_THIS, SDL_Window * window) 1054 X11_RestoreWindow(_THIS, SDL_Window * window)
1044 { 1055 {
1109 XDestroyIC(data->ic); 1120 XDestroyIC(data->ic);
1110 } 1121 }
1111 #endif 1122 #endif
1112 if (data->created) { 1123 if (data->created) {
1113 XDestroyWindow(display, data->xwindow); 1124 XDestroyWindow(display, data->xwindow);
1125 XFlush(display);
1114 } 1126 }
1115 SDL_free(data); 1127 SDL_free(data);
1116 } 1128 }
1117 } 1129 }
1118 1130