qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs display.c display.h extras.c haiku.cpp h...


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs display.c display.h extras.c haiku.cpp h...
Date: Wed, 15 Mar 2017 03:24:32 -0400 (EDT)

CVSROOT:        /sources/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        17/03/15 03:24:31

Modified files:
        .              : display.c display.h extras.c haiku.cpp 
                         html2png.c qe.c tty.c win32.c x11.c 

Log message:
        display: improve display structure handling
        - add QEDisplay.dpy_describe handler
        - rename dpy_init as screen_init
        - allocate TTYState instead of using static struct in tty.c

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/display.c?cvsroot=qemacs&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/qemacs/display.h?cvsroot=qemacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/qemacs/extras.c?cvsroot=qemacs&r1=1.54&r2=1.55
http://cvs.savannah.gnu.org/viewcvs/qemacs/haiku.cpp?cvsroot=qemacs&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/qemacs/html2png.c?cvsroot=qemacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.c?cvsroot=qemacs&r1=1.249&r2=1.250
http://cvs.savannah.gnu.org/viewcvs/qemacs/tty.c?cvsroot=qemacs&r1=1.70&r2=1.71
http://cvs.savannah.gnu.org/viewcvs/qemacs/win32.c?cvsroot=qemacs&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/qemacs/x11.c?cvsroot=qemacs&r1=1.44&r2=1.45

Patches:
Index: display.c
===================================================================
RCS file: /sources/qemacs/qemacs/display.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- display.c   16 Sep 2015 22:18:23 -0000      1.18
+++ display.c   15 Mar 2017 07:24:31 -0000      1.19
@@ -2,6 +2,7 @@
  * Display system for QEmacs
  *
  * Copyright (c) 2000 Fabrice Bellard.
+ * Copyright (c) 2002-2017 Charlie Gordon.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -112,6 +113,7 @@
     NULL, /* dpy_bmp_lock */
     NULL, /* dpy_bmp_unlock */
     NULL, /* dpy_full_screen */
+    NULL, /* dpy_describe */
     NULL, /* next */
 };
 
@@ -236,7 +238,7 @@
     return dpy;
 }
 
-int dpy_init(QEditScreen *s, QEDisplay *dpy, int w, int h)
+int screen_init(QEditScreen *s, QEDisplay *dpy, int w, int h)
 {
     s->dpy = dpy ? *dpy : dummy_dpy;
     return s->dpy.dpy_init(s, w, h);

Index: display.h
===================================================================
RCS file: /sources/qemacs/qemacs/display.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- display.h   16 Sep 2015 22:18:23 -0000      1.17
+++ display.h   15 Mar 2017 07:24:31 -0000      1.18
@@ -2,6 +2,7 @@
  * Display system for QEmacs
  *
  * Copyright (c) 2000 Fabrice Bellard.
+ * Copyright (c) 2002-2017 Charlie Gordon.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -130,8 +131,8 @@
     void (*dpy_bmp_lock)(QEditScreen *s, QEBitmap *bitmap, QEPicture *pict,
                          int x1, int y1, int w1, int h1);
     void (*dpy_bmp_unlock)(QEditScreen *s, QEBitmap *b);
-    /* full screen support */
     void (*dpy_full_screen)(QEditScreen *s, int full_screen);
+    void (*dpy_describe)(QEditScreen *s, EditBuffer *b);
     QEDisplay *next;
 };
 
@@ -153,7 +154,7 @@
 int qe_register_display(QEDisplay *dpy);
 QEDisplay *probe_display(void);
 
-int dpy_init(QEditScreen *s, QEDisplay *dpy, int w, int h);
+int screen_init(QEditScreen *s, QEDisplay *dpy, int w, int h);
 
 static inline void dpy_close(QEditScreen *s)
 {

Index: extras.c
===================================================================
RCS file: /sources/qemacs/qemacs/extras.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- extras.c    6 Mar 2017 12:54:49 -0000       1.54
+++ extras.c    15 Mar 2017 07:24:31 -0000      1.55
@@ -1325,6 +1325,37 @@
     }
 }
 
+static void do_describe_screen(EditState *e, int argval)
+{
+    QEditScreen *s = e->screen;
+    EditBuffer *b1;
+    int show;
+    int w;
+
+    b1 = new_help_buffer(&show);
+    if (!b1)
+        return;
+
+    eb_printf(b1, "Screen Description\n\n");
+
+    w = 16;
+    eb_printf(b1, "%*s: %s\n", w, "dpy.name", s->dpy.name);
+    eb_printf(b1, "%*s: %d, %d\n", w, "width, height", s->width, s->height);
+    eb_printf(b1, "%*s: %s\n", w, "charset", s->charset->name);
+    eb_printf(b1, "%*s: %d\n", w, "media", s->media);
+    eb_printf(b1, "%*s: %d\n", w, "bitmap_format", s->bitmap_format);
+    eb_printf(b1, "%*s: %d\n\n", w, "video_format", s->video_format);
+
+    if (s->dpy.dpy_describe) {
+        s->dpy.dpy_describe(s, b1);
+    }
+
+    b1->flags |= BF_READONLY;
+    if (show) {
+        show_popup(b1);
+    }
+}
+
 /*---------------- buffer contents sorting ----------------*/
 
 struct chunk_ctx {
@@ -1505,6 +1536,8 @@
           "describe-buffer", do_describe_buffer, ESi, "ui")
     CMD2( KEY_CTRLH('w'), KEY_CTRLH(KEY_CTRL('W')),
           "describe-window", do_describe_window, ESi, "ui")
