about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2022-10-14 04:38:35 +0200
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2022-10-14 04:38:35 +0200
commit37494841bac048f8845ef39c226a2e80dc608d0a (patch)
tree179b08cc38da41421c5b87e9d5c70873113362cb /pkgs/games
parent86872d31b1f8379c4d62aacfa18bd5a9d7530447 (diff)
fsg: migrate to wxGTK32
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/fsg/default.nix10
-rw-r--r--pkgs/games/fsg/wxgtk-3.2.patch68
2 files changed, 74 insertions, 4 deletions
diff --git a/pkgs/games/fsg/default.nix b/pkgs/games/fsg/default.nix
index 3869ad9884947..282030023f74f 100644
--- a/pkgs/games/fsg/default.nix
+++ b/pkgs/games/fsg/default.nix
@@ -1,5 +1,4 @@
-{ lib, stdenv, fetchurl, gtk2, glib, pkg-config, libGLU, libGL, wxGTK, libX11, xorgproto
-, runtimeShell }:
+{ lib, stdenv, fetchurl, gtk2, glib, pkg-config, libGLU, libGL, wxGTK32, libX11, xorgproto, runtimeShell }:
 
 stdenv.mkDerivation rec {
   pname = "fsg";
@@ -11,10 +10,13 @@ stdenv.mkDerivation rec {
     sha256 = "1756y01rkvd3f1pkj88jqh83fqcfl2fy0c48mcq53pjzln9ycv8c";
   };
 
+  patches = [ ./wxgtk-3.2.patch ];
+
   hardeningDisable = [ "format" ];
 
   nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ gtk2 glib libGLU libGL wxGTK libX11 xorgproto ];
+
+  buildInputs = [ glib libGLU libGL wxGTK32 libX11 xorgproto ];
 
   preBuild = ''
     sed -e '
@@ -32,7 +34,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Cellular automata engine tuned towards the likes of Falling Sand";
-    maintainers = [lib.maintainers.raskin];
+    maintainers = [ lib.maintainers.raskin ];
     platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/games/fsg/wxgtk-3.2.patch b/pkgs/games/fsg/wxgtk-3.2.patch
new file mode 100644
index 0000000000000..dff9f54aeeebf
--- /dev/null
+++ b/pkgs/games/fsg/wxgtk-3.2.patch
@@ -0,0 +1,68 @@
+diff --git a/Canvas.cpp b/Canvas.cpp
+index 8c00727..5ee7756 100644
+--- a/Canvas.cpp
++++ b/Canvas.cpp
+@@ -889,7 +889,6 @@ void Canvas::Refresh(){
+   if (doDraw){
+     wxClientDC dc(this);
+ 
+-    dc.BeginDrawing();
+     
+     wxMemoryDC memdc;
+     wxImage image(g_width, g_height, bitmapdata, true);
+@@ -899,7 +898,6 @@ void Canvas::Refresh(){
+     dc.Blit(0,0,g_width, g_height, &memdc, 0, 0);
+     
+     if (!drawAll){
+-      dc.EndDrawing();
+       return;
+     }
+     else{
+@@ -912,7 +910,6 @@ void Canvas::Refresh(){
+     }
+     
+ 
+-    dc.EndDrawing();
+ 
+   }
+ }
+diff --git a/MainFrame.cpp b/MainFrame.cpp
+index c45107b..d93f9e1 100644
+--- a/MainFrame.cpp
++++ b/MainFrame.cpp
+@@ -178,7 +178,7 @@ MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& si
+       RHSizer->Add(RH4, 0, wxEXPAND | wxALL, 5);
+     }
+ 
+-    sizer->Add(g_canvas, 0, wxADJUST_MINSIZE | wxALL, 10);
++    sizer->Add(g_canvas, 0, wxALL, 10);
+     sizer->Add(RHSizer, 1, wxEXPAND);
+   }
+   this->SetSizer(sizer);
+@@ -1165,7 +1165,7 @@ void MainFrame::OnMenu(wxCommandEvent& event){
+   }
+   else if(event.GetId() == 1051){
+     //Load
+-    wxFileDialog dialog(this, _("Load from a file"), _(""), _(""), _("Any Image Files (*.*)|*.*"), wxOPEN);
++    wxFileDialog dialog(this, _("Load from a file"), _(""), _(""), _("Any Image Files (*.*)|*.*"), wxFD_OPEN);
+     
+     if (dialog.ShowModal() == wxID_OK){
+       sandboxFilename = dialog.GetPath();
+@@ -1174,7 +1174,7 @@ void MainFrame::OnMenu(wxCommandEvent& event){
+   }
+   else if(event.GetId() == 1052){
+     //Save
+-    wxFileDialog dialog(this, _("Save to a file"), _(""), _(""), _("PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp"), wxSAVE);
++    wxFileDialog dialog(this, _("Save to a file"), _(""), _(""), _("PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp"), wxFD_SAVE);
+     
+     if (dialog.ShowModal() == wxID_OK){
+       wxString filename = dialog.GetPath();
+@@ -1216,7 +1216,7 @@ void MainFrame::OnMenu(wxCommandEvent& event){
+   else if(event.GetId() == 1055){
+     //Load physics
+ 
+-    wxFileDialog dialog(this, _("Load from a file"), _(""), _(""), _("Physics Files (*.txt)|*.txt"), wxOPEN);
++    wxFileDialog dialog(this, _("Load from a file"), _(""), _(""), _("Physics Files (*.txt)|*.txt"), wxFD_OPEN);
+     if (dialog.ShowModal() == wxID_OK){
+       physicsFilename = dialog.GetPath();
+       loadPhysics(physicsFilename);