char *platform_default_s(const char *name)
{
+ if (!strcmp(name, "SerialLine"))
+ return dupstr("/dev/ttyS0");
return NULL;
}
*/
#if GTK_CHECK_VERSION(2,0,0)
struct gui_data *inst = (struct gui_data *)frontend;
- if (iconic)
+ if (zoomed)
gtk_window_maximize(GTK_WINDOW(inst->window));
else
gtk_window_unmaximize(GTK_WINDOW(inst->window));
inst->back->free(inst->backhandle);
inst->backhandle = NULL;
inst->back = NULL;
+ term_provide_resize_fn(inst->term, NULL, NULL);
update_specials_menu(inst);
}
gtk_widget_show(inst->restartitem);
*/
#if GTK_CHECK_VERSION(2,0,0)
gtk_widget_set_size_request(inst->area, area_x, area_y);
+ _gtk_container_dequeue_resize_handler(GTK_CONTAINER(inst->window));
+ gtk_window_resize(GTK_WINDOW(inst->window),
+ area_x + offset_x, area_y + offset_y);
#else
gtk_widget_set_usize(inst->area, area_x, area_y);
gtk_drawing_area_size(GTK_DRAWING_AREA(inst->area), area_x, area_y);
-#endif
-
gtk_container_dequeue_resize_handler(GTK_CONTAINER(inst->window));
-
-#if GTK_CHECK_VERSION(2,0,0)
- gtk_window_resize(GTK_WINDOW(inst->window),
- area_x + offset_x, area_y + offset_y);
-#else
gdk_window_resize(inst->window->window,
area_x + offset_x, area_y + offset_y);
#endif
*/
void init_cutbuffers()
{
+ unsigned char empty[] = "";
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER0, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER0, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER1, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER1, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER2, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER2, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER3, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER3, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER4, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER4, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER5, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER5, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER6, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER6, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER7, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER7, XA_STRING, 8, PropModeAppend, empty, 0);
}
/* Store the data in a cut-buffer. */
struct gui_data *inst = (struct gui_data *)data;
if (seldata->target == utf8_string_atom)
gtk_selection_data_set(seldata, seldata->target, 8,
- inst->pasteout_data_utf8,
+ (unsigned char *)inst->pasteout_data_utf8,
inst->pasteout_data_utf8_len);
else if (seldata->target == compound_text_atom)
gtk_selection_data_set(seldata, seldata->target, 8,
- inst->pasteout_data_ctext,
+ (unsigned char *)inst->pasteout_data_ctext,
inst->pasteout_data_ctext_len);
else
gtk_selection_data_set(seldata, seldata->target, 8,
- inst->pasteout_data, inst->pasteout_data_len);
+ (unsigned char *)inst->pasteout_data,
+ inst->pasteout_data_len);
}
gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
wcs[i] = text[i];
}
+ if (inst->fonts[fontid] == NULL && (fontid & 2)) {
+ /*
+ * We've been given ATTR_WIDE, but have no wide font.
+ * Fall back to the non-wide font.
+ */
+ fontid &= ~2;
+ }
+
if (inst->fonts[fontid] == NULL) {
/*
- * The font for this contingency does not exist.
- * Typically this means we've been given ATTR_WIDE
- * character and have no wide font. So we display
- * nothing at all; such is life.
+ * The font for this contingency does not exist. So we
+ * display nothing at all; such is life.
*/
} else if (inst->fontinfo[fontid].is_wide) {
/*
return NULL;
}
- if (cursor_val >= 0 && !cursor_font)
+ if (cursor_val >= 0 && !cursor_font) {
cursor_font = gdk_font_load("cursor");
+ if (cursor_font)
+ gdk_font_ref(cursor_font);
+ }
/*
* Get the text extent of the cursor in question. We use the
cfg->line_codepage[sizeof(cfg->line_codepage)-1] = '\0';
} else if (!strcmp(p, "-geometry")) {
- int flags, x, y, w, h;
+ int flags, x, y;
+ unsigned int w, h;
EXPECTS_ARG;
SECOND_PASS_ONLY;
flags = XParseGeometry(val, &x, &y, &w, &h);
if (flags & WidthValue)
- cfg->width = w;
+ cfg->width = (int)w;
if (flags & HeightValue)
- cfg->height = h;
+ cfg->height = (int)h;
if (flags & (XValue | YValue)) {
inst->xpos = x;
if (rwx & 1) flags |= GDK_INPUT_READ;
if (rwx & 2) flags |= GDK_INPUT_WRITE;
if (rwx & 4) flags |= GDK_INPUT_EXCEPTION;
+ assert(flags);
return gdk_input_add(fd, flags, fd_input_func, NULL);
}
inst->cfg.font.name);
exit(1);
}
+ gdk_font_ref(inst->fonts[0]);
font_charset = set_font_info(inst, 0);
if (inst->cfg.shadowbold) {
}
inst->fonts[1] = name ? gdk_font_load(name) : NULL;
if (inst->fonts[1]) {
+ gdk_font_ref(inst->fonts[1]);
set_font_info(inst, 1);
} else if (!guessed) {
fprintf(stderr, "%s: unable to load bold font \"%s\"\n", appname,
}
inst->fonts[2] = name ? gdk_font_load(name) : NULL;
if (inst->fonts[2]) {
+ gdk_font_ref(inst->fonts[2]);
set_font_info(inst, 2);
} else if (!guessed) {
fprintf(stderr, "%s: unable to load wide font \"%s\"\n", appname,
}
inst->fonts[3] = name ? gdk_font_load(name) : NULL;
if (inst->fonts[3]) {
+ gdk_font_ref(inst->fonts[3]);
set_font_info(inst, 3);
} else if (!guessed) {
fprintf(stderr, "%s: unable to load wide/bold font \"%s\"\n", appname,
}
inst->font_width = gdk_char_width(inst->fonts[0], ' ');
+ if (!inst->font_width) {
+ /* Maybe this is a 16-bit font? If so, GDK 2 actually expects a
+ * pointer to an XChar2b. This is pretty revolting. Can Pango do
+ * this more neatly even for server-side fonts?
+ */
+ XChar2b space;
+ space.byte1 = 0;
+ space.byte2 = ' ';
+ inst->font_width = gdk_text_width(inst->fonts[0],
+ (const gchar *)&space, 2);
+ }
inst->font_height = inst->fonts[0]->ascent + inst->fonts[0]->descent;
inst->direct_to_font = init_ucs(&inst->ucsdata, inst->cfg.line_codepage,
get_sesslist(&sesslist, FALSE); /* free up */
}
+void set_window_icon(GtkWidget *window, const char *const *const *icon,
+ int n_icon)
+{
+ GdkPixmap *iconpm;
+#if GTK_CHECK_VERSION(2,0,0)
+ GList *iconlist;
+ int n;
+#endif
+
+ if (!n_icon)
+ return;
+
+ gtk_widget_realize(window);
+ iconpm = gdk_pixmap_create_from_xpm_d(window->window, NULL,
+ NULL, (gchar **)icon[0]);
+ gdk_window_set_icon(window->window, NULL, iconpm, NULL);
+
+#if GTK_CHECK_VERSION(2,0,0)
+ iconlist = NULL;
+ for (n = 0; n < n_icon; n++) {
+ iconlist =
+ g_list_append(iconlist,
+ gdk_pixbuf_new_from_xpm_data((const gchar **)
+ icon[n]));
+ }
+ gdk_window_set_icon_list(window->window, iconlist);
+#endif
+}
+
void update_specials_menu(void *frontend)
{
struct gui_data *inst = (struct gui_data *)frontend;
cmdline_run_saved(&inst->cfg);
- if (!*inst->cfg.host && !cfgbox(&inst->cfg))
+ if (!cfg_launchable(&inst->cfg) && !cfgbox(&inst->cfg))
exit(0); /* config box hit Cancel */
}
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK | GDK_BUTTON_MOTION_MASK);
+ {
+ extern const char *const *const main_icon[];
+ extern const int n_main_icon;
+ set_window_icon(inst->window, main_icon, n_main_icon);
+ }
+
gtk_widget_show(inst->window);
set_window_background(inst);