]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - unix/gtkwin.c
At last, merge the putty-gtk2 branch back into the trunk!
[PuTTY.git] / unix / gtkwin.c
index 2972dba11a5fba3145cb3fd712f638445ff58198..dc8d6607e860b2ea1dcea999c08281f81ba50239 100644 (file)
@@ -134,7 +134,7 @@ FontSpec platform_default_fontspec(const char *name)
 {
     FontSpec ret;
     if (!strcmp(name, "Font"))
-       strcpy(ret.name, "fixed");
+       strcpy(ret.name, "server:fixed");
     else
        *ret.name = '\0';
     return ret;
@@ -1350,12 +1350,28 @@ void request_resize(void *frontend, int w, int h)
      */
 #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);
+    /*
+     * I can no longer remember what this call to
+     * gtk_container_dequeue_resize_handler is for. It was
+     * introduced in r3092 with no comment, and the commit log
+     * message was uninformative. I'm _guessing_ its purpose is to
+     * prevent gratuitous resize processing on the window given
+     * that we're about to resize it anyway, but I have no idea
+     * why that's so incredibly vital.
+     * 
+     * I've tried removing the call, and nothing seems to go
+     * wrong. I've backtracked to r3092 and tried removing the
+     * call there, and still nothing goes wrong. So I'm going to
+     * adopt the working hypothesis that it's superfluous; I won't
+     * actually remove it from the GTK 1.2 code, but I won't
+     * attempt to replicate its functionality in the GTK 2 code
+     * above.
+     */
     gtk_container_dequeue_resize_handler(GTK_CONTAINER(inst->window));
     gdk_window_resize(inst->window->window,
                      area_x + offset_x, area_y + offset_y);
@@ -1455,7 +1471,7 @@ void palette_reset(void *frontend)
     /* Since Default Background may have changed, ensure that space
      * between text area and window border is refreshed. */
     set_window_background(inst);
-    if (inst->area) {
+    if (inst->area && inst->area->window) {
        draw_backing_rect(inst);
        gtk_widget_queue_draw(inst->area);
     }
@@ -2026,7 +2042,7 @@ void do_text_internal(Context ctx, int x, int y, wchar_t *text, int len,
            unifont_draw_text(inst->pixmap, gc, inst->fonts[fontid],
                              x*inst->font_width+inst->cfg.window_border,
                              y*inst->font_height+inst->cfg.window_border+inst->fonts[0]->ascent,
-                             gcs, mblen, widefactor > 1, bold);
+                             gcs, mblen, widefactor > 1, bold, inst->font_width);
        }
 
        sfree(gcs);
@@ -2618,7 +2634,8 @@ void setup_fonts_ucs(struct gui_data *inst)
     if (inst->fonts[3])
         unifont_destroy(inst->fonts[3]);
 
-    inst->fonts[0] = unifont_create(inst->cfg.font.name, FALSE, FALSE,
+    inst->fonts[0] = unifont_create(inst->area, inst->cfg.font.name,
+                                   FALSE, FALSE,
                                    inst->cfg.shadowboldoffset,
                                    inst->cfg.shadowbold);
     if (!inst->fonts[0]) {
@@ -2630,7 +2647,8 @@ void setup_fonts_ucs(struct gui_data *inst)
     if (inst->cfg.shadowbold || !inst->cfg.boldfont.name[0]) {
        inst->fonts[1] = NULL;
     } else {
-       inst->fonts[1] = unifont_create(inst->cfg.boldfont.name, FALSE, TRUE,
+       inst->fonts[1] = unifont_create(inst->area, inst->cfg.boldfont.name,
+                                       FALSE, TRUE,
                                        inst->cfg.shadowboldoffset,
                                        inst->cfg.shadowbold);
        if (!inst->fonts[1]) {
@@ -2641,7 +2659,8 @@ void setup_fonts_ucs(struct gui_data *inst)
     }
 
     if (inst->cfg.widefont.name[0]) {
-       inst->fonts[2] = unifont_create(inst->cfg.widefont.name, TRUE, FALSE,
+       inst->fonts[2] = unifont_create(inst->area, inst->cfg.widefont.name,
+                                       TRUE, FALSE,
                                        inst->cfg.shadowboldoffset,
                                        inst->cfg.shadowbold);
        if (!inst->fonts[2]) {
@@ -2656,7 +2675,8 @@ void setup_fonts_ucs(struct gui_data *inst)
     if (inst->cfg.shadowbold || !inst->cfg.wideboldfont.name[0]) {
        inst->fonts[3] = NULL;
     } else {
-       inst->fonts[3] = unifont_create(inst->cfg.wideboldfont.name, TRUE,
+       inst->fonts[3] = unifont_create(inst->area,
+                                       inst->cfg.wideboldfont.name, TRUE,
                                        TRUE, inst->cfg.shadowboldoffset,
                                        inst->cfg.shadowbold);
        if (!inst->fonts[3]) {
@@ -3320,6 +3340,8 @@ int pt_main(int argc, char **argv)
     if (!utf8_string_atom)
         utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
 
+    inst->area = gtk_drawing_area_new();
+
     setup_fonts_ucs(inst);
     init_cutbuffers();
 
@@ -3333,7 +3355,6 @@ int pt_main(int argc, char **argv)
     inst->width = inst->cfg.width;
     inst->height = inst->cfg.height;
 
-    inst->area = gtk_drawing_area_new();
     gtk_drawing_area_size(GTK_DRAWING_AREA(inst->area),
                          inst->font_width * inst->cfg.width + 2*inst->cfg.window_border,
                          inst->font_height * inst->cfg.height + 2*inst->cfg.window_border);