示例#1
0
int
main (int argc, char *argv[])
{
  GooCanvasItemModel *model;
  GdkPixbuf *pixbuf;

  /* Initialize GTK+. */
  gtk_init (&argc, &argv);

  pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
				     "dialog-warning", 48, 0, NULL);

  model = create_model (pixbuf);

  /* Create 2 windows to show off multiple views. */
  create_window (model);
#if 1
  create_window (model);
#endif

  g_object_unref (model);

  gtk_main ();

  return 0;
}
示例#2
0
void 
shelm_clock_dialog(const char *window_title, const char *window_text, int window_width, int window_height, const char *window_background, Eina_Bool show_seconds, Eina_Bool show_am_pm, const char *time, Eina_Bool is_editable)
{
  Evas_Object *window, *background, *frame, *box, *clock, *buttonbar, *button_cancel, *button_ok;
  char buf[PATH_MAX];

  if (window_title)
    window = create_window("shellementary-clockdialog", window_title, cancel_callback);
  else
    window = create_window("shellementary-clockdialog", _("Set the time"), cancel_callback);

  background = create_background(window, window_background, EINA_TRUE);
  elm_win_resize_object_add(window, background);
  evas_object_show(background);

  frame = create_frame(window, EINA_TRUE);
  elm_win_resize_object_add(window, frame);
  evas_object_show(frame);

  box = create_box(window, EINA_FALSE);
  elm_object_content_set(frame, box);
  evas_object_show(box);

  if (window_text)
    {
      Evas_Object *label;
      label = create_label(window, window_text);
      elm_box_pack_end(box, label);
      evas_object_show(label);
    }

  clock = create_clock(window, show_seconds, show_am_pm, time, is_editable);
  elm_box_pack_end(box, clock);
  evas_object_show(clock);

  buttonbar = create_box(window, EINA_TRUE);
  elm_box_pack_end(box, buttonbar);
  evas_object_show(buttonbar);

  snprintf(buf, sizeof(buf), "%s/icon-cancel.png", PACKAGE_DATA_DIR);
  button_cancel = create_button(window, buf, _("Cancel"));
  evas_object_smart_callback_add(button_cancel, "clicked", cancel_callback, NULL);
  elm_box_pack_start(buttonbar, button_cancel);
  evas_object_show(button_cancel);

  snprintf(buf, sizeof(buf), "%s/icon-ok.png", PACKAGE_DATA_DIR);
  button_ok = create_button(window, buf, _("OK"));
  evas_object_smart_callback_add(button_ok, "clicked", clock_callback, clock);
  elm_box_pack_end(buttonbar, button_ok);
  evas_object_show(button_ok);

  if (!window_width)
    evas_object_geometry_get(window, NULL, NULL, &window_width, NULL);
  if (!window_height)
    evas_object_geometry_get(window, NULL, NULL, NULL, &window_height);

  evas_object_resize(window, window_width, window_height);

  evas_object_show(window);
}
int main(int argc, char *argv[]) {
   int thread_support;
   char root_path[MPI_PMEM_MAX_ROOT_PATH];
   MPI_Win_pmem_metadata windows[2];
   int result = 0;

   MPI_Init_thread_pmem(&argc, &argv, MPI_THREAD_MULTIPLE, &thread_support);

   // Set root path for the first time, create 2 windows and delete one of them.
   sprintf(root_path, "%s/0", argv[1]);
   MPI_Win_pmem_set_root_path(root_path);
   result |= create_window("1", 1024);
   result |= create_window("2", 1024);
   if (result != 0) {
      MPI_Finalize_pmem();
      return result;
   }
   MPI_Win_pmem_delete("2");

   // Prepare expected result.
   windows[0].flags = MPI_PMEM_FLAG_OBJECT_EXISTS;
   windows[0].size = 1024;
   strcpy(windows[0].name, "1");
   windows[1].flags = MPI_PMEM_FLAG_OBJECT_DELETED;
   windows[1].size = 1024;
   strcpy(windows[1].name, "2");

   // Set root path once again and check result.
   MPI_Win_pmem_set_root_path(root_path);
   result = check_global_metadata_file(windows, 2);

   MPI_Finalize_pmem();

   return result;
}
示例#4
0
文件: windows.c 项目: SigmaG/nmud
struct windows* prepare_windows(struct conf* cnf) {

