comparison src/frame-msw.c @ 3022:dd34bc8e9423

[xemacs-hg @ 2005-10-25 03:54:01 by ben] add support for `window-id' property in mswindows frame-msw.c: New function, like decode_x_frame. frame-msw.c: Add `window-id' property for MS Windows frames.
author ben
date Tue, 25 Oct 2005 03:54:03 +0000
parents 5bf18ccb05df
children d305f4207861
comparison
equal deleted inserted replaced
3021:285d258fdeb6 3022:dd34bc8e9423
99 }; 99 };
100 100
101 /*---------------------------------------------------------------------*/ 101 /*---------------------------------------------------------------------*/
102 /*----- DISPLAY FRAME -----*/ 102 /*----- DISPLAY FRAME -----*/
103 /*---------------------------------------------------------------------*/ 103 /*---------------------------------------------------------------------*/
104
105 static struct frame *
106 decode_mswindows_frame (Lisp_Object frame)
107 {
108 if (NILP (frame))
109 frame = wrap_frame (selected_frame ());
110 CHECK_LIVE_FRAME (frame);
111 /* this will also catch dead frames, but putting in the above check
112 results in a more useful error */
113 CHECK_MSWINDOWS_FRAME (frame);
114 return XFRAME (frame);
115 }
104 116
105 HWND 117 HWND
106 mswindows_get_selected_frame_hwnd (void) 118 mswindows_get_selected_frame_hwnd (void)
107 { 119 {
108 Lisp_Object frame, device; 120 Lisp_Object frame, device;
562 qxeSetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext); 574 qxeSetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext);
563 } 575 }
564 } 576 }
565 577
566 static Lisp_Object 578 static Lisp_Object
579 mswindows_window_id (Lisp_Object frame)
580 {
581 Ibyte str[255];
582 struct frame *f = decode_mswindows_frame (frame);
583
584 qxesprintf (str, "%lu", FRAME_MSWINDOWS_HANDLE (f));
585 return build_intstring (str);
586 }
587
588 static Lisp_Object
567 mswindows_frame_property (struct frame *f, Lisp_Object property) 589 mswindows_frame_property (struct frame *f, Lisp_Object property)
568 { 590 {
569 if (EQ (Qleft, property) || EQ (Qtop, property)) 591 if (EQ (Qleft, property) || EQ (Qtop, property))
570 { 592 {
571 RECT rc; 593 RECT rc;
572 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc); 594 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc);
573 return make_int (EQ (Qtop, property) ? rc.top : rc.left); 595 return make_int (EQ (Qtop, property) ? rc.top : rc.left);
574 } 596 }
597 if (EQ (Qwindow_id, property))
598 return mswindows_window_id (wrap_frame (f));
599
575 return Qunbound; 600 return Qunbound;
576 } 601 }
577 602
578 static int 603 static int
579 mswindows_internal_frame_property_p (struct frame *UNUSED (f), 604 mswindows_internal_frame_property_p (struct frame *UNUSED (f),
580 Lisp_Object property) 605 Lisp_Object property)
581 { 606 {
582 return EQ (property, Qleft) 607 return EQ (property, Qleft)
583 || EQ (property, Qtop); 608 || EQ (property, Qtop)
609 || EQ (property, Qwindow_id);
584 /* #### frame-x.c has also this. Why? 610 /* #### frame-x.c has also this. Why?
585 || STRINGP (property); 611 || STRINGP (property);
586 */ 612 */
587 } 613 }
588 614
593 RECT rc; 619 RECT rc;
594 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc); 620 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc);
595 621
596 props = cons3 (Qtop, make_int (rc.top), props); 622 props = cons3 (Qtop, make_int (rc.top), props);
597 props = cons3 (Qleft, make_int (rc.left), props); 623 props = cons3 (Qleft, make_int (rc.left), props);
624 props = cons3 (Qwindow_id, mswindows_window_id (wrap_frame (f)), props);
598 625
599 return props; 626 return props;
600 } 627 }
601 628
602 static void 629 static void
1207 decorations). 1234 decorations).
1208 left X position (in pixels) of the upper-left 1235 left X position (in pixels) of the upper-left
1209 outermost corner of the frame (i.e. the 1236 outermost corner of the frame (i.e. the
1210 upper-left of the window-manager 1237 upper-left of the window-manager
1211 decorations). 1238 decorations).
1239 window-id Window handle (HWND) of the frame.
1240 Cannot be set.
1212 1241
1213 See also `default-frame-plist', which specifies properties which apply 1242 See also `default-frame-plist', which specifies properties which apply
1214 to all frames, not just mswindows frames. 1243 to all frames, not just mswindows frames.
1215 */ ); 1244 */ );
1216 Vdefault_mswindows_frame_plist = Qnil; 1245 Vdefault_mswindows_frame_plist = Qnil;