aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/camorama-gtk3.ui80
-rw-r--r--src/callbacks.c38
-rw-r--r--src/callbacks.h3
-rw-r--r--src/camorama-window.c7
4 files changed, 126 insertions, 2 deletions
diff --git a/data/camorama-gtk3.ui b/data/camorama-gtk3.ui
index 826fb59..7d98b72 100644
--- a/data/camorama-gtk3.ui
+++ b/data/camorama-gtk3.ui
@@ -39,6 +39,11 @@
<property name="can_focus">False</property>
<property name="pixbuf">snap-icon-small.xpm</property>
</object>
+ <object class="GtkImage" id="image23">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">view-fullscreen</property>
+ </object>
<object class="GtkWindow" id="main_window">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Camorama-libglade</property>
@@ -80,6 +85,17 @@
</object>
</child>
<child>
+ <object class="GtkImageMenuItem" id="imagemenuitem2">
+ <property name="label" translatable="yes">Toggle _Full Screen</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="image">image23</property>
+ <property name="use_stock">False</property>
+ <accelerator key="f" signal="activate" modifiers="GDK_CONTROL_MASK"/>
+ </object>
+ </child>
+ <child>
<object class="GtkSeparatorMenuItem" id="menuitem2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -346,6 +362,68 @@
</packing>
</child>
<child>
+ <object class="GtkAlignment" id="alignment6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="hexpand">True</property>
+ <child>
+ <object class="GtkButton" id="button3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="halign">center</property>
+ <signal name="clicked" handler="capture_func" swapped="no"/>
+ <child>
+ <object class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <child>
+ <object class="GtkBox" id="hbox34">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkImage" id="image22">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">view-fullscreen</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label77">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Full Screen</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -402,7 +480,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/src/callbacks.c b/src/callbacks.c
index b4ee1bf..603351c 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -353,7 +353,7 @@ static void get_geometry(cam_t *cam, unsigned int *width, unsigned int *height)
#endif
}
-gboolean on_configure_event(GtkMenuItem *menuitem, GdkEvent *event, cam_t *cam)
+gboolean on_configure_event(GtkMenuItem *menuitem, GdkEvent *event, cam_t *cam)
{
#if GTK_MAJOR_VERSION >= 3
GtkWidget *da = GTK_WIDGET(gtk_builder_get_object(cam->xml, "da"));
@@ -386,6 +386,42 @@ gboolean on_configure_event(GtkMenuItem *menuitem, GdkEvent *event, cam_t *cam)
return FALSE;
}
+gboolean on_window_state_event(GtkMenuItem *menuitem,
+ GdkEventWindowState *event, cam_t *cam)
+{
+#if GTK_MAJOR_VERSION >= 3
+ if (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) {
+ gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(cam->xml, "menuitem3")));
+ gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(cam->xml, "menuitem4")));
+ gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(cam->xml, "hbox31")));
+ gtk_widget_hide(cam->status);
+ } else {
+ gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(cam->xml, "menuitem3")));
+ gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(cam->xml, "menuitem4")));
+ gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(cam->xml, "hbox31")));
+ gtk_widget_show(cam->status);
+ }
+#endif
+
+ return GDK_EVENT_PROPAGATE;
+}
+
+void toggle_fullscreen(GtkWidget *widget, cam_t *cam)
+{
+ GdkWindowState state;
+ GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(cam->xml,
+ "main_window"));
+
+ state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (window)));
+
+ if (state & GDK_WINDOW_STATE_FULLSCREEN) {
+ gtk_window_unfullscreen(GTK_WINDOW(window));
+ } else {
+ gtk_window_fullscreen(GTK_WINDOW(window));
+ }
+}
+
+
void set_image_scale(cam_t *cam)
{
float f;
diff --git a/src/callbacks.h b/src/callbacks.h
index 4f11587..a23df4d 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -18,6 +18,8 @@ G_BEGIN_DECLS
void on_change_size_activate(GtkWidget * widget, cam_t *cam);
void on_quit_activate(GtkMenuItem *menuitem, cam_t *cam);
gboolean on_configure_event(GtkMenuItem *menuitem, GdkEvent *event, cam_t *cam);
+gboolean on_window_state_event(GtkMenuItem *menuitem,
+ GdkEventWindowState *event, cam_t *cam);
int delete_event(GtkWidget *, gpointer data);
void cap_func(GtkWidget *, cam_t *);
void rcap_func(GtkWidget *, cam_t *);
@@ -48,6 +50,7 @@ gboolean delete_event_prefs_window(GtkWidget *widget, GdkEvent *event,
cam_t *cam);
void capture_func2(GtkWidget *, cam_t *);
void capture_func(GtkWidget *, cam_t *);
+void toggle_fullscreen(GtkWidget *, cam_t *);
gint timeout_capture_func(cam_t *);
gint fps(GtkWidget *);
gint timeout_func(cam_t *);
diff --git a/src/camorama-window.c b/src/camorama-window.c
index 8f05d78..7e69e36 100644
--- a/src/camorama-window.c
+++ b/src/camorama-window.c
@@ -516,5 +516,12 @@ void load_interface(cam_t *cam)
// Detect window resize calls
g_signal_connect(GTK_WIDGET(gtk_builder_get_object(cam->xml, "da")),
"configure-event", G_CALLBACK(on_configure_event), cam);
+ g_signal_connect(window, "window-state-event",
+ G_CALLBACK(on_window_state_event), cam);
+
+ g_signal_connect(gtk_builder_get_object(cam->xml, "button3"),
+ "clicked", G_CALLBACK(toggle_fullscreen), cam);
+ g_signal_connect(gtk_builder_get_object(cam->xml, "imagemenuitem2"),
+ "activate", G_CALLBACK(toggle_fullscreen), cam);
#endif
}

Privacy Policy