	struct windows* W = malloc(sizeof(struct windows));

	int t_size;
	int r_size;
	int buf_size;
	if (cnf == NULL | cnf->t_size == 0) {
		t_size = 6;
	} else {
		t_size = cnf->t_size;
	}
	if (cnf == NULL | cnf->t_size == 0) {
		r_size = 25;
	} else {
		r_size = cnf->r_size;
	}
	if (cnf == NULL | cnf->buffer < 2*LINES) {
		buf_size = 2*LINES;
	} else {
		buf_size = cnf->buffer;
	}

	W->t_win = create_window(t_size+1,COLS,0,0,buf_size);
	W->r_win = create_window(LINES-t_size-1,r_size+1,t_size+1,COLS-r_size-1,buf_size);
	W->b_win = create_window(2,COLS-r_size-1,LINES-2,0,buf_size);
	W->m_win = create_window(LINES-t_size-3,COLS-r_size-1,t_size+1,0,buf_size);

	redraw_borders(W);
	return W;
}
示例#5
0
文件: gfx_test.c 项目: Haifisch/axle
void test_xserv(Screen* vesa_screen) {
	Window* window = create_window(rect_make(point_make(50, 50), size_make(400, 500)));
	window->title = "Color test";
	add_subwindow(vesa_screen->window, window);
	
	Window* label_win = create_window(rect_make(point_make(350, 100), size_make(500, 200)));
	label_win->title = "Text test";
	Label* test_label = create_label(rect_make(point_make(0, 0), label_win->content_view->frame.size), "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pulvinar dui bibendum nunc convallis, bibendum venenatis mauris ornare. Donec et libero lacus. Nulla tristique auctor pulvinar. Aenean enim elit, malesuada nec dignissim eget, varius ac nunc. Vestibulum varius lectus nisi, in dignissim orci volutpat in. Aliquam eget eros lorem. Quisque tempor est a rhoncus consequat. Quisque vestibulum finibus sapien. Etiam enim sem, vehicula ac lorem vitae, mattis mollis mauris. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Vivamus eleifend dui vel nulla suscipit pretium. Suspendisse vel nunc efficitur, lobortis dui convallis, tristique tellus. Ut ut viverra est. Etiam tempor justo risus. Cras laoreet eu sapien et lacinia. Nunc imperdiet blandit purus a semper.");
	add_sublabel(label_win->content_view, test_label);
	add_subwindow(vesa_screen->window, label_win);

	//create evenly spaced subsections
	for (int i = 0; i < 34; i++) {
		double height = window->content_view->frame.size.height / 32;
		View* view = create_view(rect_make(point_make(0, height * i), size_make(window->content_view->frame.size.width, height)));
		add_subview(window->content_view, view);
	}
	for (int i = 0; i < 1000; i++) {
		for (int j = 0; j < window->content_view->subviews->size; j++) {
			View* subview = array_m_lookup(window->content_view->subviews, j);
			set_background_color(subview, color_make(rand() % 256, rand() % 256, rand() % 256));
		}
		sleep(50);
	}
}	
示例#6
0
void 
shelm_simple_dialog(const char *window_title, const char *window_text, int window_width, int window_height, const char *window_background, const char *window_icccm_name, const char *window_default_title, const char *window_default_icon)
{
  Evas_Object *window, *background, *frame, *box, *hbox, *icon, *button_ok;
  char buf[PATH_MAX];

  snprintf(buf, sizeof(buf), "shellementary-%s", window_icccm_name);
  if (window_title)
    window = create_window(buf, window_title, destroy);
  else
    window = create_window(buf, window_default_title, destroy);

  background = create_background(window, window_background, EINA_FALSE);
  elm_win_resize_object_add(window, background);
  evas_object_show(background);

  frame = create_frame(window, EINA_FALSE);
  elm_win_resize_object_add(window, frame);
  evas_object_show(frame);

  box = create_box(window, EINA_FALSE);
  elm_object_content_set(frame, box);
  evas_object_show(box);

  hbox = create_box(window, EINA_TRUE);
  elm_box_pack_end(box, hbox);
  evas_object_show(hbox);

  icon = create_icon(window, window_default_icon);
  elm_box_pack_start(hbox, icon);
  evas_object_show(icon);

  if (window_text)
    {
      Evas_Object *label;
      label = create_label(window, window_text);
      elm_box_pack_end(hbox, label);
      evas_object_show(label);
    }

  snprintf(buf, sizeof(buf), "%s/icon-ok.png", PACKAGE_DATA_DIR);
  button_ok = create_button(window, buf, _("OK"));
  evas_object_smart_callback_add(button_ok, "clicked", destroy, NULL);
  elm_box_pack_end(box, button_ok);
  evas_object_show(button_ok);

  if (!window_width)
    evas_object_geometry_get(window, NULL, NULL, &window_width, NULL);
  if (!window_height)
    evas_object_geometry_get(window, NULL, NULL, NULL, &window_height);

  evas_object_resize(window, window_width, window_height);

  evas_object_show(window);
}
示例#7
0
void overlay_open(struct overlay * overlay, xcb_connection_t * connection) {
    overlay->connection = connection;
    const xcb_setup_t * setup = xcb_get_setup(connection);
    xcb_screen_iterator_t iter = xcb_setup_roots_iterator(setup);
    xcb_screen_t * screen = iter.data;
    overlay->screen = screen;
    overlay->top = create_window(connection, screen);
    overlay->left = create_window(connection, screen);
    overlay->right = create_window(connection, screen);
    overlay->bottom = create_window(connection, screen);
    xcb_flush(connection);
}
示例#8
0
void display_images(IMAGE &clip_image, IMAGE &scaled_image) { 
  WINDOW clip_im_window;         //window for debug
  WINDOW scale_im_window;        //window for debug
  INT16 i;
  GRAPHICS_EVENT event;          //                                                      c;

                                 // xmin xmax ymin ymax
  clip_im_window = create_window ("Clipped Blob", SCROLLINGWIN, editor_word_xpos - 20, editor_word_ypos - 100, 5 * clip_image.get_xsize (), 5 * clip_image.get_ysize (), 0, clip_image.get_xsize (), 0, clip_image.get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(clip_im_window); 
  show_sub_image (&clip_image,
    0, 0,
    clip_image.get_xsize (), clip_image.get_ysize (),
    clip_im_window, 0, 0);

  line_color_index(clip_im_window, RED); 
  for (i = 1; i < clip_image.get_xsize (); i++) {
    move2d (clip_im_window, i, 0);
    draw2d (clip_im_window, i, clip_image.get_xsize ());
  }
  for (i = 1; i < clip_image.get_ysize (); i++) {
    move2d (clip_im_window, 0, i);
    draw2d (clip_im_window, clip_image.get_xsize (), i);
  }

                                 // xmin xmax ymin ymax
  scale_im_window = create_window ("Scaled Blob", SCROLLINGWIN, editor_word_xpos + 300, editor_word_ypos - 100, 5 * scaled_image.get_xsize (), 5 * scaled_image.get_ysize (), 0, scaled_image.get_xsize (), 0, scaled_image.get_ysize (),
    TRUE, FALSE, FALSE, TRUE);   // down event & key only

  clear_view_surface(scale_im_window); 
  show_sub_image (&scaled_image,
    0, 0,
    scaled_image.get_xsize (), scaled_image.get_ysize (),
    scale_im_window, 0, 0);

  line_color_index(scale_im_window, RED); 
  for (i = 1; i < scaled_image.get_xsize (); i++) {
    move2d (scale_im_window, i, 0);
    draw2d (scale_im_window, i, scaled_image.get_xsize ());
  }
  for (i = 1; i < scaled_image.get_ysize (); i++) {
    move2d (scale_im_window, 0, i);
    draw2d (scale_im_window, scaled_image.get_xsize (), i);
  }

  overlap_picture_ops(TRUE); 
  await_event(scale_im_window, TRUE, ANY_EVENT, &event); 
  destroy_window(clip_im_window); 
  destroy_window(scale_im_window); 
}
示例#9
0
int main() {
	window *window = create_window(L"test window", -1, -1, 800, 600, on_resize, 0, 0);

	while (window->is_open) {
		window->cursor_type = INTERACT;

		unsigned char *row = (unsigned char *)window->bitmap_memory;

		int pitch = window->bitmap_width * 4; // 4 bytes per pixel

		for (int y = 0; y < window->bitmap_height; y++) {
			unsigned char *pixel = (unsigned char *)row;

			for (int x = 0; x < window->bitmap_width; x++) {
				*pixel = 255;
				pixel++;

				*pixel = 0;
				pixel++;

				*pixel = 0;
				pixel++;

				*pixel = 0;
				pixel++;
			}

			row += pitch;
		}

		update_window(window);
	}

	return 0;
}
示例#10
0
static int perform_window_task(aroop_txt_t*msg, int*offset, int*cur_key, int*cur_type, int*cur_len) {
	// check the task ..
	static int ready = 0;
	ready++;
	int cmd = msg_numeric_value(msg, offset, cur_type, cur_len);
	SYNC_ASSERT(msg_next(msg, offset, cur_key, cur_type, cur_len) != -1);
	SYNC_ASSERT(*cur_key == ENUM_ROOPKOTHA_GUI_CORE_TASK_ARG);
	int wid = msg_numeric_value(msg, offset, cur_type, cur_len);
	x11_window_t*win = get_window(wid);
	switch(cmd) {
	case ENUM_ROOPKOTHA_GUI_WINDOW_TASK_SHOW_WINDOW:
		if(win == NULL) {
			win = create_window(gcore.disp, RootWindow (gcore.disp, gcore.scrn), wid);
		}
		watchdog_log_string("Show window\n");
		break;
	case ENUM_ROOPKOTHA_GUI_WINDOW_TASK_DESTROY:
		aroop_indexed_list_set(&gcore.pwins, wid, NULL);
		if(win != NULL) {
			// TODO destroy window
		}
	break;
#if 0
	case ENUM_ROOPKOTHA_GUI_WINDOW_TASK_PAINT_COMPLETE:
		qw->setPage(qtg->page);
		qtg->painter->end();
		qw->repaint();
	break;
#endif
	}
	if(win)
		OPPUNREF(win);
	return 0;
}
示例#11
0
int
main(int argc, char **argv)
{
	struct sigaction sigint;
	struct display *display;
	struct window *window;
	int ret = 0;

	display = create_display();
	window = create_window(display, 250, 250);
	if (!window)
		return 1;

	sigint.sa_handler = signal_int;
	sigemptyset(&sigint.sa_mask);
	sigint.sa_flags = SA_RESETHAND;
	sigaction(SIGINT, &sigint, NULL);

	/* Here we retrieve the linux-dmabuf objects, or error */
	wl_display_roundtrip(display->display);

	if (!running)
		return 1;

	redraw(window, NULL, 0);

	while (running && ret != -1)
		ret = wl_display_dispatch(display->display);

	fprintf(stderr, "simple-dmabuf exiting\n");
	destroy_window(window);
	destroy_display(display);

	return 0;
}
示例#12
0
void								wififriend_scan_network(GtkWidget* Widget, gpointer Data)
{
	DWORD							Error = ERROR_SUCCESS;
	PWLAN_AVAILABLE_NETWORK_LIST	Network = NULL;
	t_wifi							St;
	int								I;
	GtkWidget						*WinScan = NULL;
	GtkWidget						*ListOfWifi = NULL;

	I = 1;
	St = wififriend_create_handle();
	St = wififriend_retrieve_config(St);
	if((WlanGetAvailableNetworkList(St.MyHandle, &St.MyGuid, 0x00000001, NULL, &Network)) != ERROR_SUCCESS)
		error_scan(0);
	else
	{
		WinScan = create_window(236, 27, "Wifi scan");
		ListOfWifi = gtk_combo_box_new_text();
		while(I != Network->dwNumberOfItems)
		{
			gtk_combo_box_prepend_text(GTK_COMBO_BOX(ListOfWifi), (const gchar *)Network->Network[I].dot11Ssid.ucSSID);
			I++;
		}
		gtk_combo_box_set_active(GTK_COMBO_BOX(ListOfWifi), 0);
		gtk_container_add(GTK_CONTAINER(WinScan), ListOfWifi);
		g_signal_connect(G_OBJECT(ListOfWifi), "changed", G_CALLBACK(wififriend_connect_to_unsecure_network), (gpointer)ListOfWifi);
		display_interface(WinScan);
		WlanCloseHandle(St.MyHandle, NULL);
	}
}
示例#13
0
static int
gtk_cmd_handler (pinentry_t pe)
{
  GtkWidget *w;
  int want_pass = !!pe->pin;

  got_input = FALSE;
  pinentry = pe;
  confirm_value = CONFIRM_CANCEL;
  passphrase_ok = 0;
  w = create_window (want_pass ? 0 : 1);
  gtk_main ();
  gtk_widget_destroy (w);
  while (gtk_events_pending ())
    gtk_main_iteration ();

  if (confirm_value == CONFIRM_CANCEL || grab_failed)
    pe->canceled = 1;

  pinentry = NULL;
  if (want_pass)
    {
      if (passphrase_ok && pe->pin)
	return strlen (pe->pin);
      else
	return -1;
    }
  else
    return (confirm_value == CONFIRM_OK) ? 1 : 0;
}
/* ------------------------- public functions */
int mode_preferences(int argc, char *argv[])
{
        GError *err = NULL;
        struct configuration config;
        struct catalog *catalog;

        ocha_init(PACKAGE, argc, argv, TRUE/*GUI*/, &config);
        mode_install_if_necessary(&config);
        ocha_init_requires_catalog(config.catalog_path);

        catalog =  catalog_new_and_connect(config.catalog_path, &err);
        if(!catalog) {
                printf("error: invalid catalog at %s: %s\n",
                       config.catalog_path,
                       err->message);
                exit(12);
        }

        create_window(catalog);

        gtk_main();

        catalog_free(catalog);
        return 0;
}
示例#15
0
int main(int argc, char *argv[])
{
	UniqueApp *app;
	GtkWidget *window;
	GtkWidget *notebook;
	GError *error = NULL;

	bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
	textdomain(GETTEXT_PACKAGE);

	if (gtk_init_with_args(&argc, &argv, NULL,
				options, GETTEXT_PACKAGE, &error) == FALSE) {
		if (error) {
			g_print("%s\n", error->message);
			g_error_free(error);
		} else
			g_print("An unknown error occurred\n");

		return 1;
	}

	if (option_dump != FALSE) {
		dump_devices ();
		return 0;
	}

	app = unique_app_new ("org.mate.Bluetooth.properties", NULL);
	if (unique_app_is_running (app)) {
		gdk_notify_startup_complete ();
		unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
		return 0;
	}

	g_set_application_name(_("Bluetooth Properties"));

	gtk_window_set_default_icon_name("bluetooth");

	bluetooth_plugin_manager_init ();

	notebook = gtk_notebook_new();
	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);

	setup_adapter(GTK_NOTEBOOK(notebook));

	window = create_window(notebook);

	g_signal_connect (app, "message-received",
			  G_CALLBACK (message_received_cb), window);

	gtk_main();

	bluetooth_plugin_manager_cleanup ();

	cleanup_adapter();

	g_object_unref(app);

	return 0;
}
示例#16
0
int
main(int argc, char *argv[])
{
  gint result;

  setlocale(LC_ALL, "");
  bindtextdomain(PACKAGE, LOCALEDIR);
  textdomain(PACKAGE);
  bind_textdomain_codeset(PACKAGE, "UTF-8");
  parse_arg(argc, argv);

  gtk_init(&argc, &argv);
  setup_default_icon();

  result = create_window();

  if (result == -1) {
    g_printerr(_("Error:%s\n"), get_error_msg());
    exit(EXIT_FAILURE);
  }

  gtk_main ();

  return 0;
}
示例#17
0
void audgui_show_equalizer_window (void)
{
    if (equalizer_window == NULL)
        equalizer_window = create_window ();

    gtk_window_present ((GtkWindow *) equalizer_window);
}
示例#18
0
static int
gtk_cmd_handler (pinentry_t pe)
{
  GtkWidget *w;
  int want_pass = !!pe->pin;

  pinentry = pe;
  confirm_yes = 0;
  passphrase_ok = 0;
  w = create_window (want_pass ? 0 : 1);
  gtk_main ();
  gtk_widget_destroy (w);
  while (gtk_events_pending ())
    gtk_main_iteration ();

  pinentry = NULL;
  if (want_pass)
    {
      if (passphrase_ok && pe->pin)
	return strlen (pe->pin);
      else
	return -1;
    }
  else
    return confirm_yes;
}
示例#19
0
文件: vo_gl.c 项目: azuwis/mplayer
/* connect to server, create and map window,
 * allocate colors and (shared) memory
 */
