From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Newsgroups: gmane.emacs.devel Subject: Re: How about introducing a new frame parameter: topmost Date: Wed, 4 Jun 2008 13:06:29 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C8C601.0FC3A31B" X-Trace: ger.gmane.org 1212599845 1921 80.91.229.12 (4 Jun 2008 17:17:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 Jun 2008 17:17:25 +0000 (UTC) To: , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 04 19:18:04 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K3wcc-0004Rr-K8 for ged-emacs-devel@m.gmane.org; Wed, 04 Jun 2008 19:18:03 +0200 Original-Received: from localhost ([127.0.0.1]:33379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3wbp-0000ph-Sk for ged-emacs-devel@m.gmane.org; Wed, 04 Jun 2008 13:17:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3lEl-00029t-GJ for emacs-devel@gnu.org; Wed, 04 Jun 2008 01:08:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3lEk-00028R-CM for emacs-devel@gnu.org; Wed, 04 Jun 2008 01:08:38 -0400 Original-Received: from [199.232.76.173] (port=58948 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3lEk-00028B-70 for emacs-devel@gnu.org; Wed, 04 Jun 2008 01:08:38 -0400 Original-Received: from email.gdnt.com.cn ([202.104.30.38]:3894) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K3lEj-0006a4-AZ for emacs-devel@gnu.org; Wed, 04 Jun 2008 01:08:38 -0400 Original-Received: from sd-ef-01.cnshn.gdnt.local ([202.38.41.132]) by email.gdnt.com.cn with Microsoft SMTPSVC(6.0.3790.1830); Wed, 4 Jun 2008 13:08:44 +0800 Original-Received: from sd-ex-01.cnshn.gdnt.local ([202.38.38.8]) by sd-ef-01.cnshn.gdnt.local with Microsoft SMTPSVC(6.0.3790.1830); Wed, 4 Jun 2008 13:08:44 +0800 Original-Received: from RND-MX01.rnd.gdnt.local ([202.38.32.248]) by sd-ex-01.cnshn.gdnt.local with Microsoft SMTPSVC(6.0.3790.1830); Wed, 4 Jun 2008 13:08:44 +0800 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Re: How about introducing a new frame parameter: topmost Thread-Index: AcjGAL9nlFqKJUkWSOu/iAJmeel+VA== X-OriginalArrivalTime: 04 Jun 2008 05:08:44.0475 (UTC) FILETIME=[0FF090B0:01C8C601] X-TM-AS-Product-Ver: SMEX-7.0.0.1345-3.6.1039-15232.002 X-TM-AS-Result: No--16.404300-8.000000-31 X-detected-kernel: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-Mailman-Approved-At: Wed, 04 Jun 2008 13:15:21 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98402 Archived-At: This is a multi-part message in MIME format. ------_=_NextPart_001_01C8C601.0FC3A31B Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > It needs to work under X11 as well before I'd consider integrating the > feature. BTW, another detail is: does this property mean "stay above > every other GUI window", or "stay above the current Emacs frame", or > "stay above all other frames owned by this Emacs process"? > =20 > The latter seems more useful. The former is probably what your > code does. In X11, there's a feature which could do something like > the 2nd option, which is to mark a frame as being "transient", in which > case most window managers will try to keep it "above its parent window", > at least if that transient window is sufficiently small. > =20 > =20 > Stefan =20 Yes, my code does the one "stay above every other GUI window". That is the easiest way. =20 I did try to implement the 2nd option ("stay above the current Emacs frame") too by using the existing frame parameter "parent-id".=20 Something like: =20 In proc w32_createwindow: if (f->output_data.w32->parent_desc !=3D FRAME_X_DISPLAY_INFO (f)->root_window) { long style; =20 SetWindowLong (hwnd, GWL_HWNDPARENT, (long)f->output_data.w32->parent_desc); style =3D GetWindowLong (hwnd, GWL_STYLE); style &=3D ~(WS_MINIMIZEBOX); SetWindowLong (hwnd, GWL_STYLE, style); } Comment out the following line in x-create-frame: /* f->output_data.w32->parent_desc =3D FRAME_W32_DISPLAY_INFO (f)->root_window;*/ And also something need to be taken care in Fdelete_frame. =20 It works. But sometimes it has problem in redisplaying the parent window (parent window is not painted sometimes). And the child frame (window) doesn't have icon/button in the windows taskbar too.=20 =20 In GTK+, there is a API to do the 2nd option: gtk_window_set_transient_for. In Windows, this API actually is implemented by calling SetWindowLong with GWL_HWNDPARENT too. =20 But the MSDN says: You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent of a child window. Instead, use the SetParent function.=20 But SetParent is not what we need.=20 =20 Don't know a way to do the 3rd option ("stay above all other frames owned by this Emacs process") yet :-( =20 =20 ------_=_NextPart_001_01C8C601.0FC3A31B Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
> It needs to work under = X11 as well before I'd=20 consider integrating the
> feature.  BTW, another detail is: = does=20 this property mean "stay above
> every other GUI window", or "stay = above=20 the current Emacs frame", or
> "stay above all other frames owned = by this=20 Emacs process"?

> The latter seems more = useful.  The=20 former is probably what your
> code does.  In X11, there's a = feature=20 which could do something like
> the 2nd option, which is to mark a = frame=20 as being "transient", in which
> case most window managers will = try to=20 keep it "above its parent window",
> at least if that transient = window is=20 sufficiently small.

> =20
>         = Stefan
 
Yes, my code does the one = "stay above every other GUI=20 window". That is
the easiest way.
 
I did try to implement the = 2nd option ("stay above the=20 current Emacs
frame") too by using the existing frame parameter = "parent-id".=20
Something like:
 
  In proc=20 w32_createwindow:
      if=20 (f->output_data.w32->parent_desc !=3D FRAME_X_DISPLAY_INFO=20 (f)->root_window)
       =20 {
          long=20 style;
         =20
          SetWindowLong = (hwnd,=20 GWL_HWNDPARENT,=20 (long)f->output_data.w32->parent_desc);
    =      =20 style =3D GetWindowLong (hwnd,=20 GWL_STYLE);
          = style=20 &=3D=20 ~(WS_MINIMIZEBOX);
        &nb= sp;=20 SetWindowLong (hwnd, GWL_STYLE,=20 style);
        }
  = Comment out=20 the following line in x-create-frame:
     /*=20 f->output_data.w32->parent_desc =3D FRAME_W32_DISPLAY_INFO=20 (f)->root_window;*/
  And also something need to be taken=20 care in Fdelete_frame.
 
It works. But sometimes it = has problem in=20 redisplaying the parent = window
(parent=20 window is not painted sometimes). And the child frame = (window)
doesn't have=20 icon/button in the windows = taskbar=20 too.
 
In GTK+, there is a API to = do the 2nd=20 option:
gtk_window_set_transient_for. In Windows, this API actually=20 is
implemented by calling SetWindowLong with GWL_HWNDPARENT = too.
 
But the MSDN = says:
   You must not call=20 SetWindowLong with the GWL_HWNDPARENT index to
   change = the parent=20 of a child window. Instead, use the SetParent
   function. =
But=20 SetParent is not what we need.
 

Don't know a way to do = the 3rd option ("stay above=20 all other frames
owned by this Emacs process") yet :-(
 

 
------_=_NextPart_001_01C8C601.0FC3A31B--