int main(int argc, char** argv) { int count = 0; if (!glfwInit()) { fprintf(stderr, "Failed to initialize GLFW\n"); exit(1); } for (;;) { if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOW)) { glfwTerminate(); exit(1); } glMatrixMode(GL_PROJECTION); glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f); glMatrixMode(GL_MODELVIEW); glClearColor(0.f, 0.f, 0.f, 0.f); glColor3f(1.f, 1.f, 1.f); glfwSetTime(0.0); while (glfwGetTime() < 5.0) { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glRotatef((GLfloat) glfwGetTime() * 100.f, 0.f, 0.f, 1.f); glRectf(-0.5f, -0.5f, 1.f, 1.f); glPopMatrix(); glfwSwapBuffers(); if (closed) close_window(); if (!glfwGetWindowParam(GLFW_OPENED)) { printf("User closed window\n"); glfwTerminate(); exit(0); } } printf("Closing window\n"); close_window(); count++; } }
//------------------------------------------------------------------------------ void TCErisoApp::Quit() { // 見かけの終了を速めるため、先に隠す mCErisoWin->Hide(); // ダイアログを終了 close_window(reinterpret_cast<BWindow**>(&mAboutWin)); close_window(reinterpret_cast<BWindow**>(&mRangeIDWin)); // メインウィンドウを終了 close_window(reinterpret_cast<BWindow**>(&mCErisoWin)); // 自身を終了 SUPER::Quit(); }
int TextMan::print(const char *p, int lin, int col, int len) { if (p == NULL) return 0; debugC(4, kDebugLevelText, "lin = %d, col = %d, len = %d", lin, col, len); if (col == 0 && lin == 0 && len == 0) lin = col = -1; if (len == 0) len = 30; blit_textbox(p, lin, col, len); if (getflag(F_output_mode)) { /* non-blocking window */ setflag(F_output_mode, false); return 1; } /* blocking */ if (game.vars[V_window_reset] == 0) { int k; setvar(V_key, 0); k = wait_key(); close_window(); return k; } /* timed window */ debugC(3, kDebugLevelText, "f15==0, v21==%d => timed", getvar(21)); game.msg_box_ticks = getvar(V_window_reset) * 10; setvar(V_key, 0); do { main_cycle(); if (game.keypress == KEY_ENTER) { debugC(4, kDebugLevelText, "KEY_ENTER"); setvar(V_window_reset, 0); game.keypress = 0; break; } } while (game.msg_box_ticks > 0); setvar(V_window_reset, 0); close_window(); return 0; }
static void ft_manager_response_cb (GtkWidget *widget, gint response, EmpathyFTManager *manager) { EmpathyFTManagerPriv *priv = GET_PRIV (manager); switch (response) { case RESPONSE_CLEAR: ft_manager_clear (manager); break; case RESPONSE_OPEN: ft_manager_open (manager); break; case RESPONSE_STOP: ft_manager_stop (manager); break; case RESPONSE_CLOSE: if (!close_window (manager)) gtk_widget_destroy (priv->window); break; case GTK_RESPONSE_NONE: case GTK_RESPONSE_DELETE_EVENT: /* Do nothing */ break; default: g_assert_not_reached (); } }
static gboolean ft_manager_delete_event_cb (GtkWidget *widget, GdkEvent *event, EmpathyFTManager *manager) { return close_window (manager); }
int loadgame_simple () { char home[MAX_PATH], path[MAX_PATH]; int rc = 0; if (get_app_dir (home, MAX_PATH) < 0) { message_box ("Error loading game."); return err_BadFileOpen; } sprintf(path, "%s/" DATA_DIR "/%05X.%s/%08d.sav", home, game.crc, game.id, 0); erase_both(); stop_sound(); close_window(); if ((rc = load_game (path)) == err_OK) { message_box ("Game restored."); game.exit_all_logics = 1; menu_enable_all(); } else { message_box ("Error restoring game."); } return rc; }
static int action_window (Display *disp, Window win, char mode) {/*{{{*/ p_verbose("Using window: 0x%.8lx\n", win); switch (mode) { case 'a': return activate_window(disp, win, True); case 'c': return close_window(disp, win); case 'e': /* resize/move the window around the desktop => -r -e */ return window_move_resize(disp, win, options.param); case 't': /* move the window to the specified desktop => -r -t */ return window_to_desktop(disp, win, atoi(options.param)); case 'R': /* move the window to the current desktop and activate it => -r */ if (window_to_desktop(disp, win, -1) == EXIT_SUCCESS) { usleep(100000); /* 100 ms - make sure the WM has enough time to move the window, before we activate it */ return activate_window(disp, win, False); } else { return EXIT_FAILURE; } default: fprintf(stderr, "Unknown action: '%c'\n", mode); return EXIT_FAILURE; } }/*}}}*/
void ObjectViewer::do_key_event( int key, int scancode, int action, int mods ) { //std::cerr << "key :" << key << " char: " << char(key) << std::endl; if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) close_window(); if ( action == GLFW_PRESS ) { switch( key ) { case 262: //arrow right transform_model( 1.f, 0.f ); break; case 263: //arrow left transform_model( -1.f, 0.f ); break; case 264: //arrow down transform_model( 0.f, 1.f ); break; case 265: //arrow up transform_model( 0.f, -1.f ); break; case 'H': show_help(); break; case 'F': toogle_culling(); break; case 'W': m_rendermode = static_cast<RenderMode>( (m_rendermode+1)%RENDER_SIZE ); break; default: fprintf( stderr, "unkown key:%c\n", key ); } } }
void kernel_load_exit(void) { if (INVALID_WINDOW_HANDLE!=kernel_load_window) { close_window(kernel_load_window); kernel_load_window=INVALID_WINDOW_HANDLE; progress_load_rate_handle=INVALID_WIDGET_HANDLE; load_rate=100; } }
int main(int argc, char** argv) { int count = 0; for (;;) { if (!open_window(640, 480, (count & 1) ? GLFW_FULLSCREEN : GLFW_WINDOWED)) { glfwTerminate(); exit(EXIT_FAILURE); } glMatrixMode(GL_PROJECTION); glOrtho(-1.f, 1.f, -1.f, 1.f, 1.f, -1.f); glMatrixMode(GL_MODELVIEW); glfwSetTime(0.0); while (glfwGetTime() < 5.0) { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glRotatef((GLfloat) glfwGetTime() * 100.f, 0.f, 0.f, 1.f); glRectf(-0.5f, -0.5f, 1.f, 1.f); glPopMatrix(); glfwSwapBuffers(window_handle); glfwPollEvents(); if (closed) { close_window(); printf("User closed window\n"); glfwTerminate(); exit(EXIT_SUCCESS); } } printf("Closing window\n"); close_window(); count++; } }
int save_all_map(void) { int x,y,z; char info[160]; char *txt; if ((z=check_map(&x,&y))!=0) { WINDOW *w; unselect_map(); if ((w=find_window(tool_bar))!=NULL) close_window(w); tool_sel=30; create_map_win(-1); open_sector_win(); jdi_na_sektor(x); } sprintf(info,"Chyba %02d na pozici %d:%d",-z,x,y); switch (z) { case -1:msg_box(info,'\01',"Chyb� definice st�ny!","OK",NULL);break; case -2:msg_box(info,'\01',"Chodba vede do neexistuj�c�ho sektoru!","OK",NULL);break; case -3:msg_box(info,'\01',"Schody jsou �patn� spojen� se sousedn�m� sektory!","OK",NULL);break; case -4:msg_box(info,'\01',"Ud�lost v neexistuj�c�m sektoru!","OK",NULL);break; } if (!backup) { create_backup(filename); create_backup(SHOP_NAME); create_backup(ITEMS_DAT); create_backup(MOB_FILE); create_backup(MOB_SOUND); backup=1; } if (save_map(filename)) { sprintf(info,"Nedok��u ulo�it soubor %s.",filename); msg_box("Chyba I/O",'\01',info,"!Panika!",NULL); } else txt=pripona(filename,TXT); save_items(); if (_access(txt,0)!=0) { FILE *f; f=fopen(txt,"w"); if (f) { fputs("-1\n",f); fclose(f); } } if (!mglob.local_monsters) { save_mobs(); save_sound_map(); } save_all_shops(); validate_sound_map(); return z; }
int main (int argc, char **argv) { int quit = 0; create_window (); while (!quit) { eventloop (); } close_window (); return EXIT_SUCCESS; }
void kernel_set_load_rate(unsigned int rate) { if (rate>load_rate) { set_progress_value(kernel_load_window,progress_load_rate_handle,rate); if (MAX_KERNEL_LOAD_RATE==rate) { close_window(kernel_load_window); return; } load_rate=rate; } }
void tchatbox::close_window_button_callback(tlobby_chat_window& chat_window, bool& handled, bool& halt) { const int index = std::find_if(open_windows_.begin(), open_windows_.end(), [&chat_window](const tlobby_chat_window& room) { return room.name == chat_window.name; }) - open_windows_.begin(); close_window(index); handled = true; halt = true; }
Data_analysis_gui::Data_analysis_gui( QWidget* parent, const char* name ) : QWidget( parent, Qt::Window ) { plot_ = 0; scrollview_ = 0; if (name) setObjectName(name); setupUi(this); // QLayout* layout = this->layout(); // QSizeGrip* grip = new QSizeGrip( gripbox_, "grip" ); // layout->add( grip ); QVBoxLayout * vbox = new QVBoxLayout; vbox->addSpacing(-1); gripbox_->setLayout(vbox); /* gripbox_->setOrientation( Qt::Vertical ); gripbox_->setColumns( 2 ); gripbox_->addSpace( -1 ); */ vbox->addWidget(new QSizeGrip( gripbox_)); /* //add a status bar (mainly for its resize grip...) QLayout* layout = this->layout(); QStatusBar* statusbar = new QStatusBar( this, "statusbar" ); QSizePolicy policy( QSizePolicy::Preferred, QSizePolicy::Fixed ); statusbar->setSizePolicy( policy ); statusbar->setSizeGripEnabled( true ); QPushButton* close_button_ = new QPushButton( "Close", statusbar, "close_button" ); QPushButton* save_button_ = new QPushButton( "Save As Image", statusbar, "save_button" ); statusbar->addWidget( save_button_, 0, true ); QLayout* bar_layout = statusbar->layout(); bar_layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed ) ); statusbar->addWidget( close_button_, 0, true ); layout->add( statusbar ); */ init_display_area(); init_controls_area(); QObject::connect( (QObject*) close_button_, SIGNAL( clicked() ), this, SLOT( close_window() ) ); QObject::connect( (QObject*) save_button_, SIGNAL( clicked() ), this, SLOT( save_as_image() ) ); }
static void destructor(void *arg) { struct vidisp_st *st = arg; if (st->image) { st->image->data = NULL; XDestroyImage(st->image); } close_window(st); }
/** * Display a message box. * This function displays the specified message in a text box * centered in the screen and waits until a key is pressed. * @param p The text to be displayed */ int TextMan::message_box(const char *s) { int k; _sprites->erase_both(); blit_textbox(s, -1, -1, -1); _sprites->blit_both(); k = wait_key(); debugC(4, kDebugLevelText, "wait_key returned %02x", k); close_window(); return k; }
/**************************************************************** * * * ferme la fenˆtre de tampon * * mais ne libŠre pas la m‚moire * * * ****************************************************************/ void fermer_tampon(void) { register windowptr winptr = (windowptr)&Firstwindow; /* ferme la fenˆtre */ close_window(Tampon -> win, TRUE); /* Remove window record from window list. */ while(winptr -> next) if (winptr -> next == Tampon) break; else winptr = winptr -> next; if (!winptr -> next) { error_msg(Z_NO_CORRESPONDING_HANDLE); shutdown(FALSE); } /* on d‚gage de la liste */ winptr -> next = winptr -> next -> next; /* Update the front window pointer. */ if (!BottomIsMeaningful) { int place = Tampon -> place; for (winptr = Firstwindow; winptr; winptr = winptr -> next) if (winptr -> place > place) winptr -> place--; /* recherche la nouvelle fenˆtre de niveau 0 */ for (winptr = Firstwindow; winptr; winptr = winptr -> next) if (!winptr -> place) break; if (winptr) make_frontwin(winptr); } if (Tampon -> menu_entry > FAIL) { memset(MenuShortCuts[6].menu[WINDOW_LIST_1 - CHOIX_FONTE + Tampon -> menu_entry].text, ' ', MenuShortCuts[6].size -SHORTCUT_SIZE -1); menu_ienable(Menu, WINDOW_LIST_1 + Tampon -> menu_entry, FALSE); menu_icheck(Menu, WINDOW_LIST_1 + Tampon -> menu_entry, FALSE); *(PopUpEntryTree[6][WINDOW_LIST_1 - CHOIX_FONTE +1 + Tampon -> menu_entry].ob_spec.free_string +1) = '\0'; PopUpEntryTree[6][WINDOW_LIST_1 - CHOIX_FONTE +1 + Tampon -> menu_entry].ob_state |= DISABLED; } /* rend le menu 'Ouvrir Tampon' cliquable */ menu_ienable(Menu, OUVRIR_TAMPON, 1); } /* fermer_tampon */
void close_app(void) { WINDOW *w; CTL3D x = {0,0,0,0}; w = create_window(0,0,1,1,0,&x); desktop_add_window(w); define(-1,0,0,639,477,0,fog_bar);property(NULL,NULL,NULL,RGB555(16,0,0)); redraw_desktop(); if ((ask_exit_status = msg_box("Dotaz?",'\x2',"Chce¨ program ukon‡it, nebo nahr t jinou mapu?","Jinou mapu","Ukon‡it","Ne",NULL)) != 3) terminate(); close_window(w); do_events(); }
//Delete a folder (closes a window) static int x11fs_rmdir(const char *path) { //Check the folder is one representing a window //Returning ENOSYS because sometimes this will be on a dir, just not one that represents a window //TODO: Probably return more meaningful errors int wid; if((wid=get_winid(path)) == -1 || strlen(path)>11) return -ENOSYS; //Close the window close_window(wid); return 0; }
X11Window::~X11Window() { SetupDisplay::get_message_queue()->remove_client(this); SetupDisplay::get_message_queue()->set_mouse_capture(this, false); get_keyboard_provider()->dispose(); get_mouse_provider()->dispose(); for (auto & elem : joysticks) elem.get_provider()->dispose(); close_window(); }
/** * \brief Method called when the frame is displayed. */ void ptb::frame_pause::on_focus() { // This method is called when the message box asking the player if // he really wants to come back to the title screen. if ( m_msg_result & message_box::s_ok ) { bear::engine::game::get_instance().set_waiting_level ("level/title_screen.cl"); close_window(); } else m_msg_result = 0; } // frame_pause::on_focus()
/* len is in characters, not pixels!! */ void TextMan::blit_textbox(const char *p, int y, int x, int len) { /* if x | y = -1, then centre the box */ int xoff, yoff, lin, h, w; char *msg, *m; debugC(3, kDebugLevelText, "x=%d, y=%d, len=%d", x, y, len); if (game.window.active) close_window(); if (x == 0 && y == 0 && len == 0) x = y = -1; if (len <= 0 || len >= 40) len = 32; xoff = x * CHAR_COLS; yoff = y * CHAR_LINES; len--; m = msg = word_wrap_string(agi_sprintf(p), &len); for (lin = 1; *m; m++) { /* Test \r for MacOS 8 */ if (*m == '\n' || *m == '\r') lin++; } if (lin * CHAR_LINES > GFX_HEIGHT) lin = (GFX_HEIGHT / CHAR_LINES); w = (len + 2) * CHAR_COLS; h = (lin + 2) * CHAR_LINES; if (xoff < 0) xoff = (GFX_WIDTH - w - CHAR_COLS) / 2; else xoff -= CHAR_COLS; if (yoff < 0) yoff = (GFX_HEIGHT - 3 * CHAR_LINES - h) / 2; draw_window(xoff, yoff, xoff + w - 1, yoff + h - 1); print_text2(2, msg, 0, CHAR_COLS + xoff, CHAR_LINES + yoff, len + 1, MSG_BOX_TEXT, MSG_BOX_COLOUR); free(msg); do_update(); }
int close_win_by_title(gchar *title) { Window *client_list; unsigned long client_list_size; int count; int i; Display *disp; setlocale(LC_ALL, ""); init_charset();/*lkadd*/ if (! (disp = XOpenDisplay(NULL))) { fputs("Cannot open display.\n", stderr); return 1; }/*打开显示*/ if((client_list = get_client_list(disp, &client_list_size)) == NULL) { return EXIT_FAILURE; } count = client_list_size / sizeof(Window); for (i = 0; i < count; i++) { gchar *title_utf8 = get_window_title(disp, client_list[i]); /* UTF8 */ gchar *title_out = get_output_str(title_utf8, TRUE); if(g_strcasecmp(title, title_out) == 0) { close_window(disp, client_list[i]); break; } g_free(title_utf8); g_free(title_out); } g_free(client_list); XCloseDisplay(disp); if(i >= count) { return EXIT_SUCCESS; } else { #if MY_DEBUG_OUTPUT == 1 g_print("cann't find the window with title:%s \n", title); #endif return 1; } }
void window_request(int pid, unsigned char *req) { /* window request */ if (req[1] == WMREQ_REGWIN) add_window(pid, (wm_reg_t *) req); else if (req[1] == WMREQ_REDRAW) redraw_window(pid, (wm_redraw_t *) req); else if (req[1] == WMREQ_CLOSEWIN) close_window(pid, (wm_closewin_t *) req); else if (req[1] == WMREQ_SET_WP) { set_wallpaper(((wm_set_wallpaper_t *) req)->index); update_screen(); } }
void edit_sector(int source) { TSECTOR *p; TSTR_LIST l; CTL3D b1,b2,b3; l=read_directory("c:\\windows\\system\\*.*",DIR_FULL,_A_NORMAL); p=&mapa.sectordef[source]; memcpy(&b1,def_border(1,0),sizeof(CTL3D)); memcpy(&b2,def_border(5,WINCOLOR),sizeof(CTL3D)); memcpy(&b3,def_border(3,WINCOLOR),sizeof(CTL3D)); default_font=vga_font; memcpy(f_default,flat_color(0x0000),sizeof(charcolors)); def_dialoge(100,100,300,200,"String list - test only"); define(9,10,20,240,170,0,listbox,l,0x1f);c_default(0); o_end->autoresizex=1; o_end->autoresizey=1; define(10,3,42,17,110,1,scroll_bar_v,0,10,1,SCROLLBARCOL); property(NULL,NULL,NULL,WINCOLOR); o_end->autoresizey=1; define(11,1,20,21,17,1,scroll_button,-1,0,"\x1e"); property(NULL,icones,NULL,WINCOLOR);on_change(scroll_support); define(12,1,22,21,17,2,scroll_button,1,10,"\x1f"); property(NULL,icones,NULL,WINCOLOR);on_change(scroll_support); define(20,1,1,10,10,2,resizer); /* define(OK_BUTT,100,5,80,20,2,button,"Ok");property(&b1,NULL,NULL,WINCOLOR); on_change(terminate); define(CANCEL_BUTT,10,5,80,20,2,button,"Zru¨it");property(&b1,NULL,NULL,WINCOLOR); on_change(terminate); define(-1,5,20,100,12,0,label,"P©ipojen¡:"); define(10,10,35,50,12,0,input_line,20,0,MAPSIZE-1,"%6d");property(&b2,NULL,NULL,WINCOLOR); set_default(strs(p->step_next[0]));on_exit(test_int); define(20,10,50,50,12,0,input_line,20,0,MAPSIZE-1,"%6d");property(&b2,NULL,NULL,WINCOLOR); set_default(strs(p->step_next[1]));on_exit(test_int); define(30,10,65,50,12,0,input_line,20,0,MAPSIZE-1,"%6d");property(&b2,NULL,NULL,WINCOLOR); set_default(strs(p->step_next[2]));on_exit(test_int); define(40,10,80,50,12,0,input_line,20,0,MAPSIZE-1,"%6d");property(&b2,NULL,NULL,WINCOLOR); set_default(strs(p->step_next[3]));on_exit(test_int); define(50,70,35,80,12,0,button,"Sever");property(&b1,NULL,NULL,WINCOLOR);on_change(edit_side_sup); define(60,70,50,80,12,0,button,"V˜chod");property(&b1,NULL,NULL,WINCOLOR);on_change(edit_side_sup); define(70,70,65,80,12,0,button,"Jih");property(&b1,NULL,NULL,WINCOLOR);on_change(edit_side_sup); define(80,70,80,80,12,0,button,"Z pad");property(&b1,NULL,NULL,WINCOLOR);on_change(edit_side_sup); temp_source=source; */redraw_window(); escape(); close_window(waktual); release_list(l); }
int main( int argc, char *argv[] ) { qInstallMessageHandler( message_output ); QApplication a( argc, argv ); VodPlayInterface w; vod_ir_play_window = &w; w.show(); a.connect( &w, SIGNAL( close_window() ), &a, SLOT( quit() ) ); //a.connect( &w, SIGNAL( min_window() ), &w, SLOT( showMinimized() ) ); //a.connect( &w, SIGNAL( max_window() ), &w, SLOT( showMaximized() ) ); //窗口居屏幕中间 w.move( ( QApplication::desktop()->width() - w.width())/2, ( QApplication::desktop()->height() - w.height())/2 ); return a.exec(); }
int loadgame_simple () { char home[MAX_PATH], path[MAX_PATH]; int rc = 0; printf("here?\n"); #ifdef DREAMCAST uint8 addr, port, unit; addr = maple_first_vmu(); if (addr) { maple_create_port (addr, &port, &unit); sprintf (g_vmu_port, "%c%d", port + 'a', unit); } else { message_box("No VMU found."); return err_OK; } sprintf(path, VMU_PATH, g_vmu_port, game.id, slot); #else if (get_app_dir (home, MAX_PATH) < 0) { message_box ("Error loading game."); return err_BadFileOpen; } sprintf(path, "%s/" DATA_DIR "/%05X.%s/%08d.sav", home, game.crc, game.id, 0); #endif erase_both(); stop_sound(); close_window(); if ((rc = load_game (path)) == err_OK) { message_box ("Game restored."); game.exit_all_logics = 1; menu_enable_all(); } else { message_box ("Error restoring game."); } return rc; }
void close_windows(void) { if (tui_disabled) return; /* must delete panels before their attached windows */ if (dialogue_window) close_panel(dialogue_panel); if (cooling_device_window) close_panel(data_panel); close_window(title_bar_window); close_window(tz_sensor_window); close_window(status_bar_window); close_window(cooling_device_window); close_window(control_window); close_window(thermal_data_window); close_window(dialogue_window); }
static gint key_press (GtkWidget *widget, GdkEventKey *event, GUI *appGUI) { switch (event->keyval) { case GDK_Escape: close_window (NULL, widget); return TRUE; case GDK_Page_Down: about_switch_buttons (FALSE, appGUI); return TRUE; case GDK_Page_Up: about_switch_buttons (TRUE, appGUI); return TRUE; } return FALSE; }