|
楼主 |
发表于 2006-6-14 16:14:56
|
显示全部楼层
#define WINSIZEX 320
#define WINSIZEY 200
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
Display *dpy;
GtkWidget* button;
GtkWidget* fixed;
GtkWidget* topdows;
topdows = gtk_window_new(GTK_WINDOW_TOPLEVEL);
............../*初始化窗口*/
fixed = gtk_fixed_new();
mainwin = gtk_drawing_area_new();
gtk_widget_set_size_request (mainwin, 200, 200);
gtk_fixed_put(GTK_FIXED(fixed),mainwin,0,0);
button = gtk_button_new_with_label("Savem");
gtk_fixed_put(GTK_FIXED(fixed),button,210,0);
gtk_container_add (GTK_CONTAINER (topdows),fixed);
gtk_widget_show_all(topdows);
printf("win_id = %ld\n",GDK_WINDOW_XWINDOW(mainwin->window));
{
char SDL_windowhack[32];
sprintf(SDL_windowhack,"SDL_WINDOWID=%ld",
GDK_WINDOW_XWINDOW(mainwin->window));
putenv(SDL_windowhack);
printf("SDL_windowhack[32] = { %s }\n",SDL_windowhack);
}
if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr,"Couldn't initialize SDL: %s\n",SDL_GetError());
gtk_main_quit();
}
printf("1****************\n");
screen = SDL_SetVideoMode(200, 200, 0, 0);/*到这里就行不通了噢*/
printf("2****************\n");
CheckShape();/*初始化xlib*/
ShowWindow();
SDL_UpdateRect(screen, 0,0,0,0);
gtk_main();
SDL_Quit();
return 0;
} |
|