• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Japanese translation of message catalog for Sawfish Window-Manager


Commit MetaInfo

修訂ffd378e47ff29c9830c7cb9d4262df58117fa14f (tree)
時間2015-01-31 02:02:43
作者Chris 'Nano' Bratusek <Nanolx@user...>
CommiterChris 'Nano' Bratusek

Log Message

Merge pull request #11 from hans1024/master

using NET_WM_ICON to get 16x16 icons

Change Summary

差異

--- a/lisp/sawfish/wm/ext/cabinet.jl
+++ b/lisp/sawfish/wm/ext/cabinet.jl
@@ -396,8 +396,8 @@
396396 (t cabinet:default-item-forground))))
397397
398398 (define (cabinet-item-format w)
399- (let ((item (cons (if (window-icon-image w)
400- (window-icon-image w)
399+ (let ((item (cons (if (window-icon-image w 32)
400+ (window-icon-image w 32)
401401 (require 'rep.io.files)
402402 (if (file-exists-p (concat (car (cdr image-load-path)) "/" "cabinet-missing.png"))
403403 (make-image (concat (cdr image-load-path) "cabinet-missing.png"))))
--- a/lisp/sawfish/wm/util/display-wininfo.jl
+++ b/lisp/sawfish/wm/util/display-wininfo.jl
@@ -110,7 +110,7 @@ If W is nil previous window is removed."
110110
111111 (when w
112112 (let* ((text (make-text-item (window-info w) default-font))
113- (icon (let ((i (window-icon-image w)))
113+ (icon (let ((i (window-icon-image w 32)))
114114 (and i (scale-image i (car icon-size) (cdr icon-size)))))
115115 (icon-dims (if icon icon-size '(0 . 0)))
116116 (win-size (cons (+ (car icon-dims)
--- a/src/images.c
+++ b/src/images.c
@@ -990,6 +990,49 @@ defines the color of its pixels.
990990 return Qnil;
991991 }
992992
993+#ifdef HAVE_GDK_PIXBUF
994+static void
995+argbdata_to_pixdata (gulong * argb_data, int len, unsigned char ** pixdata)
996+{
997+ guchar *p;
998+ guint argb;
999+ guint rgba;
1000+ int i;
1001+
1002+ *pixdata = rep_alloc (len * 4);
1003+ p = *pixdata;
1004+
1005+ i = 0;
1006+ while (i < len)
1007+ {
1008+ argb = argb_data[i];
1009+ rgba = (argb << 8) | (argb >> 24);
1010+
1011+ *p = rgba >> 24; ++p;
1012+ *p = (rgba >> 16) & 0xff; ++p;
1013+ *p = (rgba >> 8) & 0xff; ++p;
1014+ *p = rgba & 0xff; ++p;
1015+
1016+ ++i;
1017+ }
1018+}
1019+
1020+repv make_image_from_data (long * data, int size)
1021+{
1022+ unsigned char * pixdata;
1023+ argbdata_to_pixdata(data, size * size, &pixdata);
1024+
1025+ GdkPixbuf * img = gdk_pixbuf_new_from_data(pixdata,
1026+ GDK_COLORSPACE_RGB,
1027+ TRUE, 8,
1028+ size, size,
1029+ size * 4,
1030+ free_pixbuf_data,
1031+ pixdata);
1032+ return make_image(img, Qnil);
1033+}
1034+#endif
1035+
9931036 DEFUN("tile-image", Ftile_image, Stile_image, (repv dst, repv src), rep_Subr2) /*
9941037 ::doc:sawfish.wm.images#tile-image::
9951038 tile-image DEST-IMAGE SOURCE-IMAGE
--- a/src/sawfish.h
+++ b/src/sawfish.h
@@ -157,6 +157,7 @@ typedef struct lisp_window {
157157 repv net_name, net_icon_name;
158158 int frame_vis;
159159 repv icon_image;
160+ int icon_size;
160161
161162 /* Frame data */
162163 Window frame; /* Reparenter window */
--- a/src/sawfish_subrs.h
+++ b/src/sawfish_subrs.h
@@ -230,6 +230,9 @@ extern int image_channels (Lisp_Image *im);
230230 extern void image_changed (Lisp_Image *im);
231231 extern void images_init (void);
232232 extern void images_kill (void);
233+#ifdef HAVE_GDK_PIXBUF
234+extern repv make_image_from_data (long * data, int size);
235+#endif
233236
234237 /* from keys.c */
235238 extern repv Qglobal_keymap, Qunbound_key_hook, Qkeymap;
--- a/src/windows.c
+++ b/src/windows.c
@@ -1404,7 +1404,7 @@ out:
14041404 }
14051405
14061406 DEFUN("window-icon-image", Fwindow_icon_image,
1407- Swindow_icon_image, (repv win), rep_Subr1) /*
1407+ Swindow_icon_image, (repv args), rep_SubrN) /*
14081408 ::doc:sawfish.wm.windows.subrs#window-icon-image::
14091409 window-icon-image WINDOW
14101410
@@ -1412,10 +1412,59 @@ Returns an image object representing the icon currently associated with
14121412 WINDOW. Returns the symbol `nil' if no such image.
14131413 ::end:: */
14141414 {
1415+ if (!rep_CONSP(args))
1416+ return rep_signal_missing_arg (1);
1417+ repv win = rep_CAR(args);
14151418 rep_DECLARE1 (win, WINDOWP);
14161419
1417- if (VWIN (win)->icon_image == rep_NULL)
1420+ int iconsize = 16;
1421+ if (rep_CONSP(rep_CDR(args)) && rep_INTP(rep_CAR(rep_CDR(args))))
14181422 {
1423+ iconsize = rep_INT(rep_CAR(rep_CDR(args)));
1424+ }
1425+
1426+ if (VWIN (win)->icon_image == rep_NULL || VWIN (win)->icon_size != iconsize)
1427+ {
1428+ VWIN (win)->icon_size = iconsize;
1429+
1430+ #ifdef HAVE_GDK_PIXBUF
1431+ if (!WINDOW_IS_GONE_P (VWIN (win)))
1432+ {
1433+ Atom actual_type;
1434+ int actual_format;
1435+ unsigned long nitems, bytes_after;
1436+ union {
1437+ unsigned long *l;
1438+ unsigned char *c;
1439+ } data;
1440+
1441+ static Atom net_wm_icon = 0;
1442+
1443+ if (net_wm_icon == 0)
1444+ net_wm_icon = XInternAtom (dpy, "_NET_WM_ICON", False);
1445+
1446+ data.l = 0;
1447+ if (XGetWindowProperty (dpy, VWIN (win)->id, net_wm_icon,
1448+ 0L, G_MAXLONG, False, AnyPropertyType,
1449+ &actual_type, &actual_format,
1450+ &nitems, &bytes_after,
1451+ &data.c) == Success)
1452+ {
1453+ int i;
1454+ for (i = 0; i < nitems; i += 2 + data.l[i] * data.l[i + 1])
1455+ if (data.l[i] == iconsize && data.l[i + 1] == iconsize)
1456+ {
1457+ VWIN (win)->icon_image =
1458+ make_image_from_data(&(data.l[i + 2]), iconsize);
1459+ XFree (data.l);
1460+ return VWIN (win)->icon_image;
1461+ }
1462+ }
1463+ if (data.l != 0)
1464+ XFree (data.l);
1465+ }
1466+ #endif
1467+
14191468 Window pixmap_id = 0, mask_id = 0;
14201469
14211470 if (VWIN (win)->wmhints != 0)