qemacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemacs-commit] qemacs display.c image.c qe.c qe.h qeconfig.h v...


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs display.c image.c qe.c qe.h qeconfig.h v...
Date: Wed, 3 May 2017 06:50:50 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        17/05/03 06:50:49

Modified files:
        .              : display.c image.c qe.c qe.h qeconfig.h video.c 

Log message:
        display: add window fields for character cell size
        - compute_client_area computes default character sizes in
          EditState.char_width and EditState.line_height.
        - edit_invalidate() takes extra parameter to invalidate
          all windows
        - do_toggle_full_screen() no longer toggles modeline
        - reset WF_POPLEFT in do_delete_other_windows
        - bind toggle-full-screen on C-c f
        - bind toggle-mode-line on C-c m
        - move fill_border to display.c

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/display.c?cvsroot=qemacs&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/qemacs/image.c?cvsroot=qemacs&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.278&r2=1.279
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.259&r2=1.260
http://cvs.savannah.gnu.org/viewcvs/qemacs/qeconfig.h?cvsroot=qemacs&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/qemacs/video.c?cvsroot=qemacs&r1=1.22&r2=1.23

Patches:
Index: display.c
===================================================================
RCS file: /sources/qemacs/qemacs/display.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- display.c   18 Apr 2017 09:14:55 -0000      1.21
+++ display.c   3 May 2017 10:50:49 -0000       1.22
@@ -400,3 +400,40 @@
 {
 }
 #endif
+/* draw only the border of a rectangle */
+void fill_border(EditState *s, int x, int y, int w, int h, int color)
+{
+    int w1, w2, h1, h2;
+
+    /* fill the background */
+    w1 = x;
+    if (w1 < 0)
+        w1 = 0;
+    w2 = s->width - (x + w);
+    if (w2 < 0)
+        w2 = 0;
+    h1 = y;
+    if (h1 < 0)
+        h1 = 0;
+    h2 = s->height - (y + h);
+    if (h2 < 0)
+        h2 = 0;
+
+    fill_rectangle(s->screen,
+                   s->xleft, s->ytop,
+                   w1, s->height,
+                   color);
+    fill_rectangle(s->screen,
+                   s->xleft + s->width - w2, s->ytop,
+                   w2, s->height,
+                   color);
+    fill_rectangle(s->screen,
+                   s->xleft + w1, s->ytop,
+                   s->width - w1 - w2, h1,
+                   color);
+    fill_rectangle(s->screen,
+                   s->xleft + w1, s->ytop + s->height - h2,
+                   s->width - w1 - w2, h2,
+                   color);
+}
+

Index: image.c
===================================================================
RCS file: /sources/qemacs/qemacs/image.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- image.c     16 Apr 2017 21:51:20 -0000      1.33
+++ image.c     3 May 2017 10:50:49 -0000       1.34
@@ -82,43 +82,6 @@
 static void image_callback(EditBuffer *b, void *opaque, int arg,
                            enum LogOperation op, int offset, int size);
 
-/* draw only the border of a rectangle */
-void fill_border(EditState *s, int x, int y, int w, int h, int color)
-{
-    int w1, w2, h1, h2;
-
-    /* fill the background */
-    w1 = x;
-    if (w1 < 0)
-        w1 = 0;
-    w2 = s->width - (x + w);
-    if (w2 < 0)
-        w2 = 0;
-    h1 = y;
-    if (h1 < 0)
-        h1 = 0;
-    h2 = s->height - (y + h);
-    if (h2 < 0)
-        h2 = 0;
-
-    fill_rectangle(s->screen,
-                   s->xleft, s->ytop,
-                   w1, s->height,
-                   color);
-    fill_rectangle(s->screen,
-                   s->xleft + s->width - w2, s->ytop,
-                   w2, s->height,
-                   color);
-    fill_rectangle(s->screen,
-                   s->xleft + w1, s->ytop,
-                   s->width - w1 - w2, h1,
-                   color);
-    fill_rectangle(s->screen,
-                   s->xleft + w1, s->ytop + s->height - h2,
-                   s->width - w1 - w2, h2,
-                   color);
-}
-
 void draw_alpha_grid(EditState *s, int x1, int y1, int w, int h)
 {
     int state, x, y;
@@ -218,7 +181,7 @@
     if (w == is->w && h == is->h)
         return;
 
-    edit_invalidate(s);
+    edit_invalidate(s, 1);
 }
 
 
@@ -550,7 +513,7 @@
     bmp_unlock(s->screen, is->disp_bmp);
     if (ib1)
         image_free(ib1);
-    edit_invalidate(s);
+    edit_invalidate(s, 1);
 }
 
 static int image_mode_init(EditState *s, EditBuffer *b, int flags)
@@ -614,7 +577,7 @@
     } else {
         is->y = 0;
     }
-    edit_invalidate(s);
+    edit_invalidate(s, 1);
 }
 
 static void image_move_left_right(EditState *s, int dir)

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.278
retrieving revision 1.279
diff -u -b -r1.278 -r1.279
--- qe.c        28 Apr 2017 21:46:01 -0000      1.278
+++ qe.c        3 May 2017 10:50:49 -0000       1.279
@@ -3057,11 +3057,6 @@
 
     qs->is_full_screen = !qs->is_full_screen;
     dpy_full_screen(screen, qs->is_full_screen);
-    if (qs->is_full_screen)
-        s->flags &= ~WF_MODELINE;
-    else
-        s->flags |= WF_MODELINE;
-    qs->hide_status = qs->is_full_screen;
     do_refresh(s);
 }
 
