X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/0d7b2c96d388f5a9b539df3cb7f4ef115e7010b7..eb0f65b4fbbea60100b53cb40a1d7138d47ad0d2:/src/widget.c diff --git a/src/widget.c b/src/widget.c index ecf145199f..0986ba61db 100644 --- a/src/widget.c +++ b/src/widget.c @@ -1,5 +1,5 @@ /* The emacs frame widget. - Copyright (C) 1992-1993, 2000-2014 Free Software Foundation, Inc. + Copyright (C) 1992-1993, 2000-2015 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -61,10 +61,7 @@ static void EmacsFrameResize (Widget widget); static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result); -#undef XtOffset -#define XtOffset(p_type,field) \ - ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) -#define offset(field) XtOffset (EmacsFrame, emacs_frame.field) +#define offset(field) offsetof (EmacsFrameRec, emacs_frame.field) static XtResource resources[] = { {XtNgeometry, XtCGeometry, XtRString, sizeof (String), @@ -271,8 +268,8 @@ set_frame_size (EmacsFrame ew) */ /* Hairily merged geometry */ - unsigned int w = FRAME_COLS (ew->emacs_frame.frame); - unsigned int h = FRAME_LINES (ew->emacs_frame.frame); + int w = FRAME_COLS (ew->emacs_frame.frame); + int h = FRAME_LINES (ew->emacs_frame.frame); Widget wmshell = get_wm_shell ((Widget) ew); /* Each Emacs shell is now independent and top-level. */ @@ -437,7 +434,7 @@ set_frame_size (EmacsFrame ew) static void update_wm_hints (EmacsFrame ew) { - Widget wmshell = get_wm_shell ((Widget)ew); + Widget wmshell = get_wm_shell ((Widget) ew); int cw; int ch; Dimension rounded_width; @@ -460,7 +457,7 @@ update_wm_hints (EmacsFrame ew) base_width = (wmshell->core.width - ew->core.width + (rounded_width - (char_width * cw))); base_height = (wmshell->core.height - ew->core.height - + (rounded_height - (char_height * ch))); + + (rounded_height - (char_height * ch))); /* This is kind of sleazy, but I can't see how else to tell it to make it mark the WM_SIZE_HINTS size as user specified. @@ -480,7 +477,7 @@ update_wm_hints (EmacsFrame ew) void widget_update_wm_size_hints (Widget widget) { - EmacsFrame ew = (EmacsFrame)widget; + EmacsFrame ew = (EmacsFrame) widget; update_wm_hints (ew); } @@ -519,7 +516,7 @@ update_from_various_frame_slots (EmacsFrame ew) static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2) { - EmacsFrame ew = (EmacsFrame)new; + EmacsFrame ew = (EmacsFrame) new; if (!ew->emacs_frame.frame) { @@ -545,7 +542,7 @@ resize_cb (Widget widget, static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) { - EmacsFrame ew = (EmacsFrame)widget; + EmacsFrame ew = (EmacsFrame) widget; /* This used to contain SubstructureRedirectMask, but this turns out to be a problem with XIM on Solaris, and events from that mask @@ -554,7 +551,7 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs | PropertyChangeMask | SubstructureNotifyMask); *mask |= CWEventMask; - XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, + XtCreateWindow (widget, InputOutput, (Visual *) CopyFromParent, *mask, attrs); /* Some ConfigureNotify events does not end up in EmacsFrameResize so make sure we get them all. Seen with xfcwm4 for example. */ @@ -571,47 +568,28 @@ EmacsFrameDestroy (Widget widget) static void EmacsFrameResize (Widget widget) { - EmacsFrame ew = (EmacsFrame)widget; + EmacsFrame ew = (EmacsFrame) widget; struct frame *f = ew->emacs_frame.frame; + int width, height; - /* Always process resize requests pixelwise. Frame maximizing - should work even when frame_resize_pixelwise is nil. */ - if (true || frame_resize_pixelwise) - { - int width, height; + pixel_to_text_size (ew, ew->core.width, ew->core.height, &width, &height); - pixel_to_text_size (ew, ew->core.width, ew->core.height, &width, &height); - change_frame_size (f, width, height, 0, 1, 0, 1); + frame_size_history_add + (f, QEmacsFrameResize, width, height, + list2 (make_number (ew->core.width), make_number (ew->core.height))); - update_wm_hints (ew); - update_various_frame_slots (ew); + change_frame_size (f, width, height, 0, 1, 0, 1); - cancel_mouse_face (f); - } - else - { - struct x_output *x = f->output_data.x; - int columns, rows; - - pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows); - if (columns != FRAME_COLS (f) - || rows != FRAME_LINES (f) - || ew->core.width != FRAME_PIXEL_WIDTH (f) - || ew->core.height + x->menubar_height != FRAME_PIXEL_HEIGHT (f)) - { - change_frame_size (f, columns, rows, 0, 1, 0, 0); - update_wm_hints (ew); - update_various_frame_slots (ew); + update_wm_hints (ew); + update_various_frame_slots (ew); - cancel_mouse_face (f); - } - } + cancel_mouse_face (f); } static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result) { - EmacsFrame ew = (EmacsFrame)widget; + EmacsFrame ew = (EmacsFrame) widget; int mask = request->request_mode; Dimension ok_width, ok_height;