Changeset 3926

Show
Ignore:
Timestamp:
2005年10月21日 00時44分28秒 (3 years ago)
Author:
fujii
Message:

Support negative offset. See ticket:192.

* mw32term.c (mw32_calc_absolute_position): Implement this
function.
(x_set_offset): Set negative offsets correctly.

* international/meadow.el (x-parse-geometry): Parse negative
offsets correctly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/ChangeLog.Meadow

    r3914 r3926  
     12005-10-21  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
     2 
     3        * international/meadow.el (x-parse-geometry): Parse negative 
     4        offsets correctly. 
     5 
    162005-10-15  Kyotaro HORIGUCHI  <horiguti@meadowy.org> 
    27 
  • trunk/lisp/international/meadow.el

    r3914 r3926  
    220220 
    221221(defun x-parse-geometry (str) 
    222   (let* ((size-regexp "\\([+\\-]?[0-9]+\\)[xX]\\([+\\-]?[0-9]+\\)") 
     222  (let* ((size-regexp "\\([0-9]+\\)?\\(?:[xX]\\([0-9]+\\)\\)?") 
    223223         (location-regexp "\\([+\\-][+\\-]?[0-9]+\\)") 
    224224         (func (lambda (x) 
    225                  (cond ((= (aref x 0) ?+) 
    226                         (cons '+ (string-to-number 
     225                 (cond ((null x) nil) 
     226                       ((= (aref x 0) ?+) 
     227                        (list '+ (string-to-number 
    227228                                  (substring x 1)))) 
    228229                       ((= (aref x 0) ?-) 
    229                         (cons '- (string-to-number 
     230                        (list '- (string-to-number 
    230231                                  (substring x 1)))) 
    231232                       (t nil)))) 
     
    236237         (concat "^" size-regexp) 
    237238         str) 
    238         (setq size-x (string-to-number (match-string 1 str)) 
    239               size-y (string-to-number (match-string 2 str)) 
     239        (setq size-x (and (match-string 1 str) 
     240                          (string-to-number (match-string 1 str))) 
     241              size-y (and (match-string 2 str) 
     242                          (string-to-number (match-string 2 str))) 
    240243              str (substring str (match-end 0)))) 
    241244    (if (string-match 
    242          (concat "^" location-regexp location-regexp
     245         (concat "^" location-regexp "\\(" location-regexp "\\)?"
    243246         str) 
    244247        (setq location-x (match-string 1 str) 
     
    246249              location-x (funcall func location-x) 
    247250              location-y (funcall func location-y))) 
     251    (if location-x 
     252        (setq result (cons (cons 'left location-x) result))) 
     253    (if location-y 
     254        (setq result (cons (cons 'top location-y) result))) 
    248255    (if size-x 
    249256        (setq result (cons (cons 'width size-x) result))) 
    250257    (if size-y 
    251258        (setq result (cons (cons 'height size-y) result))) 
    252     (cond ((eq (car location-x) '+) 
    253            (setq result 
    254                  (cons (cons 'left (cdr location-x)) 
    255                        result))) 
    256           ((eq (car location-x) '-) 
    257            (setq result 
    258                  (cons (cons 'right (cdr location-x)) 
    259                        result)))) 
    260     (cond ((eq (car location-y) '+) 
    261            (setq result 
    262                  (cons (cons 'top (cdr location-y)) 
    263                        result))) 
    264           ((eq (car location-y) '-) 
    265            (setq result 
    266                  (cons (cons 'bottom (cdr location-y)) 
    267                        result)))) 
    268259    result)) 
    269260 
  • trunk/src/ChangeLog.Meadow

    r3925 r3926  
     12005-10-21  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
     2 
     3        * mw32term.c (mw32_calc_absolute_position): Implement this 
     4        function. 
     5        (x_set_offset): Set negative offsets correctly. 
     6 
    172005-10-19  Kyotaro HORIGUCHI  <horiguti@meadowy.org> 
    28 
  • trunk/src/mw32term.c

    r3925 r3926  
    53515351mw32_calc_absolute_position (struct frame *f) 
    53525352{ 
    5353 #if 0 
    5354   Window child; 
    5355   int win_x = 0, win_y = 0; 
    5356   int flags = f->output_data.x->size_hint_flags; 
    5357   int this_window; 
    5358  
     5353  int flags = f->size_hint_flags; 
     5354  int working_area_width; 
     5355  int working_area_height; 
     5356  RECT working_area_rect; 
     5357  int width, height; 
     5358  RECT win_rect = {0, 0, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f)}; 
     5359   
    53595360  /* We have nothing to do if the current position 
    53605361     is already for the top-left corner.  */ 
     
    53625363    return; 
    53635364 
    5364 #ifdef USE_X_TOOLKIT 
    5365   this_window = XtWindow (f->output_data.x->widget); 
    5366 #else 
    5367   this_window = FRAME_X_WINDOW (f); 
    5368 #endif 
    5369  
    5370   /* Find the position of the outside upper-left corner of 
    5371      the inner window, with respect to the outer window. 
    5372      But do this only if we will need the results.  */ 
    5373   if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window) 
    5374     { 
    5375       int count; 
    5376  
    5377       BLOCK_INPUT; 
    5378       count = x_catch_errors (FRAME_X_DISPLAY (f)); 
    5379       while (1) 
    5380         { 
    5381           x_clear_errors (FRAME_X_DISPLAY (f)); 
    5382           XTranslateCoordinates (FRAME_X_DISPLAY (f), 
    5383  
    5384                                  /* From-window, to-window.  */ 
    5385                                  this_window, 
    5386                                  f->output_data.x->parent_desc, 
    5387  
    5388                                  /* From-position, to-position.  */ 
    5389                                  0, 0, &win_x, &win_y, 
    5390  
    5391                                  /* Child of win.  */ 
    5392                                  &child); 
    5393           if (x_had_errors_p (FRAME_X_DISPLAY (f))) 
    5394             { 
    5395               Window newroot, newparent = 0xdeadbeef; 
    5396               Window *newchildren; 
    5397               unsigned int nchildren; 
    5398  
    5399               if (! XQueryTree (FRAME_X_DISPLAY (f), this_window, &newroot, 
    5400                                 &newparent, &newchildren, &nchildren)) 
    5401                 break; 
    5402  
    5403               XFree ((char *) newchildren); 
    5404  
    5405               f->output_data.x->parent_desc = newparent; 
    5406             } 
    5407           else 
    5408             break; 
    5409         } 
    5410  
    5411       x_uncatch_errors (FRAME_X_DISPLAY (f), count); 
    5412       UNBLOCK_INPUT; 
    5413     } 
    5414  
    5415   /* Treat negative positions as relative to the leftmost bottommost 
    5416      position that fits on the screen.  */ 
     5365  /* Get size of working area in primary screen. */ 
     5366  SystemParametersInfo (SPI_GETWORKAREA, 0, &working_area_rect, 0); 
     5367 
     5368  working_area_width = working_area_rect.right - working_area_rect.left; 
     5369  working_area_height = working_area_rect.bottom - working_area_rect.top; 
     5370 
     5371  /* Get size of frame including non-client region. */ 
     5372  AdjustWindowRectEx (&win_rect, f->output_data.mw32->dwStyle, 
     5373                      FRAME_EXTERNAL_MENU_BAR (f), 
     5374                      f->output_data.mw32->dwStyleEx); 
     5375 
     5376  width = win_rect.right - win_rect.left; 
     5377  height = win_rect.bottom - win_rect.top; 
     5378 
     5379  /* Calculate absolute position. */ 
    54175380  if (flags & XNegative) 
    5418     f->output_data.x->left_pos = (FRAME_X_DISPLAY_INFO (f)->width 
    5419                                   - 2 * f->output_data.x->border_width - win_x 
    5420                                   - FRAME_PIXEL_WIDTH (f) 
    5421                                   + f->output_data.x->left_pos); 
    5422  
    5423   { 
    5424     int height = FRAME_PIXEL_HEIGHT (f); 
    5425  
    5426 #if defined USE_X_TOOLKIT && defined USE_MOTIF 
    5427     /* Something is fishy here.  When using Motif, starting Emacs with 
    5428        `-g -0-0', the frame appears too low by a few pixels. 
    5429  
    5430        This seems to be so because initially, while Emacs is starting, 
    5431        the column widget's height and the frame's pixel height are 
    5432        different.  The column widget's height is the right one.  In 
    5433        later invocations, when Emacs is up, the frame's pixel height 
    5434        is right, though. 
    5435  
    5436        It's not obvious where the initial small difference comes from. 
    5437        2000-12-01, gerd.  */ 
    5438  
    5439     XtVaGetValues (f->output_data.x->column_widget, XtNheight, &height, NULL); 
    5440 #endif 
     5381    f->left_pos = working_area_width - width + f->left_pos; 
    54415382 
    54425383  if (flags & YNegative) 
    5443     f->top_pos = (FRAME_X_DISPLAY_INFO (f)->height 
    5444                   - 2 * f->output_data.x->border_width 
    5445                   - win_y 
    5446                   - height 
    5447                   + f->top_pos); 
    5448   } 
    5449  
    5450   /* The left_pos and top_pos 
    5451      are now relative to the top and left screen edges, 
    5452      so the flags should correspond.  */ 
    5453   f->output_data.x->size_hint_flags &= ~ (XNegative | YNegative); 
    5454 #endif 
     5384    f->top_pos = working_area_height - height + f->top_pos; 
     5385 
     5386  f->size_hint_flags &= ~ (XNegative | YNegative); 
    54555387} 
    54565388 
     
    54665398              int change_gravity) 
    54675399{ 
    5468   if (change_gravity
     5400  if (change_gravity > 0
    54695401    { 
    54705402      f->top_pos = yoff; 
    54715403      f->left_pos = xoff; 
    5472 #if 0 
    5473       f->output_data.mw32->size_hint_flags &= ~ (XNegative | YNegative); 
     5404      f->size_hint_flags &= ~ (XNegative | YNegative); 
     5405 
    54745406      if (xoff < 0) 
    5475         f->output_data.mw32->size_hint_flags |= XNegative; 
     5407        f->size_hint_flags |= XNegative; 
    54765408      if (yoff < 0) 
    5477         f->output_data.mw32->size_hint_flags |= YNegative; 
    5478       f->output_data.mw32->win_gravity = NorthWestGravity; 
    5479 #endif 
     5409        f->size_hint_flags |= YNegative; 
     5410      f->win_gravity = NorthWestGravity; 
    54805411    } 
    54815412  mw32_calc_absolute_position (f);