static int
config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
{
  int xs, ys;
  image_height = height;
  image_width = width;
  image_format = format;
  is_yuv = mp_get_chroma_shift(image_format, &xs, &ys) > 0;
  is_yuv |= (xs << 8) | (ys << 16);
  glFindFormat(format, NULL, &gl_texfmt, &gl_format, &gl_type);

  int_pause = 0;
  vo_flipped = !!(flags & VOFLAG_FLIPPING);

  if (create_window(d_width, d_height, flags, title) < 0)
    return -1;

  if (vo_config_count)
    uninitGl();
  if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED)
    return -1;
  if (mesa_buffer && !mpglAllocateMemoryMESA) {
    mp_msg(MSGT_VO, MSGL_ERR, "Can not enable mesa-buffer because AllocateMemoryMESA was not found\n");
    mesa_buffer = 0;
  }
  initGl(vo_dwidth, vo_dheight);

  return 0;
}
示例#20
0
void loadEveBrowser()
{
    int argc = 0;
    printf("%s:%d\n", __func__, __LINE__);
    gtk_init_check(&argc, NULL);
    if (!g_thread_supported ())
        g_thread_init (NULL);
    
    printf("%s:%d\n", __func__, __LINE__);

    GtkWidget* fixed = gtk_fixed_new();
    g_vbox = gtk_vbox_new (FALSE, 0);
    gtk_box_pack_start (GTK_BOX (g_vbox), create_toolbar (), FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (g_vbox), GTK_WIDGET (create_browser ()), TRUE, TRUE, 0);
    gtk_box_pack_start (GTK_BOX (g_vbox), create_statusbar (), FALSE, FALSE, 0);
    
    g_window = create_window ();
    
    gtk_fixed_put(GTK_FIXED(fixed), g_vbox, 0, 0);
    gtk_widget_set_size_request(g_vbox, g_framebuffer_width, g_framebuffer_height);
    
    GtkWidget* statusLabel = gtk_label_new ("Status");
    gtk_fixed_put(GTK_FIXED(fixed), statusLabel, g_framebuffer_width - 200, 0);
    gtk_widget_set_size_request(statusLabel, 200, 100);
    
    gtk_container_add (GTK_CONTAINER (g_window), fixed);
}
示例#21
0
void init_misc_display(void)
{
	//create the misc window
	if(misc_win < 0)
		{
			misc_win= create_window("Misc", -1, 0, 0, 0, 0, 0, ELW_USE_UISCALE|ELW_TITLE_NONE|ELW_SHOW_LAST);
			if (misc_win < 0 || misc_win >= windows_list.num_windows)
				return;
			set_window_handler(misc_win, ELW_HANDLER_DISPLAY, &display_misc_handler);
			set_window_handler(misc_win, ELW_HANDLER_CLICK, &click_misc_handler);
			set_window_handler(misc_win, ELW_HANDLER_MOUSEOVER, &mouseover_misc_handler );
			set_window_handler(misc_win, ELW_HANDLER_UI_SCALE, &ui_scale_misc_handler );
			set_window_handler(misc_win, ELW_HANDLER_DESTROY, &destroy_misc_handler );
			cm_hud_id = cm_create(cm_hud_menu_str, context_hud_handler);
			cm_bool_line(cm_hud_id, CMH_STATS, &show_stats_in_hud, "show_stats_in_hud");
			cm_bool_line(cm_hud_id, CMH_STATBARS, &show_statbars_in_hud, "show_statbars_in_hud");
			cm_bool_line(cm_hud_id, CMH_KNOWBAR, &view_knowledge_bar, "view_knowledge_bar");
			cm_bool_line(cm_hud_id, CMH_TIMER, &view_hud_timer, "view_hud_timer");
			cm_bool_line(cm_hud_id, CMH_DIGCLOCK, &view_digital_clock, "view_digital_clock");
			cm_bool_line(cm_hud_id, CMH_ANACLOCK, &view_analog_clock, "view_analog_clock");
			cm_bool_line(cm_hud_id, CMH_SECONDS, &show_game_seconds, "show_game_seconds");
			cm_bool_line(cm_hud_id, CMH_FPS, &show_fps, "show_fps");
			cm_bool_line(cm_hud_id, CMH_INDICATORS, &show_hud_indicators, "show_indicators");
			cm_bool_line(cm_hud_id, CMH_MINIMAP, &cm_minimap_shown, NULL);
			cm_bool_line(cm_hud_id, CMH_RANGSTATS, &cm_rangstats_shown, NULL);
			cm_bool_line(cm_hud_id, CMH_QUICKBM, &cm_quickbar_enabled, NULL);
			cm_bool_line(cm_hud_id, CMH_SOUND, &cm_sound_enabled, NULL);
			cm_bool_line(cm_hud_id, CMH_MUSIC, &cm_music_enabled, NULL);
			cm_add_window(cm_hud_id, misc_win);
			cm_set_pre_show_handler(cm_hud_id, context_hud_pre_show_handler);
		}
	ui_scale_misc_handler(&windows_list.window[misc_win]);
}
示例#22
0
文件: fe-gtk.c 项目: UIKit0/picogui
void
fe_new_window (struct session *sess)
{
    sess->gui = malloc (sizeof (struct session_gui));
    memset (sess->gui, 0, sizeof (struct session_gui));
    create_window (sess);
}
示例#23
0
bool dhUserPrefs::QueryUser(void){

   find_adapters();


   if(!create_window()){

      return false;

   }

   MSG msg;

   while(GetMessage( &msg, NULL, 0, 0 )){
      if (!IsDialogMessage(m_window,&msg)) { //This makes TAB work as it should
         TranslateMessage(&msg); 
         DispatchMessage(&msg); 
      }
   }


   UnregisterClass(user_pref_wnd_class_name,GetModuleHandle(NULL));

   return m_exited_okay;

}
示例#24
0
static void test_get_adapter_luid(void)
{
    HWND window = create_window();
    IDirect3D9Ex *d3d9ex;
    UINT count;
    HRESULT hr;
    LUID luid;

    hr = pDirect3DCreate9Ex(D3D_SDK_VERSION, &d3d9ex);
    if (FAILED(hr))
    {
        skip("Direct3D9Ex is not available.\n");
        DestroyWindow(window);
        return;
    }

    count = IDirect3D9Ex_GetAdapterCount(d3d9ex);
    if (!count)
    {
        skip("No adapters available.\n");
        IDirect3D9Ex_Release(d3d9ex);
        DestroyWindow(window);
        return;
    }

    hr = IDirect3D9Ex_GetAdapterLUID(d3d9ex, D3DADAPTER_DEFAULT, &luid);
    ok(SUCCEEDED(hr), "GetAdapterLUID failed, hr %#x.\n", hr);
    trace("adapter luid: %08x:%08x.\n", luid.HighPart, luid.LowPart);

    IDirect3D9Ex_Release(d3d9ex);
}
示例#25
0
//打开新的console的函数
LAYER *open_console(LAYER_MANAGE *layer_manage, unsigned int memory_total)
{
	MEMMANAGE *memmanage = (MEMMANAGE *)MEMMANAGE_ADDR;
	LAYER *layer_console = layer_alloc(layer_manage);
	unsigned char *buf_console = (unsigned char *)memmanage_alloc_4K(memmanage, 256 * 165);	
	TASK *task_console = task_alloc();
	int *console_fifo = (int *)memmanage_alloc_4K(memmanage, 128 * 4);
	layer_set(layer_console, buf_console, 256, 165, -1);
	create_window(buf_console, 256, 165, "console", INACTIVE);
	create_textbox(layer_console, 8, 28, 240, 128, COL8_000000);
	task_console->console_stack = memmanage_alloc_4K(memmanage, 64 * 1024) + 64 * 1024 - 12;			//由于这里要传入两个参数,所以减去了12
	task_console->tss.esp = task_console->console_stack;
	task_console->tss.eip = (int) &console_task;			//eip指向的是运行console的函数首地址
	task_console->tss.es = 1 * 8;
	task_console->tss.cs = 2 * 8;
	task_console->tss.ss = 1 * 8;
	task_console->tss.ds = 1 * 8;
	task_console->tss.fs = 1 * 8;
	task_console->tss.gs = 1 * 8;
	*((int *) (task_console->tss.esp + 4)) = (int) layer_console;
	*((int *) (task_console->tss.esp + 8)) = memory_total;	
	task_run(task_console, 2, 2); 			/* level=2, priority=2 */
	layer_console->task = task_console;
	layer_console->flags |= 0x20;			//flags的0x20代表当前窗口的光标ON
	init_fifo(&task_console->fifo, 128, console_fifo, task_console);
	return layer_console;
}
示例#26
0
int application::run()
{
	if (!create_window())
	{
		return 1;
	}

	::ShowWindow(m_hwnd, SW_SHOWNORMAL);
	::UpdateWindow(m_hwnd);

	MSG msg;

	bool done = false;
	while (!done)
	{
		while (::PeekMessageW(&msg, 0, 0, 0, PM_NOREMOVE))
		{
			if (!::GetMessageW(&msg, 0, 0, 0))
			{
				done = true;
				break;
			}
			::TranslateMessage(&msg);
			::DispatchMessageW(&msg);
		}
		
		perform_idle();
	}

	return 0;
}
示例#27
0
文件: main.c 项目: sreinoso/DAM1
int
main (int argc, char *argv[])
{
    GtkWidget *window;



#ifdef ENABLE_NLS

    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);
