Commits

michael b  committed 28dabf5

Adding x.org conf feature

  • Participants
  • Parent commits 427baa3

Comments (0)

Files changed (3)

File data/ui/FsgamerWindow.ui

                         <property name="xalign">0.0099999997764825821</property>
                         <property name="yalign">0</property>
                         <property name="xpad">11</property>
-                        <property name="ypad">12</property>
+                        <property name="ypad">1</property>
                         <property name="label" translatable="yes">Configure this game</property>
                         <attributes>
                           <attribute name="font-desc" value="Sans Bold 12"/>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkExpander" id="expander1">
+                  <object class="GtkExpander" id="advanced_options_expander">
+                    <property name="height_request">60</property>
+                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="no_show_all">True</property>
                     <child>
                       <object class="GtkGrid" id="grid1">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <child>
-                          <object class="GtkSwitch" id="switch1">
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="use_action_appearance">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">0</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="switch2">
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="use_action_appearance">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="switch3">
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="use_action_appearance">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="switch4">
-                            <property name="use_action_appearance">False</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="use_action_appearance">False</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">3</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
                           <object class="GtkLabel" id="label1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="yalign">0</property>
                             <property name="xpad">15</property>
-                            <property name="label" translatable="yes">Use Alt-Tab to switch back</property>
+                            <property name="label" translatable="yes">Use alternate xorg conf file:</property>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="label2">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="xpad">15</property>
-                            <property name="label" translatable="yes">Use Ctrl+Alt+Delete to switch back</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label3">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="xpad">15</property>
-                            <property name="label" translatable="yes">Allow Ctrl+Alt+Backspace to force game to crash</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">2</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label4">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="xpad">15</property>
-                            <property name="label" translatable="yes">Allow keyboard shortcuts to adjust sound</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">3</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="label5">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
-                            <property name="yalign">0</property>
-                            <property name="xpad">15</property>
-                            <property name="label" translatable="yes">Allow keyboard shortcuts to adjust sound</property>
-                          </object>
-                          <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">4</property>
-                            <property name="width">1</property>
-                            <property name="height">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkSwitch" id="switch5">
-                            <property name="use_action_appearance">False</property>
+                          <object class="GtkEntry" id="option_xorg_conf">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="use_action_appearance">False</property>
+                            <property name="invisible_char">•</property>
+                            <signal name="changed" handler="on_options_change" swapped="no"/>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">4</property>
+                            <property name="top_attach">0</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label" translatable="yes">Advanced options</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
                       </object>
                     </child>
                   </object>

File fsgamer/FsgamerWindow.py

             self.ui.application_name.set_text(self.current_app.get_name())
             self.ui.info_label.set_text(APP_INSTRUCTIONS)
             self.ui.options_grid.set_visible(True)
+            self.ui.advanced_options_expander.set_visible(True)
             self.ui.go_button.set_visible(True)
             self.refresh_check_show_menu_icon()
             self.refresh_options()
         self.ui.options_grid.set_visible(False)
         self.ui.application_name.set_text('')
         self.ui.info_label.set_text(NO_APP_INSTRUCTIONS)
+        self.ui.advanced_options_expander.set_visible(False)
 
     def refresh_check_show_menu_icon(self):
         if not self.current_app:
 
 
     def on_options_change(self, widget, data=None):
+        print "Changing options!"
         if not self.current_app:
             return
 
             if isinstance(default_val, bool):
                 val = widget.get_active()
             elif isinstance(default_val, basestring):
-                val = widget.get_text()
+                val = widget.get_text().strip()
+            print "key , val", key, val
 
             if val != default_val:
                 self.current_app.opts[key] = val
             else:
                 # don't bother storing settings the same as default
-                del self.current_app.opts[key]
+                if key in self.current_app.opts:
+                    del self.current_app.opts[key]
 
         self.current_app.write_menu_icon()
         self.current_app.write_desktop()

File fsgamer/utils.py

     return s.strip().translate(TITLE_TRANS).replace("_", "")
 
 class shellbuilder:
-    XINIT_SCRIPT = "DISPLAY=:%(display)i.0\n%(xinit)s %(cmd)s  -- :%(display)i"
+    XINIT_SCRIPT = "DISPLAY=:%(display)i.0\n%(xinit)s %(cmd)s  -- :%(display)i %(extra)s"
     @staticmethod
-    def xinit(cmd):
+    def xinit(cmd, opts):
 
         xinit_path = shell_run.which("xinit")
         cklaunch_path = shell_run.which("ck-launch-session")
 
         xinit = "%s %s" % (xinit_path, cklaunch_path)
 
-        # Wrap script
-        script = shellbuilder.XINIT_SCRIPT % {
+        d = {
             'xinit': xinit,
             'display': 1,
             'cmd': cmd.strip(),
         }
 
+        if opts.get('xorg_conf'):
+            if not os.path.exists(opts['xorg_conf']):
+                print "ERROR: Xorg conf specified does not exist: ", opts['xorg_conf']
+                sys.exit(1)
+            d['extra'] = '-xf86config %s' % quote(opts['xorg_conf'])
+
+        # Wrap script
+        script = shellbuilder.XINIT_SCRIPT % d
+
         return script
 
     FSGWM_SCRIPT = "%(base)s --wm --exec=%(exec)s --opts=%(opts)s"
             script.append(unparse_options(d) + " &")
 
         script.append(
-                shellbuilder.xinit(shellbuilder.fsgwm(cmd, opts))
+                shellbuilder.xinit(shellbuilder.fsgwm(cmd, opts), opts)
             )
 
         return self("\n".join(script))