@@ -5697,7 +5692,6 @@
 {
     QEmacsState *qs = s->qe_state;
     int x1, y1, x2, y2;
-    int line_height, cw;
 
     x1 = s->x1;
     y1 = s->y1;
@@ -5719,15 +5713,15 @@
     s->width = x2 - x1;
     s->height = y2 - y1;
 
-    line_height = cw = 1;
+    s->line_height = s->char_width = 1;
     if (s->screen && s->screen->dpy.dpy_probe) {
         /* use window default style font except for dummy display */
-        line_height = get_line_height(s->screen, s, QE_STYLE_DEFAULT);
-        cw = get_glyph_width(s->screen, s, QE_STYLE_DEFAULT, '0');
+        s->line_height = max(1, get_line_height(s->screen, s, 
QE_STYLE_DEFAULT));
+        s->char_width = max(1, get_glyph_width(s->screen, s, QE_STYLE_DEFAULT, 
'0'));
     }
 
-    s->rows = max(1, s->height / max(line_height, 1));
-    s->cols = max(1, s->width / max(cw, 1));
+    s->rows = max(1, s->height / s->line_height);
+    s->cols = max(1, s->width / s->char_width);
 }
 
 /* Create a new edit window, add it in the window list and sets it
@@ -7102,7 +7096,7 @@
         do_load_qerc(s, s->b->filename);
 
         /* XXX: invalid place */
-        edit_invalidate(s);
+        edit_invalidate(s, 0);
         return 1;
     }
 
@@ -7434,11 +7428,20 @@
     return height;
 }
 
-void edit_invalidate(EditState *s)
+void edit_invalidate(EditState *s, int all)
 {
     /* invalidate the modeline buffer */
     s->modeline_shadow[0] = '\0';
     s->display_invalid = 1;
+    if (all) {
+        EditState *e;
+        for (e = s->qe_state->first_window; e != NULL; e = e->next_window) {
+            if (e->b == s->b) {
+                s->modeline_shadow[0] = '\0';
+                s->display_invalid = 1;
+            }
+        }
+    }
 }
 
 /* refresh the screen, s1 can be any edit window */
@@ -7523,7 +7526,7 @@
 
     /* invalidate all the edit windows and draw borders */
     for (e = qs->first_window; e != NULL; e = e->next_window) {
-        edit_invalidate(e);
+        edit_invalidate(e, 0);
         e->borders_invalid = 1;
     }
     /* invalidate status line */
@@ -7673,7 +7676,7 @@
         s->x1 = 0;
         s->x2 = qs->width;
         s->y2 = qs->height - qs->status_height;
-        s->flags &= ~WF_RSEPARATOR;
+        s->flags &= ~(WF_RSEPARATOR | WF_POPLEFT);
         compute_client_area(s);
         do_refresh(s);
     }

Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.259
retrieving revision 1.260
diff -u -b -r1.259 -r1.260
--- qe.h        25 Apr 2017 17:41:27 -0000      1.259
+++ qe.h        3 May 2017 10:50:49 -0000       1.260
@@ -1433,8 +1433,9 @@
     int curline_style;
 
     /* display area info */
-    int width, height;
     int xleft, ytop;
+    int width, height;
+    int char_width, line_height;
     int cols, rows;
     /* full window size, including borders */
     int x1, y1, x2, y2;         /* window coordinates in device units */
@@ -2052,7 +2053,7 @@
 void qe_save_window_layout(EditState *s, EditBuffer *b);
 
 void edit_display(QEmacsState *qs);
-void edit_invalidate(EditState *s);
+void edit_invalidate(EditState *s, int all);
 void display_mode_line(EditState *s);
 int edit_set_mode(EditState *s, ModeDef *m);
 void qe_set_next_mode(EditState *s, int dir, int status);

Index: qeconfig.h
===================================================================
RCS file: /sources/qemacs/qemacs/qeconfig.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- qeconfig.h  25 Apr 2017 17:15:04 -0000      1.69
+++ qeconfig.h  3 May 2017 10:50:49 -0000       1.70
@@ -276,9 +276,9 @@
     CMD3( KEY_CTRLX('3'), KEY_NONE,
           "split-window-horizontally", do_split_window, ESii,
           SW_SIDE_BY_SIDE, "uiv")
-    CMD0( KEY_CTRLX('f'), KEY_NONE,
+    CMD0( KEY_CTRLC('f'), KEY_NONE,
           "toggle-full-screen", do_toggle_full_screen)
-    CMD0( KEY_NONE, KEY_NONE,
+    CMD0( KEY_CTRLC('m'), KEY_NONE,
           "toggle-mode-line", do_toggle_mode_line)
     CMD2( KEY_NONE, KEY_NONE,
           "create-window", do_create_window, ESss,

Index: video.c
===================================================================
RCS file: /sources/qemacs/qemacs/video.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- video.c     16 Apr 2017 21:51:20 -0000      1.22
+++ video.c     3 May 2017 10:50:49 -0000       1.23
@@ -235,7 +235,7 @@
             is->video_timer = qe_add_timer(vp->delay, s, video_refresh_timer);
 
             /* invalidate window */
-            edit_invalidate(s);
+            edit_invalidate(s, 1);
             is->no_background = 1; /* XXX: horrible, needs complete rewrite */
 
             /* display picture */
@@ -259,7 +259,7 @@
            than nothing, just to test the implementation */
 
         /* invalidate window */
-        edit_invalidate(s);
+        edit_invalidate(s, 1);
         is->no_background = 1; /* XXX: horrible, needs complete rewrite */
 
         /* display picture */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]