#endif

    gtk_init (&argc, &argv);

    window = create_window ();
    gtk_widget_show (window);

    gtk_main ();


    g_free (priv);


    return 0;
}
示例#28
0
//	Create a new achievement window.
//
void Achievements_Window::open(int win_pos_x, int win_pos_y)
{
	if (main_win_id >= 0)
	{
		show_window(main_win_id);
		return;
	}

	Achievements_System *as = Achievements_System::get_instance();

	logical_rows = (their_achievements.size() + (as->get_per_row() - 1)) / as->get_per_row();
	physical_rows = (logical_rows > as->get_max_rows()) ?as->get_max_rows() :logical_rows;

	main_win_id = create_window(their_name.c_str(), -1, 0, win_pos_x, win_pos_y, 0, 0,
		ELW_USE_UISCALE|ELW_TITLE_BAR|ELW_DRAGGABLE|ELW_USE_BACKGROUND|ELW_USE_BORDER|ELW_SHOW|ELW_TITLE_NAME|ELW_ALPHA_BORDER|ELW_SWITCHABLE_OPAQUE);
	set_window_handler(main_win_id, ELW_HANDLER_DISPLAY, (int (*)())&achievements_display_handler );
	set_window_handler(main_win_id, ELW_HANDLER_CLICK, (int (*)())&achievements_click_handler );
	set_window_handler(main_win_id, ELW_HANDLER_MOUSEOVER, (int (*)())&achievements_mouseover_handler );
	set_window_handler(main_win_id, ELW_HANDLER_KEYPRESS, (int (*)())&achievements_keypress_handler );
	set_window_handler(main_win_id, ELW_HANDLER_UI_SCALE, (int (*)())&achievements_ui_scale_handler );

	window_info *win = &windows_list.window[main_win_id];
	win->data = reinterpret_cast<void *>(this);
	ui_scale_handler(win);
}
示例#29
0
int main( int argc, char **argv )
{
    // etape 1 : creer la fenetre
    Window window= create_window(1024, 640);
    if(window == NULL) 
        return 1;       // erreur lors de la creation de la fenetre ou de l'init de sdl2
    
    // etape 2 : creer un contexte opengl pour pouvoir dessiner
    Context context= create_context(window);
    if(context == NULL) 
        return 1;       // erreur lors de la creation du contexte opengl
    
    // etape 3 : creation des objets 
    if(init() < 0)
    {
        printf("[error] init failed.\n");
        return 1;
    }
    
    // etape 4 : affichage de l'application, tant que la fenetre n'est pas fermee. ou que draw() ne renvoie pas 0
    run(window, draw);

    // etape 5 : nettoyage
    quit();
    release_context(context);
    release_window(window);
    return 0;
}
示例#30
0
文件: window.c 项目: hun7err/OS-Chat
void redraw(gui_t *g, core_t *c) {
    destroy_window(g->mainwindow);
    destroy_window(g->content);
    destroy_window(g->user_list);
    g->mainwindow = create_window(LINES-3,COLS-16-2,1,1);
    g->content = create_window(LINES-3, COLS-16-2, 1, 1);
    g->user_list = create_window(LINES-3,16,1,COLS-16-1);
    c->cursor_y = LINES-1;
    //int len = strlen(c->room);
    wrefresh(g->content); // tu się sypie [nie wiedzieć czemu :x]
    wrefresh(g->user_list);
    wmove(g->mainwindow, c->cursor_y, strlen(c->room)+3+c->cursor_x);
    draw_gui(g->mainwindow, c);
    wrefresh(g->mainwindow);
    refresh();
}