summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormaniac <maniac>2006-11-17 13:16:00 +0000
committermaniac <maniac>2006-11-17 13:16:00 +0000
commiteedbbf318f86e3421cfb9c054c77fcd107bcbef6 (patch)
treee340bd3aa15d542aef279319b1da9b49c57be924 /src
parent193b6363fac59e5a6bab1ec483cfe3ecfd376441 (diff)
downloadberyl-manager-eedbbf318f86e3421cfb9c054c77fcd107bcbef6.tar.gz
beryl-manager-eedbbf318f86e3421cfb9c054c77fcd107bcbef6.tar.bz2
beryl-manager:
- added options for all Beryl command line options (in new submenu) - updated de_DE translation accordingly
Diffstat (limited to 'src')
-rw-r--r--src/main.c321
1 files changed, 275 insertions, 46 deletions
diff --git a/src/main.c b/src/main.c
index 13a4031..ed04d1c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -25,14 +25,54 @@
//better error handling
#define manager_error(String) g_critical("%s: %s", String, g_strerror(errno))
+/* enums for the Beryl options */
+typedef enum {
+ AutoBinding,
+ StrictBinding,
+ XGLBinding
+} BindingMode;
+
+typedef enum {
+ AutoCOW,
+ UseCOW,
+ NoCOW
+} COWMode;
+
+typedef enum {
+ AutoRendering,
+ IndirectRendering,
+ XGLRendering
+} RenderingMode;
+
+typedef enum {
+ AutoPlatform,
+ NvidiaPlatform,
+ AIGLXPlatform,
+ XGLPlatform
+} PlatformMode;
+
+typedef enum {
+ AutoRenderPath,
+ TFPRenderPath,
+ CopyRenderPath
+} RenderPathMode;
+
Atom wmAtom;
Atom PopupRunning;
GMutex * mutx;
EggTrayIcon * mainIcon;
GtkWidget * menu;
GtkTooltips * tips;
+
+/* options for Beryl command line */
+RenderPathMode renderPath = AutoRenderPath;
+PlatformMode platformMode = AutoPlatform;
+RenderingMode renderingMode = AutoRendering;
+COWMode cowMode = AutoCOW;
+BindingMode bindingMode = AutoBinding;
+
gboolean noGLYield=FALSE;
-gboolean useCopy=FALSE;
+
gboolean hasMouse=FALSE;
gboolean berylLaunched=FALSE;
gboolean decoratorLaunched=FALSE;
@@ -254,6 +294,32 @@ void load_settings()
i<=128) )
iconsize=i;
e=NULL;
+
+ i=g_key_file_get_integer(f,"beryl-settings","render_path",&e);
+ if (!e)
+ renderPath = (RenderPathMode) i;
+ e = NULL;
+
+ i=g_key_file_get_integer(f,"beryl-settings","cow_mode",&e);
+ if (!e)
+ cowMode = (COWMode) i;
+ e = NULL;
+
+ i=g_key_file_get_integer(f,"beryl-settings","rendering_mode",&e);
+ if (!e)
+ renderingMode = (RenderingMode) i;
+ e = NULL;
+
+ i=g_key_file_get_integer(f,"beryl-settings","platform",&e);
+ if (!e)
+ platformMode = (PlatformMode) i;
+ e = NULL;
+
+ i=g_key_file_get_integer(f,"beryl-settings","binding",&e);
+ if (!e)
+ bindingMode = (BindingMode) i;
+ e = NULL;
+
if (!XGL && NV9XXX)
{
b=g_key_file_get_boolean(f,"beryl-settings",
@@ -264,18 +330,11 @@ void load_settings()
}
else
noGLYield=FALSE;
- if (!XGL)
- {
- b=g_key_file_get_boolean(f,"beryl-settings", "use_copy", &e);
- if (!e)
- useCopy=b;
- e=NULL;
- } else
- useCopy=TRUE;
}
g_key_file_free(f);
g_free(path);
}
+
void save_settings()
{
gchar * path = g_strconcat(g_get_home_dir(),"/.beryl-managerrc",NULL);
@@ -286,11 +345,14 @@ void save_settings()
g_key_file_set_integer(f,"wm-settings","active_dm",DM);
g_key_file_set_integer(f,"wm-settings","iconsize",iconsize);
g_key_file_set_boolean(f,"wm-settings","use_fallback_wm",useFB);
+ g_key_file_set_integer(f,"beryl-settings","render_path",renderPath);
+ g_key_file_set_integer(f,"beryl-settings","cow_mode",cowMode);
+ g_key_file_set_integer(f,"beryl-settings","rendering_mode",renderingMode);
+ g_key_file_set_integer(f,"beryl-settings","platform",platformMode);
+ g_key_file_set_integer(f,"beryl-settings","binding",bindingMode);
if (!XGL && NV9XXX)
g_key_file_set_boolean(f,"beryl-settings","no_gl_yield",
noGLYield);
- if (!XGL)
- g_key_file_set_boolean(f,"beryl-settings","use_copy", useCopy);
data = g_key_file_to_data(f,NULL,NULL);
g_file_set_contents(path,data,-1,NULL);
g_key_file_free(f);
@@ -582,20 +644,53 @@ void startWM()
g_spawn_command_line_async(wm_command,NULL);
g_free(wm_command);
}
+
+#define BERYL_COMMAND_LINE_SIZE 150
+
gpointer berylThread(gpointer d)
{
gint ex=0;
- gchar beryl_command[50];
+ gchar beryl_command[BERYL_COMMAND_LINE_SIZE];
+
if (XGL)
- g_strlcpy(beryl_command, "beryl-xgl", 50);
+ g_strlcpy(beryl_command, "beryl-xgl", BERYL_COMMAND_LINE_SIZE);
else
+ g_strlcpy(beryl_command, "beryl", BERYL_COMMAND_LINE_SIZE);
+
+ switch (renderPath)
+ {
+ case TFPRenderPath: g_strlcat(beryl_command, " --use-tfp", BERYL_COMMAND_LINE_SIZE);break;
+ case CopyRenderPath: g_strlcat(beryl_command, " --use-copy", BERYL_COMMAND_LINE_SIZE);break;
+ }
+
+ switch (renderingMode)
+ {
+ case IndirectRendering: g_strlcat(beryl_command, " --indirect-rendering", BERYL_COMMAND_LINE_SIZE);break;
+ case XGLRendering: g_strlcat(beryl_command, " --xgl-rendering", BERYL_COMMAND_LINE_SIZE);break;
+ }
+
+ switch (cowMode)
+ {
+ case UseCOW: g_strlcat(beryl_command, " --use-cow", BERYL_COMMAND_LINE_SIZE);break;
+ case NoCOW: g_strlcat(beryl_command, " --no-cow", BERYL_COMMAND_LINE_SIZE);break;
+ }
+
+ switch (platformMode)
+ {
+ case AIGLXPlatform: g_strlcat(beryl_command, " --force-aiglx", BERYL_COMMAND_LINE_SIZE);break;
+ case NvidiaPlatform: g_strlcat(beryl_command, " --force-nvidia", BERYL_COMMAND_LINE_SIZE);break;
+ case XGLPlatform: g_strlcat(beryl_command, " --force-xgl", BERYL_COMMAND_LINE_SIZE);break;
+ }
+
+ switch (bindingMode)
{
- g_strlcpy(beryl_command, "beryl", 50);
- if (noGLYield)
- g_strlcat(beryl_command, " --skip-gl-yield", 50);
- if (useCopy)
- g_strlcat(beryl_command, " --use-copy", 50);
+ case StrictBinding: g_strlcat(beryl_command, " --strict-binding", BERYL_COMMAND_LINE_SIZE);break;
+ case XGLBinding: g_strlcat(beryl_command, " --xgl-binding", BERYL_COMMAND_LINE_SIZE);break;
}
+
+ if (noGLYield)
+ g_strlcat(beryl_command, " --skip-gl-yield", BERYL_COMMAND_LINE_SIZE);
+
berylLaunched=TRUE;
while(berylLaunched)
{
@@ -718,6 +813,62 @@ void setFallbackWM(GtkWidget * w, gpointer p)
save_settings();
}
}
+
+void toggleRenderingPath(GtkWidget *w, gpointer p)
+{
+ RenderPathMode rPath = GPOINTER_TO_INT(p);
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
+ {
+ renderPath = rPath;
+ save_settings();
+ }
+}
+
+void toggleCOW(GtkWidget *w, gpointer p)
+{
+ COWMode cow = GPOINTER_TO_INT(p);
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
+ {
+ cowMode = cow;
+ save_settings();
+ }
+}
+
+void togglePlatform(GtkWidget *w, gpointer p)
+{
+ PlatformMode platform = GPOINTER_TO_INT(p);
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
+ {
+ platformMode = platform;
+ save_settings();
+ }
+}
+
+void toggleBinding(GtkWidget *w, gpointer p)
+{
+ BindingMode binding = GPOINTER_TO_INT(p);
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
+ {
+ bindingMode = binding;
+ save_settings();
+ }
+}
+
+void toggleRendering(GtkWidget *w, gpointer p)
+{
+ RenderingMode rendering = GPOINTER_TO_INT(p);
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(w)))
+ {
+ renderingMode = rendering;
+ save_settings();
+ }
+}
+
void toggleFB(GtkWidget * w, gpointer p)
{
gint i;
@@ -810,17 +961,37 @@ void setGLYield(GtkWidget * w, gpointer p)
save_settings();
if (WM==0) reloadBeryl();
}
-void setUseCopy(GtkWidget * w, gpointer p)
+
+GtkWidget* add_menu_group_item(GtkWidget *menu, GSList **group, const gchar *name, gboolean show, gboolean check, GCallback callback, gpointer data)
{
- useCopy=gtk_check_menu_item_get_active(
- GTK_CHECK_MENU_ITEM(w));
- save_settings();
- if (WM==0) reloadBeryl();
+ GtkWidget *mitem;
+
+ mitem = gtk_radio_menu_item_new_with_label(*group, name);
+ *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(mitem));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu),mitem);
+
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mitem), check);
+
+ if (show)
+ gtk_widget_show(mitem);
+ else
+ gtk_widget_hide(mitem);
+
+ g_signal_connect(mitem, "toggled", callback, data);
+
+ return mitem;
}
+
void init_menu()
{
+ GtkWidget * submenu;
GtkWidget * mitem;
GtkWidget * smshell;
+ GSList * renderPathGroup = NULL;
+ GSList * cowGroup = NULL;
+ GSList * platformGroup = NULL;
+ GSList * bindingGroup = NULL;
+ GSList * renderingGroup = NULL;
GSList * wms = NULL;
GSList * fbk = NULL;
GSList * dms = NULL;
@@ -864,40 +1035,98 @@ void init_menu()
for (i=0;i<numWM;i++)
{
- mitem = gtk_radio_menu_item_new_with_label(wms,WMs[i].Name);
- wms=gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(mitem));
- if (i==WM)
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mitem),TRUE);
- gtk_menu_shell_append(GTK_MENU_SHELL(smshell),mitem);
- if (i==0 || detect_wm(i))
- gtk_widget_show(mitem);
- else
- gtk_widget_hide(mitem);
- g_signal_connect(mitem,"toggled",G_CALLBACK(setWM),GINT_TO_POINTER(i));
+ mitem = add_menu_group_item(smshell, &wms, WMs[i].Name, ((i==0) || detect_wm(i)), (i==WM), G_CALLBACK(setWM), GINT_TO_POINTER(i));
WMs[i].Item=mitem;
}
+ mitem = gtk_image_menu_item_new_with_label(_("Advanced Beryl options"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu),mitem);
+ gtk_widget_show(mitem);
+
+ submenu=gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem),submenu);
+
+ mitem = gtk_image_menu_item_new_with_label(_("Rendering path"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu),mitem);
+ gtk_widget_show(mitem);
+
+ smshell = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem),smshell);
+
+ add_menu_group_item(smshell, &renderPathGroup, _("Automatic"), TRUE, (renderPath == AutoRenderPath),
+ G_CALLBACK(toggleRenderingPath), GINT_TO_POINTER(AutoRenderPath));
+ add_menu_group_item(smshell, &renderPathGroup, _("Texture From Pixmap"), TRUE, (renderPath == TFPRenderPath),
+ G_CALLBACK(toggleRenderingPath), GINT_TO_POINTER(TFPRenderPath));
+ add_menu_group_item(smshell, &renderPathGroup, _("Copy"), TRUE, (renderPath == CopyRenderPath),
+ G_CALLBACK(toggleRenderingPath), GINT_TO_POINTER(CopyRenderPath));
+
+ mitem = gtk_image_menu_item_new_with_label(_("Composite Overlay Window"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu),mitem);
+ gtk_widget_show(mitem);
+
+ smshell = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem),smshell);
+
+ add_menu_group_item(smshell, &cowGroup, _("Automatic"), TRUE, (cowMode == AutoCOW), G_CALLBACK(toggleCOW), GINT_TO_POINTER(AutoCOW));
+ add_menu_group_item(smshell, &cowGroup, _("Use COW"), TRUE, (cowMode == UseCOW), G_CALLBACK(toggleCOW), GINT_TO_POINTER(UseCOW));
+ add_menu_group_item(smshell, &cowGroup, _("Don't use COW"), TRUE, (cowMode == NoCOW), G_CALLBACK(toggleCOW), GINT_TO_POINTER(NoCOW));
+
+ mitem = gtk_image_menu_item_new_with_label(_("Rendering platform"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu),mitem);
+ gtk_widget_show(mitem);
+
+ smshell = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem),smshell);
+
+ add_menu_group_item(smshell, &platformGroup, _("Automatic"), TRUE, (platformMode == AutoPlatform),
+ G_CALLBACK(togglePlatform), GINT_TO_POINTER(AutoPlatform));
+ add_menu_group_item(smshell, &platformGroup, _("Force Nvidia"), TRUE, (platformMode == NvidiaPlatform),
+ G_CALLBACK(togglePlatform), GINT_TO_POINTER(NvidiaPlatform));
+ add_menu_group_item(smshell, &platformGroup, _("Force AIGLX"), TRUE, (platformMode == AIGLXPlatform),
+ G_CALLBACK(togglePlatform), GINT_TO_POINTER(AIGLXPlatform));
+ add_menu_group_item(smshell, &platformGroup, _("Force XGL"), TRUE, (platformMode == XGLPlatform),
+ G_CALLBACK(togglePlatform), GINT_TO_POINTER(XGLPlatform));
+
+ mitem = gtk_image_menu_item_new_with_label(_("Binding"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu),mitem);
+ gtk_widget_show(mitem);
+
+ smshell = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem),smshell);
+
+ add_menu_group_item(smshell, &bindingGroup, _("Automatic"), TRUE, (bindingMode == AutoBinding),
+ G_CALLBACK(toggleBinding), GINT_TO_POINTER(AutoBinding));
+ add_menu_group_item(smshell, &bindingGroup, _("Strict Binding"), TRUE, (bindingMode == StrictBinding),
+ G_CALLBACK(toggleBinding), GINT_TO_POINTER(StrictBinding));
+ add_menu_group_item(smshell, &bindingGroup, _("XGL Binding"), TRUE, (bindingMode == XGLBinding),
+ G_CALLBACK(toggleBinding), GINT_TO_POINTER(XGLBinding));
+
+ mitem = gtk_image_menu_item_new_with_label(_("Rendering"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu),mitem);
+ gtk_widget_show(mitem);
+
+ smshell = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem),smshell);
+
+ add_menu_group_item(smshell, &renderingGroup, _("Automatic"), TRUE, (renderingMode == AutoRendering),
+ G_CALLBACK(toggleRendering), GINT_TO_POINTER(AutoRendering));
+ add_menu_group_item(smshell, &renderingGroup, _("Indirect Rendering"), TRUE, (renderingMode == IndirectRendering),
+ G_CALLBACK(toggleRendering), GINT_TO_POINTER(IndirectRendering));
+ add_menu_group_item(smshell, &renderingGroup, _("XGL Rendering"), TRUE, (renderingMode == XGLRendering),
+ G_CALLBACK(toggleRendering), GINT_TO_POINTER(XGLRendering));
+
if (!XGL && NV9XXX)
{
mitem = gtk_check_menu_item_new_with_label(_(
"Disable GL Yield setting\n"
"Use this to fix some redraw bugs"));
- gtk_menu_shell_append(GTK_MENU_SHELL(menu),mitem);
+ gtk_menu_shell_append(GTK_MENU_SHELL(submenu),mitem);
gtk_check_menu_item_set_active(
GTK_CHECK_MENU_ITEM(mitem),noGLYield);
gtk_widget_show(mitem);
g_signal_connect(mitem,"toggled",G_CALLBACK(setGLYield),NULL);
}
- if (!XGL)
- {
- mitem = gtk_check_menu_item_new_with_label(_(
- "Use Non-TFP Copy Rendering"));
- gtk_menu_shell_append(GTK_MENU_SHELL(menu),mitem);
- gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(mitem),useCopy);
- gtk_widget_show(mitem);
- g_signal_connect(mitem,"toggled",G_CALLBACK(setUseCopy),NULL);
- }
+
mitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu),mitem);
gtk_widget_show(mitem);
@@ -1223,7 +1452,7 @@ int main(int argc, char ** argv)
if (DM==-1)
manager_error("No Display Manager Found!");
save_settings();
-
+/*
found = False;
for (i=0;i<numDM && !found;i++) {
if (is_running(DMs[i].Prog))
@@ -1246,7 +1475,7 @@ int main(int argc, char ** argv)
}
signal (SIGUSR1, signalHandler);
signal (SIGUSR2, signalHandler);
-
+*/
gtk_main();
gdk_threads_leave ();