The seffer Shaar Reuven quotes a different work, Hadar Yaakov, as stating there is in fact a disagreement if Mashiach is specifically from the male descendants of David and Shlomo, or he can also descend from a female.
This came up in the Shaar Reuvein where he is discussing the source for Rambam's statement* that Moshiach can only come from Shlomo and not another child of David. And that's were we pick up here:
The issue is the fact that the gemara in Sanhedrin called Rabbi Yehuda Hanasi Moshiach even though we know from Kesuvos that he is only descended from the Davidic dynasty on his mother's side.
Hadar Yaakov resolves this by quoting Rashi who explained that the Talmud was not saying Rabi Yehuda HaNasi was actually Moshiach, just comparable to him. According to this understanding Moshiach must be direct patrilineal descent.
However Hadar Yaakov also quotes Pri Tzadik as using these very Talmudic statements to prove that Moshiach does not have to be of direct patrilineal descent, understanding the statement in Sanhedrin literally.
*Rambam Lo Sa'asei 362, Igeres Teiman ch 3, Pirush HaMishnayos to Chelek Yisod 12, Shu't Pe'er Hadar 225.