Mercurial > emacs
comparison src/gtkutil.c @ 50318:5b50d76d9211
* gtkutil.c (xg_resize_widgets): Don't call xg_frame_cleared.
(xg_frame_set_char_size): Calculate scroll bar width before frame
width. Call SET_FRAME_GARBAGED and cancel_mouse_face.
(xg_separator_p): Check for all documented separator types.
(xg_update_scrollbar_pos): Variable gheight not needed, use height.
(update_frame_tool_bar): Don't call gdk_window_process_all_updates.
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Wed, 26 Mar 2003 18:07:46 +0000 |
parents | c5e286e85257 |
children | 60da21fd968b |
comparison
equal
deleted
inserted
replaced
50317:e0b9e9b6bfac | 50318:5b50d76d9211 |
---|---|
333 all.width = pixelwidth; | 333 all.width = pixelwidth; |
334 all.height = pixelheight - mbheight - tbheight; | 334 all.height = pixelheight - mbheight - tbheight; |
335 | 335 |
336 gtk_widget_size_allocate (x->edit_widget, &all); | 336 gtk_widget_size_allocate (x->edit_widget, &all); |
337 | 337 |
338 xg_frame_cleared (f); | |
339 | |
340 change_frame_size (f, rows, columns, 0, 1, 0); | 338 change_frame_size (f, rows, columns, 0, 1, 0); |
341 SET_FRAME_GARBAGED (f); | 339 SET_FRAME_GARBAGED (f); |
342 cancel_mouse_face (f); | 340 cancel_mouse_face (f); |
343 } | 341 } |
344 } | 342 } |
351 int cols; | 349 int cols; |
352 int rows; | 350 int rows; |
353 { | 351 { |
354 int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows) | 352 int pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows) |
355 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); | 353 + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); |
356 int pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); | 354 int pixelwidth; |
357 | 355 |
358 /* Take into account the size of the scroll bar. Always use the | 356 /* Take into account the size of the scroll bar. Always use the |
359 number of columns occupied by the scroll bar here otherwise we | 357 number of columns occupied by the scroll bar here otherwise we |
360 might end up with a frame width that is not a multiple of the | 358 might end up with a frame width that is not a multiple of the |
361 frame's character width which is bad for vertically split | 359 frame's character width which is bad for vertically split |
366 : (FRAME_SCROLL_BAR_COLS (f) | 364 : (FRAME_SCROLL_BAR_COLS (f) |
367 * FONT_WIDTH (f->output_data.x->font))); | 365 * FONT_WIDTH (f->output_data.x->font))); |
368 | 366 |
369 compute_fringe_widths (f, 0); | 367 compute_fringe_widths (f, 0); |
370 | 368 |
369 /* CHAR_TO_PIXEL_WIDTH uses vertical_scroll_bar_extra, so call it | |
370 after calculating that value. */ | |
371 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); | |
372 | |
371 /* Must resize our top level widget. Font size may have changed, | 373 /* Must resize our top level widget. Font size may have changed, |
372 but not rows/cols. */ | 374 but not rows/cols. */ |
373 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), | 375 gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), |
374 pixelwidth, pixelheight); | 376 pixelwidth, pixelheight); |
375 xg_resize_widgets (f, pixelwidth, pixelheight); | 377 xg_resize_widgets (f, pixelwidth, pixelheight); |
378 | |
379 SET_FRAME_GARBAGED (f); | |
380 cancel_mouse_face (f); | |
376 } | 381 } |
377 | 382 |
378 /* Convert an X Window WSESC to its corresponding GtkWidget. | 383 /* Convert an X Window WSESC to its corresponding GtkWidget. |
379 Must be done like this, because GtkWidget:s can have "hidden" | 384 Must be done like this, because GtkWidget:s can have "hidden" |
380 X Window that aren't accessible. | 385 X Window that aren't accessible. |
426 xg_fixed_handle_expose(GtkWidget *widget, | 431 xg_fixed_handle_expose(GtkWidget *widget, |
427 GdkEventExpose *event, | 432 GdkEventExpose *event, |
428 gpointer user_data) | 433 gpointer user_data) |
429 { | 434 { |
430 GList *iter; | 435 GList *iter; |
431 | 436 |
432 for (iter = GTK_FIXED (widget)->children; iter; iter = g_list_next (iter)) | 437 for (iter = GTK_FIXED (widget)->children; iter; iter = g_list_next (iter)) |
433 { | 438 { |
434 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; | 439 GtkFixedChild *child_data = (GtkFixedChild *) iter->data; |
435 GtkWidget *child = child_data->widget; | 440 GtkWidget *child = child_data->widget; |
436 GdkWindow *window = child->window; | 441 GdkWindow *window = child->window; |
1274 if (! item->enabled) gtk_widget_set_sensitive (w, FALSE); | 1279 if (! item->enabled) gtk_widget_set_sensitive (w, FALSE); |
1275 | 1280 |
1276 return w; | 1281 return w; |
1277 } | 1282 } |
1278 | 1283 |
1279 /* Return non-zero if NAME specifies a separator (GTK only has one | 1284 /* Return non-zero if LABEL specifies a separator (GTK only has one |
1280 separator type) */ | 1285 separator type) */ |
1281 static int | 1286 static int |
1282 xg_separator_p (char *name) | 1287 xg_separator_p (char *label) |
1283 { | 1288 { |
1284 if (! name) return 0; | 1289 if (! label) return 0; |
1285 | 1290 else if (strlen (label) > 3 |
1286 return strcmp (name, "--") == 0 | 1291 && strncmp (label, "--", 2) == 0 |
1287 || strncmp (name, "--:", 3) == 0 | 1292 && label[2] != '-') |
1288 || strcmp (name, "---") == 0; | 1293 { |
1294 static char* separator_names[] = { | |
1295 "space", | |
1296 "no-line", | |
1297 "single-line", | |
1298 "double-line", | |
1299 "single-dashed-line", | |
1300 "double-dashed-line", | |
1301 "shadow-etched-in", | |
1302 "shadow-etched-out", | |
1303 "shadow-etched-in-dash", | |
1304 "shadow-etched-out-dash", | |
1305 "shadow-double-etched-in", | |
1306 "shadow-double-etched-out", | |
1307 "shadow-double-etched-in-dash", | |
1308 "shadow-double-etched-out-dash", | |
1309 0, | |
1310 }; | |
1311 | |
1312 int i; | |
1313 | |
1314 label += 2; | |
1315 for (i = 0; separator_names[i]; ++i) | |
1316 if (strcmp (label, separator_names[i]) == 0) | |
1317 return 1; | |
1318 } | |
1319 else | |
1320 { | |
1321 /* Old-style separator, maybe. It's a separator if it contains | |
1322 only dashes. */ | |
1323 while (*label == '-') | |
1324 ++label; | |
1325 if (*label == 0) return 1; | |
1326 } | |
1327 | |
1328 return 0; | |
1289 } | 1329 } |
1290 | 1330 |
1291 GtkWidget *xg_did_tearoff; | 1331 GtkWidget *xg_did_tearoff; |
1292 | 1332 |
1293 /* Callback invoked when a detached menu window is removed. Here we | 1333 /* Callback invoked when a detached menu window is removed. Here we |
2569 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); | 2609 GtkWidget *wscroll = xg_get_widget_from_map (scrollbar_id); |
2570 | 2610 |
2571 if (wscroll) | 2611 if (wscroll) |
2572 { | 2612 { |
2573 GtkWidget *wfixed = f->output_data.x->edit_widget; | 2613 GtkWidget *wfixed = f->output_data.x->edit_widget; |
2574 int gheight = max (height, 1); | |
2575 int winextra = canon_width > width ? (canon_width - width) / 2 : 0; | 2614 int winextra = canon_width > width ? (canon_width - width) / 2 : 0; |
2576 int bottom = top + gheight; | 2615 int bottom = top + height; |
2577 | 2616 |
2578 gint slider_width; | 2617 gint slider_width; |
2579 int oldtop, oldleft, oldbottom; | 2618 int oldtop, oldleft, oldbottom; |
2580 GtkRequisition req; | 2619 GtkRequisition req; |
2581 | 2620 |
2628 bottomdiff = abs (oldbottom - bottom); | 2667 bottomdiff = abs (oldbottom - bottom); |
2629 topdiff = abs (oldtop - top); | 2668 topdiff = abs (oldtop - top); |
2630 | 2669 |
2631 if (oldleft != left) | 2670 if (oldleft != left) |
2632 { | 2671 { |
2633 gdk_window_clear_area (wfixed->window, xl, top, wbl, gheight); | 2672 gdk_window_clear_area (wfixed->window, xl, top, wbl, height); |
2634 gdk_window_clear_area (wfixed->window, xr, top, wbr, gheight); | 2673 gdk_window_clear_area (wfixed->window, xr, top, wbr, height); |
2635 } | 2674 } |
2636 | 2675 |
2637 if (oldtop > top) | 2676 if (oldtop > top) |
2638 { | 2677 { |
2639 gdk_window_clear_area (wfixed->window, xl, top, wbl, topdiff); | 2678 gdk_window_clear_area (wfixed->window, xl, top, wbl, topdiff); |
2661 } | 2700 } |
2662 } | 2701 } |
2663 | 2702 |
2664 /* Move and resize to new values. */ | 2703 /* Move and resize to new values. */ |
2665 gtk_fixed_move (GTK_FIXED (wfixed), wscroll, left, top); | 2704 gtk_fixed_move (GTK_FIXED (wfixed), wscroll, left, top); |
2666 gtk_widget_set_size_request (wscroll, width, gheight); | 2705 gtk_widget_set_size_request (wscroll, width, height); |
2667 | 2706 |
2668 /* Must force out update so changed scroll bars gets redrawn. */ | 2707 /* Must force out update so changed scroll bars gets redrawn. */ |
2669 gdk_window_process_all_updates (); | 2708 gdk_window_process_all_updates (); |
2670 | 2709 |
2671 SET_FRAME_GARBAGED (f); | 2710 SET_FRAME_GARBAGED (f); |
2672 cancel_mouse_face (f); | 2711 cancel_mouse_face (f); |
3155 { | 3194 { |
3156 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; | 3195 FRAME_TOOLBAR_HEIGHT (f) = new_req.height; |
3157 xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); | 3196 xg_resize_outer_widget (f, FRAME_WIDTH (f), FRAME_HEIGHT (f)); |
3158 } | 3197 } |
3159 | 3198 |
3160 /* Must force out update so changed images gets redrawn. */ | |
3161 gdk_window_process_all_updates (); | |
3162 | |
3163 if (icon_list) g_list_free (icon_list); | 3199 if (icon_list) g_list_free (icon_list); |
3164 | 3200 |
3165 UNBLOCK_INPUT; | 3201 UNBLOCK_INPUT; |
3166 } | 3202 } |
3167 | 3203 |