qemacs-commit
[Top][All Lists]
Advanced

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

[Qemacs-commit] qemacs x11.c


From: Charlie Gordon
Subject: [Qemacs-commit] qemacs x11.c
Date: Wed, 12 Dec 2007 02:21:46 +0000

CVSROOT:        /cvsroot/qemacs
Module name:    qemacs
Changes by:     Charlie Gordon <chqrlie>        07/12/12 02:21:46

Modified files:
        .              : x11.c 

Log message:
        fixed some meta ctrl key combinations in x11

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/x11.c?cvsroot=qemacs&r1=1.12&r2=1.13

Patches:
Index: x11.c
===================================================================
RCS file: /cvsroot/qemacs/qemacs/x11.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- x11.c       10 Dec 2007 13:28:08 -0000      1.12
+++ x11.c       12 Dec 2007 02:21:45 -0000      1.13
@@ -323,8 +323,8 @@
 
     gc = XCreateGC(display, window, 0, NULL);
 #ifdef CONFIG_XFT
-    renderDraw = XftDrawCreate (display, window, attr.visual, 
-                                DefaultColormap (display, xscreen));
+    renderDraw = XftDrawCreate(display, window, attr.visual, 
+                               DefaultColormap(display, xscreen));
 #endif
     /* double buffer handling */
     gc_pixmap = XCreateGC(display, window, 0, NULL);
@@ -518,10 +518,7 @@
     col.color.blue = b << 8;
     col.color.alpha = a << 8;
     col.pixel = get_x11_color(color);
-    XftDrawRect (renderDraw, 
-                 &col,
-                 x1, y1, 
-                 w, h);
+    XftDrawRect(renderDraw, &col, x1, y1, w, h);
 }
 
 static QEFont *term_open_font(QEditScreen *s, int style, int size)
@@ -588,7 +585,7 @@
     XftFont *renderFont = font->private;
     XGlyphInfo gi;
 
-    XftTextExtents32 (display, renderFont, &cc, 1, &gi);
+    XftTextExtents32(display, renderFont, &cc, 1, &gi);
     return gi.xOff;
 }
 
@@ -940,8 +937,7 @@
             xfont = last_font->private;
             l = q - x11_str;
             XSetFont(display, gc, xfont->fid);
-            XDrawString16(display, dbuffer, gc,
-                          x_start, y, x11_str, l);
+            XDrawString16(display, dbuffer, gc, x_start, y, x11_str, l);
             update_rect(x_start, y - last_font->ascent, x, y + 
last_font->descent);
             x_start = x;
             q = x11_str;
@@ -957,8 +953,7 @@
         xfont = last_font->private;
         l = q - x11_str;
         XSetFont(display, gc, xfont->fid);
-        XDrawString16(display, dbuffer, gc,
-                      x_start, y, x11_str, l);
+        XDrawString16(display, dbuffer, gc, x_start, y, x11_str, l);
         update_rect(x_start, y - last_font->ascent, x, y + last_font->descent);
     }
     /* underline synthesis */
@@ -970,13 +965,11 @@
         w = x - x1;
         if (font->style & QE_STYLE_UNDERLINE) {
             dy = (font->descent + 1) / 3;
-            XFillRectangle(display, dbuffer, gc, 
-                           x1, y + dy, w, h);
+            XFillRectangle(display, dbuffer, gc, x1, y + dy, w, h);
         }
         if (font->style & QE_STYLE_LINE_THROUGH) {
             dy = -(font->ascent / 2 - 1);
-            XFillRectangle(display, dbuffer, gc, 
-                           x1, y + dy, w, h);
+            XFillRectangle(display, dbuffer, gc, x1, y + dy, w, h);
         }
     }
 }
@@ -1081,14 +1074,14 @@
     EditBuffer *b;
     XEvent xev;
 