+    CMD2( KEY_CTRLH('s'), KEY_CTRLH(KEY_CTRL('S')),
+          "describe-screen", do_describe_screen, ESi, "ui")
 
     CMD2( KEY_CTRLC('c'), KEY_NONE,
           "set-region-color", do_set_region_color, ESs,

Index: haiku.cpp
===================================================================
RCS file: /sources/qemacs/qemacs/haiku.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- haiku.cpp   7 Mar 2016 10:35:22 -0000       1.13
+++ haiku.cpp   15 Mar 2017 07:24:31 -0000      1.14
@@ -2,7 +2,7 @@
  * Haiku driver for QEmacs
  *
  * Copyright (c) 2013 Francois Revol.
- * Copyright (c) 2015-2016 Charlie Gordon.
+ * Copyright (c) 2015-2017 Charlie Gordon.
  * Copyright (c) 2002 Fabrice Bellard.
  *
  * This library is free software; you can redistribute it and/or
@@ -886,6 +886,7 @@
     NULL, /* dpy_bmp_lock */
     NULL, /* dpy_bmp_unlock */
     haiku_full_screen,
+    NULL, /* dpy_describe */
     NULL, /* next */
 };
 

Index: html2png.c
===================================================================
RCS file: /sources/qemacs/qemacs/html2png.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- html2png.c  27 Dec 2016 11:38:36 -0000      1.17
+++ html2png.c  15 Mar 2017 07:24:31 -0000      1.18
@@ -2,6 +2,7 @@
  * HTML to PPM converter using the qHTML library
  *
  * Copyright (c) 2002 Fabrice Bellard.
+ * Copyright (c) 2002-2017 Charlie Gordon.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -129,6 +130,7 @@
     NULL, /* dpy_bmp_lock */
     NULL, /* dpy_bmp_unlock */
     NULL, /* dpy_full_screen */
+    NULL, /* dpy_describe */
     NULL, /* next */
 };
 
@@ -480,7 +482,7 @@
     infilename = argv[optind];
 
     /* init display driver with dummy height */
-    if (dpy_init(screen, &ppm_dpy, page_width, 1) < 0) {
+    if (screen_init(screen, &ppm_dpy, page_width, 1) < 0) {
         fprintf(stderr, "Could not init display driver\n");
         exit(1);
     }

Index: qe.c
===================================================================
RCS file: /sources/qemacs/qemacs/qe.c,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -b -r1.249 -r1.250
--- qe.c        2 Mar 2017 15:21:16 -0000       1.249
+++ qe.c        15 Mar 2017 07:24:31 -0000      1.250
@@ -8484,7 +8484,7 @@
      * null display driver to have a consistent state
      * else many commands such as put_status would crash.
      */
-    dpy_init(&global_screen, NULL, screen_width, screen_height);
+    screen_init(&global_screen, NULL, screen_width, screen_height);
 
     /* handle options */
     _optind = parse_command_line(argc, argv);
@@ -8504,7 +8504,7 @@
             fprintf(stderr, "No suitable display found, exiting\n");
             exit(1);
         }
