… | |
… | |
500 | # if ISO_14755 |
500 | # if ISO_14755 |
501 | iso14755_51 (0); |
501 | iso14755_51 (0); |
502 | # endif |
502 | # endif |
503 | return; |
503 | return; |
504 | } |
504 | } |
|
|
505 | else if (keysym == XK_BackSpace) |
|
|
506 | { |
|
|
507 | iso14755buf = ((iso14755buf & ISO_14755_MASK) >> 4) | ISO_14755_51; |
|
|
508 | # if ISO_14755 |
|
|
509 | iso14755_51 (iso14755buf & ISO_14755_MASK); |
|
|
510 | # endif |
|
|
511 | return; |
|
|
512 | } |
505 | else if ((hv = hex_keyval (ev)) >= 0) |
513 | else if ((hv = hex_keyval (ev)) >= 0) |
506 | { |
514 | { |
507 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
515 | iso14755buf = ((iso14755buf << 4) & ISO_14755_MASK) |
508 | | hv | ISO_14755_51; |
516 | | hv | ISO_14755_51; |
509 | # if ISO_14755 |
517 | # if ISO_14755 |
… | |
… | |
528 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
536 | scr_overlay_new (0, -1, sizeof ("ISO 14755 mode") - 1, 1); |
529 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
537 | scr_overlay_set (0, 0, "ISO 14755 mode"); |
530 | # endif |
538 | # endif |
531 | } |
539 | } |
532 | #endif |
540 | #endif |
533 | |
541 | |
534 | #ifdef PRINTPIPE |
542 | #ifdef PRINTPIPE |
535 | if (keysym == XK_Print) |
543 | if (keysym == XK_Print) |
536 | { |
544 | { |
537 | scr_printscreen (ctrl | shft); |
545 | scr_printscreen (ctrl | shft); |
538 | return; |
546 | return; |
… | |
… | |
965 | scr_overlay_off (); |
973 | scr_overlay_off (); |
966 | # endif |
974 | # endif |
967 | if (iso14755buf & ISO_14755_51) |
975 | if (iso14755buf & ISO_14755_51) |
968 | commit_iso14755 (); |
976 | commit_iso14755 (); |
969 | #if ISO_14755 |
977 | #if ISO_14755 |
970 | else if (iso14755buf & ISO_14755_STARTED) |
978 | else if (option (Opt_iso14755_52) && iso14755buf & ISO_14755_STARTED) |
971 | { |
979 | { |
972 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
980 | iso14755buf = ISO_14755_52; // iso14755 part 5.2: remember empty begin/end pair |
973 | |
981 | |
974 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
982 | scr_overlay_new (0, -1, sizeof ("KEYCAP PICTURE INSERT MODE") - 1, 1); |
975 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
983 | scr_overlay_set (0, 0, "KEYCAP PICTURE INSERT MODE"); |
… | |
… | |
1178 | |
1186 | |
1179 | #if LINUX_YIELD_HACK |
1187 | #if LINUX_YIELD_HACK |
1180 | static struct event_handler |
1188 | static struct event_handler |
1181 | { |
1189 | { |
1182 | check_watcher yield_ev; |
1190 | check_watcher yield_ev; |
1183 | |
1191 | |
1184 | void yield_cb (check_watcher &w) |
1192 | void yield_cb (check_watcher &w) |
1185 | { |
1193 | { |
1186 | // this should really be sched_yield(), but the linux guys thought |
1194 | // this should really be sched_yield(), but the linux guys thought |
1187 | // that giving a process calling sched_yield () less cpu time than |
1195 | // that giving a process calling sched_yield () less cpu time than |
1188 | // ones with high nice levels is a useful thing to do. It surely is is |
1196 | // ones with high nice levels is a useful thing to do. It surely is is |
… | |
… | |
1235 | pty_ev.stop (); |
1243 | pty_ev.stop (); |
1236 | |
1244 | |
1237 | if (!option (Opt_hold)) |
1245 | if (!option (Opt_hold)) |
1238 | destroy (); |
1246 | destroy (); |
1239 | } |
1247 | } |
1240 | |
1248 | |
1241 | return false; |
1249 | return false; |
1242 | } |
1250 | } |
1243 | |
1251 | |
1244 | void |
1252 | void |
1245 | rxvt_term::pty_cb (io_watcher &w, short revents) |
1253 | rxvt_term::pty_cb (io_watcher &w, short revents) |
… | |
… | |
1481 | |
1489 | |
1482 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1490 | if (szHint.width != ev.xconfigure.width || szHint.height != ev.xconfigure.height) |
1483 | { |
1491 | { |
1484 | seen_resize = 1; |
1492 | seen_resize = 1; |
1485 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
1493 | resize_all_windows (ev.xconfigure.width, ev.xconfigure.height, 1); |
|
|
1494 | #ifdef XPM_BACKGROUND |
|
|
1495 | if (!option (Opt_transparent) && bgPixmap.auto_resize) |
|
|
1496 | { |
|
|
1497 | resize_pixmap (); |
|
|
1498 | scr_touch (true); |
|
|
1499 | } |
|
|
1500 | #endif |
1486 | } |
1501 | } |
1487 | |
1502 | |
1488 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1503 | HOOK_INVOKE ((this, HOOK_CONFIGURE_NOTIFY, DT_XEVENT, &ev, DT_END)); |
1489 | |
1504 | |
1490 | #ifdef TRANSPARENT |
1505 | #ifdef TRANSPARENT |
… | |
… | |
1831 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1846 | && ev.xproperty.atom != xa[XA_ESETROOT_PMAP_ID]) |
1832 | return; |
1847 | return; |
1833 | |
1848 | |
1834 | /* FALLTHROUGH */ |
1849 | /* FALLTHROUGH */ |
1835 | case ReparentNotify: |
1850 | case ReparentNotify: |
1836 | if (option (Opt_transparent) && check_our_parents () && am_transparent) |
1851 | if (option (Opt_transparent)) |
1837 | want_refresh = want_full_refresh = 1; |
1852 | check_our_parents (); |
1838 | break; |
1853 | break; |
1839 | } |
1854 | } |
1840 | # endif |
1855 | # endif |
1841 | } |
1856 | } |
1842 | #endif |
1857 | #endif |
… | |
… | |
2219 | #endif |
2234 | #endif |
2220 | } |
2235 | } |
2221 | } |
2236 | } |
2222 | } |
2237 | } |
2223 | |
2238 | |
2224 | #ifdef TRANSPARENT |
|
|
2225 | #if TINTING |
|
|
2226 | /* taken from aterm-0.4.2 */ |
|
|
2227 | |
|
|
2228 | typedef uint32_t RUINT32T; |
|
|
2229 | |
|
|
2230 | void ShadeXImage(rxvt_term *term, XImage* srcImage, int shade, int rm, int gm, int bm) |
|
|
2231 | { |
|
|
2232 | int sh_r, sh_g, sh_b; |
|
|
2233 | RUINT32T mask_r, mask_g, mask_b; |
|
|
2234 | RUINT32T *lookup, *lookup_r, *lookup_g, *lookup_b; |
|
|
2235 | unsigned int lower_lim_r, lower_lim_g, lower_lim_b; |
|
|
2236 | unsigned int upper_lim_r, upper_lim_g, upper_lim_b; |
|
|
2237 | int i; |
|
|
2238 | |
|
|
2239 | Visual *visual = term->visual; |
|
|
2240 | |
|
|
2241 | if( visual->c_class != TrueColor || srcImage->format != ZPixmap ) return ; |
|
|
2242 | |
|
|
2243 | /* for convenience */ |
|
|
2244 | mask_r = visual->red_mask; |
|
|
2245 | mask_g = visual->green_mask; |
|
|
2246 | mask_b = visual->blue_mask; |
|
|
2247 | |
|
|
2248 | /* boring lookup table pre-initialization */ |
|
|
2249 | switch (srcImage->bits_per_pixel) { |
|
|
2250 | case 15: |
|
|
2251 | if ((mask_r != 0x7c00) || |
|
|
2252 | (mask_g != 0x03e0) || |
|
|
2253 | (mask_b != 0x001f)) |
|
|
2254 | return; |
|
|
2255 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+32+32)); |
|
|
2256 | lookup_r = lookup; |
|
|
2257 | lookup_g = lookup+32; |
|
|
2258 | lookup_b = lookup+32+32; |
|
|
2259 | sh_r = 10; |
|
|
2260 | sh_g = 5; |
|
|
2261 | sh_b = 0; |
|
|
2262 | break; |
|
|
2263 | case 16: |
|
|
2264 | if ((mask_r != 0xf800) || |
|
|
2265 | (mask_g != 0x07e0) || |
|
|
2266 | (mask_b != 0x001f)) |
|
|
2267 | return; |
|
|
2268 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(32+64+32)); |
|
|
2269 | lookup_r = lookup; |
|
|
2270 | lookup_g = lookup+32; |
|
|
2271 | lookup_b = lookup+32+64; |
|
|
2272 | sh_r = 11; |
|
|
2273 | sh_g = 5; |
|
|
2274 | sh_b = 0; |
|
|
2275 | break; |
|
|
2276 | case 24: |
|
|
2277 | if ((mask_r != 0xff0000) || |
|
|
2278 | (mask_g != 0x00ff00) || |
|
|
2279 | (mask_b != 0x0000ff)) |
|
|
2280 | return; |
|
|
2281 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2282 | lookup_r = lookup; |
|
|
2283 | lookup_g = lookup+256; |
|
|
2284 | lookup_b = lookup+256+256; |
|
|
2285 | sh_r = 16; |
|
|
2286 | sh_g = 8; |
|
|
2287 | sh_b = 0; |
|
|
2288 | break; |
|
|
2289 | case 32: |
|
|
2290 | if ((mask_r != 0xff0000) || |
|
|
2291 | (mask_g != 0x00ff00) || |
|
|
2292 | (mask_b != 0x0000ff)) |
|
|
2293 | return; |
|
|
2294 | lookup = (RUINT32T *) malloc (sizeof (RUINT32T)*(256+256+256)); |
|
|
2295 | lookup_r = lookup; |
|
|
2296 | lookup_g = lookup+256; |
|
|
2297 | lookup_b = lookup+256+256; |
|
|
2298 | sh_r = 16; |
|
|
2299 | sh_g = 8; |
|
|
2300 | sh_b = 0; |
|
|
2301 | break; |
|
|
2302 | default: |
|
|
2303 | return; /* we do not support this color depth */ |
|
|
2304 | } |
|
|
2305 | |
|
|
2306 | /* prepare limits for color transformation (each channel is handled separately) */ |
|
|
2307 | if (shade < 0) { |
|
|
2308 | shade = -shade; |
|
|
2309 | if (shade < 0) shade = 0; |
|
|
2310 | if (shade > 100) shade = 100; |
|
|
2311 | |
|
|
2312 | lower_lim_r = 65535-rm; |
|
|
2313 | lower_lim_g = 65535-gm; |
|
|
2314 | lower_lim_b = 65535-bm; |
|
|
2315 | |
|
|
2316 | lower_lim_r = 65535-(unsigned int)(((RUINT32T)lower_lim_r)*((RUINT32T)shade)/100); |
|
|
2317 | lower_lim_g = 65535-(unsigned int)(((RUINT32T)lower_lim_g)*((RUINT32T)shade)/100); |
|
|
2318 | lower_lim_b = 65535-(unsigned int)(((RUINT32T)lower_lim_b)*((RUINT32T)shade)/100); |
|
|
2319 | |
|
|
2320 | upper_lim_r = upper_lim_g = upper_lim_b = 65535; |
|
|
2321 | } else { |
|
|
2322 | if (shade < 0) shade = 0; |
|
|
2323 | if (shade > 100) shade = 100; |
|
|
2324 | |
|
|
2325 | lower_lim_r = lower_lim_g = lower_lim_b = 0; |
|
|
2326 | |
|
|
2327 | upper_lim_r = (unsigned int)((((RUINT32T)rm)*((RUINT32T)shade))/100); |
|
|
2328 | upper_lim_g = (unsigned int)((((RUINT32T)gm)*((RUINT32T)shade))/100); |
|
|
2329 | upper_lim_b = (unsigned int)((((RUINT32T)bm)*((RUINT32T)shade))/100); |
|
|
2330 | } |
|
|
2331 | |
|
|
2332 | /* switch red and blue bytes if necessary, we need it for some weird XServers like XFree86 3.3.3.1 */ |
|
|
2333 | if ((srcImage->bits_per_pixel == 24) && (mask_r >= 0xFF0000 )) |
|
|
2334 | { |
|
|
2335 | unsigned int tmp; |
|
|
2336 | |
|
|
2337 | tmp = lower_lim_r; |
|
|
2338 | lower_lim_r = lower_lim_b; |
|
|
2339 | lower_lim_b = tmp; |
|
|
2340 | |
|
|
2341 | tmp = upper_lim_r; |
|
|
2342 | upper_lim_r = upper_lim_b; |
|
|
2343 | upper_lim_b = tmp; |
|
|
2344 | } |
|
|
2345 | |
|
|
2346 | /* fill our lookup tables */ |
|
|
2347 | for (i = 0; i <= mask_r>>sh_r; i++) |
|
|
2348 | { |
|
|
2349 | RUINT32T tmp; |
|
|
2350 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_r-lower_lim_r)); |
|
|
2351 | tmp += ((RUINT32T)(mask_r>>sh_r))*((RUINT32T)lower_lim_r); |
|
|
2352 | lookup_r[i] = (tmp/65535)<<sh_r; |
|
|
2353 | } |
|
|
2354 | for (i = 0; i <= mask_g>>sh_g; i++) |
|
|
2355 | { |
|
|
2356 | RUINT32T tmp; |
|
|
2357 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_g-lower_lim_g)); |
|
|
2358 | tmp += ((RUINT32T)(mask_g>>sh_g))*((RUINT32T)lower_lim_g); |
|
|
2359 | lookup_g[i] = (tmp/65535)<<sh_g; |
|
|
2360 | } |
|
|
2361 | for (i = 0; i <= mask_b>>sh_b; i++) |
|
|
2362 | { |
|
|
2363 | RUINT32T tmp; |
|
|
2364 | tmp = ((RUINT32T)i)*((RUINT32T)(upper_lim_b-lower_lim_b)); |
|
|
2365 | tmp += ((RUINT32T)(mask_b>>sh_b))*((RUINT32T)lower_lim_b); |
|
|
2366 | lookup_b[i] = (tmp/65535)<<sh_b; |
|
|
2367 | } |
|
|
2368 | |
|
|
2369 | /* apply table to input image (replacing colors by newly calculated ones) */ |
|
|
2370 | switch (srcImage->bits_per_pixel) |
|
|
2371 | { |
|
|
2372 | case 15: |
|
|
2373 | { |
|
|
2374 | unsigned short *p1, *pf, *p, *pl; |
|
|
2375 | p1 = (unsigned short *) srcImage->data; |
|
|
2376 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2377 | while (p1 < pf) |
|
|
2378 | { |
|
|
2379 | p = p1; |
|
|
2380 | pl = p1 + srcImage->width; |
|
|
2381 | for (; p < pl; p++) |
|
|
2382 | { |
|
|
2383 | *p = lookup_r[(*p & 0x7c00)>>10] | |
|
|
2384 | lookup_g[(*p & 0x03e0)>> 5] | |
|
|
2385 | lookup_b[(*p & 0x001f)]; |
|
|
2386 | } |
|
|
2387 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2388 | } |
|
|
2389 | break; |
|
|
2390 | } |
|
|
2391 | case 16: |
|
|
2392 | { |
|
|
2393 | unsigned short *p1, *pf, *p, *pl; |
|
|
2394 | p1 = (unsigned short *) srcImage->data; |
|
|
2395 | pf = (unsigned short *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2396 | while (p1 < pf) |
|
|
2397 | { |
|
|
2398 | p = p1; |
|
|
2399 | pl = p1 + srcImage->width; |
|
|
2400 | for (; p < pl; p++) |
|
|
2401 | { |
|
|
2402 | *p = lookup_r[(*p & 0xf800)>>11] | |
|
|
2403 | lookup_g[(*p & 0x07e0)>> 5] | |
|
|
2404 | lookup_b[(*p & 0x001f)]; |
|
|
2405 | } |
|
|
2406 | p1 = (unsigned short *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2407 | } |
|
|
2408 | break; |
|
|
2409 | } |
|
|
2410 | case 24: |
|
|
2411 | { |
|
|
2412 | unsigned char *p1, *pf, *p, *pl; |
|
|
2413 | p1 = (unsigned char *) srcImage->data; |
|
|
2414 | pf = (unsigned char *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2415 | while (p1 < pf) |
|
|
2416 | { |
|
|
2417 | p = p1; |
|
|
2418 | pl = p1 + srcImage->width * 3; |
|
|
2419 | for (; p < pl; p += 3) |
|
|
2420 | { |
|
|
2421 | p[0] = lookup_r[(p[0] & 0xff0000)>>16]; |
|
|
2422 | p[1] = lookup_r[(p[1] & 0x00ff00)>> 8]; |
|
|
2423 | p[2] = lookup_r[(p[2] & 0x0000ff)]; |
|
|
2424 | } |
|
|
2425 | p1 = (unsigned char *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2426 | } |
|
|
2427 | break; |
|
|
2428 | } |
|
|
2429 | case 32: |
|
|
2430 | { |
|
|
2431 | RUINT32T *p1, *pf, *p, *pl; |
|
|
2432 | p1 = (RUINT32T *) srcImage->data; |
|
|
2433 | pf = (RUINT32T *) (srcImage->data + srcImage->height * srcImage->bytes_per_line); |
|
|
2434 | |
|
|
2435 | while (p1 < pf) |
|
|
2436 | { |
|
|
2437 | p = p1; |
|
|
2438 | pl = p1 + srcImage->width; |
|
|
2439 | for (; p < pl; p++) |
|
|
2440 | { |
|
|
2441 | *p = lookup_r[(*p & 0xff0000)>>16] | |
|
|
2442 | lookup_g[(*p & 0x00ff00)>> 8] | |
|
|
2443 | lookup_b[(*p & 0x0000ff)] | |
|
|
2444 | (*p & ~0xffffff); |
|
|
2445 | } |
|
|
2446 | p1 = (RUINT32T *) ((char *) p1 + srcImage->bytes_per_line); |
|
|
2447 | } |
|
|
2448 | break; |
|
|
2449 | } |
|
|
2450 | } |
|
|
2451 | |
|
|
2452 | free (lookup); |
|
|
2453 | } |
|
|
2454 | #endif |
|
|
2455 | |
|
|
2456 | /* |
|
|
2457 | * Check our parents are still who we think they are. |
|
|
2458 | * Do transparency updates if required |
|
|
2459 | */ |
|
|
2460 | int |
|
|
2461 | rxvt_term::check_our_parents () |
|
|
2462 | { |
|
|
2463 | int i, pchanged, aformat, have_pixmap, rootdepth; |
|
|
2464 | unsigned long nitems, bytes_after; |
|
|
2465 | Atom atype; |
|
|
2466 | unsigned char *prop = NULL; |
|
|
2467 | Window root, oldp, *list; |
|
|
2468 | Pixmap rootpixmap = None; |
|
|
2469 | XWindowAttributes wattr, wrootattr; |
|
|
2470 | |
|
|
2471 | pchanged = 0; |
|
|
2472 | |
|
|
2473 | if (!option (Opt_transparent)) |
|
|
2474 | return pchanged; /* Don't try any more */ |
|
|
2475 | |
|
|
2476 | XGetWindowAttributes (dpy, display->root, &wrootattr); |
|
|
2477 | rootdepth = wrootattr.depth; |
|
|
2478 | |
|
|
2479 | XGetWindowAttributes (dpy, parent[0], &wattr); |
|
|
2480 | |
|
|
2481 | if (rootdepth != wattr.depth) |
|
|
2482 | { |
|
|
2483 | if (am_transparent) |
|
|
2484 | { |
|
|
2485 | pchanged = 1; |
|
|
2486 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2487 | am_transparent = am_pixmap_trans = 0; |
|
|
2488 | } |
|
|
2489 | |
|
|
2490 | return pchanged; /* Don't try any more */ |
|
|
2491 | } |
|
|
2492 | |
|
|
2493 | /* Get all X ops out of the queue so that our information is up-to-date. */ |
|
|
2494 | XSync (dpy, False); |
|
|
2495 | |
|
|
2496 | /* |
|
|
2497 | * Make the frame window set by the window manager have |
|
|
2498 | * the root background. Some window managers put multiple nested frame |
|
|
2499 | * windows for each client, so we have to take care about that. |
|
|
2500 | */ |
|
|
2501 | i = (xa[XA_XROOTPMAP_ID] |
|
|
2502 | && XGetWindowProperty (dpy, display->root, xa[XA_XROOTPMAP_ID], |
|
|
2503 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2504 | &nitems, &bytes_after, &prop) == Success); |
|
|
2505 | |
|
|
2506 | if (!i || prop == NULL) |
|
|
2507 | i = (xa[XA_ESETROOT_PMAP_ID] |
|
|
2508 | && XGetWindowProperty (dpy, display->root, xa[XA_ESETROOT_PMAP_ID], |
|
|
2509 | 0L, 1L, False, XA_PIXMAP, &atype, &aformat, |
|
|
2510 | &nitems, &bytes_after, &prop) == Success); |
|
|
2511 | |
|
|
2512 | if (!i || prop == NULL |
|
|
2513 | #if TINTING |
|
|
2514 | || !ISSET_PIXCOLOR (Color_tint) |
|
|
2515 | #endif |
|
|
2516 | ) |
|
|
2517 | have_pixmap = 0; |
|
|
2518 | else |
|
|
2519 | { |
|
|
2520 | have_pixmap = 1; |
|
|
2521 | rootpixmap = *(Pixmap *)prop; |
|
|
2522 | XFree (prop); |
|
|
2523 | } |
|
|
2524 | |
|
|
2525 | if (have_pixmap) |
|
|
2526 | { |
|
|
2527 | /* |
|
|
2528 | * Copy display->root pixmap transparency |
|
|
2529 | */ |
|
|
2530 | int sx, sy, nx, ny; |
|
|
2531 | unsigned int nw, nh; |
|
|
2532 | Window cr; |
|
|
2533 | XImage *image; |
|
|
2534 | GC gc; |
|
|
2535 | XGCValues gcvalue; |
|
|
2536 | |
|
|
2537 | XTranslateCoordinates (dpy, parent[0], display->root, |
|
|
2538 | 0, 0, &sx, &sy, &cr); |
|
|
2539 | nw = (unsigned int)szHint.width; |
|
|
2540 | nh = (unsigned int)szHint.height; |
|
|
2541 | nx = ny = 0; |
|
|
2542 | |
|
|
2543 | if (sx < 0) |
|
|
2544 | { |
|
|
2545 | nw += sx; |
|
|
2546 | nx = -sx; |
|
|
2547 | sx = 0; |
|
|
2548 | } |
|
|
2549 | |
|
|
2550 | if (sy < 0) |
|
|
2551 | { |
|
|
2552 | nh += sy; |
|
|
2553 | ny = -sy; |
|
|
2554 | sy = 0; |
|
|
2555 | } |
|
|
2556 | |
|
|
2557 | min_it (nw, (unsigned int) (wrootattr.width - sx)); |
|
|
2558 | min_it (nh, (unsigned int) (wrootattr.height - sy)); |
|
|
2559 | |
|
|
2560 | XSync (dpy, False); |
|
|
2561 | allowedxerror = -1; |
|
|
2562 | image = XGetImage (dpy, rootpixmap, sx, sy, nw, nh, AllPlanes, ZPixmap); |
|
|
2563 | |
|
|
2564 | /* XXX: handle BadMatch - usually because we're outside the pixmap */ |
|
|
2565 | /* XXX: may need a delay here? */ |
|
|
2566 | allowedxerror = 0; |
|
|
2567 | |
|
|
2568 | if (image == NULL) |
|
|
2569 | { |
|
|
2570 | if (am_transparent && am_pixmap_trans) |
|
|
2571 | { |
|
|
2572 | pchanged = 1; |
|
|
2573 | if (pixmap != None) |
|
|
2574 | { |
|
|
2575 | XFreePixmap (dpy, pixmap); |
|
|
2576 | pixmap = None; |
|
|
2577 | } |
|
|
2578 | } |
|
|
2579 | |
|
|
2580 | am_pixmap_trans = 0; |
|
|
2581 | } |
|
|
2582 | else |
|
|
2583 | { |
|
|
2584 | if (pixmap != None) |
|
|
2585 | XFreePixmap (dpy, pixmap); |
|
|
2586 | |
|
|
2587 | #if TINTING |
|
|
2588 | if (ISSET_PIXCOLOR (Color_tint)) |
|
|
2589 | { |
|
|
2590 | int shade = rs[Rs_shade] ? atoi (rs[Rs_shade]) : 100; |
|
|
2591 | |
|
|
2592 | rgba c; |
|
|
2593 | pix_colors_focused [Color_tint].get (c); |
|
|
2594 | |
|
|
2595 | ShadeXImage (this, image, shade, c.r, c.g, c.b); |
|
|
2596 | } |
|
|
2597 | #endif |
|
|
2598 | |
|
|
2599 | pixmap = XCreatePixmap (dpy, vt, szHint.width, szHint.height, image->depth); |
|
|
2600 | gc = XCreateGC (dpy, vt, 0UL, &gcvalue); |
|
|
2601 | XPutImage (dpy, pixmap, gc, image, 0, 0, |
|
|
2602 | nx, ny, image->width, image->height); |
|
|
2603 | XFreeGC (dpy, gc); |
|
|
2604 | XDestroyImage (image); |
|
|
2605 | XSetWindowBackgroundPixmap (dpy, parent[0], pixmap); |
|
|
2606 | XClearWindow (dpy, parent[0]); |
|
|
2607 | |
|
|
2608 | if (!am_transparent || !am_pixmap_trans) |
|
|
2609 | pchanged = 1; |
|
|
2610 | |
|
|
2611 | am_transparent = am_pixmap_trans = 1; |
|
|
2612 | } |
|
|
2613 | } |
|
|
2614 | |
|
|
2615 | if (am_pixmap_trans) |
|
|
2616 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2617 | else |
|
|
2618 | { |
|
|
2619 | unsigned int n; |
|
|
2620 | /* |
|
|
2621 | * InheritPixmap transparency |
|
|
2622 | */ |
|
|
2623 | for (i = 1; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2624 | { |
|
|
2625 | oldp = parent[i]; |
|
|
2626 | XQueryTree (dpy, parent[i - 1], &root, &parent[i], &list, &n); |
|
|
2627 | XFree (list); |
|
|
2628 | |
|
|
2629 | if (parent[i] == display->root) |
|
|
2630 | { |
|
|
2631 | if (oldp != None) |
|
|
2632 | pchanged = 1; |
|
|
2633 | |
|
|
2634 | break; |
|
|
2635 | } |
|
|
2636 | |
|
|
2637 | if (oldp != parent[i]) |
|
|
2638 | pchanged = 1; |
|
|
2639 | } |
|
|
2640 | |
|
|
2641 | n = 0; |
|
|
2642 | |
|
|
2643 | if (pchanged) |
|
|
2644 | for (; n < (unsigned int)i; n++) |
|
|
2645 | { |
|
|
2646 | XGetWindowAttributes (dpy, parent[n], &wattr); |
|
|
2647 | |
|
|
2648 | if (wattr.depth != rootdepth || wattr.c_class == InputOnly) |
|
|
2649 | { |
|
|
2650 | n = (int) (sizeof (parent) / sizeof (Window)) + 1; |
|
|
2651 | break; |
|
|
2652 | } |
|
|
2653 | } |
|
|
2654 | |
|
|
2655 | if (n > (sizeof (parent) / sizeof (parent[0]))) |
|
|
2656 | { |
|
|
2657 | XSetWindowBackground (dpy, parent[0], pix_colors_focused[Color_border]); |
|
|
2658 | XSetWindowBackground (dpy, vt, pix_colors_focused[Color_bg]); |
|
|
2659 | am_transparent = 0; |
|
|
2660 | /* XXX: also turn off Opt_transparent? */ |
|
|
2661 | } |
|
|
2662 | else |
|
|
2663 | { |
|
|
2664 | for (n = 0; n < (unsigned int)i; n++) |
|
|
2665 | { |
|
|
2666 | XSetWindowBackgroundPixmap (dpy, parent[n], ParentRelative); |
|
|
2667 | XClearWindow (dpy, parent[n]); |
|
|
2668 | } |
|
|
2669 | |
|
|
2670 | XSetWindowBackgroundPixmap (dpy, vt, ParentRelative); |
|
|
2671 | am_transparent = 1; |
|
|
2672 | } |
|
|
2673 | |
|
|
2674 | for (; i < (int) (sizeof (parent) / sizeof (Window)); i++) |
|
|
2675 | parent[i] = None; |
|
|
2676 | } |
|
|
2677 | |
|
|
2678 | if (scrollBar.win) |
|
|
2679 | { |
|
|
2680 | XSetWindowBackgroundPixmap (dpy, scrollBar.win, ParentRelative); |
|
|
2681 | scrollBar.setIdle (); |
|
|
2682 | scrollbar_show (0); |
|
|
2683 | } |
|
|
2684 | |
|
|
2685 | if (am_transparent) |
|
|
2686 | { |
|
|
2687 | want_refresh = want_full_refresh = 1; |
|
|
2688 | if (am_pixmap_trans) |
|
|
2689 | flush (); |
|
|
2690 | } |
|
|
2691 | |
|
|
2692 | return pchanged; |
|
|
2693 | } |
|
|
2694 | #endif |
|
|
2695 | |
|
|
2696 | /*}}} */ |
2239 | /*}}} */ |
2697 | |
2240 | |
2698 | bool |
2241 | bool |
2699 | rxvt_term::cmd_parse () |
2242 | rxvt_term::cmd_parse () |
2700 | { |
2243 | { |
… | |
… | |
2965 | { |
2508 | { |
2966 | if ((buf[len++] = cmd_getc ()) == 'i') |
2509 | if ((buf[len++] = cmd_getc ()) == 'i') |
2967 | break; /* done = 1 */ |
2510 | break; /* done = 1 */ |
2968 | } |
2511 | } |
2969 | } |
2512 | } |
2970 | |
2513 | |
2971 | for (i = 0; i < len; i++) |
2514 | for (i = 0; i < len; i++) |
2972 | if (putc (buf[i], fd) == EOF) |
2515 | if (putc (buf[i], fd) == EOF) |
2973 | { |
2516 | { |
2974 | done = 1; |
2517 | done = 1; |
2975 | break; |
2518 | break; |
… | |
… | |
3793 | int saveop = op; |
3336 | int saveop = op; |
3794 | |
3337 | |
3795 | dLocal (Display *, dpy); |
3338 | dLocal (Display *, dpy); |
3796 | |
3339 | |
3797 | assert (str != NULL); |
3340 | assert (str != NULL); |
3798 | |
3341 | |
3799 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3342 | if (HOOK_INVOKE ((this, HOOK_OSC_SEQ, DT_INT, op, DT_STR, str, DT_END))) |
3800 | return; |
3343 | return; |
3801 | |
3344 | |
3802 | switch (op) |
3345 | switch (op) |
3803 | { |
3346 | { |
… | |
… | |
3938 | #ifdef XPM_BACKGROUND |
3481 | #ifdef XPM_BACKGROUND |
3939 | resize_pixmap (); |
3482 | resize_pixmap (); |
3940 | scr_touch (true); |
3483 | scr_touch (true); |
3941 | #endif |
3484 | #endif |
3942 | } |
3485 | } |
|
|
3486 | #if TRANSPARENT && defined(HAVE_AFTERIMAGE) |
|
|
3487 | if (option (Opt_transparent)) |
|
|
3488 | check_our_parents (); |
|
|
3489 | #endif |
3943 | } |
3490 | } |
3944 | break; |
3491 | break; |
3945 | |
3492 | |
3946 | case Rxvt_restoreFG: |
3493 | case Rxvt_restoreFG: |
3947 | set_window_color (Color_fg, str); |
3494 | set_window_color (Color_fg, str); |