-    w = XGetSelectionOwner (display, XA_PRIMARY);
+    w = XGetSelectionOwner(display, XA_PRIMARY);
     if (w == None || w == window)
         return; /* qemacs can use its own selection */
 
     /* use X11 selection (Will be pasted when receiving
        SelectionNotify event) */
-    prop = XInternAtom (display, "VT_SELECTION", False);
-    XConvertSelection (display, XA_PRIMARY, XA_STRING,
+    prop = XInternAtom(display, "VT_SELECTION", False);
+    XConvertSelection(display, XA_PRIMARY, XA_STRING,
                        prop, window, CurrentTime);
 
     /* XXX: add timeout too if the target application is not well
@@ -1103,20 +1096,20 @@
     
     nread = 0;
     for (;;) {
-        if ((XGetWindowProperty (display, w, prop,
+        if ((XGetWindowProperty(display, w, prop,
                                  nread/4, 4096, True,
                                  AnyPropertyType, &actual_type, &actual_fmt,
                                  &nitems, &bytes_after,
                                  &data) != Success) ||
             (actual_type != XA_STRING)) {
-            XFree (data);
+            XFree(data);
             break;
         }
         
        eb_write(b, nread, data, nitems);
        
        nread += nitems;
-       XFree (data);
+       XFree(data);
        
        if (bytes_after == 0)
            break;
@@ -1133,7 +1126,7 @@
     EditBuffer *b;
 
     if (xa_targets == None)
-        xa_targets = XInternAtom (display, "TARGETS", False);
+        xa_targets = XInternAtom(display, "TARGETS", False);
    
     ev.xselection.type      = SelectionNotify;
     ev.xselection.property  = None;
@@ -1165,13 +1158,13 @@
             return;
         eb_read(b, 0, buf, b->total_size);
        
-        XChangeProperty (display, rq->requestor, rq->property,
+        XChangeProperty(display, rq->requestor, rq->property,
                          XA_STRING, 8, PropModeReplace,
                          buf, b->total_size);
         free(buf);
     }
     ev.xselection.property = rq->property;
-    XSendEvent (display, rq->requestor, False, 0, &ev);
+    XSendEvent(display, rq->requestor, False, 0, &ev);
 }
 
 /* fast test to see if the user pressed a key or a mouse button */
@@ -1288,7 +1281,31 @@
             shift = (xev.xkey.state & ShiftMask);
             ctrl = (xev.xkey.state & ControlMask);
             meta = (xev.xkey.state & Mod1Mask);
-
+#if 0
+            put_error(NULL, "keysym=%d %s%s%s len=%d buf[0]=%d",
+                      (int)keysym,
+                      shift ? "shft " : "",
+                      ctrl ? "ctrl " : "",
+                      meta ? "meta " : "",
+                      len, buf[0]);
+#endif
+            if (meta) {
+                switch (keysym) {
+                case XK_BackSpace:
+                    key = KEY_META(KEY_DEL);
+                    goto got_key;
+                default:
+                    if (len > 0) {
+                        key = KEY_META(buf[0] & 0xff);
+                        goto got_key;
+                    }
+                    if (keysym >= ' ' && keysym <= '~') {
+                        key = KEY_META(' ') + keysym - ' ';
+                        goto got_key;
+                    }
+                    break;
+                }
+            } else
             if (ctrl) {
                 switch (keysym) {
                 case XK_Right:
@@ -1310,18 +1327,6 @@
                     }
                     break;
                 }
-            } else if (meta) {
-                switch (keysym) {
-                case XK_BackSpace:
-                    key = KEY_META(KEY_DEL);
-                    goto got_key;
-                default:
-                    if (keysym >= ' ' && keysym <= '~') {
-                        key = KEY_META(' ') + keysym - ' ';
-                        goto got_key;
-                    }
-                    break;
-                }
             } else {
                 switch (keysym) {
                 case XK_F1:     key = KEY_F1;     goto got_key;




reply via email to

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