-        if (dpy_init(&global_screen, dpy, screen_width, screen_height) < 0) {
+        if (screen_init(&global_screen, dpy, screen_width, screen_height) < 0) 
{
             /* Just disable the display and try another */
             //fprintf(stderr, "Could not initialize display '%s', exiting\n",
             //        dpy->name);

Index: tty.c
===================================================================
RCS file: /sources/qemacs/qemacs/tty.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -b -r1.70 -r1.71
--- tty.c       9 Jun 2016 16:24:10 -0000       1.70
+++ tty.c       15 Mar 2017 07:24:31 -0000      1.71
@@ -2,7 +2,7 @@
  * TTY handling for QEmacs
  *
  * Copyright (c) 2000-2001 Fabrice Bellard.
- * Copyright (c) 2002-2016 Charlie Gordon.
+ * Copyright (c) 2002-2017 Charlie Gordon.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -110,8 +110,7 @@
 static void tty_term_exit(void);
 static void tty_read_handler(void *opaque);
 
-static struct TTYState tty_state;
-static QEditScreen *tty_screen;
+static QEditScreen *tty_screen;   /* for tty_term_exit and tty_resize */
 
 static int tty_term_probe(void)
 {
@@ -125,39 +124,42 @@
     struct termios tty;
     struct sigaction sig;
 
-    s->STDIN = stdin;
-    s->STDOUT = stdout;
+    ts = calloc(1, sizeof(*ts));
+    if (ts == NULL) {
+        return 1;
+    }
 
     tty_screen = s;
-    ts = &tty_state;
+    s->STDIN = stdin;
+    s->STDOUT = stdout;
     s->priv_data = ts;
     s->media = CSS_MEDIA_TTY;
 
     /* Derive some settings from the TERM environment variable */
-    tty_state.term_code = TERM_UNKNOWN;
-    tty_state.term_flags = USE_ERASE_END_OF_LINE;
-    tty_state.term_name = getenv("TERM");
-    if (tty_state.term_name) {
+    ts->term_code = TERM_UNKNOWN;
+    ts->term_flags = USE_ERASE_END_OF_LINE;
+    ts->term_name = getenv("TERM");
+    if (ts->term_name) {
         /* linux and xterm -> kbs=\177
          * ansi cygwin vt100 -> kbs=^H
          */
-        if (strstart(tty_state.term_name, "ansi", NULL)) {
-            tty_state.term_code = TERM_ANSI;
-            tty_state.term_flags |= KBS_CONTROL_H;
+        if (strstart(ts->term_name, "ansi", NULL)) {
+            ts->term_code = TERM_ANSI;
+            ts->term_flags |= KBS_CONTROL_H;
         } else
-        if (strstart(tty_state.term_name, "vt100", NULL)) {
-            tty_state.term_code = TERM_VT100;
-            tty_state.term_flags |= KBS_CONTROL_H;
+        if (strstart(ts->term_name, "vt100", NULL)) {
+            ts->term_code = TERM_VT100;
+            ts->term_flags |= KBS_CONTROL_H;
         } else
-        if (strstart(tty_state.term_name, "xterm", NULL)) {
-            tty_state.term_code = TERM_XTERM;
+        if (strstart(ts->term_name, "xterm", NULL)) {
+            ts->term_code = TERM_XTERM;
         } else
-        if (strstart(tty_state.term_name, "linux", NULL)) {
-            tty_state.term_code = TERM_LINUX;
+        if (strstart(ts->term_name, "linux", NULL)) {
+            ts->term_code = TERM_LINUX;
         } else
-        if (strstart(tty_state.term_name, "cygwin", NULL)) {
-            tty_state.term_code = TERM_CYGWIN;
-            tty_state.term_flags |= KBS_CONTROL_H |
+        if (strstart(ts->term_name, "cygwin", NULL)) {
+            ts->term_code = TERM_CYGWIN;
+            ts->term_flags |= KBS_CONTROL_H |
                                     USE_BOLD_AS_BRIGHT | USE_BLINK_AS_BRIGHT;
         }
     }
@@ -195,7 +197,7 @@
     /* Get charset from command line option */
     s->charset = find_charset(qe_state.tty_charset);
 
-    if (tty_state.term_code == TERM_CYGWIN)
+    if (ts->term_code == TERM_CYGWIN)
         s->charset = &charset_8859_1;
 
     if (!s->charset && !isatty(fileno(s->STDOUT)))
@@ -244,7 +246,7 @@
 
     tty_resize(0);
 
-    if (tty_state.term_flags & KBS_CONTROL_H) {
+    if (ts->term_flags & KBS_CONTROL_H) {
         do_toggle_control_h(NULL, 1);
     }
 
@@ -1387,6 +1389,7 @@
     NULL, /* dpy_bmp_lock */
     NULL, /* dpy_bmp_unlock */
     NULL, /* dpy_full_screen */
+    NULL, /* dpy__describe */
     NULL, /* next */
 };
 

Index: win32.c
===================================================================
RCS file: /sources/qemacs/qemacs/win32.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- win32.c     23 Jan 2014 12:56:23 -0000      1.17
+++ win32.c     15 Mar 2017 07:24:31 -0000      1.18
@@ -2,6 +2,7 @@
  * MS Windows driver for QEmacs
  *
  * Copyright (c) 2002 Fabrice Bellard.
+ * Copyright (c) 2002-2017 Charlie Gordon.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -519,6 +520,7 @@
     NULL, /* dpy_bmp_lock */
     NULL, /* dpy_bmp_unlock */
     NULL, /* dpy_full_screen */
+    NULL, /* dpy_describe */
     NULL, /* next */
 };
 

Index: x11.c
===================================================================
RCS file: /sources/qemacs/qemacs/x11.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- x11.c       26 Dec 2016 13:44:42 -0000      1.44
+++ x11.c       15 Mar 2017 07:24:31 -0000      1.45
@@ -1870,6 +1870,7 @@
     x11_bmp_lock,
     x11_bmp_unlock,
     x11_full_screen,
+    NULL, /* dpy_describe */
     NULL, /* next */
 };
 



reply via email to

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