Move the fullscreen API from GimpDisplayShell to GimpImageWindow
Also remove GimpDisplayShell's "window_state" member. Use gtk_widget_get_toplvel() to get to the GimpImageWindow when we need a display shell's fullscreen state.
This commit is contained in:
@ -44,6 +44,7 @@
|
|||||||
#include "display/gimpdisplayshell-appearance.h"
|
#include "display/gimpdisplayshell-appearance.h"
|
||||||
#include "display/gimpdisplayshell-scale.h"
|
#include "display/gimpdisplayshell-scale.h"
|
||||||
#include "display/gimpdisplayshell-selection.h"
|
#include "display/gimpdisplayshell-selection.h"
|
||||||
|
#include "display/gimpimagewindow.h"
|
||||||
|
|
||||||
#include "actions.h"
|
#include "actions.h"
|
||||||
#include "view-actions.h"
|
#include "view-actions.h"
|
||||||
@ -549,10 +550,12 @@ view_actions_update (GimpActionGroup *group,
|
|||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
{
|
{
|
||||||
|
GtkWidget *window = gtk_widget_get_toplevel (display->shell);
|
||||||
|
|
||||||
image = display->image;
|
image = display->image;
|
||||||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||||
|
|
||||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (window));
|
||||||
|
|
||||||
options = (image ?
|
options = (image ?
|
||||||
(fullscreen ? shell->fullscreen_options : shell->options) :
|
(fullscreen ? shell->fullscreen_options : shell->options) :
|
||||||
|
|||||||
@ -42,6 +42,7 @@
|
|||||||
#include "display/gimpdisplayshell-scale.h"
|
#include "display/gimpdisplayshell-scale.h"
|
||||||
#include "display/gimpdisplayshell-scale-dialog.h"
|
#include "display/gimpdisplayshell-scale-dialog.h"
|
||||||
#include "display/gimpdisplayshell-scroll.h"
|
#include "display/gimpdisplayshell-scroll.h"
|
||||||
|
#include "display/gimpimagewindow.h"
|
||||||
|
|
||||||
#include "widgets/gimpactiongroup.h"
|
#include "widgets/gimpactiongroup.h"
|
||||||
#include "widgets/gimpcolordialog.h"
|
#include "widgets/gimpcolordialog.h"
|
||||||
@ -573,14 +574,17 @@ view_padding_color_cmd_callback (GtkAction *action,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpDisplay *display;
|
GimpDisplay *display;
|
||||||
|
GtkWidget *window;
|
||||||
GimpDisplayShell *shell;
|
GimpDisplayShell *shell;
|
||||||
GimpDisplayOptions *options;
|
GimpDisplayOptions *options;
|
||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
return_if_no_display (display, data);
|
return_if_no_display (display, data);
|
||||||
|
|
||||||
|
window = gtk_widget_get_toplevel (display->shell);
|
||||||
|
|
||||||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
shell = GIMP_DISPLAY_SHELL (display->shell);
|
||||||
|
|
||||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (window));
|
||||||
|
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
options = shell->fullscreen_options;
|
options = shell->fullscreen_options;
|
||||||
@ -673,15 +677,15 @@ view_fullscreen_cmd_callback (GtkAction *action,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GimpDisplay *display;
|
GimpDisplay *display;
|
||||||
GimpDisplayShell *shell;
|
GtkWidget *window;
|
||||||
gboolean active;
|
gboolean active;
|
||||||
return_if_no_display (display, data);
|
return_if_no_display (display, data);
|
||||||
|
|
||||||
shell = GIMP_DISPLAY_SHELL (display->shell);
|
window = gtk_widget_get_toplevel (display->shell);
|
||||||
|
|
||||||
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||||
|
|
||||||
gimp_display_shell_set_fullscreen (shell, active);
|
gimp_image_window_set_fullscreen (GIMP_IMAGE_WINDOW (window), active);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -730,10 +734,13 @@ view_padding_color_dialog_update (GimpColorDialog *dialog,
|
|||||||
GimpColorDialogState state,
|
GimpColorDialogState state,
|
||||||
GimpDisplayShell *shell)
|
GimpDisplayShell *shell)
|
||||||
{
|
{
|
||||||
|
GtkWidget *window;
|
||||||
GimpDisplayOptions *options;
|
GimpDisplayOptions *options;
|
||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
|
|
||||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
||||||
|
|
||||||
|
fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (window));
|
||||||
|
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
options = shell->fullscreen_options;
|
options = shell->fullscreen_options;
|
||||||
|
|||||||
@ -43,12 +43,13 @@
|
|||||||
#include "gimpdisplayshell.h"
|
#include "gimpdisplayshell.h"
|
||||||
#include "gimpdisplayshell-appearance.h"
|
#include "gimpdisplayshell-appearance.h"
|
||||||
#include "gimpdisplayshell-selection.h"
|
#include "gimpdisplayshell-selection.h"
|
||||||
|
#include "gimpimagewindow.h"
|
||||||
#include "gimpstatusbar.h"
|
#include "gimpstatusbar.h"
|
||||||
|
|
||||||
|
|
||||||
#define GET_OPTIONS(shell) \
|
#define GET_OPTIONS(shell) \
|
||||||
(shell->display->image ? \
|
(shell->display->image ? \
|
||||||
(gimp_display_shell_get_fullscreen (shell) ? \
|
(gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell)))) ? \
|
||||||
shell->fullscreen_options : shell->options) : \
|
shell->fullscreen_options : shell->options) : \
|
||||||
shell->no_image_options)
|
shell->no_image_options)
|
||||||
|
|
||||||
@ -78,7 +79,8 @@ gimp_display_shell_appearance_update (GimpDisplayShell *shell)
|
|||||||
|
|
||||||
options = GET_OPTIONS (shell);
|
options = GET_OPTIONS (shell);
|
||||||
|
|
||||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
/* FIXME temp image window hack */
|
||||||
|
fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (shell));
|
||||||
|
|
||||||
if (shell->menubar)
|
if (shell->menubar)
|
||||||
gtk_widget_set_name (GTK_WIDGET (shell->menubar),
|
gtk_widget_set_name (GTK_WIDGET (shell->menubar),
|
||||||
@ -110,29 +112,6 @@ gimp_display_shell_appearance_update (GimpDisplayShell *shell)
|
|||||||
&options->padding_color);
|
&options->padding_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
gimp_display_shell_set_fullscreen (GimpDisplayShell *shell,
|
|
||||||
gboolean fullscreen)
|
|
||||||
{
|
|
||||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
|
||||||
|
|
||||||
if (fullscreen != gimp_display_shell_get_fullscreen (shell))
|
|
||||||
{
|
|
||||||
if (fullscreen)
|
|
||||||
gtk_window_fullscreen (GTK_WINDOW (shell));
|
|
||||||
else
|
|
||||||
gtk_window_unfullscreen (GTK_WINDOW (shell));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
gimp_display_shell_get_fullscreen (const GimpDisplayShell *shell)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), FALSE);
|
|
||||||
|
|
||||||
return (shell->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
|
gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
|
||||||
gboolean show)
|
gboolean show)
|
||||||
|
|||||||
@ -21,10 +21,6 @@
|
|||||||
|
|
||||||
void gimp_display_shell_appearance_update (GimpDisplayShell *shell);
|
void gimp_display_shell_appearance_update (GimpDisplayShell *shell);
|
||||||
|
|
||||||
void gimp_display_shell_set_fullscreen (GimpDisplayShell *shell,
|
|
||||||
gboolean fullscreen);
|
|
||||||
gboolean gimp_display_shell_get_fullscreen (const GimpDisplayShell *shell);
|
|
||||||
|
|
||||||
void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
|
void gimp_display_shell_set_show_menubar (GimpDisplayShell *shell,
|
||||||
gboolean show);
|
gboolean show);
|
||||||
gboolean gimp_display_shell_get_show_menubar (const GimpDisplayShell *shell);
|
gboolean gimp_display_shell_get_show_menubar (const GimpDisplayShell *shell);
|
||||||
|
|||||||
@ -48,6 +48,7 @@
|
|||||||
#include "gimpdisplayshell-scroll.h"
|
#include "gimpdisplayshell-scroll.h"
|
||||||
#include "gimpdisplayshell-selection.h"
|
#include "gimpdisplayshell-selection.h"
|
||||||
#include "gimpdisplayshell-title.h"
|
#include "gimpdisplayshell-title.h"
|
||||||
|
#include "gimpimagewindow.h"
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
@ -671,13 +672,16 @@ gimp_display_shell_padding_notify_handler (GObject *config,
|
|||||||
GimpDisplayShell *shell)
|
GimpDisplayShell *shell)
|
||||||
{
|
{
|
||||||
GimpDisplayConfig *display_config;
|
GimpDisplayConfig *display_config;
|
||||||
|
GtkWidget *window;
|
||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
GimpCanvasPaddingMode padding_mode;
|
GimpCanvasPaddingMode padding_mode;
|
||||||
GimpRGB padding_color;
|
GimpRGB padding_color;
|
||||||
|
|
||||||
display_config = shell->display->config;
|
display_config = shell->display->config;
|
||||||
|
|
||||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
window = gtk_widget_get_toplevel (GTK_WIDGET (shell));
|
||||||
|
|
||||||
|
fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (window));
|
||||||
|
|
||||||
/* if the user did not set the padding mode for this display explicitely */
|
/* if the user did not set the padding mode for this display explicitely */
|
||||||
if (! shell->fullscreen_options->padding_mode_set)
|
if (! shell->fullscreen_options->padding_mode_set)
|
||||||
|
|||||||
@ -338,7 +338,6 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||||||
|
|
||||||
shell->paused_count = 0;
|
shell->paused_count = 0;
|
||||||
|
|
||||||
shell->window_state = 0;
|
|
||||||
shell->zoom_on_resize = FALSE;
|
shell->zoom_on_resize = FALSE;
|
||||||
shell->show_transform_preview = FALSE;
|
shell->show_transform_preview = FALSE;
|
||||||
|
|
||||||
@ -645,21 +644,17 @@ gimp_display_shell_window_state_event (GtkWidget *widget,
|
|||||||
|
|
||||||
GTK_WIDGET_CLASS (parent_class)->window_state_event (widget, event);
|
GTK_WIDGET_CLASS (parent_class)->window_state_event (widget, event);
|
||||||
|
|
||||||
shell->window_state = event->new_window_state;
|
|
||||||
|
|
||||||
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
||||||
{
|
{
|
||||||
|
GtkWidget *window;
|
||||||
GimpActionGroup *group;
|
GimpActionGroup *group;
|
||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
|
|
||||||
|
window = gtk_widget_get_toplevel (widget);
|
||||||
|
|
||||||
gimp_display_shell_appearance_update (shell);
|
gimp_display_shell_appearance_update (shell);
|
||||||
|
|
||||||
fullscreen = gimp_display_shell_get_fullscreen (shell);
|
fullscreen = gimp_image_window_get_fullscreen (GIMP_IMAGE_WINDOW (window));
|
||||||
|
|
||||||
GIMP_LOG (WM, "Display shell '%s' [%p] set fullscreen %s",
|
|
||||||
gtk_window_get_title (GTK_WINDOW (widget)),
|
|
||||||
widget,
|
|
||||||
fullscreen ? "TURE" : "FALSE");
|
|
||||||
|
|
||||||
group = gimp_ui_manager_get_action_group (shell->menubar_manager, "view");
|
group = gimp_ui_manager_get_action_group (shell->menubar_manager, "view");
|
||||||
gimp_action_group_set_action_active (group,
|
gimp_action_group_set_action_active (group,
|
||||||
@ -680,11 +675,6 @@ gimp_display_shell_window_state_event (GtkWidget *widget,
|
|||||||
gboolean iconified = (event->new_window_state &
|
gboolean iconified = (event->new_window_state &
|
||||||
GDK_WINDOW_STATE_ICONIFIED) != 0;
|
GDK_WINDOW_STATE_ICONIFIED) != 0;
|
||||||
|
|
||||||
GIMP_LOG (WM, "Display shell '%s' [%p] set %s",
|
|
||||||
gtk_window_get_title (GTK_WINDOW (widget)),
|
|
||||||
widget,
|
|
||||||
iconified ? "iconified" : "uniconified");
|
|
||||||
|
|
||||||
if (iconified)
|
if (iconified)
|
||||||
{
|
{
|
||||||
if (gimp_displays_get_num_visible (gimp) == 0)
|
if (gimp_displays_get_num_visible (gimp) == 0)
|
||||||
|
|||||||
@ -184,7 +184,6 @@ struct _GimpDisplayShell
|
|||||||
GimpTreeHandler *vectors_thaw_handler;
|
GimpTreeHandler *vectors_thaw_handler;
|
||||||
GimpTreeHandler *vectors_visible_handler;
|
GimpTreeHandler *vectors_visible_handler;
|
||||||
|
|
||||||
GdkWindowState window_state; /* for fullscreen display */
|
|
||||||
gboolean zoom_on_resize;
|
gboolean zoom_on_resize;
|
||||||
gboolean show_transform_preview;
|
gboolean show_transform_preview;
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "display-types.h"
|
#include "display-types.h"
|
||||||
|
|
||||||
|
#include "widgets/gimpactiongroup.h"
|
||||||
#include "widgets/gimpmenufactory.h"
|
#include "widgets/gimpmenufactory.h"
|
||||||
#include "widgets/gimpuimanager.h"
|
#include "widgets/gimpuimanager.h"
|
||||||
|
|
||||||
@ -186,6 +187,34 @@ gimp_image_window_window_state (GtkWidget *widget,
|
|||||||
|
|
||||||
window->window_state = event->new_window_state;
|
window->window_state = event->new_window_state;
|
||||||
|
|
||||||
|
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
|
||||||
|
{
|
||||||
|
GimpActionGroup *group;
|
||||||
|
gboolean fullscreen;
|
||||||
|
|
||||||
|
fullscreen = gimp_image_window_get_fullscreen (window);
|
||||||
|
|
||||||
|
GIMP_LOG (WM, "Image window '%s' [%p] set fullscreen %s",
|
||||||
|
gtk_window_get_title (GTK_WINDOW (widget)),
|
||||||
|
widget,
|
||||||
|
fullscreen ? "TURE" : "FALSE");
|
||||||
|
|
||||||
|
group = gimp_ui_manager_get_action_group (window->menubar_manager, "view");
|
||||||
|
gimp_action_group_set_action_active (group,
|
||||||
|
"view-fullscreen", fullscreen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->changed_mask & GDK_WINDOW_STATE_ICONIFIED)
|
||||||
|
{
|
||||||
|
gboolean iconified = (event->new_window_state &
|
||||||
|
GDK_WINDOW_STATE_ICONIFIED) != 0;
|
||||||
|
|
||||||
|
GIMP_LOG (WM, "Image window '%s' [%p] set %s",
|
||||||
|
gtk_window_get_title (GTK_WINDOW (widget)),
|
||||||
|
widget,
|
||||||
|
iconified ? "iconified" : "uniconified");
|
||||||
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,3 +228,26 @@ gimp_image_window_get_active_display (GimpImageWindow *window)
|
|||||||
|
|
||||||
return GIMP_DISPLAY_SHELL (window)->display;
|
return GIMP_DISPLAY_SHELL (window)->display;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gimp_image_window_set_fullscreen (GimpImageWindow *window,
|
||||||
|
gboolean fullscreen)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GIMP_IS_IMAGE_WINDOW (window));
|
||||||
|
|
||||||
|
if (fullscreen != gimp_image_window_get_fullscreen (window))
|
||||||
|
{
|
||||||
|
if (fullscreen)
|
||||||
|
gtk_window_fullscreen (GTK_WINDOW (window));
|
||||||
|
else
|
||||||
|
gtk_window_unfullscreen (GTK_WINDOW (window));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gimp_image_window_get_fullscreen (GimpImageWindow *window)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_IMAGE_WINDOW (window), FALSE);
|
||||||
|
|
||||||
|
return (window->window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
|
||||||
|
}
|
||||||
|
|||||||
@ -51,6 +51,9 @@ GType gimp_image_window_get_type (void) G_GNUC_CONST;
|
|||||||
|
|
||||||
GimpDisplay * gimp_image_window_get_active_display (GimpImageWindow *window);
|
GimpDisplay * gimp_image_window_get_active_display (GimpImageWindow *window);
|
||||||
|
|
||||||
|
void gimp_image_window_set_fullscreen (GimpImageWindow *window,
|
||||||
|
gboolean fullscreen);
|
||||||
|
gboolean gimp_image_window_get_fullscreen (GimpImageWindow *window);
|
||||||
|
|
||||||
|
|
||||||
#endif /* __GIMP_IMAGE_WINDOW_H__ */
|
#endif /* __GIMP_IMAGE_WINDOW_H__ */
|
||||||
|
|||||||
Reference in New Issue
Block a user