Skip to content

Commit

Permalink
fix soulthreads#19: [win32] Persistent mode: sometimes XWinMosaic win…
Browse files Browse the repository at this point in the history
…dow isn't raised after pressing Alt+Tab
  • Loading branch information
idealist1508 committed Aug 6, 2014
1 parent 5adb7ed commit c308b3f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,11 @@ void tab_event (gboolean shift) //FIXME: put prototype for this function
update_box_list();
draw_mosaic (GTK_LAYOUT (layout), boxes, wsize, 0,
options.box_width, options.box_height);
#ifdef WIN32
gtk_widget_show (window);
raise_window (gdk_win32_drawable_get_handle( window->window ));
#else
gtk_window_present (GTK_WINDOW (window));
#endif
}
}
16 changes: 16 additions & 0 deletions src/win32_interaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,22 @@ GdkPixbuf* get_window_icon(HWND win, guint req_width, guint req_height)
return gicon;
}

void raise_window(HWND win)
{
HWND hCurrWnd;
int iMyTID;
int iCurrTID;

hCurrWnd = GetForegroundWindow();
iMyTID = GetCurrentThreadId();
iCurrTID = GetWindowThreadProcessId(hCurrWnd,0);

AttachThreadInput(iMyTID, iCurrTID, TRUE);

SetForegroundWindow(win);

AttachThreadInput(iMyTID, iCurrTID, FALSE);}

HWND* sorted_windows_list(HWND *myown, HWND *active_win, int *nitems)
{
WINDOWINFO pwi;
Expand Down
1 change: 1 addition & 0 deletions src/win32_interaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
char *get_window_name(HWND win);
char *get_window_class(HWND win);
HWND* sorted_windows_list(HWND *myown, HWND *active_win, int *nitems);
void raise_window(HWND win);
void switch_to_window(HWND win);
GdkPixbuf* get_window_icon(HWND win, guint req_width, guint req_height);

Expand Down

0 comments on commit c308b3f

Please sign in to comment.