0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Inside Wine; CreateWindow から XCreateWindow

Last updated at Posted at 2018-02-27

[目次] (https://qiita.com/Yutaka_Aoki/items/9d38ea98406f4096435b)

Inside Wine; Window の作成

CreateWidowEx() から、X Window の Window が生成されるまでの流れ

非常に分かりにくいのですが、結論から言えば、CreateWidowEx() した際に実際に、X Window の XCreateWindow() を呼び出しているのは、「set_window_pos()」の中から呼び出される所のX11DRV_WindowPosChanging()の中です。その関数から、X11DRV_create_win_data() が呼び出され、create_whole_window() が呼び出され、XCreateWindow() が呼び出されて、戻り値の 「Window」という型の ID 値を、data->whole_window の中に代入しています。なお、Window 型は、構造体型ではありません。

CreateWindowExW()
--->
WIN_CreateWindowEx()
  call set_window_pos()
--> wine/dlls/user32/winpos.c
--> X11DRV_WindowPosChanging()
--> X11DRV_create_win_data()
--> dlls/winex11.drv/window.c :
    static void create_whole_window( struct x11drv_win_data *data )
--->
 data->whole_window = XCreateWindow(
              data->display, root_window, pos.x, pos.y,
              cx, cy, 0, data->vis.depth, InputOutput,
              data->vis.visual, mask, &attr );

という流れのようです。

static struct x11drv_win_data *X11DRV_create_win_data( HWND hwnd, const RECT *window_rect,
                                                       const RECT *client_rect ) {
    Display *display;
    struct x11drv_win_data *data;
    HWND parent;
    if (!(parent = GetAncestor( hwnd, GA_PARENT ))) return NULL;  /* desktop */
    /* don't create win data for HWND_MESSAGE windows */
    if (parent != GetDesktopWindow() && !GetAncestor( parent, GA_PARENT )) return NULL;
    if (GetWindowThreadProcessId( hwnd, NULL ) != GetCurrentThreadId()) return NULL;
    display = thread_init_display();
    init_clip_window();  /* make sure the clip window is initialized in this thread */
    if (!(data = alloc_win_data( display, hwnd ))) return NULL;
    data->whole_rect = data->window_rect = *window_rect;
    data->client_rect = *client_rect;
    if (parent == GetDesktopWindow()){
        create_whole_window( data );
        TRACE( "win %p/%lx window %s whole %s client %s\n",
               hwnd, data->whole_window, wine_dbgstr_rect( &data->window_rect ),
               wine_dbgstr_rect( &data->whole_rect ), wine_dbgstr_rect( &data->client_rect ));
    }
    return data;
}

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

aaa

あああ

end

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?