Changeset 3899
- Timestamp:
- 10/12/05 02:51:36 (3 years ago)
- Files:
-
- trunk/src/ChangeLog.Meadow (modified) (1 diff)
- trunk/src/frame.c (modified) (1 diff)
- trunk/src/mw32fns.c (modified) (12 diffs)
- trunk/src/mw32term.c (modified) (3 diffs)
- trunk/src/mw32term.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/ChangeLog.Meadow
r3898 r3899 1 2005-10-12 Kyotaro HORIGUCHI <horiguti@meadowy.org> 2 3 * frame.c (frame_parms): New frame parameter "alpha". 4 5 * mw32fns.c: include <windows.h> to use 6 SetLayeredWindowAttributes. 7 (Qalpha): New symbol. 8 (mw32-frame-alpha-lower-limit): New LISP variable. 9 (mw32_update_frame_alpha): New extern. 10 (mw32_set_frame_alpha): New function. 11 (mw32_WndProc<WM_MOVING>): New message handler. 12 (mw32_window): Setup initial frame alpha. 13 (x-create-frame): Initiallize frame parameters *-alpha. 14 (mw32i_frame_parm_handlers): Add frame parm handler 15 mw32_set_frame_alpha. 16 17 * mw32term.h(struct mw32_output): New four members active_alpha, 18 inactive_alpha, moving_alpha, and current_alpha. 19 20 * mw32term.c: include <windows.h> to use 21 SetLayeredWindowAttributes. 22 (mw32_update_frame_alpha): New function. 23 (MW32_update_end): Refresh layered window when frame alpha is set. 24 1 25 2005-10-12 Kyotaro HORIGUCHI <horiguti@meadowy.org> 2 26 trunk/src/frame.c
r3809 r3899 2602 2602 #endif 2603 2603 {"cursor-height", 0}, 2604 {"alpha", 0}, 2604 2605 #endif 2605 2606 }; trunk/src/mw32fns.c
r3886 r3899 21 21 22 22 /* MW32 implementation by MIYASHITA Hisashi <himi@meadowy.org> */ 23 24 /* This is included to use SetLayeredWindowAttributes() */ 25 #define _WIN32_WINNT 0x0500 26 #include <windows.h> 23 27 24 28 #include <config.h> … … 98 102 Lisp_Object Qbox; 99 103 Lisp_Object Qcursor_height; 104 Lisp_Object Qalpha; 100 105 Lisp_Object Qnone; 101 106 Lisp_Object Qouter_window_id; … … 112 117 /* The ANSI codepage. */ 113 118 int w32_ansi_code_page; 119 120 /* Lower limit of alpha value of frame. */ 121 int mw32_frame_alpha_lower_limit; 114 122 115 123 #if GLYPH_DEBUG … … 924 932 } 925 933 934 /* defined in mw32term.c */ 935 extern void mw32_update_frame_alpha (struct frame *f, int change_style); 936 937 static void 938 mw32_set_frame_alpha (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 939 { 940 int oldalpha= f->output_data.mw32->current_alpha; 941 int newalpha_active, newalpha_inactive, newalpha_moving, newalpha; 942 int obj; 943 944 if (NILP (arg)) 945 newalpha_active = newalpha_inactive = -1; 946 else 947 { 948 if (NUMBERP (arg)) 949 { 950 newalpha_active = XINT (arg); 951 952 if (newalpha_active < 0 || newalpha_active > 100) 953 args_out_of_range (make_number (0), make_number (100)); 954 955 newalpha_inactive = newalpha_moving = newalpha_active; 956 } 957 else if (CONSP (arg)) 958 { 959 if (! NUMBERP (CAR (arg))) 960 wrong_type_argument (Qnumberp, (CAR (arg))); 961 newalpha_active = XINT (CAR (arg)); 962 963 if (NUMBERP (CDR (arg))) 964 newalpha_inactive = XINT (CDR (arg)); 965 else if (CONSP (CDR (arg)) && NUMBERP (CAR (CDR (arg)))) 966 newalpha_inactive = XINT (CAR (CDR (arg))); 967 else 968 wrong_type_argument (Qnumberp, (CDR (arg))); 969 970 newalpha_moving = newalpha_active; 971 972 if (newalpha_active > 100 || newalpha_active < 0 973 || newalpha_inactive > 100 || newalpha_inactive < 0) 974 args_out_of_range (make_number (0), make_number (100)); 975 976 if (CONSP (CDR (arg))) 977 { 978 if (Flength (arg) > 2) 979 { 980 obj = (CAR (CDR (CDR (arg)))); 981 if (! NUMBERP (obj)) 982 wrong_type_argument (Qnumberp, obj); 983 newalpha_moving = XINT (obj); 984 985 if (newalpha_moving > 100 || newalpha_moving < 0) 986 args_out_of_range (make_number (0), make_number (100)); 987 } 988 } 989 } 990 else 991 wrong_type_argument (Qnumberp, arg); 992 993 /* Apply lower limit silently */ 994 if (newalpha_active < mw32_frame_alpha_lower_limit) 995 newalpha_active = mw32_frame_alpha_lower_limit; 996 if (newalpha_inactive < mw32_frame_alpha_lower_limit) 997 newalpha_inactive = mw32_frame_alpha_lower_limit; 998 if (newalpha_moving < mw32_frame_alpha_lower_limit) 999 newalpha_moving = mw32_frame_alpha_lower_limit; 1000 } 1001 1002 f->output_data.mw32->active_alpha = newalpha_active; 1003 f->output_data.mw32->inactive_alpha = newalpha_inactive; 1004 f->output_data.mw32->moving_alpha = newalpha_moving; 1005 1006 mw32_update_frame_alpha (f, TRUE); 1007 } 1008 926 1009 927 1010 #ifdef IME_CONTROL … … 1866 1949 return 0; 1867 1950 1951 case WM_MOVING: 1952 if (f->output_data.mw32->moving_alpha >= 0 1953 && f->output_data.mw32->current_alpha >= 0 1954 && (f->output_data.mw32->moving_alpha != 1955 f->output_data.mw32->current_alpha)) 1956 { 1957 SetLayeredWindowAttributes(FRAME_MW32_WINDOW (f), 1958 RGB(255, 255, 255), 1959 (int) 1960 ((float)(f->output_data.mw32->moving_alpha) 1961 /(float)100*(float)255), 1962 LWA_ALPHA); 1963 f->output_data.mw32->current_alpha 1964 = f->output_data.mw32->moving_alpha; 1965 } 1966 return 0; 1967 1868 1968 case WM_MOVE: 1869 1969 … … 1900 2000 f->top_pos = rect.top; 1901 2001 SET_FRAME_GARBAGED (f); 2002 mw32_update_frame_alpha (f, FALSE); 1902 2003 } 1903 2004 } … … 2570 2671 if (FRAME_MW32_WINDOW (f) == 0) 2571 2672 error ("Unable to create window"); 2673 2674 mw32_update_frame_alpha (f, TRUE); 2572 2675 } 2573 2676 … … 2702 2805 f->output_data.mw32->hdc = INVALID_HANDLE_VALUE; 2703 2806 f->output_data.mw32->message_thread_hdc = INVALID_HANDLE_VALUE; 2807 f->output_data.mw32->current_alpha = -1; 2808 f->output_data.mw32->active_alpha = -1; 2809 f->output_data.mw32->inactive_alpha = -1; 2810 f->output_data.mw32->moving_alpha = -1; 2704 2811 { 2705 2812 LOGFONT lf; … … 2928 3035 x_default_parameter (f, parameters, Qscroll_bar_width, Qnil, 2929 3036 "scrollBarWidth", "ScrollBarWidth", RES_TYPE_NUMBER); 3037 x_default_parameter (f, parameters, Qalpha, Qnil, 3038 "alpha", "Alpha", RES_TYPE_NUMBER); 2930 3039 2931 3040 /* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size. … … 4630 4739 mw32_set_frame_ime_font, 4631 4740 #endif 4632 mw32_set_cursor_height 4741 mw32_set_cursor_height, 4742 mw32_set_frame_alpha 4633 4743 }; 4634 4744 … … 4660 4770 Qcursor_height = intern ("cursor-height"); 4661 4771 staticpro (&Qcursor_height); 4772 Qalpha = intern ("alpha"); 4773 staticpro (&Qalpha); 4662 4774 Qnone = intern ("none"); 4663 4775 staticpro (&Qnone); … … 4757 4869 w32_ansi_code_page = GetACP (); 4758 4870 4871 DEFVAR_INT ("mw32-frame-alpha-lower-limit", &mw32_frame_alpha_lower_limit, 4872 doc: /* Lower limit of alpha value of frame. */); 4873 mw32_frame_alpha_lower_limit = 20; 4874 4759 4875 defsubr (&Sxw_display_color_p); 4760 4876 defsubr (&Sx_display_grayscale_p); trunk/src/mw32term.c
r3898 r3899 39 39 40 40 #include <stdio.h> 41 42 /* This is included to use SetLayeredWindowAttributes() */ 43 #define _WIN32_WINNT 0x0500 44 #include <windows.h> 45 #ifdef WHEEL_PAGESCROLL 46 #undef WHEEL_PAGESCROLL 47 #endif 41 48 42 49 #include "lisp.h" … … 695 702 696 703 704 /* Change alpha of frame. */ 705 void 706 mw32_update_frame_alpha (struct frame *f, int change_style) 707 { 708 int newalpha, oldalpha; 709 710 oldalpha = f->output_data.mw32->current_alpha; 711 712 if (FRAME_MW32_DISPLAY_INFO (f)->mw32_highlight_frame == f) 713 newalpha = f->output_data.mw32->active_alpha; 714 else 715 newalpha = f->output_data.mw32->inactive_alpha; 716 717 if (change_style) 718 { 719 if (newalpha < 0 && oldalpha >= 0) 720 SetWindowLong (FRAME_MW32_WINDOW (f),GWL_EXSTYLE, 721 GetWindowLong (FRAME_MW32_WINDOW (f), GWL_EXSTYLE) 722 & ~WS_EX_LAYERED); 723 else if (newalpha >= 0 && oldalpha < 0) 724 SetWindowLong (FRAME_MW32_WINDOW (f),GWL_EXSTYLE, 725 GetWindowLong (FRAME_MW32_WINDOW (f), GWL_EXSTYLE) 726 | WS_EX_LAYERED); 727 } 728 /* Caloing SetLayeredWindowAttributes to update displaed frame image 729 when alpha is used. */ 730 if (newalpha >= 0) 731 SetLayeredWindowAttributes(FRAME_MW32_WINDOW (f), 732 RGB(255, 255, 255), 733 (int) 734 ((float)newalpha 735 /(float)100*(float)255), 736 LWA_ALPHA); 737 738 f->output_data.mw32->current_alpha = newalpha; 739 } 740 697 741 /* End update of frame F. This function is installed as a hook in 698 742 update_end. */ … … 703 747 /* Mouse highlight may be displayed again. */ 704 748 if (FRAME_MW32_P (f)) 705 FRAME_MW32_DISPLAY_INFO (f)->mouse_face_defer = 0; 749 { 750 FRAME_MW32_DISPLAY_INFO (f)->mouse_face_defer = 0; 751 /* This is necessary to display updates when alpha > -1 */ 752 mw32_update_frame_alpha (f, FALSE); 753 } 706 754 } 707 755 trunk/src/mw32term.h
r3871 r3899 477 477 /* logfont for IME */ 478 478 LOGFONT ime_logfont; 479 480 /* Transparent frame. Range is -1 to 100, -1 means alpha disabled. */ 481 int active_alpha; /* Alpha value when this frame is active */ 482 int inactive_alpha; /* Alpha value when this frame is inactive */ 483 int moving_alpha; /* Alpha value when this frame is under move */ 484 int current_alpha; /* Current alpha value of this frame */ 479 485 }; 480 486
